add:apk升级功能
This commit is contained in:
@@ -12,17 +12,19 @@ import org.nl.wms.dispatch_manage.point.service.ISchBasePointService;
|
|||||||
import org.nl.wms.dispatch_manage.point.service.dao.SchBasePoint;
|
import org.nl.wms.dispatch_manage.point.service.dao.SchBasePoint;
|
||||||
import org.nl.wms.external_system.acs.service.WmsToAcsService;
|
import org.nl.wms.external_system.acs.service.WmsToAcsService;
|
||||||
import org.nl.wms.pda_manage.devicemanage.dto.ComTp;
|
import org.nl.wms.pda_manage.devicemanage.dto.ComTp;
|
||||||
|
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||||
|
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*公共接口
|
*公共接口
|
||||||
@@ -30,19 +32,18 @@ import java.util.List;
|
|||||||
* @since 2024-03-28
|
* @since 2024-03-28
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("api/pda/common")
|
@RequestMapping("api/pda")
|
||||||
public class PdaCommonController {
|
public class PdaCommonController {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsToAcsService wmsToAcsService;
|
private ISysParamService iSysParamService;
|
||||||
@Autowired
|
|
||||||
private ISchBasePointService iSchBasePointService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库编码
|
* 仓库编码
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/storList")
|
@PostMapping("common/storList")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
@Log("仓库编码")
|
@Log("仓库编码")
|
||||||
public ResponseEntity<TableDataInfo<List>> storList() {
|
public ResponseEntity<TableDataInfo<List>> storList() {
|
||||||
@@ -53,6 +54,76 @@ public class PdaCommonController {
|
|||||||
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
@Log("获取升级地址")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Map> apkUrl() {
|
||||||
|
Map of = MapOf.of("versionName", "1.0.1", "url", "http://192.168.10.54:8012/api/pda/download/app-release");
|
||||||
|
return new ResponseEntity<>(of,HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@RequestMapping("/download/app-release")
|
||||||
|
@SaIgnore
|
||||||
|
public void setPrint(HttpServletResponse response) throws Exception {
|
||||||
|
Param byCode = iSysParamService.findByCode("apkurl");
|
||||||
|
if (byCode==null){
|
||||||
|
throw new BadRequestException("更新失败:为配置apk下载地址");
|
||||||
|
}
|
||||||
|
downloadFile(response,byCode.getValue(),"release");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件下载
|
||||||
|
* @param response
|
||||||
|
* @param fileName
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void downloadFile(HttpServletResponse response, String path, String fileName) throws Exception {
|
||||||
|
if (fileName != null) {
|
||||||
|
//设置文件路径
|
||||||
|
File file = new File(path);
|
||||||
|
if (file.exists()) {
|
||||||
|
response.setHeader("content-type", "application/octet-stream");
|
||||||
|
response.setContentType("application/octet-stream");
|
||||||
|
try {
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename="+new String(fileName.getBytes("utf-8"),"ISO-8859-1")+".apk");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
FileInputStream fis = null;
|
||||||
|
BufferedInputStream bis = null;
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(file);
|
||||||
|
bis = new BufferedInputStream(fis);
|
||||||
|
OutputStream os = response.getOutputStream();
|
||||||
|
int i = bis.read(buffer);
|
||||||
|
while (i != -1) {
|
||||||
|
os.write(buffer, 0, i);
|
||||||
|
i = bis.read(buffer);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (bis != null) {
|
||||||
|
try {
|
||||||
|
bis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fis != null) {
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ security:
|
|||||||
- /api/param/getValueByCode
|
- /api/param/getValueByCode
|
||||||
- /plumelog/**
|
- /plumelog/**
|
||||||
- /api/esLog/**
|
- /api/esLog/**
|
||||||
|
- /api/pda/download/app-release
|
||||||
- /api/bigScreenScreen/**
|
- /api/bigScreenScreen/**
|
||||||
- /api/users
|
- /api/users
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
|
|||||||
Reference in New Issue
Block a user