|
|
|
@ -6,8 +6,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.common.utils.IpUtils;
|
|
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
|
|
import com.ruoyi.api.utils.Md5Utils;
|
|
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.api.domain.*;
|
|
|
|
|
import com.ruoyi.api.service.IPdaApkVersionService;
|
|
|
|
@ -30,8 +32,7 @@ import java.util.List;
|
|
|
|
|
*/
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping("/pda/pda_version")
|
|
|
|
|
public class PdaApkVersionController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
public class PdaApkVersionController extends BaseController {
|
|
|
|
|
private String prefix = "pda/pda_version";
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -39,8 +40,7 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("pda:pda_version:view")
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String pda_version()
|
|
|
|
|
{
|
|
|
|
|
public String pda_version() {
|
|
|
|
|
return prefix + "/pda_version";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -50,8 +50,7 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
@RequiresPermissions("pda:pda_version:list")
|
|
|
|
|
@PostMapping("/list")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public TableDataInfo list(PdaApkVersion pdaApkVersion)
|
|
|
|
|
{
|
|
|
|
|
public TableDataInfo list(PdaApkVersion pdaApkVersion) {
|
|
|
|
|
startPage();
|
|
|
|
|
List<PdaApkVersion> list = pdaApkVersionService.selectPdaApkVersionList(pdaApkVersion);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
@ -64,8 +63,7 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
@Log(title = "手持版本升级", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult export(PdaApkVersion pdaApkVersion)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult export(PdaApkVersion pdaApkVersion) {
|
|
|
|
|
List<PdaApkVersion> list = pdaApkVersionService.selectPdaApkVersionList(pdaApkVersion);
|
|
|
|
|
ExcelUtil<PdaApkVersion> util = new ExcelUtil<PdaApkVersion>(PdaApkVersion.class);
|
|
|
|
|
return util.exportExcel(list, "手持版本升级数据");
|
|
|
|
@ -75,8 +73,7 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
* 新增手持版本升级
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/add")
|
|
|
|
|
public String add()
|
|
|
|
|
{
|
|
|
|
|
public String add() {
|
|
|
|
|
return prefix + "/add";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -87,26 +84,25 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
@Log(title = "手持版本升级", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping("/add")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult addSave(MultipartFile file, PdaApkVersion pdaApkVersion)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult addSave(MultipartFile file, PdaApkVersion pdaApkVersion) {
|
|
|
|
|
|
|
|
|
|
// 上传文件路径
|
|
|
|
|
String filePath = RuoYiConfig.getUploadPath()+"/apk";
|
|
|
|
|
String filePath = RuoYiConfig.getUploadPath() + "/apk";
|
|
|
|
|
// 上传并返回新文件名称
|
|
|
|
|
try {
|
|
|
|
|
String fileName = FileUploadUtils.upload(filePath, file);
|
|
|
|
|
// System.out.println("上传路径"+filePath+fileName);
|
|
|
|
|
// D:/ruoyi/uploadPath/upload/profile/upload/2023/04/06/app-debug_20230406170208A001.apk
|
|
|
|
|
String pathname = filePath + fileName;
|
|
|
|
|
System.out.println("地址1"+pathname);
|
|
|
|
|
pathname= pathname.replace("/profile/upload/apk","");
|
|
|
|
|
System.out.println("地址2:"+pathname);
|
|
|
|
|
File file1=new File(pathname);
|
|
|
|
|
System.out.println("文件获取:"+file1.exists());
|
|
|
|
|
System.out.println(file1.length()/1024);
|
|
|
|
|
pdaApkVersion.setApkSize(file1.length()/1024);
|
|
|
|
|
System.out.println("地址1" + pathname);
|
|
|
|
|
pathname = pathname.replace("/profile/upload/apk", "");
|
|
|
|
|
System.out.println("地址2:" + pathname);
|
|
|
|
|
File file1 = new File(pathname);
|
|
|
|
|
System.out.println("文件获取:" + file1.exists());
|
|
|
|
|
System.out.println(file1.length() / 1024);
|
|
|
|
|
pdaApkVersion.setApkSize(file1.length() / 1024);
|
|
|
|
|
pdaApkVersion.setApkMd5(Md5Utils.getFileMD5(file1));
|
|
|
|
|
pdaApkVersion.setDownloadUrl("http://10.32.128.150:90"+fileName);
|
|
|
|
|
pdaApkVersion.setDownloadUrl( "http://119.45.202.115:8090"+fileName);
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -119,11 +115,19 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("pda:pda_version:edit")
|
|
|
|
|
@GetMapping("/edit/{objid}")
|
|
|
|
|
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
|
|
|
|
|
{
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult edit(@PathVariable("objid") Long objid) {
|
|
|
|
|
PdaApkVersion pdaApkVersion = pdaApkVersionService.selectPdaApkVersionByObjid(objid);
|
|
|
|
|
mmap.put("pdaApkVersion", pdaApkVersion);
|
|
|
|
|
return prefix + "/edit";
|
|
|
|
|
String downloadUrl = pdaApkVersion.getDownloadUrl();
|
|
|
|
|
String substring = downloadUrl.substring(downloadUrl.indexOf("/apk"), downloadUrl.length());
|
|
|
|
|
try {
|
|
|
|
|
FileUtils.deleteFile(RuoYiConfig.getUploadPath() + substring);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(pdaApkVersionService.deletePdaApkVersionByObjid(objid));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -133,8 +137,7 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
@Log(title = "手持版本升级", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PostMapping("/edit")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult editSave(PdaApkVersion pdaApkVersion)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult editSave(PdaApkVersion pdaApkVersion) {
|
|
|
|
|
return toAjax(pdaApkVersionService.updatePdaApkVersion(pdaApkVersion));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -143,10 +146,16 @@ public class PdaApkVersionController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
@RequiresPermissions("pda:pda_version:remove")
|
|
|
|
|
@Log(title = "手持版本升级", businessType = BusinessType.DELETE)
|
|
|
|
|
@PostMapping( "/remove")
|
|
|
|
|
@PostMapping("/remove")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult remove(String ids)
|
|
|
|
|
{
|
|
|
|
|
public AjaxResult remove(String ids) {
|
|
|
|
|
System.out.println(ids);
|
|
|
|
|
PdaApkVersion pdaApkVersion = pdaApkVersionService.selectPdaApkVersionByObjid(Long.valueOf(ids));
|
|
|
|
|
String downloadUrl = pdaApkVersion.getDownloadUrl();
|
|
|
|
|
if (downloadUrl!=null&&!downloadUrl.isEmpty()){
|
|
|
|
|
String substring = downloadUrl.substring(downloadUrl.indexOf("/apk"), downloadUrl.length());
|
|
|
|
|
FileUtils.deleteFile(RuoYiConfig.getUploadPath() + substring);
|
|
|
|
|
}
|
|
|
|
|
return toAjax(pdaApkVersionService.deletePdaApkVersionByObjids(ids));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|