|
@@ -25,6 +25,7 @@ using OASystem.Domain.Dtos.CRM;
|
|
|
using System.Diagnostics;
|
|
|
using MathNet.Numerics.Statistics.Mcmc;
|
|
|
using AlibabaCloud.OpenApiClient.Models;
|
|
|
+using System;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -483,6 +484,118 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// IOS获取团组签证拍照上传进度03(相册)
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<ActionResult> PostIOSVisaProgressImageList(IOS_VisaImageListDto dto)
|
|
|
+ {
|
|
|
+ if (dto == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "请求错误:"));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<VisaProgressImageView> list = _delegationVisaRep.GetVisaProgressImageList(dto.visaProgressCustomerId, dto.picType);
|
|
|
+
|
|
|
+ return Ok(JsonView(list));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// IOS获取团组签证拍照上传进度04(图片上传)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<ActionResult> PostIOSVisaProgressUploadImage(IOS_VisaUploadImageDto dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ //string result = decodeBase64ToImage(dto.base64DataURL, dto.imageName);
|
|
|
+
|
|
|
+ //if (!string.IsNullOrEmpty(result))
|
|
|
+ //{
|
|
|
+
|
|
|
+ //}
|
|
|
+ //else {
|
|
|
+ // return Ok(JsonView(false, "上传失败"));
|
|
|
+ //}
|
|
|
+
|
|
|
+ DateTime dt1970 = new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
|
|
+ int sucNum = 0;
|
|
|
+ foreach (var item in dto.base64DataList)
|
|
|
+ {
|
|
|
+ string imageName = dto.imageName + ((DateTime.Now.Ticks - dt1970.Ticks) / 10000).ToString();
|
|
|
+ string result = decodeBase64ToImage(item, imageName);
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(result))
|
|
|
+ {
|
|
|
+ Grp_VisaProgressCustomerPicture pic = new Grp_VisaProgressCustomerPicture();
|
|
|
+ pic.CreateUserId = dto.CreateUserId;
|
|
|
+ pic.PicName = imageName;
|
|
|
+ pic.PicPath = result;
|
|
|
+ pic.VisaProgressCustomerId = dto.visaProgressCustomerId;
|
|
|
+
|
|
|
+ int insertResult = await _delegationVisaRep.AddAsync<Grp_VisaProgressCustomerPicture>(pic);
|
|
|
+ if (insertResult > 0)
|
|
|
+ {
|
|
|
+ sucNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ string msg = string.Format(@"成功上传{0}张", sucNum);
|
|
|
+
|
|
|
+ return Ok(JsonView(true, msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ private string decodeBase64ToImage(string base64DataURL, string imgName)
|
|
|
+ {
|
|
|
+ string filename = "";//声明一个string类型的相对路径
|
|
|
+
|
|
|
+ String base64 = base64DataURL.Substring(base64DataURL.IndexOf(",") + 1); //将‘,’以前的多余字符串删除
|
|
|
+ System.Drawing.Bitmap bitmap = null;//定义一个Bitmap对象,接收转换完成的图片
|
|
|
+
|
|
|
+ try//会有异常抛出,try,catch一下
|
|
|
+ {
|
|
|
+
|
|
|
+ byte[] arr = Convert.FromBase64String(base64);//将纯净资源Base64转换成等效的8位无符号整形数组
|
|
|
+
|
|
|
+ System.IO.MemoryStream ms = new System.IO.MemoryStream(arr);//转换成无法调整大小的MemoryStream对象
|
|
|
+ bitmap = new System.Drawing.Bitmap(ms);//将MemoryStream对象转换成Bitmap对象
|
|
|
+
|
|
|
+ var fileDir = AppSettingsHelper.Get("VisaProgressImageFtpPath");
|
|
|
+ //文件名称
|
|
|
+ filename = "VisaProgress_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + imgName + ".jpg";//所要保存的相对路径及名字
|
|
|
+ //上传的文件的路径
|
|
|
+ string filePath = "";
|
|
|
+ if (!Directory.Exists(fileDir))
|
|
|
+ {
|
|
|
+ Directory.CreateDirectory(fileDir);
|
|
|
+ }
|
|
|
+ //上传的文件的路径
|
|
|
+ filePath = fileDir + filename;
|
|
|
+
|
|
|
+ //string url = HttpRuntime.AppDomainAppPath.ToString();
|
|
|
+ //string tmpRootDir = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString()); //获取程序根目录
|
|
|
+ //string imagesurl2 = tmpRootDir + filename; //转换成绝对路径
|
|
|
+ bitmap.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);//保存到服务器路径
|
|
|
+ //bitmap.Save(filePath + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
|
|
|
+ //bitmap.Save(filePath + ".gif", System.Drawing.Imaging.ImageFormat.Gif);
|
|
|
+ //bitmap.Save(filePath + ".png", System.Drawing.Imaging.ImageFormat.Png);
|
|
|
+ ms.Close();//关闭当前流,并释放所有与之关联的资源
|
|
|
+ bitmap.Dispose();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ string massage = e.Message;
|
|
|
+ }
|
|
|
+ return filename;//返回相对路径
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 团组任务分配
|
|
@@ -906,7 +1019,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
Result groupData = await _airTicketResRep.OpAirTicketRes(dto);
|
|
|
if (groupData.Code != 0)
|