| | |
| | | private String name; |
| | | private long size; |
| | | private String path; |
| | | private String userName; |
| | | private boolean success; |
| | | private String errorMessage; |
| | | |
| | |
| | | this.path = path; |
| | | } |
| | | |
| | | public FileDTO(String name, long size, String path,String userName) { |
| | | this.name = name; |
| | | this.size = size; |
| | | this.path = path; |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public FileDTO(String name, long size) { |
| | | this.name = name; |
| | | this.size = size; |
| | |
| | | |
| | | @RequestMapping(value = "/plan/insert/file/auth") |
| | | // @ManagerAuth |
| | | public R insertFile(@RequestParam("planId") String planId, @RequestParam("filename") String filename, @RequestParam("filesize") Long filesize) { |
| | | public R insertFile(@RequestParam("planId") String planId, @RequestParam("filename") String filename, |
| | | @RequestParam("filesize") Long filesize,@RequestParam("token") String token) { |
| | | try { |
| | | // InputStream inputStream = file.getInputStream(); |
| | | // // 获取文件的内容类型 |
| | |
| | | //// String url = "http://tjdt.oss-cn-hangzhou.aliyuncs.com/"+file.getOriginalFilename(); |
| | | // String[] names = url.split("com/"); |
| | | // String name= names[1]; |
| | | |
| | | |
| | | String nickname = null; |
| | | Long userId = null; |
| | | if (!Cools.isEmpty(token)) { |
| | | User user = getUser(token); |
| | | nickname = user.getNickname(); |
| | | userId = user.getId(); |
| | | } |
| | | String[] split = planId.split("-"); |
| | | int id = Integer.parseInt(split[1]); |
| | | String url = "http://zhongyang-ftpserver.oss-cn-hangzhou.aliyuncs.com/" + filename; |
| | | planService.increasePlanUrl(id, url, filename, filesize); |
| | | planService.increasePlanUrl(id, url, filename, filesize,nickname,userId); |
| | | return R.ok(); |
| | | } catch (Exception e) { |
| | | System.out.println(e); |
| | |
| | | String url = planService.selectPlanUrlPlanIdUrl(id2); |
| | | String name = planService.selectPlanUrlPlanIdName(id2); |
| | | Long size = planService.selectPlanUrlPlanIdSize(id2); |
| | | FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(name,size,url); |
| | | String userName = planService.selectPlanUrlPlanIdUserName(id2); |
| | | FileSaveExampleUtil.FileDTO dto = new FileSaveExampleUtil.FileDTO(name,size,url,userName); |
| | | fileDTOS.add(dto); |
| | | } |
| | | // List<FileSaveExampleUtil.FileDTO> fileDTOS = FileSaveExampleUtil.viewFileList(savePath); |
| | |
| | | /** |
| | | * 区分 1: 货架 0: 集成 |
| | | */ |
| | | @ApiModelProperty(value= "区分 1: 货架 0: 集成 ") |
| | | @ApiModelProperty(value= "区分 1: 货架 2: 集成 ") |
| | | private Integer type; |
| | | |
| | | /** |
| | |
| | | |
| | | Plan selectByUuid(@Param("hostId") Long hostId, @Param("uuid") String uuid); |
| | | |
| | | void increasePlanUrl(@Param("planId") int planId, @Param("url") String url, @Param("name") String name, @Param("size") Long size); |
| | | void increasePlanUrl(@Param("planId") int planId, @Param("url") String url, @Param("name") String name, @Param("size") Long size,@Param("userName") String userName, @Param("userId") Long userId ); |
| | | |
| | | String selectPlanUrlPlanIdUrl(@Param("id") int id); |
| | | String selectPlanUrlPlanIdName(@Param("id") int id); |
| | | Long selectPlanUrlPlanIdSize(@Param("id") int id); |
| | | String selectPlanUrlPlanIdUserName(@Param("id") int id); |
| | | List<Integer> selectPlanUrlId(@Param("planId") int planId); |
| | | |
| | | Plan selectPlanByNewestUuid(@Param("hostId") Long hostId); |
| | |
| | | public interface PlanService extends IService<Plan> { |
| | | |
| | | Plan selectByUuid(Long hostId, String uuid); |
| | | void increasePlanUrl(int planId, String url,String name,Long size); |
| | | void increasePlanUrl(int planId, String url,String name,Long size,String userName,Long userId); |
| | | String selectPlanUrlPlanIdUrl(int planId); |
| | | String selectPlanUrlPlanIdName(int planId); |
| | | Long selectPlanUrlPlanIdSize(int planId); |
| | | String selectPlanUrlPlanIdUserName(int planId); |
| | | List<Integer> selectPlanUrlId(int planId); |
| | | |
| | | String getUuid(Long hostId); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void increasePlanUrl(int planId, String url,String name,Long size) { |
| | | this.baseMapper.increasePlanUrl(planId, url,name,size); |
| | | public void increasePlanUrl(int planId, String url,String name,Long size,String userName,Long userId) { |
| | | this.baseMapper.increasePlanUrl(planId, url,name,size,userName,userId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return this.baseMapper.selectPlanUrlPlanIdSize(id); |
| | | } |
| | | |
| | | @Override |
| | | public String selectPlanUrlPlanIdUserName(int id) { |
| | | return this.baseMapper.selectPlanUrlPlanIdUserName(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getUuid(Long hostId) { |
| | |
| | | and id=#{id} |
| | | </select> |
| | | |
| | | <select id="selectPlanUrlPlanIdUserName" resultType="java.lang.String"> |
| | | select user_name from man_plan_url |
| | | where 1=1 |
| | | and id=#{id} |
| | | </select> |
| | | |
| | | <select id="selectPlanUrlId" resultType="java.lang.Integer"> |
| | | select id from man_plan_url |
| | | where 1=1 |
| | |
| | | </select> |
| | | |
| | | <insert id="increasePlanUrl"> |
| | | insert into man_plan_url(plan_id,url,name,file_size) |
| | | values(#{planId},#{url},#{name},#{size}) |
| | | insert into man_plan_url(plan_id,url,name,file_size,user_name,user_id) |
| | | values(#{planId},#{url},#{name},#{size},#{userName},#{userId}) |
| | | </insert> |
| | | |
| | | |
| | |
| | | var tr = $(['<tr id="upload-">' |
| | | ,'<td id="upload-filename-id-'+ file.lastModified + '">' + file.name +'</td>' |
| | | ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>' |
| | | ,'<td id="upload-filename-userName-'+ '">' +'</td>' |
| | | ,'<td id="upload-file-id-' + file.lastModified + '"><div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="progress-demo-'+ file.lastModified +'"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | ,'<td>' |
| | | ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>' |
| | |
| | | layer.msg('上传成功', {icon: 1}); |
| | | $("#upload-file-id-" + file.lastModified).html("上传成功") |
| | | $("#upload-filename-id-" + file.lastModified).html(filename) |
| | | |
| | | let token = localStorage.getItem("token"); |
| | | $.ajax({ |
| | | url: baseUrl+"/plan/insert/file/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | 'planId': $('.layui-layer-title').text(), |
| | | 'filename': filename, |
| | | 'filesize': file.size |
| | | 'filesize': file.size, |
| | | 'token': token |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | tr.id = "upload-"+index; |
| | | tr.innerHTML = '<td>' + file.name + '</td>' |
| | | + '<td>' + (file.size / 1024).toFixed(1) + 'kb</td>' |
| | | + '<td>' + file.userName + '</td>' |
| | | // + '<td><div class="layui-progress" lay-filter="progress-demo-' + index ,100 + '%'+ '"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | + '<td>'+'已完成'+'</td>' |
| | | + '<td>' |
| | |
| | | var tr = $(['<tr id="upload-">' |
| | | ,'<td id="upload-filename-id-'+ file.lastModified + '">' + file.name +'</td>' |
| | | ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>' |
| | | ,'<td id="upload-filename-userName-'+ '">' +'</td>' |
| | | ,'<td id="upload-file-id-' + file.lastModified + '"><div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="progress-demo-'+ file.lastModified +'"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | ,'<td>' |
| | | ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>' |
| | |
| | | layer.msg('上传成功', {icon: 1}); |
| | | $("#upload-file-id-" + file.lastModified).html("上传成功") |
| | | $("#upload-filename-id-" + file.lastModified).html(filename) |
| | | |
| | | let token = localStorage.getItem("token"); |
| | | $.ajax({ |
| | | url: baseUrl+"/plan/insert/file/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | 'planId': $('.layui-layer-title').text(), |
| | | 'filename': filename, |
| | | 'filesize': file.size |
| | | 'filesize': file.size, |
| | | 'token': token |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | tr.id = "upload-"+index; |
| | | tr.innerHTML = '<td>' + file.name + '</td>' |
| | | + '<td>' + (file.size / 1024).toFixed(1) + 'kb</td>' |
| | | + '<td>' + file.userName + '</td>' |
| | | // + '<td><div class="layui-progress" lay-filter="progress-demo-' + index ,100 + '%'+ '"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | + '<td>'+'已完成'+'</td>' |
| | | + '<td>' |
| | |
| | | var tr = $(['<tr id="upload-">' |
| | | ,'<td id="upload-filename-id-'+ file.lastModified + '">' + file.name +'</td>' |
| | | ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>' |
| | | ,'<td id="upload-filename-userName-'+ '">' +'</td>' |
| | | ,'<td id="upload-file-id-' + file.lastModified + '"><div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="progress-demo-'+ file.lastModified +'"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | ,'<td>' |
| | | ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>' |
| | |
| | | layer.msg('上传成功', {icon: 1}); |
| | | $("#upload-file-id-" + file.lastModified).html("上传成功") |
| | | $("#upload-filename-id-" + file.lastModified).html(filename) |
| | | |
| | | let token = localStorage.getItem("token"); |
| | | $.ajax({ |
| | | url: baseUrl+"/plan/insert/file/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | 'planId': $('.layui-layer-title').text(), |
| | | 'filename': filename, |
| | | 'filesize': file.size |
| | | 'filesize': file.size, |
| | | 'token': token |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | tr.id = "upload-"+index; |
| | | tr.innerHTML = '<td>' + file.name + '</td>' |
| | | + '<td>' + (file.size / 1024).toFixed(1) + 'kb</td>' |
| | | + '<td>' + file.userName + '</td>' |
| | | // + '<td><div class="layui-progress" lay-filter="progress-demo-' + index ,100 + '%'+ '"><div class="layui-progress-bar" lay-percent=""></div></div></td>' |
| | | + '<td>'+'已完成'+'</td>' |
| | | + '<td>' |
| | |
| | | <thead> |
| | | <tr><th>文件名</th> |
| | | <th>大小</th> |
| | | <th>上传者</th> |
| | | <th>上传进度</th> |
| | | <th>操作</th> |
| | | </tr></thead> |
| | |
| | | <thead> |
| | | <tr><th>文件名</th> |
| | | <th>大小</th> |
| | | <th>上传者</th> |
| | | <th>上传进度</th> |
| | | <th>操作</th> |
| | | </tr></thead> |
| | |
| | | <thead> |
| | | <tr><th>文件名</th> |
| | | <th>大小</th> |
| | | <th>上传者</th> |
| | | <th>上传进度</th> |
| | | <th>操作</th> |
| | | </tr></thead> |