|
|
|
@ -119,6 +119,8 @@ import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
@ -769,6 +771,7 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void uploadWZTP(String stEndName) {
|
|
|
|
private void uploadWZTP(String stEndName) {
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
File wztpuploadfile = new File(path + "/" + stEndName);
|
|
|
|
File wztpuploadfile = new File(path + "/" + stEndName);
|
|
|
|
|
|
|
|
showLog(wztpuploadfile.getPath());
|
|
|
|
//showToast("filesize:" + String.valueOf(wztpuploadfile.length()));
|
|
|
|
//showToast("filesize:" + String.valueOf(wztpuploadfile.length()));
|
|
|
|
RequestBody requestFile = RequestBody.create(MediaType.parse("image/*"), wztpuploadfile);
|
|
|
|
RequestBody requestFile = RequestBody.create(MediaType.parse("image/*"), wztpuploadfile);
|
|
|
|
MultipartBody.Part body = MultipartBody.Part.createFormData("fileps", wztpuploadfile.getName(), requestFile);
|
|
|
|
MultipartBody.Part body = MultipartBody.Part.createFormData("fileps", wztpuploadfile.getName(), requestFile);
|
|
|
|
@ -808,6 +811,7 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void uploadWZTPFJT(String fjtEndName) {
|
|
|
|
private void uploadWZTPFJT(String fjtEndName) {
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
File wztpuploadfile = new File(path + "/" + fjtEndName);
|
|
|
|
File wztpuploadfile = new File(path + "/" + fjtEndName);
|
|
|
|
|
|
|
|
showLog(wztpuploadfile.getPath());
|
|
|
|
//showToast("filesize:" + String.valueOf(wztpuploadfile.length()));
|
|
|
|
//showToast("filesize:" + String.valueOf(wztpuploadfile.length()));
|
|
|
|
RequestBody requestFile = RequestBody.create(MediaType.parse("image/*"), wztpuploadfile);
|
|
|
|
RequestBody requestFile = RequestBody.create(MediaType.parse("image/*"), wztpuploadfile);
|
|
|
|
MultipartBody.Part body = MultipartBody.Part.createFormData("fileps", wztpuploadfile.getName(), requestFile);
|
|
|
|
MultipartBody.Part body = MultipartBody.Part.createFormData("fileps", wztpuploadfile.getName(), requestFile);
|
|
|
|
@ -856,14 +860,21 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
Log.i("app", wztp.getItemnum() + "." + extensionName);
|
|
|
|
Log.i("app", wztp.getItemnum() + "." + extensionName);
|
|
|
|
Log.i("app", String.valueOf(duration));
|
|
|
|
Log.i("app", String.valueOf(duration));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String itemNumTemp = wztp.getItemnum();
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(itemNumTemp) && itemNumTemp.contains("/")){
|
|
|
|
|
|
|
|
itemNumTemp.replace("/","-");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog("---------itemNumTemp-------");
|
|
|
|
|
|
|
|
showLog(itemNumTemp);
|
|
|
|
|
|
|
|
|
|
|
|
HttpUtils.getYXApi(this).uploadwztpBody(
|
|
|
|
HttpUtils.getYXApi(this).uploadwztpBody(
|
|
|
|
wztp.getItemnum(),
|
|
|
|
wztp.getItemnum(),
|
|
|
|
wztp.getItemid(),
|
|
|
|
wztp.getItemid(),
|
|
|
|
username,
|
|
|
|
username,
|
|
|
|
"3",
|
|
|
|
"3",
|
|
|
|
wztp.getItemnum() + "." + extensionName,
|
|
|
|
itemNumTemp + "." + extensionName,
|
|
|
|
duration,
|
|
|
|
duration,
|
|
|
|
wztp.getItemnum() + ".jpg",
|
|
|
|
itemNumTemp + ".jpg",
|
|
|
|
body).enqueue(new BaseCallBack<wztpBean>(context) {
|
|
|
|
body).enqueue(new BaseCallBack<wztpBean>(context) {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Call<wztpBean> call, retrofit2.Response<wztpBean> response) {
|
|
|
|
public void onSuccess(Call<wztpBean> call, retrofit2.Response<wztpBean> response) {
|
|
|
|
@ -893,7 +904,11 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void compressVideo() {
|
|
|
|
private void compressVideo() {
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
Wztpscinfo.Wztp wztp = wztps.get(0);
|
|
|
|
String extensionName = FileUtils.getFileType(videoFileName);
|
|
|
|
String extensionName = FileUtils.getFileType(videoFileName);
|
|
|
|
videoCompressFilePath = context.getExternalFilesDir(null).getPath() + "/Movies/" + wztp.getItemnum() + "_compress_video." + extensionName;
|
|
|
|
String itemNumTemp = wztp.getItemnum();
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(itemNumTemp) && itemNumTemp.contains("/")){
|
|
|
|
|
|
|
|
itemNumTemp = itemNumTemp.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
videoCompressFilePath = context.getExternalFilesDir(null).getPath() + "/Movies/" + itemNumTemp + "_compress_video." + extensionName;
|
|
|
|
VideoCompress.compressVideoLow(videoFilePath, videoCompressFilePath, new VideoCompress.CompressListener() {
|
|
|
|
VideoCompress.compressVideoLow(videoFilePath, videoCompressFilePath, new VideoCompress.CompressListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onStart() {
|
|
|
|
public void onStart() {
|
|
|
|
@ -931,14 +946,32 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
Log.i("app", wztp.getItemnum() + "." + extensionName);
|
|
|
|
Log.i("app", wztp.getItemnum() + "." + extensionName);
|
|
|
|
Log.i("app", String.valueOf(duration));
|
|
|
|
Log.i("app", String.valueOf(duration));
|
|
|
|
|
|
|
|
|
|
|
|
String url = Contans.IP + Contans.YDCK_WZ_UPLOAD_VIDEO_URL + "?itemnum=" + wztp.getItemnum() + "&itemid=" + wztp.getItemid() + "&operid=" + username
|
|
|
|
String itemNumTemp = wztp.getItemnum();
|
|
|
|
+ "&type=3" + "&fname=" + wztp.getItemnum() + "." + extensionName + "&videoleng=" + duration + "&videosltname=" + wztp.getItemnum() + "_video.jpg";
|
|
|
|
if(!TextUtils.isEmpty(itemNumTemp) && itemNumTemp.contains("/")){
|
|
|
|
|
|
|
|
itemNumTemp = itemNumTemp.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showLog(itemNumTemp);
|
|
|
|
|
|
|
|
showLog(wztp.getItemnum());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String itemNumEncode = wztp.getItemnum();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(itemNumEncode) && itemNumEncode.contains("/")){
|
|
|
|
|
|
|
|
itemNumEncode = URLEncoder.encode(itemNumEncode, "UTF-8");;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (UnsupportedEncodingException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url = Contans.IP + Contans.YDCK_WZ_UPLOAD_VIDEO_URL + "?itemnum=" + itemNumEncode + "&itemid=" + wztp.getItemid() + "&operid=" + username
|
|
|
|
|
|
|
|
+ "&type=3" + "&fname=" + itemNumTemp + "." + extensionName + "&videoleng=" + duration + "&videosltname=" + itemNumTemp + "_video.jpg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log.i("app", url);
|
|
|
|
Log.i("app", url);
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Bitmap bitmapVideo = VideoImageUtil.createVideoThumbnail(videoFilePath, MediaStore.Images.Thumbnails.MINI_KIND);
|
|
|
|
Bitmap bitmapVideo = VideoImageUtil.createVideoThumbnail(videoFilePath, MediaStore.Images.Thumbnails.MINI_KIND);
|
|
|
|
videoStFilePath = context.getExternalFilesDir(null).getPath() + "/Movies/" + wztp.getItemnum() + "_video.jpg";
|
|
|
|
videoStFilePath = context.getExternalFilesDir(null).getPath() + "/Movies/" + itemNumTemp + "_video.jpg";
|
|
|
|
VideoImageUtil.saveImage(videoStFilePath, bitmapVideo);
|
|
|
|
VideoImageUtil.saveImage(videoStFilePath, bitmapVideo);
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -1334,6 +1367,13 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void cropFromTake(String name, int flag) throws IOException {
|
|
|
|
private void cropFromTake(String name, int flag) throws IOException {
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
stFileName = name + ".jpg";
|
|
|
|
stFileName = name + ".jpg";
|
|
|
|
|
|
|
|
showLog("-------before------");
|
|
|
|
|
|
|
|
showLog(stFileName);
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(name) && name.contains("/")){
|
|
|
|
|
|
|
|
stFileName = stFileName.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
showLog("-------after------");
|
|
|
|
|
|
|
|
showLog(stFileName);
|
|
|
|
this.deleteFileIfNeed(path, stFileName);
|
|
|
|
this.deleteFileIfNeed(path, stFileName);
|
|
|
|
File fos = this.createFileIfNeed(path, stFileName);
|
|
|
|
File fos = this.createFileIfNeed(path, stFileName);
|
|
|
|
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", fos);
|
|
|
|
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", fos);
|
|
|
|
@ -1355,6 +1395,9 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
String applicationId = App.getApplicationId(context);
|
|
|
|
|
|
|
|
|
|
|
|
fjtFileName = name + ".jpg";
|
|
|
|
fjtFileName = name + ".jpg";
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(name) && name.contains("/")){
|
|
|
|
|
|
|
|
fjtFileName = fjtFileName.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
this.deleteFileIfNeed(path, fjtFileName);
|
|
|
|
this.deleteFileIfNeed(path, fjtFileName);
|
|
|
|
File fos = this.createFileIfNeed(path, fjtFileName);
|
|
|
|
File fos = this.createFileIfNeed(path, fjtFileName);
|
|
|
|
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", fos);
|
|
|
|
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", fos);
|
|
|
|
@ -1412,6 +1455,9 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void choosePhoto(int flag) {
|
|
|
|
private void choosePhoto(int flag) {
|
|
|
|
|
|
|
|
|
|
|
|
stFileName = UiUtlis.getText(etHgtm) + ".jpg";
|
|
|
|
stFileName = UiUtlis.getText(etHgtm) + ".jpg";
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(stFileName) && stFileName.contains("/")){
|
|
|
|
|
|
|
|
stFileName = stFileName.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
this.deleteFileIfNeed(path, stFileName);
|
|
|
|
this.deleteFileIfNeed(path, stFileName);
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
|
|
|
Intent fjtxc = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
|
|
Intent fjtxc = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
|
|
@ -1434,6 +1480,9 @@ public class WztpScActivity extends BaseActivity2 {
|
|
|
|
private void choosePhotoFjt(int flag) {
|
|
|
|
private void choosePhotoFjt(int flag) {
|
|
|
|
|
|
|
|
|
|
|
|
fjtFileName = UiUtlis.getText(etHgtm) + "FJT" + ".jpg";
|
|
|
|
fjtFileName = UiUtlis.getText(etHgtm) + "FJT" + ".jpg";
|
|
|
|
|
|
|
|
if(!TextUtils.isEmpty(fjtFileName) && fjtFileName.contains("/")){
|
|
|
|
|
|
|
|
fjtFileName = fjtFileName.replace("/","_");
|
|
|
|
|
|
|
|
}
|
|
|
|
this.deleteFileIfNeed(path, fjtFileName);
|
|
|
|
this.deleteFileIfNeed(path, fjtFileName);
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
|
|
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
|
|
|
Intent fjtxc = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
|
|
Intent fjtxc = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
|
|
|
|