多组input文件,每组 multiple选择多张图片上传可增删其中任意一张图片,用formData对象实现;(ajax做异步,自己做延时同步)

input multiple选择多张图片时,需要删除其中的一张图片怎么做,大家都知道 input 中的文件是不能删除和更改的,只能清空,这里我的做法是 定义一个对象储存器把需要的文件存在储存器中 formData,后台不从Input中读取,从对象存储器中获取文件,一组图片使用一个储存器中formData,存储器中的 key 我们用文件名Input的ID 拼接,而后取出图片的key 也用Input的ID;删除图片也是同一个key; 上传所有的图片时,用ajax 需要异步操作与后台交互,后台根据 key 获取所有图片,图片最终保存在阿里oss对象储存服务器上,数据库写入图片上传后返回的URL地址;

ajaxasync: false同步后,(确认框)无法关闭用户会误认为程序卡死状态】,确认框需要等待所有的ajax代码依次执行结束才会关闭,所以这里需要把ajax改为异步,自己通过其它技术实现同步,用户点确认按钮后确认框会马上关闭

【 

ajax同步技术:

1、  var someAjaxDfd = $.Deferred(); 

2、  var its_promise = $.when( someAjaxDfd );

3、 someAjaxDfd.resolve();   放对应的ajax 执行结束的代码中

4、  its_promise.done(function () {
         【对应的ajax执行结束后会执行这里面的代码】
        });

ajax 同步图:

someAjaxDfd.resolve();   放对应的ajax 执行结束的代码中;

效果:

添加图片:

删除其中一张图片:

 

重复图片提示:

单图片预览:

 确认框:

(ajax 如不做异步,这个框点击确认后会一直存在直到ajax都执行完毕,用户点击后会误认为程序卡死)

上传图片组件样式:

D:\Project\lvmsm\src\main\webapp\assets\upjs\css\index.css

<link href="/assets/upjs/css/index.css" type="text/css" rel="stylesheet"/>

/*上传图片插件的样式*/
.img-box{
	margin-top: 40px;
}
.img-box .up-p{
	margin-bottom: 20px;
	font-size: 16px;
	color: #555;
}
.z_photo{
	padding: 18px;
	border:2px dashed #E7E6E6;
	/*padding: 18px;*/
}
.z_photo .z_file{
	position: relative;
}
.z_file  .file{
	width: 100%;
	height: 100%;
	opacity: 0;
	position: absolute;
	top: 0px;
	left: 0px;
	z-index: 100;
}
.z_photo .up-section{
	position: relative;
	margin-right: 20px;
	margin-bottom: 20px;
}
.up-section .close-upimg{
	position: absolute;
	top: 6px;
	right: 8px;
	display: none;
	z-index: 10;
}
.up-section .up-span{
	/*display: block;*/
	width: 100%;
	height: 100%;
	visibility: hidden;
	position: absolute;
	top: 0px;
	left: 0px;
	z-index: 9;
	background: rgba(0,0,0,.5);
}
.up-section:hover{
	border: 2px solid #f15134;
}
.up-section:hover .close-upimg{

	display: block;
}
.up-section:hover .up-span{
	/*选择中图片变黑*/
	/*visibility: visible;*/
}
.z_photo .up-img{
	display: block;
	width: 100%;
	height: 100%;
}
.loading{
    border: 1px solid #D1D1D1;
	background:url(../img/loading.gif) no-repeat center;
}
.up-opcity{
	opacity: 0;
}
.img-name-p{
	display: none;
}
.upimg-div .up-section {
    width: 190px;
    height: 180px;
}
.img-box .upimg-div .z_file {
    width: 190px;
    height: 180px;
}
.z_file .add-img {
    display: block;
    width: 190px;
    height: 180px;
}
/*遮罩层样式*/
.mask{
	z-index: 1000;
	display: none;
	position: fixed;
	top: 0px;
	left: 0px;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,.4);
}
.mask .mask-content{
	 width: 500px;
	 position: absolute;
	 top: 50%;
	 left: 50%;
	 margin-left: -250px;
	 margin-top: -80px;
	 background: white;
	 height: 160px;
	 text-align: center;
}
.mask .mask-content .del-p{
	color: #555;
	height: 94px;
	line-height: 94px;
	font-size: 18px;
	border-bottom: 1px solid #D1D1D1;
}
.mask-content .check-p{
	height: 66px;
	line-height: 66px;
	position: absolute;
	bottom: 0px;
	left: 0px;
	width: 100%;
}
.mask-content .check-p span{
	width: 49%;
	display:inline-block;
	text-align: center;
	color:#d4361d ;
	font-size: 18px;
}
.check-p .del-com{
	border-right: 1px solid #D1D1D1;
}
<link href="/assets/upjs/css/common.css" type="text/css" rel="stylesheet"/>
* {
	box-sizing: border-box;
	-moz-box-sizing: border-box;
	/* Firefox */
	-webkit-box-sizing: border-box;
	/* Safari */
}
.up-section .type-upimg{
	display: none;
}
::-ms-clear,::-ms-reveal{display:none;}
textarea{
	outline: none;
	line-height: 14px;
	padding-left: 4px;
	padding-top: 4px;
	border: 1px solid #ccc;
	color: #444;
	font-size: 14px;
	outline: none;
	text-align: left;
}
.overflow{
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
button{
	outline: none;
	border: 0px;
	font-family: "微软雅黑", "PingFang SC", "arial, helvetica, sans-serif";
}
input{
	font-family: "微软雅黑", "PingFang SC", "arial, helvetica, sans-serif";
	outline: none;
}
a {
	outline: none;
}
a,button{cursor:pointer;} 

/*body {
	background: #f4f4f4;
	font-size: 14px;
	font-family: "微软雅黑", "PingFang SC", "arial, helvetica, sans-serif";
}*/
.clear {
	clear: both;
}
.full{
	width: 1210px;
	min-width: 1210px;
	margin: 0 auto;
}
.full-big{
	width: 1340px;
	min-width: 1340px;
	margin: 0 auto;
}
.img-full{
	display: block;
	width: 100%;
}
::-webkit-input-placeholder {
	color: #777;
	font-size: 14px;
}
:-moz-placeholder {
	/* Firefox 18- */
	color: #777;
	font-size: 14px;
}
::-moz-placeholder {
	/* Firefox 19+ */
	color: #777;
	font-size: 14px;
}
:-ms-input-placeholder {
	color:#777;
	font-size: 14px;
}
/* ====clear float====== */
/*nav a:visited{color: rgb(65,65,65);}
aside a:visited{color: rgb(65,65,65);}*/
.fl {
	float: left;
}
.fr {
	float: right;
}
.clear:after {
	content: '';
	display: block;
	clear: both;
}
/* reset */
.pic img{display: none;}
i,
p,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
br,
em,
dl,
dd,
li,
ul,
ol,
td,
th,
pre,
form,
body,
input,
strong,
textarea,
select,figcaption,figure{
	margin: 0;
	padding: 0;
}
em {
	font-style: normal
}
li {
	list-style: none
}
a {
	text-decoration: none;
}
img {
	border: none;
	
}
table {
	border-collapse: collapse;
}
textarea {
	resize: none;
	overflow: auto;
}
a,button{cursor:pointer;} 

图片增删 与后台交互js:

assets/js/gm/add-GasCylinderCheckInfoAjaxfileupload.js

/*===========================================主页证书查看===================================================*/
$(document).ready(function() {


});
//多图片查看
function showImg(urls) {
  var  url = "";
    if(null != urls && 0 < urls.length) {
        $("#showImg").val(urls);
        var url = urls.split(',');

    }
    if(null != url && url != ""){
        popWin.showWin("1300","590","查看证书",url);
    }else{
        DJMask.msg("未获取到数据请检查!");
    }

}

//单图片查看
function showImgD(url) {

    if(null != url && url != ""){
        popWinD.showWin("600","590","查看证书",url);
    }else{
        DJMask.msg("未获取到数据请检查!");
    }

}
/*function ass() {
    popWin.showWin("800","600","通用的iframe弹层插件","http://www.jq22.com");
}*/
/*-------------------------------------------------上传图片,图片显示js,控制5张图片------------------------------------------------------------------------*/
//取数据
/*产品合格证*/
/*对应图片上传input的ID*/
var fu1="productqualifyurlFile1";
/*图片储存器*/
var formData = new FormData();
var formData1 = new FormData();

/*(质量证明书)*/
/*对应图片上传input的ID*/
var fuA="qualitycertificateurlFile2";
/*图片储存器*/
var formDataA = new FormData();
var formDataA1 = new FormData();

/*(使用说明书)*/
/*对应图片上传input的ID*/
var fuB="instructionmanualurlFile2";
/*图片储存器*/
var formDataB = new FormData();
var formDataB1 = new FormData();

/*(检验报告)*/
/*对应图片上传input的ID*/
var fuC="inspectereporturlFile2"
/*图片储存器*/
var formDataC = new FormData();
var formDataC1 = new FormData();

/*(日常检验记录)*/
/*对应图片上传input的ID*/
var fuD="dailyinspectrecordurlFile2";
/*图片储存器*/
var formDataD = new FormData();
var formDataD1 = new FormData();


$(function () {
    var delParent;
    var idFile;
    var defaults = {
        fileType: ["jpg", "png", "bmp", "jpeg", "JPG","PNG"],   // 上传文件的类型

        fileSize: 1024 * 1024 * 10                  // 上传文件的大小 10M
    };
    /*点击图片的文本框*/
    $("table").delegate(".file", "change", function () {

       /*获取对应图片上传input的ID*/
        idFile = $(this).attr("id")+"";
        /*获取对应图片集*/
        var file = document.getElementById(idFile);
        var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元素

        var fileList = file.files; //获取的图片文件

        console.log(fileList + "======filelist=====");
        var input = $(this).parent();//文本框的父亲元素
        var imgArr = [];

        //遍历得到的图片文件

        var numUp = imgContainer.find(".up-section").length;
        var totalNum = numUp + fileList.length;  //总的数量
        if (fileList.length > 5 || totalNum > 5) {
          //一次选择上传超过5个 或者是已经上传和这次上传的到的总数也不可以超过5个
            DJMask.msg("上传图片数目不可以超过5个,请重新选择!");
        }
        else if (numUp < 5) {
            fileList = validateUp(fileList);
            for (var i = 0; i < fileList.length; i++) {
                var imgUrl = window.URL.createObjectURL(fileList[i]);
                imgArr.push(imgUrl);
             
                var $section = $("<section class='up-section fl loading'>");
                imgContainer.prepend($section);
                var $span = $("<span class='up-span'>");
                $span.appendTo($section);

             /*   删除图片*/
          var $img0 = $("<img class='close-upimg'>").on("click", function (event) {

                    event.preventDefault();
                    event.stopPropagation();
                    $(".works-mask").show();
                    delParent = $(this).parent();

              var numUp = delParent.siblings().length;
              if (numUp < 6) {
                  delParent.parent().find(".z_file").show();
              }
              /* 获取删除图片的图片名*/  
              var fileName =$(this).parent().children(".img-name-p").text();
                /* 获取删除图片的input的ID*/  
              var idFile1 = $(this).parent(). nextAll(".z_file").children(".file").attr("id")+"";

      /* 判断删除图片的input的ID是哪一组图片,对应操作对应的图片储存器!*/          
                  if(idFile1 == fu1){
                  formData.delete((fileName+idFile1));
                  formData.delete(idFile1);
                  formData1.delete(idFile1);
                  var i = formData.entries();
                  while(item = i.next()){
                      if(item.done) break;
                      //因为对象里存储多个类型的图片,需要区分图片单独增删
                      if(item.value[0] != idFile1){
                       //将需要的图片中转一下,直接放formData这个里可能会死循序
                          formData1.append(idFile1,item.value[1]);
                      }
                  }
                  //遍历中转存储器formDataA中的图片
                  var y = formData1.entries();
                  while(item1 = y.next()){
                      if(item1.done) break;
                          //加入formData存储器中,key为input的ID
                          formData.append(idFile1,item1.value[1]);
                  }
                  delParent.remove();
              }else if(idFile1 == fuA){
                  formDataA.delete((fileName+idFile1));
                  formDataA.delete(idFile1);
                  formDataA1.delete(idFile1);
                  var i = formDataA.entries();
                  while(item = i.next()){
                      if(item.done) break;
                      //因为对象里存储多个类型的图片,需要区分图片单独增删
                      if(item.value[0] != idFile1){
                         //将需要的图片中转一下,直接放formDataA这个里可能会死循序
                          formDataA1.append(idFile1,item.value[1]);
                      }
                  }

                  var y = formDataA1.entries();
                  while(item1 = y.next()){
                      if(item1.done) break;
                          formDataA.append(idFile1,item1.value[1]);
                  }
                  delParent.remove();
              }else if(idFile1 == fuB){
                  formDataB.delete((fileName+idFile1));
                  formDataB.delete(idFile1);
                  formDataB1.delete(idFile1);
                  var i = formDataB.entries();
                  while(item = i.next()){
                      if(item.done) break;
                      //因为对象里存储多个类型的图片,需要区分图片单独增删
                      if(item.value[0] != idFile1){
                          formDataB1.append(idFile1,item.value[1]);
                      }
                  }

                  var y = formDataB1.entries();
                  while(item1 = y.next()){
                      if(item1.done) break;
                          formDataB.append(idFile1,item1.value[1]);
                  }
                  delParent.remove();
              }else if(idFile1 == fuC){
                  formDataC.delete((fileName+idFile1));
                  formDataC.delete(idFile1);
                  formDataC1.delete(idFile1);
                  var i = formDataC.entries();
                  while(item = i.next()){
                      if(item.done) break;
                      //因为对象里存储多个类型的图片,需要区分图片单独增删
                      if((item.value[0]+"") != idFile1){
                          formDataC1.append(idFile1,item.value[1]);
                      }
                  }

                  var y = formDataC1.entries();
                  while(item1 = y.next()){
                      if(item1.done) break;
                          formDataC.append(idFile1,item1.value[1]);
                  }
                  delParent.remove();
              }else if(idFile1 == fuD){
                  formDataD.delete((fileName+idFile1));
                  formDataD.delete(idFile1);
                  formDataD1.delete(idFile1);
                  var i = formDataD.entries();
                  while(item = i.next()){
                      if(item.done) break;
                      //因为对象里存储多个类型的图片,需要区分图片单独增删
                      if((item.value[0]+"") != idFile1){
                          formDataD1.append(idFile1,item.value[1]);

                      }

                  }

                  var y = formDataD1.entries();
                  while(item1 = y.next()){
                      if(item1.done) break;
                          formDataD.append(idFile1,item1.value[1]);
                  }

                  delParent.remove();
              }

                });

                /*删除图片按钮*/
                $img0.attr({"src":"/assets//upjs/img/a7.png"}).appendTo($section);
                /*单张图片预览*/
                var $img = $("<a href=\"javascript:showImgD('"+imgArr[i]+"')\"><img class='up-img up-opcity' src='"+imgArr[i]+"'></a>");
                /*var $img = $("<img class='up-img up-opcity' >");*/
                $img.attr("src", imgArr[i]);
                $img.appendTo($section);
                var $p = $("<p class='img-name-p'>");
                $p.html(fileList[i].name).appendTo($section);
                var $input = $("<input id='taglocation' name='taglocation' value='' type='hidden'>");
                $input.appendTo($section);
                var $input2 = $("<input id='tags' name='tags' value='' type='hidden'/>");
                $input2.appendTo($section);

            }
        }




        setTimeout(function () {
            $(".up-section").removeClass("loading");
            $(".up-img").removeClass("up-opcity");
        }, 450);
        numUp = imgContainer.find(".up-section").length;
        if (numUp >= 5) {
            $(this).parent().hide();
        }

    });


    $(".z_photo").delegate(".close-upimg", "click", function () {
        $(".works-mask").show();
        delParent = $(this).parent();
    });

    $(".wsdel-ok").click(function () {
        $(".works-mask").hide();
        var numUp = delParent.siblings().length;
        if (numUp < 6) {
            delParent.parent().find(".z_file").show();
        }

        delParent.remove();

    });

    $(".wsdel-no").click(function () {
        $(".works-mask").hide();
    });



    function validateUp(files) {

        var arrFiles = [];//替换的文件数组

        for (var i = 0, file; file = files[i]; i++) {
            //获取文件上传的后缀名

            var newStr = file.name.split("").reverse().join("");
            if (newStr.split(".")[0] != null) {
                var type = newStr.split(".")[0].split("").reverse().join("");
                console.log(type + "===type===");
                if (jQuery.inArray(type, defaults.fileType) > -1) {
                    // 类型符合,可以上传
                    if (file.size >= defaults.fileSize) {
                        DJMask.msg(file.size);
                        DJMask.msg('您这个"' + file.name + '"文件大小过大');
                    
                    } else {

                        // 在这里需要判断当前所有文件中
                        //判断 增加的图片是哪个input 的ID,把图片加入对应的图片储存器中
                        if(idFile == fu1){
                           //判断 图片储存器中是否已存在该图片,如果存在就不加入,并给与提示;
                            if( !formData.has((file.name+idFile))) {
                                formData.append((file.name + idFile), file);
                                formData.append(idFile, file);
                                arrFiles.push(file);
                            }else{
                                DJMask.msg("文件不能重复上传!");
                            }

                        }else if(idFile == fuA){
                            if( !formDataA.has((file.name+idFile))) {
                                formDataA.append((file.name + idFile), file);
                                formDataA.append(idFile, file);
                                arrFiles.push(file);
                            }else{
                                DJMask.msg("文件不能重复上传!");
                            }
                        }else if(idFile == fuB){
                            if( !formDataB.has((file.name+idFile))) {
                                formDataB.append((file.name + idFile), file);
                                formDataB.append(idFile, file);
                                arrFiles.push(file);
                            }else{
                                DJMask.msg("文件不能重复上传!");
                            }
                        }else if(idFile == fuC){
                                if( !formDataC.has((file.name+idFile))) {
                            formDataC.append((file.name+idFile),file);
                            formDataC.append(idFile,file);
                                    arrFiles.push(file);
                                }else{
                                    DJMask.msg("文件不能重复上传!");
                                }
                        }else if(idFile == fuD){
                                if( !formDataD.has((file.name+idFile))) {
                            formDataD.append((file.name+idFile),file);
                            formDataD.append(idFile,file);
                              arrFiles.push(file);
                                }else{
                                    DJMask.msg("文件不能重复上传!");
                                }
                        }
                    }
                } else {
                    
                    DJMask.msg('您这个"' + file.name + '"上传类型不符合');
                }
            } else {
               
                DJMask.msg('您这个"' + file.name + '"没有类型, 无法识别');
            }
        }
        return arrFiles;
    }

})

/*================================================实现数据库图片上传==================================================================*/



/*产品合格证*/
function ProductqualifyurlFileUpload(someAjaxDfd) {
    /*产品合格证*/
    $.ajax({
        url: "/config/create-AllGasCylinderCheckInfoFileurlFileUpload",
        type: "POST",
        dataType: 'json',
        processData: false,
        contentType: false,
        data: formData,
        /*async: false,*/
        success: function(data){
            if (data.resultCode == 200) {
                $("#productqualifyurl").val(data.fieldString);
            }
            if (data.resultCode == 505) {
                DJMask.msg("请图片上传失败");
            }
            someAjaxDfd.resolve();
        },
        error: function () {
        }
    });

}



/*质量证书*/
 function qualitycertificateurlFileUpload(ajax1Dfd) {
    /*质量证书*/
     $.ajax({
         url: "/config/create-AllGasCylinderCheckInfoQualitycertificateurlFileUpload",
         type: "POST",
         dataType: 'json',
         processData: false,
         contentType: false,
         data: formDataA,
         /*async: false,*/
         success: function(data){
             if (data.resultCode == 200) {
                 $("#qualitycertificateurl").val(data.fieldString);
             }
             if(data.resultCode == 505){
                 DJMask.msg("请图片上传失败");
             }
             ajax1Dfd.resolve();
         },
         error: function () {
         }
     });


}


/* 使用说明书*/
function instructionmanualurlFileUpload(ajax3Dfd) {
    $.ajax({
        url: "/config/create-AllGasCylinderCheckInfoInstructionmanualurlUpload",
        type: "POST",
        dataType: 'json',
        processData: false,
        contentType: false,
        data: formDataB,
        /*async: false,*/
        success: function(data){
            if (data.resultCode == 200) {
                $("#instructionmanualurl").val(data.fieldString);
            }
            if(data.resultCode == 505){
                DJMask.msg("请图片上传失败");
            }
            ajax3Dfd.resolve();
        },
        error: function () {
        }
    });

}
/* 检验报告*/
function InspectereporturlUpload(ajax4Dfd) {
    /*===================================== */
    $.ajax({
        url: "/config/create-AllGasCylinderCheckInspectereporturlUpload",
        type: "POST",
        dataType: 'json',
        processData: false,
        contentType: false,
        data: formDataC,
       /* async: false,*/
        success: function(data){
            if (data.resultCode == 200) {
                $("#inspectereporturl").val(data.fieldString);
            }
            if(data.resultCode == 505){
                DJMask.msg("请图片上传失败");
            }
            ajax4Dfd.resolve();
        },
        error: function () {
        }
    });


}
/*  日常检验记录*/
function DailyinspectrecordurlUpload(ajax5Dfd) {

    $.ajax({
        url: "/config/create-AllGasCylinderCheckDailyinspectrecordurlUpload",
        type: "POST",
        dataType: 'json',
        processData: false,
        contentType: false,
        data: formDataD,
        /*async: false,*/
        success: function(data){
            if (data.resultCode == 200) {
                $("#dailyinspectrecordurl").val(data.fieldString);
            }
            if(data.resultCode == 505){
                DJMask.msg("请图片上传失败");
            }
            ajax5Dfd.resolve();
        },
        error: function () {
        }
    });

}




/*==================================上传图片(产品合格证url)=主页上传图片,更新数据库============================================================*/
function productqualifyurlUploadImage1(id, i) {
    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);
    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("productqualifyurlFile" + i + "").files;
    var f = document.getElementById("productqualifyurlFile" + i + "").value;
    if ((files.length-0) == 0) {
        DJMask.msg("请上传图片");
        return false;
    }else if( 5 < (files.length-0)  ){
        DJMask.msg("图片不能超过5张!");
        return false;
    } else {
        if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
            DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
            return false;
        }
    }

    DJMask.msg("请稍等正在处理!");
    $.ajaxFileUpload({
        url: "/config/add-GasCylinderCheckInfoProductqualifyurlUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
        /*data: {'id': id},*/
        fileElementId: 'productqualifyurlFile' + i,
        dataType: "json",
        success: function (data) {
            if (200 == data.resultCode) {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            } else {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                DJMask.msg(data.failDesc);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            }

        }
    });


}
/*==================================上传图片(质量证明书url)=主页上传图片,更新数据库============================================================*/
function qualitycertificateurlUploadImage1(id, i) {
    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);
    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("qualitycertificateurlFile" + i + "").files;
    var f = document.getElementById("qualitycertificateurlFile" + i + "").value;
    if ((files.length-0) == 0) {
        DJMask.msg("请上传图片");
        return false;
    }else if( 5 < (files.length-0)  ){
        DJMask.msg("图片不能超过5张!");
        return false;
    } else {
        if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
            DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
            return false;
        }
    }

    DJMask.msg("请稍等正在处理!");
    $.ajaxFileUpload({
        url: "/config/add-GasCylinderCheckInfoQualitycertificateurlUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
        /*data: {'id': id},*/
        fileElementId: 'qualitycertificateurlFile' + i,
        dataType: "json",
        success: function (data) {
            if (200 == data.resultCode) {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            } else {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                DJMask.msg(data.failDesc);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            }

        }
    });


}
/*==================================上传图片(质量说明书)=主页上传图片,更新数据库============================================================*/
function qualityspecifyurlUploadImage1(id, i) {
    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);
    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("qualityspecifyurlFile" + i + "").files;
    var f = document.getElementById("qualityspecifyurlFile" + i + "").value;
    if ((files.length-0) == 0) {
        DJMask.msg("请上传图片");
        return false;
    }else if( 5 < (files.length-0)  ){
        DJMask.msg("图片不能超过5张!");
        return false;
    } else {
        if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
            DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
            return false;
        }
    }

    DJMask.msg("请稍等正在处理!");
    $.ajaxFileUpload({
        url: "/config/add-GasCylinderCheckInfoQualityspecifyurlUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
        /*data: {'id': id},*/
        fileElementId: 'qualityspecifyurlFile' + i,
        dataType: "json",
        success: function (data) {
            if (200 == data.resultCode) {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            } else {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                DJMask.msg(data.failDesc);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            }

        }
    });


}
/*==================================上传图片(使用说明书url)=主页上传图片,更新数据库============================================================*/
function instructionmanualurlUploadImage1(id, i) {
    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);
    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("instructionmanualurlFile" + i + "").files;
    var f = document.getElementById("instructionmanualurlFile" + i + "").value;
    if ((files.length-0) == 0) {
        DJMask.msg("请上传图片");
        return false;
    }else if( 5 < (files.length-0)  ){
        DJMask.msg("图片不能超过5张!");
        return false;
    } else {
        if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
            DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
            return false;
        }
    }

    DJMask.msg("请稍等正在处理!");
    $.ajaxFileUpload({
        url: "/config/add-GasCylinderCheckInfoInstructionmanualurlUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
        /*data: {'id': id},*/
        fileElementId: 'instructionmanualurlFile' + i,
        dataType: "json",
        success: function (data) {
            if (200 == data.resultCode) {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            } else {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                DJMask.msg(data.failDesc);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            }

        }
    });


}

/*==================================================================================================================================================*/

/*==================================上传图片(检验报告)=主页上传图片,更新数据库============================================================*/



function inspectereporturlUploadImage1(id, i) {
    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);
    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("inspectereporturlFile" + i + "").files;
    var f = document.getElementById("inspectereporturlFile" + i + "").value;
        if ((files.length-0) == 0) {
            DJMask.msg("请上传图片");
            return false;
        }else if( 5 < (files.length-0)  ){
            DJMask.msg("图片不能超过5张!");
            return false;
        } else {
            if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
                DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                return false;
            }
        }

    DJMask.msg("请稍等正在处理!");
        $.ajaxFileUpload({
            url: "/config/add-GasCylinderCheckInfoInspectereporturlUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
            /*data: {'id': id},*/
            fileElementId: 'inspectereporturlFile' + i,
            dataType: "json",
            success: function (data) {
                if (200 == data.resultCode) {
                    setTimeout(function(){
                        DJMask.msg(data.failDesc);
                    },1500);
                    setTimeout(function(){
                        ajax1Dfd.resolve();
                    },3000);
                    its_promise.done(function(){
                        getAllpage();
                    });
                } else {
                    setTimeout(function(){
                        DJMask.msg(data.failDesc);
                    },1500);
                    DJMask.msg(data.failDesc);
                    setTimeout(function(){
                        ajax1Dfd.resolve();
                    },3000);
                    its_promise.done(function(){
                        getAllpage();
                    });
                }

            }
        });


}

/*==================================上传图片(日常检验记录)主页上传图片,更新数据库=============================================================*/
function dailyinspectrecordurlUploadImage1(id, i) {

    var ajax1Dfd = $.Deferred();
    var its_promise = $.when(ajax1Dfd);

    $("#gasCylinderCheckInfoId").val(id);
    var files = document.getElementById("dailyinspectrecordurlFile" + i + "").files;
    var f = document.getElementById("dailyinspectrecordurlFile" + i + "").value;
    if ((files.length-0) == 0) {
        DJMask.msg("请上传图片");
        return false;
    }else if(5 < (files.length-0) ){
        DJMask.msg("图片不能超过5张!");
        return false;
    } else {
        if (f != null && !/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f)) {
            DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
            return false;
        }
    }
    /*    var id = $("#id").val();*/
    DJMask.msg("请稍等正在处理!");

    $.ajaxFileUpload({
        url: "/config/add-GasCylinderCheckInfoDailyinspectrecordurlFileUpload1?gasCylinderCheckInfoId=" + id + "&ii=" + i,
        /*data: {'id': id},*/
        fileElementId: 'dailyinspectrecordurlFile' + i,
        dataType: "json",
        success: function (data) {
            if (200 == data.resultCode) {
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });

            } else {
                DJMask.msg(data.failDesc);
                setTimeout(function(){
                    DJMask.msg(data.failDesc);
                },1500);
                setTimeout(function(){
                    ajax1Dfd.resolve();
                },3000);
                its_promise.done(function(){
                    getAllpage();
                });
            }
            /*    $("#certificateURL5").attr("src", data);
                $("#dailyinspectrecordurl").val(data);*/
            /* var data2 = data.split("?");*/
     /*       $("#loading").toggle();*/
        }
    });
}





 直接把 formData 赋值个ajax的data,后台后根据key 名接收;

 

后台用 CommonsMultipartFile集合对应传过来的名字来接收数据;

图片增加删除页面与用户交互 js 操作:

assets/js/gm/air_parameter_add.js


/*=====================菜单定位=========================*/

$(".c-nav .ed").find("li").eq(1).addClass("cur")
$(".c-nav .ed").find("li").eq(1).find(".abx").eq(8).addClass("cur")


/*=================日期=============================*/
//日期常规用法
laydate.render({
    elem: '#testdate'
});



/*=============================气瓶id查询,查询气瓶位置编号======================================*/
/*function SelsceGasCylinderpositionnum() {
    /!*下拉选择气瓶编号时,从value获取气瓶id*!/
    var gasCylinderId = $("#num").val();
    $.ajax({
        type: 'post',
        dataType: "json",
        /!*contentType: "application/json; charset=utf-8",*!/
        url: "/config/showAdd-GasCylinderCheckInfoTwo",
        data: {"gasCylinderId": gasCylinderId},
        success: function (data) {
            if (data.resultCode == 200) {
                if (0 < data.list.length) {
                    $("#positionnum").val(data.list[0].positionnum);
                    $("#GasCylinderNum").val(data.list[0].num);

                } else {
                    DJMask.msg("无气瓶数据");
                }
            }
            if (data.resultCode == 505) {
                $("#messageValue").val(data.failDesc);
                $("#btn3").click();
            }
        }, error: function () {
            $("#messageValue").val("获取车牌异常!");
            $("#btn3").click();

        }
    });

}*/

/*=============================气瓶编号查询气瓶位置编号和车牌号======================================*/
$(function () {
    SelsceGasCylinderpositionnum1();
});
function SelsceGasCylinderpositionnum1() {
    //先清除所有
    $("#cph").val("");
    $("#positionnum").val("");
    $("#num").val("");
    $("#GasCylinderNum").val("");
    /*(产品合格证)*/
    $("#certificateURL1").attr("src", "");
    $("#productqualifyurl").val("");

    /*(质量说明书qualityspecifyurl)*/
    $("#certificateURL").attr("src", "");
    $("#manufacturingsupervisioninsurl").val("");
    /*(质量证明书)*/
    $("#certificateURL2").attr("src", "");
    $("#qualitycertificateurl").val("");
    /*(使用说明书)*/
    $("#certificateURL6").attr("src", "");
    $("#instructionmanualurl").val("");


    /*(检验报告)*/
    $("#certificateURL4").attr("src", "");
    $("#inspectereporturl").val("");
    /*(日常检验记录)*/
    $("#certificateURL5").attr("src", "");
    $("#dailyinspectrecordurl").val("");

    $("#gasCylinderCheckInfoId").val("");

    /*(产品合格证)*/
    $("#productqualifyurldurlHtml").html("");
    /*(质量证书)*/
    $("#qualitycertificateurlHtml").html("");
    /*(质量说明书)*/
    $("#manufacturingsupervisioninsurlHtml").html("");
    /*(使用说明书)*/
    $("#instructionmanualurlHtml").html("");
    /*(检验报告)*/
    $("#inspectereporturldurlHtml").html("");
    /*(日常检验记录)*/
    $("#dailyinspectrecordurlHtml").html("");


    var loadingX = $("#loadingX").val();

    var num = $("#num1").val();
    if (null == num || 0 == num.length) {
        DJMask.msg("请输入气瓶编号!");
        return;
    }

    $.ajax({
        type: 'post',
        dataType: "json",
        /*contentType: "application/json; charset=utf-8",*/
        url: "/config/SelsceGasCylinderpositionnum1",
        data: {"num": num},
        success: function (data) {
            if (data.resultCode == 200) {
                if (0 < data.list.length) {
                    $("#cph").val(data.list[0].vehicle.cph);
                    $("#positionnum").val(data.list[0].gasCylinder.positionnum);
                    $("#num").val(data.list[0].gasCylinder.id);
                    $("#GasCylinderNum").val(data.list[0].gasCylinder.num);

                    if (null != data.list[0].gasCylinderCheckInfo) {
                        /*原产品合格证*/
                        if (null != data.list[0].gasCylinderCheckInfo.productqualifyurl && 0 <  data.list[0].gasCylinderCheckInfo.productqualifyurl.length) {
                            $("#productqualifyurl").val(data.list[0].gasCylinderCheckInfo.productqualifyurl);
                        }
                        /*原质量证书*/
                            if (null != data.list[0].gasCylinderCheckInfo.qualitycertificateurl && 0 <  data.list[0].gasCylinderCheckInfo.qualitycertificateurl.length) {
                                $("#qualitycertificateurl").val(data.list[0].gasCylinderCheckInfo.qualitycertificateurl);
                            }
                        /*原质量说明书*/
                          /*  if (null != data.list[0].gasCylinderCheckInfo.qualityspecifyurl && 0 < data.list[0].gasCylinderCheckInfo.qualityspecifyurl.length) {
                                $("#manufacturingsupervisioninsurl").val(data.list[0].gasCylinderCheckInfo.qualityspecifyurl);

                            }*/

                        /*原使用说明书*/
                            if (null != data.list[0].gasCylinderCheckInfo.instructionmanualurl && 0 < data.list[0].gasCylinderCheckInfo.instructionmanualurl.length) {
                                $("#instructionmanualurl").val(data.list[0].gasCylinderCheckInfo.instructionmanualurl);
                            }

                    }
                    /*产品合格证*/
                        td1 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            " <p class=\"up-p\">产品合格证:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"productqualifyurlFile1\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";

                        /*(质量证明书)*/
                        td2 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            "<p class=\"up-p\">质量证书:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"qualitycertificateurlFile2\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";
                        /*(质量说明书)*/
                       /* td3 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            "<p class=\"up-p\">质量说明书:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"manufacturingSupervisIoninsurFile2\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";*/
                        /*(使用说明书)*/
                        td4 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            " <p class=\"up-p\">使用说明书:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"instructionmanualurlFile2\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";

                        /*(检验报告)*/
                        td5 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            "<p class=\"up-p\">检验报告:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"inspectereporturlFile2\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";

                        /*(日常检验记录)*/
                        td6 =
                            "<div class=\"img-box full\">" +
                            "<section class=\" img-section\">" +
                            "<p class=\"up-p\">日常检验记录:<span class=\"up-span\">最多可以上传5张图片</span></p>" +
                            "<div class=\"z_photo upimg-div clear\" >" +
                            "<section class=\"z_file fl\">" +
                            "<img src=\"/assets/upjs/img/a11.png\" class=\"add-img\">" +
                            "<input type=\"file\" name=\"file\" id=\"dailyinspectrecordurlFile2\" class=\"file\" value=\"\" accept=\"image/jpg,image/jpeg,image/png,image/bmp\" multiple />" +
                            "</section>" +
                            "</div>" +
                            "</section>" +
                            "</div>";

                        /*新增必须isfirsttest 写1*/
                        $("#isfirsttest").val(1);
                        /*产品合格证*/
                        $("#productqualifyurldurlHtml").html(td1);
                        /*质量证书*/
                        $("#qualitycertificateurlHtml").html(td2);
                        /*/!*质量说明书*!/
                        $("#manufacturingsupervisioninsurlHtml").html(td3);*/
                        /*使用说明书*/
                        $("#instructionmanualurlHtml").html(td4);
                        /*检验报告*/
                        $("#inspectereporturldurlHtml").html(td5);
                        /*日常检验记录*/
                        $("#dailyinspectrecordurlHtml").html(td6);


                 /*   }
*/

                } else {
                    DJMask.msg(data.failDesc);
                }
            }
            if (data.resultCode == 505) {
                DJMask.msg(data.failDesc);

            }
        }, error: function () {
            DJMask.msg(data.failDesc);


        }
    });

}

/*=============================添加======================================*/
function go() {
    $("#btn1").click();
}

/*================================================弹出框 =========================================================*/
$(function () {
    /* 添加提示框和js逻辑!*/
    $("#btn1").click(function () {
        var cph = $("#cph").val();
        /*这个num,是气瓶id*/
        var num = $("#num").val();
        /*检验日期*/
        var firsttestdate = $("#testdate").val();
        /*检验单位*/
        var firsttestunit = $("#testunit").val();
        /*检验结果*/
        var firsttestresult = $("#testresult").val();
        if ( 0 == firsttestdate.length
            ) {
            DJMask.msg("请输入检验日期!");
            return;
        }
        if (0 == firsttestunit.length
            ) {
            DJMask.msg("请输入检验单位!");
            return;
        }
        if ( 0 == firsttestresult.length) {
            DJMask.msg("请输入检验结果!");
            return;
        }
        /*================图片上传获得图片id=================*/
        /*===============先上传图片=========================*/


        var f1 = document.getElementById("productqualifyurlFile1").value;
        var f2 = document.getElementById("qualitycertificateurlFile2").value;
      /*  var f3 = document.getElementById("manufacturingSupervisIoninsurFile2").value;*/
        var f4 = document.getElementById("instructionmanualurlFile2").value;
        var f5 = document.getElementById("inspectereporturlFile2").value;
        var f6 = document.getElementById("dailyinspectrecordurlFile2").value;

        //判断图片是否已经上传

        /*=============ajax图片上传===========================*/
        var txt = "确定为车牌号: " + cph + " 添加定检信息?";
        var option = {
            title: "添加定检信息",
            btn: parseInt("0011", 2),
            onOk: function () {
                console.log("确认啦");
                DJMask.msg("正在处理请稍等!");
                DJMask.show();
                var someAjaxDfd = $.Deferred();
                var ajax1Dfd = $.Deferred();
                var ajax2Dfd = $.Deferred();
                var ajax3Dfd = $.Deferred();
                var ajax4Dfd = $.Deferred();
                var ajax5Dfd = $.Deferred();
                var ajaxtime = $.Deferred();
                // 返回这个延迟对象的Promise
                /*产品合格证*/
                var its_promise = $.when(someAjaxDfd);
                /*质量证书*/
                var its_promise1 = $.when(ajax1Dfd);
                /* 质量说明书*/
                var its_promise2 = $.when(ajax2Dfd);
                /* 使用说明书*/
                var its_promise3 = $.when(ajax3Dfd);
                /* 检验报告*/
                var its_promise4 = $.when(ajax4Dfd);
                /* 日常检验记录*/
                var its_promise5 = $.when(ajax5Dfd);

                /* 添加数据*/
                var its_promiseTime = $.when(ajaxtime);


                 /* 记录用户总共上传多少组图片*/
                var FF = 0;

                /* 记录ajax 上传完成了多少组图片*/
                var x = 0;
                /*======================新方法=================================*/

                if (null != f1 && f1 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f1)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /*产品合格证*/
                    ProductqualifyurlFileUpload(someAjaxDfd);

                    its_promise.done(function () {
                        x++;
                    });
                }
                if (null != f2 && f2 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f2)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /*质量证书*/
                    qualitycertificateurlFileUpload(ajax1Dfd);
                    its_promise1.done(function () {
                        x++;

                    });
                }
                /* 质量说明书*/
               /*if (null != f3 && f3 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f3)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /!* 质量说明书*!/
                    ManufacturingSupervisionInsurFileUpload(ajax2Dfd);
                    its_promise2.done(function () {
                        x++;

                    });
                }*/
                if (null != f4 && f4 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f4)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /* 使用说明书*/
                    instructionmanualurlFileUpload(ajax3Dfd);
                    its_promise3.done(function () {

                        x++;
                    });
                }
                if (null != f5 && f5 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f5)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /* 检验报告*/
                    InspectereporturlUpload(ajax4Dfd);
                    its_promise4.done(function () {

                        x++;
                    });
                }
                if (null != f6 && f6 != ""){
                    if ((!/\.(|jpg|jpeg|png|JPG|PNG)$/.test(f6)) ) {
                        DJMask.msg("图片类型必须是.jpeg,jpg,png中的一种");
                        return false;
                    }
                    FF++;
                    /*  日常检验记录*/
                    DailyinspectrecordurlUpload(ajax5Dfd);
                    its_promise5.done(function () {

                        x++;
                    });

                }

                var time = setInterval(function () {
                    if(FF == x){
                        ajaxtime.resolve();
                        clearTimeout(time);
                        console.log("时间停")
                    }
                    console.log("时间轮")
                },5000);

                        its_promiseTime.done(function () {
                            /*定检信息数据写入*/
                            createGasCylinderchkInfo(cph);
                       });
            }
        }

        window.wxc.xcConfirm(txt, "custom", option);
    });

    /* 添加气瓶定检信息*/
    function createGasCylinderchkInfo(cph) {
        var productqualifyurl = $("#productqualifyurl").val();
        var qualitycertificateurl = $("#qualitycertificateurl").val();
        var manufacturingsupervisioninsurl = $("#manufacturingsupervisioninsurl").val();
        var instructionmanualurl = $("#instructionmanualurl").val();
        var inspectereporturl = $("#inspectereporturl").val();
        var dailyinspectrecordurl = $("#dailyinspectrecordurl").val();
        var num = $("#num").val();
        var GasCylinderNum = $("#GasCylinderNum").val();
        var positionnum = $("#positionnum").val();
        var orderByClause = $("#orderByClause").val();
        var isfirsttest = $("#isfirsttest").val();
        var testdate = $("#testdate").val();
        var testunit = $("#testunit").val();
        var testresult = $("#testresult").val();

        console.log("确认啦");
        $.ajax({
            type: "POST",
            dataType: "json",
            async:false,
            url: "/config/add-GasCylinderCheckInfo",//url
            data: {
                "productqualifyurl": productqualifyurl,
                "qualitycertificateurl": qualitycertificateurl,
                "manufacturingsupervisioninsurl": manufacturingsupervisioninsurl,
                "instructionmanualurl": instructionmanualurl,
                "inspectereporturl": inspectereporturl,
                "dailyinspectrecordurl": dailyinspectrecordurl,
                "num": num,
                "cph": cph,
                "GasCylinderNum": GasCylinderNum,
                "positionnum": positionnum,
                "orderByClause": orderByClause,
                "isfirsttest": isfirsttest,
                "testdate": testdate,
                "testunit": testunit,
                "testresult": testresult
            },

            success: function (data) {
                DJMask.hide();
                console.log("ajax:" + data);
                if (data.resultCode == 200) {

                    $("#messageValue").val(data.failDesc);
                    $("#btn2").click();

                }
                if (data.resultCode == 505) {
                    $("#messageValue").val(data.failDesc);
                    $("#btn3").click();
                }
                ;
            },
            error: function () {

                $("#messageValue").val("系统异常操作不成功!\n");
                $("#btn3").click();
            }
        });

    }

    /* 成功提示*/
    $("#btn2").click(function () {
        var txt = $("#messageValue").val();
        var option = {
            title: "添加定检信息",
            btn: parseInt("0012", 2),
            onOk: function () {
                window.history.go(-1);
            }
        }
        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.success, option);
    });
    /* 错误提示!*/
    $("#btn3").click(function () {
        var txt = $("#messageValue").val();
        var option = {
            title: "添加定检信息",
            btn: parseInt("0012", 2),
            onOk: function () {
            }
        }
        window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error, option);
    });
});

触发图片上传操作的 click function:

关键点说明:

js中定义了两个变量 FF 与 X,分别记录用户总共上传多少组图片与记录ajax 上传完成了多少组图片,

通过setInterval每5秒轮询用户总共上传图片组数量与ajax上传完成了多少组图片数量, 若FF 的数量

与 X 的数量一致相等即表示图片上传完成,获得了图片储存URL,可执行下步数据写入操作;

定义变量 FF 与 X :

setInterval轮询对比两个变量的值,直到两变量值相等为止:

FF与X数值相等时通知下一步数据写人操作:

页面:

<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <link rel="icon" type="image/x-icon" href="/assets/i/favicon.ico"/>
    <link rel="stylesheet" href="/assets/newPageJs/css/reset.css">
    <link rel="stylesheet" href="/assets/newPageJs/css/style.css">

    <script src="/assets/newPageJs/js/jQuery.js"></script>
    <script type="text/javascript" src="/assets/showImg/js/popwin.js"></script>
</head>
<body>

<!--nave-->
<jsp:include page="../common/newMenu.jsp"></jsp:include>

<!--header-->
<jsp:include page="../common/newTop.jsp"></jsp:include>
<!--main-->
<div class="over-auto">
    <form class="am-form am-form-horizontal" action="##" method="post"
          id="stuForm">
        <input id="gasCylinderCheckInfoId" name="gasCylinderCheckInfoId"
               type="hidden" value="">
        <%--第一次添加为1,第二次添加为0--%>
        <input id="isfirsttest" name="isfirsttest" type="hidden" value="">
        <%--产品合格证--%>
        <input type="hidden" id="productqualifyurl" name="productqualifyurl"
               value="">
        <%--质量证书--%>
        <input type="hidden" id="qualitycertificateurl" name="productqualifyurl"
               value="">
        <%--质量说明书--%>
        <input type="hidden" id="manufacturingsupervisioninsurl"
               name="productqualifyurl" value="">
        <%--使用说明书--%>
        <input type="hidden" id="instructionmanualurl" name="productqualifyurl"
               value="">
        <%--检验报告--%>
        <input type="hidden" id="inspectereporturl" name="productqualifyurl"
               value="">
        <%--日常检验记录--%>
        <input type="hidden" id="dailyinspectrecordurl" name="productqualifyurl"
               value="">
        <input id="loadingX" name="loadingX" type="hidden"
               value="${pageContext.request.contextPath}/assets/img/loading.gif">
        <div class="m-main">
            <div class="f-cb">
                <div class="m-title">添加定检信息</div>
                <a href="javascript:history.go(-1);" class="return fr">返回</a>
                <a href="javascript:go()" type="button" class="modify fr"><img
                        src="/assets/newPageJs/img/a8.svg"
                        alt=""/>提交</a>
            </div>
            <div class="kk-box">
                <div class="box-one">


                    <div class="s-title">基础信息</div>
                    <table id="tabe">
                        <%-- ======--%>
                        <tr>
                            <td class="w320">
                                <div class="same-bx mar-fr">
                                    <%--获取的气瓶编号--%>
                                    <input name="GasCylinderNum"
                                           id="GasCylinderNum" type="hidden">
                                    <%--这里了的num存放气瓶id--%>
                                    <input name="num" id="num" type="hidden">
                                    <div class="te">气瓶编号</div>
                                    <input class="pt hover" name="num1"
                                           id="num1" value=""
                                           onblur="SelsceGasCylinderpositionnum1()"
                                           type="text"><span style="color:red;margin-left: 2px">*</span>
                                    <%--<select class="select hover" id="num" name="num"
                                            onchange="SelsceGasCylinderpositionnum();">

                                    </select> 按车牌号查询气瓶信息 --%>
                                </div>
                            </td>
                            <td>
                                <div class="same-bx mar-fr">
                                    <div class="te">气瓶位置编号</div>
                                    <input class="pt hover" name="positionnum"
                                           id="positionnum" value=""
                                           readonly="readonly" type="text">
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="same-bx mar-fr">
                                    <div class="te">车牌号</div>
                                    <%--<input class="pt hover" name="cph" id="cph" value="" onblur="SelectVehicleByCph()"
                                           type="text"> 按车牌号查询气瓶信息 --%>
                                    <input class="pt hover" name="cph" id="cph"
                                           value=""
                                           readonly="readonly" type="text">
                                </div>
                            </td>
                            <td>

                            </td>
                        </tr>

                        <%--================--%>
                    </table>
                </div>
                <div class="box-one">
                    <div class="s-title">检验信息</div>
                    <table>
                        <tr>
                            <td class="w320">
                                <div class="same-bx mar-fr">
                                    <div class="te">检验日期</div>
                                    <input type="text"
                                           class="layui-input pt hover day"
                                           name="testdate"
                                           id="testdate" value="" lay-key="1">
                                    <span style="color:red;margin-left: 2px">*</span>
                                </div>
                            </td>
                            <td>
                                <div class="same-bx mar-fr">
                                    <div class="te">检验单位</div>
                                    <input class="pt hover" name="testunit"
                                           id="testunit" type="text">
                                    <span style="color:red;margin-left: 2px">*</span>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <div class="same-bx mar-fr">
                                    <div class="te">检验结果</div>
                                    <select class="select1 hover"
                                            id="testresult" name="testresult">
                                        <option value="">请选择</option>
                                        <option value="合格">合格</option>
                                        <option value="不合格">不合格</option>
                                    </select>
                                    <span style="color:red;margin-left: 2px">*</span>
                                </div>
                            </td>
                            <td>

                            </td>
                        </tr>
                    </table>

                    <table>
                        <tr>
                            <%--产品合格证--%>
                            <%-- <td id="productqualifyurldurlHtml">--%>
                            <td id="productqualifyurldurlHtml">

                                <%--    <div class="img-box full">
                                        <section class=" img-section">
                                            <p class="up-p">产品合格证:<span class="up-span">最多可以上传5张图片</span></p>
                                            <div class="z_photo upimg-div clear" >
                                                <section class="z_file fl">
                                                    <img src="/assets/upjs/img/a11.png" class="add-img">
                                                    <input type="file" name="file" id="productqualifyurlFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                                </section>
                                            </div>
                                        </section>
                                    </div>--%>
                                <%--            <aside class="mask works-mask">
                                                <div class="mask-content">
                                                    <p class="del-p">您确定要删除作品图片吗?</p>
                                                    <p class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></p>
                                                </div>
                                            </aside>--%>

                            </td>
                            <%--<td id="qualitycertificateurlHtml">--%>
                            <td>

                            </td>
                        </tr>
                        <tr>
                            <%--质量证明书--%>
                            <td id="qualitycertificateurlHtml">
                                <%--<td id="manufacturingsupervisioninsurlHtml">--%>
                                <%--   <div class="img-box full">
                                          <section class=" img-section">
                                              <p class="up-p">质量证书:<span class="up-span">最多可以上传5张图片</span></p>
                                              <div class="z_photo upimg-div clear" >
                                                  <section class="z_file fl">
                                                      <img src="/assets/upjs/img/a11.png" class="add-img">
                                                      <input type="file" name="file" id="qualitycertificateurlFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                                  </section>
                                              </div>
                                          </section>
                                      </div>--%>
                            </td>
                            <td>
                                <%--<td id="instructionmanualurlHtml">--%>
                            </td>
                        </tr>
                        <tr>
                            <%--质量说明书--%>
                            <td id="manufacturingsupervisioninsurlHtml">
                                <%--  <div class="img-box full">
                                      <section class=" img-section">
                                          <p class="up-p">质量说明书:<span class="up-span">最多可以上传5张图片,马上上传</span></p>
                                          <div class="z_photo upimg-div clear" >
                                              <section class="z_file fl">
                                                  <img src="/assets/upjs/img/a11.png" class="add-img">
                                                  <input type="file" name="file" id="manufacturingSupervisIoninsurFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                              </section>
                                          </div>
                                      </section>
                                  </div>--%>
                            </td>
                            <td>

                            </td>
                        </tr>

                        <tr>
                            <%--使用说明书--%>
                            <td id="instructionmanualurlHtml">
                                <%--<td id="inspectereporturldurlHtml">--%>
                                <%--    <div class="img-box full">
                                        <section class=" img-section">
                                            <p class="up-p">使用说明书:<span class="up-span">最多可以上传5张图片,马上上传</span></p>
                                            <div class="z_photo upimg-div clear" >
                                                <section class="z_file fl">
                                                    <img src="/assets/upjs/img/a11.png" class="add-img">
                                                    <input type="file" name="file" id="instructionmanualurlFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                                </section>
                                            </div>
                                        </section>
                                    </div>--%>
                            </td>
                            <td>
                                <%-- <td id="dailyinspectrecordurlHtml">--%>

                            </td>
                        </tr>
                        <tr>
                            <%--检验报告--%>
                            <td id="inspectereporturldurlHtml">
                                <%--  <div class="img-box full">
                                      <section class=" img-section">
                                          <p class="up-p">检验报告:<span class="up-span">最多可以上传5张图片,马上上传</span></p>
                                          <div class="z_photo upimg-div clear" >
                                              <section class="z_file fl">
                                                  <img src="/assets/upjs/img/a11.png" class="add-img">
                                                  <input type="file" name="file" id="inspectereporturlFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                              </section>
                                          </div>
                                      </section>
                                  </div>--%>
                            </td>
                            <td>

                            </td>
                        </tr>
                        <tr>
                            <%--日常检验记录--%>
                            <td id="dailyinspectrecordurlHtml"><%--
                                <div class="img-box full">
                                    <section class=" img-section">
                                        <p class="up-p">日常检验记录:<span class="up-span">最多可以上传5张图片,马上上传</span></p>
                                        <div class="z_photo upimg-div clear" >
                                            <section class="z_file fl">
                                                <img src="/assets/upjs/img/a11.png" class="add-img">
                                                <input type="file" name="file" id="dailyinspectrecordurlFile1" class="file" value="" accept="image/jpg,image/jpeg,image/png,image/bmp" multiple />
                                            </section>
                                        </div>
                                    </section>
                                </div>--%>
                            </td>
                            <td>

                            </td>
                        </tr>

                        <tr>
                            <%--========这个没用但去掉会对图片上传样式造成影响=========--%>
                            <td class="w320">
                                <div class="same-bx mar-fr">
                                    <div class="te"></div>
                                    <input type="hidden" class="" name=""
                                           id="" value="" lay-key="1">
                                </div>
                            </td>
                            <td>

                            </td>
                        </tr>

                    </table>
                </div>
                <div class="box-one">

                </div>
            </div>

        </div>

    </form>
</div>
<%--====================================================遮罩========================================================--%>
<input type="hidden" id="messageValue" name="messageValue" value="">
<input type="hidden" id="createVehgroupId" name="createVehgroupId" value="">
<input type="hidden" id="value" name="value" value="">
<input type="hidden" id="id1" name="id1" value="">
<input type="hidden" id="vehId" name="vehId" value="">
<input type="hidden" id="num1" name="num1" value="">

<input class="sgBtn" id="btn4" type="hidden" value="弹窗4(自定义)">
<input class="sgBtn" id="btn5" type="hidden" value="弹窗5(自定义)">
<input class="sgBtn" id="btn7" type="hidden" value="弹窗7(自定义)">

<input class="sgBtn" id="btn1" type="hidden" value="弹窗1(自定义)">
<input class="sgBtn" id="btn2" type="hidden" value="弹窗2(自定义)">
<input class="sgBtn" id="btn3" type="hidden" value="弹窗3(自定义)">


<<%--script src="/assets/js/system/DJMask.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/css/xcConfirm.css"/>
<script src="/assets/js/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
<script src="/assets/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
    .sgBtn{width: 135px; height: 35px; line-height: 35px; margin-left: 10px; margin-top: 10px; text-align: center; background-color: #0095D9; color: #FFFFFF; float: left; border-radius: 5px;}
</style>
<link href="/assets/css/index.css" rel="stylesheet"/>
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>--%>
<script src="/assets/js/system/DJMask.js"></script>
<link rel="stylesheet" type="text/css" href="/assets/css/xcConfirm.css"/>
<script src="/assets/js/jquery-1.9.1.js" type="text/javascript"
        charset="utf-8"></script>
<script src="/assets/js/xcConfirm.js" type="text/javascript"
        charset="utf-8"></script>
<style type="text/css">
    .sgBtn {
        width: 135px;
        height: 35px;
        line-height: 35px;
        margin-left: 10px;
        margin-top: 10px;
        text-align: center;
        background-color: #0095D9;
        color: #FFFFFF;
        float: left;
        border-radius: 5px;
    }
</style>
<%--<link href="/assets/css/index.css" rel="stylesheet"/>--%>
<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="/assets/js/jquery-DJMask.2.1.1.js"
        charset="UTF-8"></script>

<script src="/assets/js/jquery.min.js"></script>
<script src="/assets/js/amazeui.min.js"></script>

<%--<script src="/assets/js/laydate/laydate.js"></script>--%>
<!-- 日期js改成你的路径 -->
<script src="${pageContext.request.contextPath}/assets/newPageJs/js/laydate/laydate.js"></script>
<%--<script src="/assets/js/app.js"></script>--%>

</body>

<script src="/assets/newPageJs/js/main.js"></script>
<script src="/assets/js/gm/air_parameter_add.js"></script>

<%--图片上传--%>
<link href="/assets/upjs/css/common.css" type="text/css" rel="stylesheet"/>
<link href="/assets/upjs/css/index.css" type="text/css" rel="stylesheet"/>
<%--<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>--%>
<%--<script src="/assets/upjs/js/imgUp.js"></script>--%>
<%--上传--%>
<script src="/assets/js/gm/add-GasCylinderCheckInfoAjaxfileupload.js"></script>
<script src="/assets/js/ajaxfileupload.js"></script>


</html>

单图片预览js:

assets/showImg/js/popwin.js


var popWin = {
    scrolling: 'no',
    //是否显示滚动条 no,yes,auto

int: function() {
        this.mouseClose();
        this.closeMask();
        //this.mouseDown();

    },

showWin: function(width, height, title, src) {
        var iframeHeight = height - 52;
        var marginLeft = width / 2;
        var marginTop = height / 2;
        var inntHtml = '';
        inntHtml += '<div id="mask" style="width:100%; height:100%; position:fixed; top:0; left:0; z-index:1999;background:#cccccc; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity:0.5;"></div>'
        inntHtml += '<div id="maskTop" style="width: ' + width + 'px; height: ' + height + 'px; border: #999999 1px solid; background: #fff; color: #333; position: fixed; top: 50%; left: 50%; margin-left: -' + marginLeft + 'px; margin-top: -' + marginTop + 'px; z-index: 2999; filter: progid:DXImageTransform.Microsoft.Shadow(color=#909090,direction=120,strength=4); -moz-box-shadow: 2px 2px 10px #909090; -webkit-box-shadow: 2px 2px 10px #909090; box-shadow: 2px 2px 10px #909090;">'
        inntHtml += '<div id="maskTitle" style="height: 50px; line-height: 50px; font-family: Microsoft Yahei; font-size: 20px; color: #333333; padding-left: 20px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAyCAYAAABlG0p9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABvSURBVEhL1cq5DcAwDENR7T+sL9lOOoUbkCoCwwKewOJbiGe+31BkwgeDM18YgrPhxuBs4CkS4cQQZMKFwd0R+gzFJaFjcD+EfXgoMuHA4O4Iew/FJWHD4BJhwxDoYcNTIKwY3NGwYggQFgxODEt8xO1/6P+HHxEAAAAASUVORK5CYII=); border-bottom: 1px solid #999999; position: relative;">'
        inntHtml += '' + title + ''
        inntHtml += '<div id="popWinClose" style="width: 28px; height: 28px; cursor: pointer; position: absolute; top: -12px; right: -9px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJeSURBVEhLvZbPq2lRFMf9B4bSTTIxZiBSMlCI9ycoKX+Bod7w/il3YIL4NyhFmYmBKD2Sp0ix3vqes/e529n74t33Op9astevr3PO2tvxvcLtdquzfbAtyAV8IlYX6d+DG7yxvbP9Fr2fglxR8ybavAYX/GD7Jfr8NahFD9HuMZz4U9Q5jEYjqlarFA6HiVPuDD7EkOMGvTjna9xi8/mcstmsJvKVIRc1Kl+K4haIHItut0t+v9/Y+JGhBrUq6M2xT9iBAXGeGQrY/U+miqI3NNhvw4t3EbNuyXeuzG3ood5eaLDfhhfO6JueWbPZtGKFQkGLNRoN2u/3FI/HtRh6SaDBPkusLnzWpMlkaRC7XC5WfLVaUTqddmKVSoVOp5MVG4/HlEql7mph6vRCC4IfYm2Nt7vAzW63o2KxSLVaja7Xq/DatFotrR49JdCCoHNcmfZZPp+n9XotMmxwVVwnVjbD4ZAikYhWj54SaN1dgjtZWiaToe12K7J0JpOJUUyaykuCsFwuR8fjUWR+slgsKBAIGGukqbwsiGdmElwul5RIJIw10lReEsQ0ns9nkaVzOBys226qhak8HRrsM7ktJLPZjDabjVjZYLBKpZJWrw0NfzzcFvj1KtPp1HpmsVjM2iIq/X5fqzdti4cbHycINjUYDAYUCoWcGA4BHAag1+tRMBi8q4VpGx/wl4dHWzKZpHa7TdFoVIuVy2XqdDrGSTUebYAXnh/e3v49AXZ49wcs4YB3rxgStyjApGG8TfsUPsTUaZQ8FZPgFrB585oo4QLvXoTdcIP/9Krv8/0BDUSOirKWU6wAAAAASUVORK5CYII=);"></div>'
        inntHtml += '</div>'
    for(var i = 0; i < src.length; i++){
            if(src[i] != ""){
                /*inntHtml +=  "<img src=\"" + src[i] + "\" onclick=\"lookProductqualifyurl('"+src[i]+"');\" class=\"add-img\" style=\"list-style:none;margin:8.5px;width: 420px;height: 400px; \">";*/
                inntHtml +=  "<img src=\"" + src[i] + "\" onclick=\"showImgD('"+src[i]+"');\" class=\"add-img\" style=\"list-style:none;margin:8.5px;width: 300px;height: 250px; \">";
            }

    }

    /*inntHtml += '<iframe width="' + width + '" height="' + iframeHeight + '" frameborder="0" scrolling="' + this.scrolling + '" src="' + url + '"></iframe>';*/

        $("body").append(inntHtml);
        this.int();


    },

mouseClose: function() {
        $("#popWinClose").on('mouseenter', 
        function() {
            $(this).css("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJwSURBVEhLvZbLSiNBFIb7DVyKiIgb17oQRRAXgor6CIIIeQKXMksfxYUbFbMZRh0Yb6ODMgEddCVmoWkRLzFekukxfay/+lRbqSqTVob+4CyqzuVPV59TaS8JYRhmhM0Ly5MB9tiX4fDPIQq0CpsT9sC1G4JYzmnlMskQCRPCrrnOh0EuanC5+ojAL5wXc5/LUW5qitba2ynreTWGPfgQY4JaXNaNKfZ0dkY7g4OWyHuGWOTovCuKI+AYib+8TF+bmpyF6xlykKuD2iwTITbQIPE7Q4Kr2EdMF0VtaLCcFJxjnzySzzyZaaihHy80WE4Kxq3vemcns7PStzsyYvn+zMxQUCzSRne35UMtBTSUWIb3ZKeZSRCrBoH0lwsF2u7vj32/JyepWi5L3/3hIW319dXkwvTuhRYE53kt29tMMAlub2lvdJRy09MUVqu8G3GxsGDlo6YCWhCMryvXnO0OD1PF9zkiQj5VGPIqonhwQOsdHVY+aiqgVfMIZrCy7YEBCm5uOMqmdHTkFFOmk0gQ9nNoiF4eHznyjed8nr41NztzlOkkFsQ7cwmWz89ps6fHmaNMJ5Gg7MZKhaNs/pVK8thduTCdhk2DOVNjoXg6PaW/V1e8ikBj7Y2NWflW06BVee0cC/x6nYfjY/nOfnR1yRHRucxmrXzXWNQdfNwgGGpwt79Pa21tsQ+XAC4D4K+s0GpLS00uzBp8vm3qXm1bvb1UWFyk752dlu/X+Dj5S0vOTnVebUAsUr+80/17AmIjvT9ghXCk94mhMEUBOg3t7ZpT7MGnd6OioZgCRyAsnc9EhUhI70PYRBT4T5/6nvcKYG1hElXAZggAAAAASUVORK5CYII=)");

        });

        $("#popWinClose").on('mouseleave', 
        function() {
            $(this).css("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJeSURBVEhLvZbPq2lRFMf9B4bSTTIxZiBSMlCI9ycoKX+Bod7w/il3YIL4NyhFmYmBKD2Sp0ix3vqes/e529n74t33Op9astevr3PO2tvxvcLtdquzfbAtyAV8IlYX6d+DG7yxvbP9Fr2fglxR8ybavAYX/GD7Jfr8NahFD9HuMZz4U9Q5jEYjqlarFA6HiVPuDD7EkOMGvTjna9xi8/mcstmsJvKVIRc1Kl+K4haIHItut0t+v9/Y+JGhBrUq6M2xT9iBAXGeGQrY/U+miqI3NNhvw4t3EbNuyXeuzG3ood5eaLDfhhfO6JueWbPZtGKFQkGLNRoN2u/3FI/HtRh6SaDBPkusLnzWpMlkaRC7XC5WfLVaUTqddmKVSoVOp5MVG4/HlEql7mph6vRCC4IfYm2Nt7vAzW63o2KxSLVaja7Xq/DatFotrR49JdCCoHNcmfZZPp+n9XotMmxwVVwnVjbD4ZAikYhWj54SaN1dgjtZWiaToe12K7J0JpOJUUyaykuCsFwuR8fjUWR+slgsKBAIGGukqbwsiGdmElwul5RIJIw10lReEsQ0ns9nkaVzOBys226qhak8HRrsM7ktJLPZjDabjVjZYLBKpZJWrw0NfzzcFvj1KtPp1HpmsVjM2iIq/X5fqzdti4cbHycINjUYDAYUCoWcGA4BHAag1+tRMBi8q4VpGx/wl4dHWzKZpHa7TdFoVIuVy2XqdDrGSTUebYAXnh/e3v49AXZ49wcs4YB3rxgStyjApGG8TfsUPsTUaZQ8FZPgFrB585oo4QLvXoTdcIP/9Krv8/0BDUSOirKWU6wAAAAASUVORK5CYII=)");

        });

    },

closeMask: function() {
        $("#popWinClose").on('click', 
        function() {
            $("#mask,#maskTop").fadeOut(function() {
                $(this).remove();

            });

        });

    }

/*mouseDown : function(){
		var dragging = false;
		var iX, iY;
		//var elmen = $("div#maskTop");
		$("#maskTop").on('mousedown' , function(e){
			dragging = true;
                iX = e.clientX - this.offsetLeft;
                iY = e.clientY - this.offsetTop;
                this.setCapture && this.setCapture();
                return false;
		});
		document.onmousemove = function(e) {
                if (dragging) {
                var e = e || window.event;
                var oX = e.clientX - iX;
                var oY = e.clientY - iY;
                $("#maskTop").css({"left":oX + "px", "top":oY + "px"});
                return false;
                }
            };
            $(document).mouseup(function(e) {
                dragging = false;
                $("#maskTop")[0].releaseCapture();
                e.cancelBubble = true;
            })
	},*/

};

/*单图片查看*/
var popWinD = {
    scrolling: 'no',
    //是否显示滚动条 no,yes,auto

    int: function() {
        this.mouseClose();
        this.closeMask();
        //this.mouseDown();

    },

    showWin: function(width, height, title, src) {
        var iframeHeight = height - 52;
        var marginLeft = width / 2;
        var marginTop = height / 2;
        var inntHtml = '';

        inntHtml += '<div id="mask1" style="width:100%; height:100%; position:fixed; top:0; left:0; z-index:3500;background:#cccccc; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity:0.5;"></div>'
        inntHtml += '<div id="maskTop1" style="width: ' + width + 'px; height: ' + height + 'px; border: #999999 1px solid; background: #fff; color: #333; position: fixed; top: 50%; left: 50%; margin-left: -' + marginLeft + 'px; margin-top: -' + marginTop + 'px; z-index: 3600; filter: progid:DXImageTransform.Microsoft.Shadow(color=#909090,direction=120,strength=4); -moz-box-shadow: 2px 2px 10px #909090; -webkit-box-shadow: 2px 2px 10px #909090; box-shadow: 2px 2px 10px #909090;">'
        inntHtml += '<div id="maskTitle1" style="height: 50px; line-height: 50px; font-family: Microsoft Yahei; font-size: 20px; color: #333333; padding-left: 20px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAyCAYAAABlG0p9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABvSURBVEhL1cq5DcAwDENR7T+sL9lOOoUbkCoCwwKewOJbiGe+31BkwgeDM18YgrPhxuBs4CkS4cQQZMKFwd0R+gzFJaFjcD+EfXgoMuHA4O4Iew/FJWHD4BJhwxDoYcNTIKwY3NGwYggQFgxODEt8xO1/6P+HHxEAAAAASUVORK5CYII=); border-bottom: 1px solid #999999; position: relative;">'
        inntHtml += '' + title + ''
        inntHtml += '<div id="popWinClose1" style="width: 28px; height: 28px; cursor: pointer; position: absolute; top: -12px; right: -9px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJeSURBVEhLvZbPq2lRFMf9B4bSTTIxZiBSMlCI9ycoKX+Bod7w/il3YIL4NyhFmYmBKD2Sp0ix3vqes/e529n74t33Op9astevr3PO2tvxvcLtdquzfbAtyAV8IlYX6d+DG7yxvbP9Fr2fglxR8ybavAYX/GD7Jfr8NahFD9HuMZz4U9Q5jEYjqlarFA6HiVPuDD7EkOMGvTjna9xi8/mcstmsJvKVIRc1Kl+K4haIHItut0t+v9/Y+JGhBrUq6M2xT9iBAXGeGQrY/U+miqI3NNhvw4t3EbNuyXeuzG3ood5eaLDfhhfO6JueWbPZtGKFQkGLNRoN2u/3FI/HtRh6SaDBPkusLnzWpMlkaRC7XC5WfLVaUTqddmKVSoVOp5MVG4/HlEql7mph6vRCC4IfYm2Nt7vAzW63o2KxSLVaja7Xq/DatFotrR49JdCCoHNcmfZZPp+n9XotMmxwVVwnVjbD4ZAikYhWj54SaN1dgjtZWiaToe12K7J0JpOJUUyaykuCsFwuR8fjUWR+slgsKBAIGGukqbwsiGdmElwul5RIJIw10lReEsQ0ns9nkaVzOBys226qhak8HRrsM7ktJLPZjDabjVjZYLBKpZJWrw0NfzzcFvj1KtPp1HpmsVjM2iIq/X5fqzdti4cbHycINjUYDAYUCoWcGA4BHAag1+tRMBi8q4VpGx/wl4dHWzKZpHa7TdFoVIuVy2XqdDrGSTUebYAXnh/e3v49AXZ49wcs4YB3rxgStyjApGG8TfsUPsTUaZQ8FZPgFrB585oo4QLvXoTdcIP/9Krv8/0BDUSOirKWU6wAAAAASUVORK5CYII=);"></div>'
        inntHtml += '</div>'
        /*inntHtml +=' <div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">'
        inntHtml +=' <div id="innerdiv" style="position:absolute;">'*/

            if(src != ""){
                inntHtml +=  "<img src=\"" + src + "\"  class=\"add-img\" style=\"list-style:none;margin:8.5px;width: 580px;height: 524px; \">";
            }
        /*inntHtml += '</div>'
        inntHtml += '</div>'*/
        /*inntHtml += '<iframe width="' + width + '" height="' + iframeHeight + '" frameborder="0" scrolling="' + this.scrolling + '" src="' + src[i] + '"></iframe>';*/

        $("body").append(inntHtml);
        this.int();


    },

    mouseClose: function() {
        $("#popWinClose1").on('mouseenter',
            function() {
                $(this).css("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJwSURBVEhLvZbLSiNBFIb7DVyKiIgb17oQRRAXgor6CIIIeQKXMksfxYUbFbMZRh0Yb6ODMgEddCVmoWkRLzFekukxfay/+lRbqSqTVob+4CyqzuVPV59TaS8JYRhmhM0Ly5MB9tiX4fDPIQq0CpsT9sC1G4JYzmnlMskQCRPCrrnOh0EuanC5+ojAL5wXc5/LUW5qitba2ynreTWGPfgQY4JaXNaNKfZ0dkY7g4OWyHuGWOTovCuKI+AYib+8TF+bmpyF6xlykKuD2iwTITbQIPE7Q4Kr2EdMF0VtaLCcFJxjnzySzzyZaaihHy80WE4Kxq3vemcns7PStzsyYvn+zMxQUCzSRne35UMtBTSUWIb3ZKeZSRCrBoH0lwsF2u7vj32/JyepWi5L3/3hIW319dXkwvTuhRYE53kt29tMMAlub2lvdJRy09MUVqu8G3GxsGDlo6YCWhCMryvXnO0OD1PF9zkiQj5VGPIqonhwQOsdHVY+aiqgVfMIZrCy7YEBCm5uOMqmdHTkFFOmk0gQ9nNoiF4eHznyjed8nr41NztzlOkkFsQ7cwmWz89ps6fHmaNMJ5Gg7MZKhaNs/pVK8thduTCdhk2DOVNjoXg6PaW/V1e8ikBj7Y2NWflW06BVee0cC/x6nYfjY/nOfnR1yRHRucxmrXzXWNQdfNwgGGpwt79Pa21tsQ+XAC4D4K+s0GpLS00uzBp8vm3qXm1bvb1UWFyk752dlu/X+Dj5S0vOTnVebUAsUr+80/17AmIjvT9ghXCk94mhMEUBOg3t7ZpT7MGnd6OioZgCRyAsnc9EhUhI70PYRBT4T5/6nvcKYG1hElXAZggAAAAASUVORK5CYII=)");

            });

        $("#popWinClose1").on('mouseleave',
            function() {
                $(this).css("background-image", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJeSURBVEhLvZbPq2lRFMf9B4bSTTIxZiBSMlCI9ycoKX+Bod7w/il3YIL4NyhFmYmBKD2Sp0ix3vqes/e529n74t33Op9astevr3PO2tvxvcLtdquzfbAtyAV8IlYX6d+DG7yxvbP9Fr2fglxR8ybavAYX/GD7Jfr8NahFD9HuMZz4U9Q5jEYjqlarFA6HiVPuDD7EkOMGvTjna9xi8/mcstmsJvKVIRc1Kl+K4haIHItut0t+v9/Y+JGhBrUq6M2xT9iBAXGeGQrY/U+miqI3NNhvw4t3EbNuyXeuzG3ood5eaLDfhhfO6JueWbPZtGKFQkGLNRoN2u/3FI/HtRh6SaDBPkusLnzWpMlkaRC7XC5WfLVaUTqddmKVSoVOp5MVG4/HlEql7mph6vRCC4IfYm2Nt7vAzW63o2KxSLVaja7Xq/DatFotrR49JdCCoHNcmfZZPp+n9XotMmxwVVwnVjbD4ZAikYhWj54SaN1dgjtZWiaToe12K7J0JpOJUUyaykuCsFwuR8fjUWR+slgsKBAIGGukqbwsiGdmElwul5RIJIw10lReEsQ0ns9nkaVzOBys226qhak8HRrsM7ktJLPZjDabjVjZYLBKpZJWrw0NfzzcFvj1KtPp1HpmsVjM2iIq/X5fqzdti4cbHycINjUYDAYUCoWcGA4BHAag1+tRMBi8q4VpGx/wl4dHWzKZpHa7TdFoVIuVy2XqdDrGSTUebYAXnh/e3v49AXZ49wcs4YB3rxgStyjApGG8TfsUPsTUaZQ8FZPgFrB585oo4QLvXoTdcIP/9Krv8/0BDUSOirKWU6wAAAAASUVORK5CYII=)");

            });

    },

    closeMask: function() {
        $("#popWinClose1").on('click',
            function() {
                $("#mask1,#maskTop1").fadeOut(function() {
                    $(this).remove();

                });

            });

    }

    /*mouseDown : function(){
            var dragging = false;
            var iX, iY;
            //var elmen = $("div#maskTop");
            $("#maskTop").on('mousedown' , function(e){
                dragging = true;
                    iX = e.clientX - this.offsetLeft;
                    iY = e.clientY - this.offsetTop;
                    this.setCapture && this.setCapture();
                    return false;
            });
            document.onmousemove = function(e) {
                    if (dragging) {
                    var e = e || window.event;
                    var oX = e.clientX - iX;
                    var oY = e.clientY - iY;
                    $("#maskTop").css({"left":oX + "px", "top":oY + "px"});
                    return false;
                    }
                };
                $(document).mouseup(function(e) {
                    dragging = false;
                    $("#maskTop")[0].releaseCapture();
                    e.cancelBubble = true;
                })
        },*/

};

 

DJMask弹出提示框js:
assets/js/jquery-DJMask.2.1.1.js

/**DJMask.js
 * author:Mo
 * updateTime:2016/12/17
 * */
DJMask={
			common:{//公共配置
				windowW:$(window).width(),//浏览器窗口宽度
				windowH:$(window).height(),//浏览器窗口高度	
				closeCssAnimate:function(){//关闭X的动画效果
					$("[class*=-close]").css({
							"transition":"all 0.4s ease-in-out",
							"-webkit-transition":"all 0.4s ease-in-out",
							"-ms-transition":"all 0.4s ease-in-out"
					}).hover(function(){
						$(this).css({
							"color":"#ff0000",
							"transform":"rotate(360deg)",
							"-webkit-transform":"rotate(360deg)",
							"-ms-transform":"rotate(360deg)"
						});
					},function(){
						$(this).css({
							"color":"#666",
							"transform":"rotate(0deg)",
							"-webkit-transform":"rotate(0deg)",
							"-ms-transform":"rotate(0deg)"
						});
					})
				}
			},
			maskBackgroundCss:function(){
				var css={//遮罩的黑色透明背景样式
						"background":"#000000",						
						"opacity":"0.5",
						"-moz-opacity":"0.5",
						"-webkit-opacity":"0.5",
						"filter":"alpha(opacity=50)",
						"width":"100%",
						"height":document.body.scrollHeight,//文档的高度
						"position": "absolute",
						"top": "0px",
						"left": "0px",
						"z-index": "100",
						"display":"none"
					};
				return css;
			},
			init:function(){//初始化				
								var maskHtml='<div id="dj-mask"></div>';								
								$(maskHtml).appendTo("body");
								djMaskDomLoaded=$("#dj-mask");
								djMaskDomLoaded.css(this.maskBackgroundCss());
				},
			show:function(){//展示遮罩
				this.init();
				djMaskDomLoaded.show();
			},
			hide:function(){//关闭遮罩
				djMaskDomLoaded.remove();
			},	
			loadingCss:function(){
				this.show();
				var loadingBoxCenterCss={
					"position":"absolute",
					"left":"50%",
					"top":"50%",
					"height":"20px",
					"width":"100px",
					"margin-top":"-10px",
					"margin-left":"-50px",
					"z-index":"999999999"
				};
				var objectClass={
					"width":"20px",
					"height":"20px",
					"background-color":"#FFF",
					"-moz-border-radius":"50% 50% 50% 50%",
					"-webkit-border-radius":"50% 50% 50% 50%",
					"border-radius":"50% 50% 50% 50%",
					"margin-right":"20px",
					"margin-bottom":"20px",
					"position":"absolute"
				};
				var objectOneCss={
					"-webkit-animation":"object 2s linear infinite",
					"-ms-animation":"object 2s linear infinite",
		 			"animation":"object 2s linear infinite"
				};
				var objectTwoCss={
					"-webkit-animation": "object 2s linear infinite -.4s",
					"-ms-animation":"object 2s linear infinite -.4s",
					"animation":"object 2s linear infinite -.4s"
				};
				var objectThreeCss={
					"-webkit-animation": "object 2s linear infinite -.8s",
					"-ms-animation": "object 2s linear infinite -.8s",
					"animation": "object 2s linear infinite -.8s"
				};
				var objectFourCss={
					"-webkit-animation": "object 2s linear infinite -1.2s",
					"-ms-animation": "object 2s linear infinite -1.2s",
					"animation": "object 2s linear infinite -1.2s",
				};
				var objectFiveCss={
					"-webkit-animation": "object 2s linear infinite -1.6s",
					"-ms-animation": "object 2s linear infinite -1.6s",
					"animation":"object 2s linear infinite -1.6s"
				};
				var keyframesObj='0% { left: 100px; top:0}'+
							  	 '80% { left: 0; top:0;}'+
							  	 '85% { left: 0; top: -20px; width: 20px; height: 20px;}'+
							  	 '90% { width: 40px; height: 15px; }'+
							  	 '95% { left: 100px; top: -20px; width: 20px; height: 20px;}'+
							  	 '100% { left: 100px; top:0; }';
				document.styleSheets.item(0).insertRule('@-webkit-keyframes object{0% { left: 100px; top:0}80% { left: 0; top:0;}85% { left: 0; top: -20px; width: 20px; height: 20px;}90% { width: 40px; height: 15px; }95% { left: 100px; top: -20px; width: 20px; height: 20px;}100% { left: 100px; top:0; }}',0); 
				document.styleSheets.item(0).insertRule('@keyframes object{0% { left: 100px; top:0}80% { left: 0; top:0;}85% { left: 0; top: -20px; width: 20px; height: 20px;}90% { width: 40px; height: 15px; }95% { left: 100px; top: -20px; width: 20px; height: 20px;}100% { left: 100px; top:0; }	}',0); 
				var html='<div id="dj-mask-loadingBoxCenter">'+
						 '<div class="object" id="objectOne"></div>'+
						 '<div class="object" id="objectTwo" style="left:20px;"></div>'+
						 '<div class="object" id="objectThree" style="left:40px;"></div>'+
						 '<div class="object" id="objectFour" style="left:60px;"></div>'+
						 '<div class="object" id="objectFive" style="left:80px;"></div>'
						 '</div>';
				$(html).css(loadingBoxCenterCss).appendTo("body").children(".object").css(objectClass);
				$("#objectOne").css(objectOneCss);
				$("#objectTwo").css(objectTwoCss);
				$("#objectThree").css(objectThreeCss);
				$("#objectFour").css(objectFourCss);
				$("#objectFive").css(objectFiveCss);
			},
			loading:function(option){//加载中...
				if(option=="close"){
					this.hide();
					$("#dj-mask-loadingBoxCenter").remove();
				}
				else{										
					this.loadingCss();
				}
			},
			closeAll:function(){				
					$("[class^=dj-mask-]").remove();
					$("[id^=dj-mask]").remove();			
			},
			msg:function(message){//消息提示
				if(message==undefined||message=="") return false;
				var msgDom='<div class="dj-msg-number-'+Math.floor(Math.random()*1000000)+'"></div>';					
				$(msgDom).css({
					"overflow":"hidden",
					"background":"rgba(0,0,0,.5)",
					"border-radius":"4px",
					"position": "fixed",
					"top":$(window).height()/2.5+"px",
					"left":$(window).width()/2+"px",	
					"padding":"15px",
					"color":"#fff",
					"z-index":"999999",
					"display":"none",
					"max-width":"200px",
					"word-break":"break-all"
				}).appendTo("body").html(message);
				var msgDomLoaded=$("."+$(msgDom).attr("class"));//获取设置样式后的msg元素
				msgDomLoaded.css({//消息居中
					"margin-left":"-"+msgDomLoaded.width()/2+"px",
					"margin-top":"-"+msgDomLoaded.height()/2+"px",
				}).fadeIn();
				setTimeout(function(){
					$("."+$(msgDom).attr("class")).remove();
				},1500);
			},
			alertMask:function(){//弹框遮罩
				var alertMaskHtml='<div id="dj-mask-alert"></div>';								
				$(alertMaskHtml).appendTo("body");
				alertMaskDomLoaded=$("#dj-mask-alert");
				alertMaskDomLoaded.css($.extend(this.maskBackgroundCss(),{"z-index":"200"}));
			},
			alert:function(message,callback){//弹框提醒				
				if(message==""||message==undefined) return false;
				this.alertMask();
				alertMaskDomLoaded.show(); 
				var alertDom='<div class="dj-mask-alert-'+Math.floor(Math.random()*1000000)+'"></div>';
				$(alertDom).css({
					"width":"200px",
					"overflow":"hidden",
					"border":"1px solid #ddd",					
					"z-index":"300",
					"background":"#fff",
					"border-radius":"4px",
					"position": "fixed",
					"top":$(window).height()/2.5+"px",
					"left":$(window).width()/2+"px",	
				}).appendTo("body");
				var alertDomLoaded=$("."+$(alertDom).attr("class"));
				alertDomLoaded.css({
					"margin-left":"-"+alertDomLoaded.width()/2+"px",
					"margin-top":"-"+alertDomLoaded.height()/2+"px",
				})
				.append('<div style="height:30px;border-bottom:1px solid #ddd;line-height:30px;padding-left:10px;font-size:14px;color:#666;background:#ebebeb">提示<a style="float:right;margin-right:10px;cursor:pointer;color:#666;font-size:15px;" class="dj-alert-close">X</a></div>')
				.append('<div style="font-size:13px;color:#333;padding:10px;overflow:hidden;word-break:break-all" class="dj-alert-content"></div>')
				.append('<a style="display:block;width:50px;height:25px;line-height:25px;text-align:center;border-radius:4px;background:#428bca;color:#fff;cursor:pointer;float:right;margin:5px;padding:0" class="dj-alert-ok">确定</a>');
				this.common.closeCssAnimate();
				$(".dj-alert-content").html(message);
				$(".dj-alert-close").click(function(){//关闭窗口
					alertDomLoaded.remove();
					alertMaskDomLoaded.remove();
				});
				$(".dj-alert-ok").click(function(){
					if(callback)  callback();//有回调函数执行函数内容
					alertDomLoaded.remove();
					alertMaskDomLoaded.remove();
				});
			},
			openMask:function(){//自定义弹窗遮罩				
				var openMaskHtml='<div id="dj-mask-open"></div>';								
				$(openMaskHtml).appendTo("body");
				openMaskDomLoaded=$("#dj-mask-open");
				openMaskDomLoaded.css($.extend(this.maskBackgroundCss(),{"z-index":"150"}));
			},
			open:function(options,callback){//自定义弹窗内容
				var config={
					width:"400px",
					height:"300px",
					title:"提示",
					content:"<div>loading.......</div>"
				},
				me=$.extend(config, options);
				this.openMask();
				openMaskDomLoaded.show();
				var contentDom='<div class="dj-mask-content-'+Math.floor(Math.random()*1000000)+'"></div>';
				$(contentDom).css({
					"width":me.width,
					"height":me.height,
					"overflow":"hidden",
					"border":"1px solid #ddd",					
					"z-index":"150",
					"background":"#fff",
					"border-radius":"4px",
					"position": "fixed",
					"top":$(window).height()/2.5+"px",
					"left":$(window).width()/2+"px",		
				}).appendTo("body");
				var contentDomLoaded=$("."+$(contentDom).attr("class"));
				contentDomLoaded.css({
					"margin-left":"-"+contentDomLoaded.width()/2+"px",
					"margin-top":"-"+contentDomLoaded.height()/2+"px",
				})
				.append('<div style="height:30px;border-bottom:1px solid #ddd;line-height:30px;padding-left:10px;font-size:14px;color:#666;background:#ebebeb">'+me.title+'<a style="float:right;margin-right:10px;cursor:pointer;color:#666;font-size:15px;" class="dj-content-close">X</a></div>')
				.append('<div style="font-size:13px;color:#333;padding:10px;overflow:hidden;word-break:break-all" class="dj-content-content"></div>');
				this.common.closeCssAnimate();
				$(".dj-content-content").html(me.content);
				$(".dj-content-close").click(function(){//关闭窗口
					if(callback) callback();//有回调函数执行函数内容
					contentDomLoaded.remove();
					openMaskDomLoaded.remove();					
				});
			},
			doAjaxMthod:(function(){//定义完立即执行	,ajax遮罩添加	
					var mss = {};
					var ajaxStart_default = mss.ajaxStart_default = function() {						
						DJMask.loading();
					};
					var ajaxStop_default = mss.ajaxStop_default = function() {
						DJMask.loading("close");
					};
					$(document).ajaxStart(ajaxStart_default); // 默认的ajax执行前处理
					$(document).ajaxStop(ajaxStop_default); // 默认的ajax执行完毕处理
			}())
		};

确认弹出框:

<link rel="stylesheet" type="text/css" href="/assets/css/xcConfirm.css"/>

/*垂直居中*/
.verticalAlign{ vertical-align:middle; display:inline-block; height:100%; margin-left:-1px;}

.xcConfirm .xc_layer{position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #666666; opacity: 0.5; z-index: 2147000000;}
.xcConfirm .popBox{position: fixed; left: 50%; top: 50%; background-color: #ffffff; z-index: 2147000001; width: 500px; height: 250px; margin-left: -285px; margin-top: -150px; border-radius: 5px; font-weight: bold; color: #535e66;}
.xcConfirm .popBox .ttBox{height: 20px; line-height: 30px; padding: 14px 30px; border-bottom: solid 1px #eef0f1;}
.xcConfirm .popBox .ttBox .tt{font-size: 18px; display: block; float: left; height: 30px; position: relative;}
.xcConfirm .popBox .ttBox .clsBtn{display: block; cursor: pointer; width: 12px; height: 12px; position: absolute; top: 22px; right: 30px; background: url(../img/icons.png) -48px -96px no-repeat;}
.xcConfirm .popBox .txtBox{margin: 40px 100px; height: 100px; overflow: hidden;}
.xcConfirm .popBox .txtBox .bigIcon{float: left; margin-right: 20px; width: 48px; height: 48px; background-image: url(../img/icons.png); background-repeat: no-repeat; background-position: 48px 0;}
.xcConfirm .popBox .txtBox p{ height: 84px; margin-top: 16px; line-height: 26px; overflow-x: hidden; overflow-y: auto;}
.xcConfirm .popBox .txtBox p input{width: 364px; height: 30px; border: solid 1px #eef0f1; font-size: 18px; margin-top: 6px;}
.xcConfirm .popBox .btnArea{border-top: solid 1px #eef0f1;}
.xcConfirm .popBox .btnGroup{float: right;}
.xcConfirm .popBox .btnGroup .sgBtn{margin-top: -25px; margin-right: 12px;}
.xcConfirm .popBox .sgBtn{display: block; cursor: pointer; float: left; width: 95px; height: 35px; line-height: 35px; text-align: center; color: #FFFFFF; border-radius: 5px;}
.xcConfirm .popBox .sgBtn.ok{background-color: #0095d9; color: #FFFFFF;}
.xcConfirm .popBox .sgBtn.cancel{background-color: #546a79; color: #FFFFFF;}

 assets/js/xcConfirm.js

 
/*
 * 使用说明:
 * window.wxc.Pop(popHtml, [type], [options])
 * popHtml:html字符串
 * type:window.wxc.xcConfirm.typeEnum集合中的元素
 * options:扩展对象
 * 用法:
 * 1. window.wxc.xcConfirm("我是弹窗<span>lalala</span>");
 * 2. window.wxc.xcConfirm("成功","success");
 * 3. window.wxc.xcConfirm("请输入","input",{onOk:function(){}})
 * 4. window.wxc.xcConfirm("自定义",{title:"自定义"})
 */
(function($){
	window.wxc = window.wxc || {};
	window.wxc.xcConfirm = function(popHtml, type, options) {
	    var btnType = window.wxc.xcConfirm.btnEnum;
		var eventType = window.wxc.xcConfirm.eventEnum;
		var popType = {
			info: {
				title: "信息",
				icon: "0 0",//蓝色i
				btn: btnType.ok
			},
			success: {
				title: "成功",
				icon: "0 -48px",//绿色对勾
				btn: btnType.ok
			},
			error: {
				title: "错误",
				icon: "-48px -48px",//红色叉
				btn: btnType.ok
			},
			confirm: {
				title: "提示",
				icon: "-48px 0",//黄色问号
				btn: btnType.okcancel
			},
			warning: {
				title: "警告",
				icon: "0 -96px",//黄色叹号
				btn: btnType.okcancel
			},
			input: {
				title: "输入",
				icon: "",
				btn: btnType.ok
			},
			custom: {
				title: "",
				icon: "",
				btn: btnType.ok
			}
		};
		var itype = type ? type instanceof Object ? type : popType[type] || {} : {};//格式化输入的参数:弹窗类型
		var config = $.extend(true, {
			//属性
			title: "", //自定义的标题
			icon: "", //图标
			btn: btnType.ok, //按钮,默认单按钮
			//事件
			onOk: $.noop,//点击确定的按钮回调
			onCancel: $.noop,//点击取消的按钮回调
			onClose: $.noop//弹窗关闭的回调,返回触发事件
		}, itype, options);
		
		var $txt = $("<p>").html(popHtml);//弹窗文本dom
		var $tt = $("<span>").addClass("tt").text(config.title);//标题
		var icon = config.icon;
		var $icon = icon ? $("<div>").addClass("bigIcon").css("backgroundPosition",icon) : "";
		var btn = config.btn;//按钮组生成参数
		
		var popId = creatPopId();//弹窗索引
		
		var $box = $("<div>").addClass("xcConfirm");//弹窗插件容器
		var $layer = $("<div>").addClass("xc_layer");//遮罩层
		var $popBox = $("<div>").addClass("popBox");//弹窗盒子
		var $ttBox = $("<div>").addClass("ttBox");//弹窗顶部区域
		var $txtBox = $("<div>").addClass("txtBox");//弹窗内容主体区
		var $btnArea = $("<div>").addClass("btnArea");//按钮区域
		
		var $ok = $("<a>").addClass("sgBtn").addClass("ok").text("确定");//确定按钮
		var $cancel = $("<a>").addClass("sgBtn").addClass("cancel").text("取消");//取消按钮
		var $input = $("<input>").addClass("inputBox");//输入框
		var $clsBtn = $("<a>").addClass("clsBtn");//关闭按钮
		
		//建立按钮映射关系
		var btns = {
			ok: $ok,
			cancel: $cancel
		};
		
		init();
		
		function init(){
			//处理特殊类型input
			if(popType["input"] === itype){
				$txt.append($input);
			}
			
			creatDom();
			bind();
		}
		
		function creatDom(){
			$popBox.append(
				$ttBox.append(
					$clsBtn
				).append(
					$tt
				)
			).append(
				$txtBox.append($icon).append($txt)
			).append(
				$btnArea.append(creatBtnGroup(btn))
			);
			$box.attr("id", popId).append($layer).append($popBox);
			$("body").append($box);
		}
		
		function bind(){
			//点击确认按钮
			$ok.click(doOk);
			
			//回车键触发确认按钮事件
			$(window).bind("keydown", function(e){
				if(e.keyCode == 13) {
					if($("#" + popId).length == 1){
						doOk();
					}
				}
			});
			
			//点击取消按钮
			$cancel.click(doCancel);
			
			//点击关闭按钮
			$clsBtn.click(doClose);
		}

		//确认按钮事件
		function doOk(){
			var $o = $(this);
			var v = $.trim($input.val());
			if ($input.is(":visible"))
		        config.onOk(v);
		    else
		        config.onOk();
			$("#" + popId).remove(); 
			config.onClose(eventType.ok);
		}
		
		//取消按钮事件
		function doCancel(){
			var $o = $(this);
			config.onCancel();
			$("#" + popId).remove(); 
			config.onClose(eventType.cancel);
		}
		
		//关闭按钮事件
		function doClose(){
			$("#" + popId).remove();
			config.onClose(eventType.close);
			$(window).unbind("keydown");
		}
		
		//生成按钮组
		function creatBtnGroup(tp){
			var $bgp = $("<div>").addClass("btnGroup");
			$.each(btns, function(i, n){
				if( btnType[i] == (tp & btnType[i]) ){
					$bgp.append(n);
				}
			});
			return $bgp;
		}

		//重生popId,防止id重复
		function creatPopId(){
			var i = "pop_" + (new Date()).getTime()+parseInt(Math.random()*100000);//弹窗索引
			if($("#" + i).length > 0){
				return creatPopId();
			}else{
				return i;
			}
		}
	};
	
	//按钮类型
	window.wxc.xcConfirm.btnEnum = {
		ok: parseInt("0001",2), //确定按钮
		cancel: parseInt("0010",2), //取消按钮
		okcancel: parseInt("0011",2) //确定&&取消
	};
	
	//触发事件类型
	window.wxc.xcConfirm.eventEnum = {
		ok: 1,
		cancel: 2,
		close: 3
	};
	
	//弹窗类型
	window.wxc.xcConfirm.typeEnum = {
		info: "info",
		success: "success",
		error:"error",
		confirm: "confirm",
		warning: "warning",
		input: "input",
		custom: "custom"
	};

})(jQuery);

后台:

package com.tc.lvmsm.controller.gm;

import com.tc.common.bean.cm.CmService;
import com.tc.common.log.BaseController;
import com.tc.common.log.ModuleLogger;
import com.tc.common.log.ModuleLoggerFactory;

import com.tc.common.page.Page;
import com.tc.common.pic.OSSUploadUtil;
import com.tc.lvmsm.serv.itf.GasCylinderCheckInfoService;
import com.tc.lvmsm.serv.itf.GasService;
import com.tc.lvmsm.vo.cm.VehicleAndGasCylinderAndGasCylinderCheckInfo;
import com.tc.lvmsm.vo.gm.*;
import com.tc.lvmsm.vo.vm.Vehicle;
import com.tc.lvmsm.vo.vm.VehicleExample;
import com.tc.util.DateUtils;
import com.tc.util.ExcelUtil;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.*;

/**
 * <p>
 * <p>
 * FileName: GasCylinderCheckInfoController
 * Author:    苏凯
 * Date:     2018/3/22 19:08
 * Description: 气瓶定检信息Controller
 *
 */
@Controller
public class GasCylinderCheckInfoController
{
    /**
     * 配置管理、Service层各模块接口bean
     */
    @Autowired
    private CmService cmServiceFactory;
    /**
     * 气瓶管理、气瓶定检service
     */
    @Autowired
    private GasCylinderCheckInfoService gasCylinderCheckInfoService;
    /**
     * 配置管理 气瓶service
     */
    @Autowired
    private GasService gasService;
    /**
     * 获得日志句柄
     */
    private ModuleLogger logger = ModuleLoggerFactory
            .getDefinedLogger("GM\\GasCylinderCheckInfoController ");

    /**
     * Description: 查询所有数据+分页(ajax WEB-INF/jsp/gm/air_test_info.jsp);
    
    
     *
     * @param cph       车辆条件做查询条件
    
    
     * @param num       气瓶编号
     * @param pageNow   查询当前第几页的数据
     * @param pageSize1 显示每页多少条数据
    
    
     * @return page
     */
    @RequestMapping(value = "/config/show-GasCylinderCheckInfo", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Page showAllGasCylinderCheckInfo(HttpServletRequest request,
            Integer pageNow, Integer pageSize1, String cph, String num,
            String positionnum, String firsttestdate1, String firsttestdate2,
            String orderByClause)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/show-GasCylinderCheckInfo ";
        // 创建分页对象
        Page page = null;
        try
        {
            // 排序 默认id
            if (null == orderByClause || 0 == orderByClause.length())
            {
                orderByClause = "testdate DESC";
            }
            // 转换positionnum查询条件
            if (null != positionnum && "气瓶已卸载!".equals(positionnum.trim()))
            {
                positionnum = "待配置气瓶!";
            }
            if (null != positionnum && "气瓶已卸载".equals(positionnum.trim()))
            {
                positionnum = "待配置气瓶!";
            }
            // 创建气瓶定检信息的List容器
            List<GasCylinderCheckInfo> gasCylinderCheckInfos = new ArrayList<GasCylinderCheckInfo>();
            // 如果页面有传入气瓶参数做查询条件,需要获取车队ID
            List<Integer> vehicleIds = new ArrayList<Integer>();
            // 获取气瓶id
            List<Integer> GasCylinderIds = new ArrayList<Integer>();
            // 存放关联数据的集合

            List<VehicleAndGasCylinderAndGasCylinderCheckInfo> vehicleAndGasCylinderAndGasCylinderCheckInfos = new ArrayList<VehicleAndGasCylinderAndGasCylinderCheckInfo>();
            // 通过车辆查条件查询数据

            if ((null != cph && 0 < cph.trim().length()))
            {
                VehicleExample vehicleExample = new VehicleExample();
                VehicleExample.Criteria vehicleExampleCriteria = vehicleExample
                        .createCriteria();
                // 车牌号

                vehicleExampleCriteria.andCphLike("%" +cph.trim()+ "%");

                List<Vehicle> vehicles = cmServiceFactory.getVmVehicleService()
                        .selectByExample(CALLER, vehicleExample);
                if (0 < vehicles.size())
                {
                    for (int j = 0; j < vehicles.size(); j++)
                    {
                        // 通过车辆条件获取到已配置气瓶的车辆id(车辆id放容器中用做获取气瓶信息的条件)
                        vehicleIds.add(vehicles.get(j).getId().intValue());
                    }
                }
                else
                {
                    vehicleIds.add(0);
                }
            }
            // 页面有传入气瓶编号或气瓶位置编号做查询条件

            // 创建气瓶查询条件
            if ((null != num && 0 < num.trim().length())
                    || (null != positionnum && 0 < positionnum.trim().length())
                    || (0 < vehicleIds.size()))
            {
                GasCylinderExample gasCylinderExample = new GasCylinderExample();
                GasCylinderExample.Criteria criteria2 = gasCylinderExample
                        .createCriteria();
                // 气瓶编号num
                if (null != num && 0 < num.trim().length())
                {
                    criteria2.andNumLike("%" +num.trim()+ "%");
                }
                // 气瓶位置编号positionnum
                if (null != positionnum && 0 < positionnum.trim().length())
                {
                    criteria2.andPositionnumEqualTo(positionnum.trim());
                }
                // 通过车辆id获取已经配置的配置信息

                if (0 < vehicleIds.size())
                {
                    List<Long> vehicleIdsL = new ArrayList<Long>();
                    for (int i = 0; i < vehicleIds.size(); i++)
                    {
                        vehicleIdsL.add(vehicleIds.get(i).longValue());
                    }
                    if (0 < vehicleIdsL.size())
                    {
                        criteria2.andVehidIn(vehicleIdsL);
                    }
                }
                // 必须显示已安装的气瓶,排除(Vehid= -1状态 为未安装的气瓶)
                long i = -1;
                /* criteria2.andVehidNotEqualTo(i); */ // 如果只需要显示已配置车辆的气瓶信息,把这条注释打开即可
                List<GasCylinder> gasCylinders = gasService
                        .selectByExample(CALLER, gasCylinderExample);
                if (0 < gasCylinders.size())
                {
                    for (int j = 0; j < gasCylinders.size(); j++)
                    {
                        GasCylinderIds.add(gasCylinders.get(j).getId());
                    }
                }
                else
                {
                    GasCylinder gasCylinder = new GasCylinder();
                    gasCylinder.setNum("无气瓶信息");
                    // 当气瓶编号未查询到数据时,页面不应当有数据,所以这边的车辆ID集合中写入0;

                    GasCylinderIds.add(0);
                }
            }

            // 构造气瓶定检查询条件
            GasCylinderCheckInfoExample gasCylinderCheckInfoExample = new GasCylinderCheckInfoExample();
            GasCylinderCheckInfoExample.Criteria criteria2 = gasCylinderCheckInfoExample
                    .createCriteria();
            if (0 < GasCylinderIds.size())
            {
                criteria2.andGascylinderidIn(GasCylinderIds);
            }
            // 按日期查询

            if (null != firsttestdate1 && 0 < firsttestdate1.length())
            {
                criteria2.andTestdateEqualTo(firsttestdate1);
            }

            int i1 = gasCylinderCheckInfoService.countByExample(CALLER,
                    gasCylinderCheckInfoExample);
            if (null != pageNow)
            {
                page = new Page(i1, pageNow);
                if (null != pageSize1)
                {
                    page.setPageSize(pageSize1);
                }

                gasCylinderCheckInfos = gasCylinderCheckInfoService
                        .selectGasCylinderCheckInfoeByExampleNoUrlList(CALLER,
                                page.getStartPos(), page.getPageSize(),
                                gasCylinderCheckInfoExample, orderByClause);

                if (0 < gasCylinderCheckInfos.size())
                {
                    for (int i = 0; i < gasCylinderCheckInfos.size(); i++)
                    {
                        VehicleAndGasCylinderAndGasCylinderCheckInfo vehicleAndGasCylinderAndGasCylinderCheckInfo = getVehicleAndGasCylinderAndGasCylinderCheckInfo(
                                CALLER, request,
                                vehicleAndGasCylinderAndGasCylinderCheckInfos,
                                gasCylinderCheckInfos, cph, i);
                        vehicleAndGasCylinderAndGasCylinderCheckInfos.add(
                                vehicleAndGasCylinderAndGasCylinderCheckInfo);
                    }
                }
                else
                {
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "查询", 0, 1, "未找到气瓶定检数据!" + CALLER);
                }
            }
            else
            {
                page = new Page(i1, 1);
                if (null != pageSize1)
                {
                    page.setPageSize(pageSize1);
                }
                gasCylinderCheckInfos = gasCylinderCheckInfoService
                        .selectGasCylinderCheckInfoeByExample(CALLER,
                                page.getStartPos(), page.getPageSize(),
                                gasCylinderCheckInfoExample, orderByClause);
                if (0 < gasCylinderCheckInfos.size())
                {
                    for (int i = 0; i < gasCylinderCheckInfos.size(); i++)
                    {
                        ////
                        VehicleAndGasCylinderAndGasCylinderCheckInfo vehicleAndGasCylinderAndGasCylinderCheckInfo = getVehicleAndGasCylinderAndGasCylinderCheckInfo(
                                CALLER, request,
                                vehicleAndGasCylinderAndGasCylinderCheckInfos,
                                gasCylinderCheckInfos, cph, i);
                        vehicleAndGasCylinderAndGasCylinderCheckInfos.add(
                                vehicleAndGasCylinderAndGasCylinderCheckInfo);
                    }
                }
                else
                {
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "查询", 0, 1, "未找到气瓶定检数据!" + CALLER);
                }
            }
            page.setList(vehicleAndGasCylinderAndGasCylinderCheckInfos);
            page.setResultCode(200);
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "查询", 1, 1, "" + CALLER);
        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "查询", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }
    }

    /**
     * Description: 查询数据(修改详情[获取图片])
    
    
     *
     * @param gasCylinderCheckInfoId 气瓶定检id
     * @return Page
     */
    @RequestMapping(value = "/config/showAdd-GasCylinderCheckInfoBytsByGasCylinderCheckInfoId", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Page GasCylinderCheckInfoBytsByGasCylinderCheckInfoId(
            HttpServletRequest request, Integer gasCylinderCheckInfoId)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_GasCylinderCheckInfoBytsByGasCylinderCheckInfoId";
        Page page = new Page();
        try
        {
            GasCylinderCheckInfo gasCylinderCheckInfo = gasCylinderCheckInfoService
                    .selectByPrimaryKey(CALLER, gasCylinderCheckInfoId);
            if (null != gasCylinderCheckInfo)
            {
                page.setResultCode(200);
                page.getList().add(gasCylinderCheckInfo);
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "气瓶定检详情", 1, 1, "显示图片!" + CALLER);
            }
            else
            {
                page.setResultCode(505);
                page.setFailDesc("未获取到定检信息!");
            }

        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "气瓶定检详情", 0, 1, "显示图片!" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;

        }

    }

    ;

    /**
     * Description: 查询数据(修改详情)
     *
     * @param gasCylinderCheckInfoId 气瓶定检id
     * @return String ("/gm/air_parameter_g")
     */
    @RequestMapping(value = "/config/Update-GasCylinderCheckInfo", produces = "application/json;charset=UTF-8")
    public String showGasCylinderCheckInfo(HttpServletRequest request,
            Integer gasCylinderCheckInfoId)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/Update-GasCylinderCheckInfo ";
        try
        {
            // 创建(车辆 气瓶 气瓶定检信息 )对象

            VehicleAndGasCylinderAndGasCylinderCheckInfo vehicleAndGasCylinderAndGasCylinderCheckInfo = new VehicleAndGasCylinderAndGasCylinderCheckInfo();
            if (null != gasCylinderCheckInfoId && 0 < gasCylinderCheckInfoId)
            {
                GasCylinderCheckInfo gasCylinderCheckInfo = gasCylinderCheckInfoService
                        .selectByPrimaryKey(CALLER, gasCylinderCheckInfoId);
                /*
                 * GasCylinderCheckInfo gasCylinderCheckInfo =
                 * gasCylinderCheckInfoService.
                 * getPictureDataByGasCylinderCheckInfo(CALLER,
                 * gasCylinderCheckInfo1);
                 */
                if (null != gasCylinderCheckInfo)
                {
                    vehicleAndGasCylinderAndGasCylinderCheckInfo
                            .setGasCylinderCheckInfo(gasCylinderCheckInfo);
                    GasCylinder gasCylinder = gasService.selectByPrimaryKey(
                            CALLER, gasCylinderCheckInfo.getGascylinderid());
                    if (null != gasCylinder)
                    {
                        vehicleAndGasCylinderAndGasCylinderCheckInfo
                                .setGasCylinder(gasCylinder);
                        Vehicle vehicle = cmServiceFactory.getVmVehicleService()
                                .selectByPrimaryKey(CALLER,
                                        gasCylinder.getVehid().intValue());
                        if (null != vehicle)
                        {
                            vehicleAndGasCylinderAndGasCylinderCheckInfo
                                    .setVehicle(vehicle);
                        }
                        else
                        {
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "气瓶定检详情", 0, 1,
                                    "从数据库中未获取到车辆信息" + CALLER);
                            logger.writeLog(logger.LOG_LEVEL_ERROR,
                                    "" + CALLER);
                        }
                    }
                    else
                    {
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "气瓶定检详情", 0, 1,
                                "从数据库中未获取到气瓶定检信息" + CALLER);
                        logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
                    }
                }
                else
                {
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "气瓶定检详情", 0, 1, "从数据库中未获取到气瓶信息" + CALLER);
                    logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
                }

                request.setAttribute(
                        "vehicleAndGasCylinderAndGasCylinderCheckInfo",
                        vehicleAndGasCylinderAndGasCylinderCheckInfo);

                logger.writeLog(logger.LOG_LEVEL_DEBUG,
                        logger.getExitMethodHint());
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "气瓶定检详情", 1, 1, "" + CALLER);
            }
            else
            {
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "气瓶定检详情", 0, 1, "未接收到气瓶定检参数id" + CALLER);
                logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            }
        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "气瓶定检详情", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return "/gm/air_parameter_g";
            /* return "/gm/Update-GasCylinderCheckInfo"; */
        }

    }

    /**
     * Description:添加气瓶定检信息(ajax WEB-INF/jsp/gm/add-GasCylinderCheckInfo.jsp);
    
    
     *
     * @param gasCylinderCheckInfo           气瓶定检对象
     * @param gasCylinderId                  气瓶id
     * @param cph                            车辆牌照
     * @param GasCylinderNum                 气瓶编码
     * @param positionnum                    气瓶位置编号
     * @param manufacturingsupervisioninsurl 质量说明书URL
     * @param orderByClause                  字段排序
     * @return page
     */
    @RequestMapping(value = "/config/add-GasCylinderCheckInfo", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Page addGasCylinderCheckInfo(HttpServletRequest request,
            GasCylinderCheckInfo gasCylinderCheckInfo,
            @RequestParam("num") Integer gasCylinderId, String cph,
            String GasCylinderNum, String positionnum,
            String manufacturingsupervisioninsurl, String orderByClause)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfo ";
        Integer a = gasCylinderId;
        Page page = new Page();

        try
        {
            // 排序 默认id
            if (null == orderByClause || 0 == orderByClause.length())
            {
                orderByClause = "ID DESC";
            }
            if (null != manufacturingsupervisioninsurl
                    && 0 < manufacturingsupervisioninsurl.length())
            {
                gasCylinderCheckInfo
                        .setQualityspecifyurl(manufacturingsupervisioninsurl);
            }
            page = gasCylinderCheckInfoService.addGasCylinderCheckInfo(CALLER,
                    request, gasCylinderCheckInfo, gasCylinderId, cph,
                    GasCylinderNum, positionnum, orderByClause);
        }
        catch (Exception e)
        {
            page.setResultCode(502);
            page.setFailDesc("请检查!");
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "添加定检信息", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

    /**
     * Description:修改气瓶定检信息;
    
    
     *
     * @param gasCylinderCheckInfo           气瓶定检信息
     * @param cph                            车辆牌照
     * @param positionnum                    气瓶位置编号
     * @param num                            气瓶编号
     * @param manufacturingsupervisioninsurl 质量说明书URL
     * @param orderByClause                  字段排序
     * @return page
     */
    @RequestMapping(value = "/config/Update-GasCylinderCheckInfoT", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Page updateGasCylinderCheckInfo(HttpServletRequest request,
            GasCylinderCheckInfo gasCylinderCheckInfo, String cph, String num,
            String positionnum, String manufacturingsupervisioninsurl,
            String orderByClause)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/Update-GasCylinderCheckInfoT ";
        Page page = new Page();
        // 排序 默认id
        if (null == orderByClause || 0 == orderByClause.length())
        {
            orderByClause = "ID DESC";
        }
        try
        {
            if (null != manufacturingsupervisioninsurl
                    && 0 < manufacturingsupervisioninsurl.length())
            {
                gasCylinderCheckInfo
                        .setQualityspecifyurl(manufacturingsupervisioninsurl);
            }
            page = gasCylinderCheckInfoService.updateGasCylinderCheckInfo(
                    CALLER, request, gasCylinderCheckInfo, cph, num,
                    positionnum, orderByClause);
            /*
             * page =
             * gasCylinderCheckInfoService.addGasCylinderCheckInfo(CALLER,
             * request, gasCylinderCheckInfo, gasCylinderId, cph,
             * GasCylinderNum, positionnum);
             */
        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "修改气瓶定检信息", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

    /**
     * Description:删除气瓶定检信息;
    
    
     *
     * @param id 气瓶定检信息id
     * @return page
     */
    @RequestMapping(value = "/config/delete-GasCylinderCheckInfo", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Page deleteGasCylinderCheckInfo(HttpServletRequest request,
            Integer id)
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/delete-GasCylinderCheckInfo";
        Page page = new Page();
        try
        {
            if (null != id && 0 < id)
            {
                int i = 0;
                /*
                 * gasCylinderCheckInfoService.
                 * deletePictureDataByGasCylinderCheckInfo(CALLER,id);
                 */
                i = gasCylinderCheckInfoService.deleteByPrimaryKey(CALLER, id);
                if (0 < i)
                {
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "修改气瓶定检信息/删除气瓶定检信息", 1, 1,
                            "气瓶定检信息删除失败,请检查数据库" + CALLER);
                    page.setResultCode(200);
                    page.setFailDesc("气瓶定检信息删除成功!");

                }
                else
                {
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "修改气瓶定检信息/删除气瓶定检信息", 0, 1,
                            "气瓶定检信息删除失败,请检查数据库" + CALLER);
                    page.setResultCode(505);
                    page.setFailDesc("气瓶定检信息删除失败!");
                    return page;
                }

            }
            else
            {
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "修改气瓶定检信息/删除气瓶定检信息", 0, 1,
                        "气瓶定检信息删除失败,未获取到页面传来的气瓶定检id参数!" + CALLER);
                page.setResultCode(505);
                page.setFailDesc("气瓶定检信息删除失败!");
                return page;
            }

        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "修改气瓶定检信息/删除气瓶定检信息", 0, 1, "系统异常删除气瓶定检信息失败!" + CALLER);
            page.setResultCode(505);
            page.setFailDesc("系统异常删除气瓶定检信息失败!");
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);

        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }


    //==============================文件上传======================================
    /**
     * 产品合格证文件上传
     */
    @RequestMapping(value = "/config/create-AllGasCylinderCheckInfoFileurlFileUpload", method = RequestMethod.POST)
    @ResponseBody
    public Page AllGasCylinderCheckInfoProductqualifyurlFileUpload(
            @RequestParam("productqualifyurlFile1") List<CommonsMultipartFile> files,
            HttpServletRequest request) throws IOException
    {
        String CALLER = "GasCylinderCheckInfoController_/config/create-AllGasCylinderCheckInfoFileurlFileUpload ";
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        System.out.println(url);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";

                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                        }
                    }
                }
                if (null != urls && 0 < urls.length())
                {
                    page.setFieldString(urls);
                    page.setFailDesc("图片上传成功!");
                    page.setResultCode(200);
                }
            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "增加气瓶定检信息/文件上传", 0, 1, "系统异常文件上传失败!" + CALLER);
        }
        finally
        {
            return page;
        }
    }

    /**
     *质量证书文件上传
     */
    @RequestMapping(value = "/config/create-AllGasCylinderCheckInfoQualitycertificateurlFileUpload", method = RequestMethod.POST)
    @ResponseBody
    public Page AllGasCylinderCheckInfoQualitycertificateurlFileUpload(
            @RequestParam("qualitycertificateurlFile2") List<CommonsMultipartFile> files,
            HttpServletRequest request) throws IOException
    {
        String CALLER = "GasCylinderCheckInfoController_/config/create-AllGasCylinderCheckInfoFileurlFileUpload ";
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        System.out.println(url);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";

                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                        }
                    }
                }
                if (null != urls && 0 < urls.length())
                {
                    page.setFieldString(urls);
                    page.setFailDesc("图片上传成功!");
                    page.setResultCode(200);
                }
            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "增加气瓶定检信息/文件上传", 0, 1, "系统异常文件上传失败!" + CALLER);
        }
        finally
        {
            return page;
        }
    }


 /**
 * 使用说明书文件上传
 */
@RequestMapping(value = "/config/create-AllGasCylinderCheckInfoInstructionmanualurlUpload", method = RequestMethod.POST)
@ResponseBody
public Page AllGasCylinderCheckInfoInstructionmanualurlFileUpload(
        @RequestParam("instructionmanualurlFile2") List<CommonsMultipartFile> files,
        HttpServletRequest request) throws IOException
{
    String CALLER = "GasCylinderCheckInfoController_/config/create-AllGasCylinderCheckInfoFileurlFileUpload ";
    String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
    String fileName = "";
    String fileType = "";
    Page page = new Page();
    String urls = "";
    try
    {
        if (null != files && 0 < files.size())
        {
            for (int i = 0; i < files.size(); i++)
            {
                if (!files.get(i).isEmpty())
                {
                    // 文件保存路径
                    CommonsMultipartFile file = (CommonsMultipartFile) files
                            .get(i);
                    fileName = file.getOriginalFilename();
                    if (null != fileName && 0 < fileName.length())
                    {
                        fileType = fileName
                                .substring(fileName.lastIndexOf(".") + 1);
                    }
                    String url = OSSUploadUtil.uploadFile(file, fileType);
                    System.out.println(url);
                    if (null != url && 0 < url.length())
                    {
                        urls += url + ",";

                    }
                    else
                    {
                        page.setFailDesc("图片上传不成功!");
                        page.setResultCode(505);
                    }
                }
            }
            if (null != urls && 0 < urls.length())
            {
                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);
            }
        }
        else
        {
            page.setFailDesc("未获取到文件信息!");
            page.setResultCode(505);
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
        BaseController.saveLog(
                SecurityUtils.getSubject().getPrincipals().toString(),
                startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                "增加气瓶定检信息/文件上传", 0, 1, "系统异常文件上传失败!" + CALLER);
    }
    finally
    {
        return page;
    }
}

    /**
     * 检验报告文件上传
     */
    @RequestMapping(value = "/config/create-AllGasCylinderCheckInspectereporturlUpload", method = RequestMethod.POST)
    @ResponseBody
    public Page AllGasCylinderCheckInspectereporturlFileUpload(
            @RequestParam("inspectereporturlFile2") List<CommonsMultipartFile> files,
            HttpServletRequest request) throws IOException
    {
        String CALLER = "GasCylinderCheckInfoController_/config/create-AllGasCylinderCheckInfoFileurlFileUpload ";
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        System.out.println(url);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";

                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                        }
                    }
                }
                if (null != urls && 0 < urls.length())
                {
                    page.setFieldString(urls);
                    page.setFailDesc("图片上传成功!");
                    page.setResultCode(200);
                }
            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "增加气瓶定检信息/文件上传", 0, 1, "系统异常文件上传失败!" + CALLER);
        }
        finally
        {
            return page;
        }
    }

    /**
     * 日常检验记录文件上传
     */
    @RequestMapping(value = "/config/create-AllGasCylinderCheckDailyinspectrecordurlUpload", method = RequestMethod.POST)
    @ResponseBody
    public Page AllGasCylinderCheckDailyinspectrecordurlFileUpload(
            @RequestParam("dailyinspectrecordurlFile2") List<CommonsMultipartFile> files,
            HttpServletRequest request) throws IOException
    {
        String CALLER = "GasCylinderCheckInfoController_/config/create-AllGasCylinderCheckInfoFileurlFileUpload ";
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        System.out.println(url);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";

                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                        }
                    }
                }
                if (null != urls && 0 < urls.length())
                {
                    page.setFieldString(urls);
                    page.setFailDesc("图片上传成功!");
                    page.setResultCode(200);
                }
            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "增加气瓶定检信息/文件上传", 0, 1, "系统异常文件上传失败!" + CALLER);
        }
        finally
        {
            return page;
        }
    }
    /**
     * Description:气瓶定检查询分页
     *
     * @param vehicleAndGasCylinderAndGasCylinderCheckInfos (车辆、气瓶、气瓶定检信息)封装对象
    
     * @param gasCylinderCheckInfos                         (气瓶定检信息集合)
    
    
     * @param cph                                           车牌号
    
    
     * @param i                                             遍历索引
     * @param
     */
    public VehicleAndGasCylinderAndGasCylinderCheckInfo getVehicleAndGasCylinderAndGasCylinderCheckInfo(
            String CALLER, HttpServletRequest request,
            List<VehicleAndGasCylinderAndGasCylinderCheckInfo> vehicleAndGasCylinderAndGasCylinderCheckInfos,
            List<GasCylinderCheckInfo> gasCylinderCheckInfos, String cph, int i)
            throws Exception
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        VehicleAndGasCylinderAndGasCylinderCheckInfo vehicleAndGasCylinderAndGasCylinderCheckInfo = new VehicleAndGasCylinderAndGasCylinderCheckInfo();
        vehicleAndGasCylinderAndGasCylinderCheckInfo
                .setGasCylinderCheckInfo(gasCylinderCheckInfos.get(i));
        if (null != gasCylinderCheckInfos.get(i).getGascylinderid()
                && 0 < gasCylinderCheckInfos.get(i).getGascylinderid())
        {
            // 获取气瓶信息
            GasCylinderExample gasCylinderExample = new GasCylinderExample();
            GasCylinderExample.Criteria criteria1 = gasCylinderExample
                    .createCriteria();
            criteria1.andIdEqualTo(
                    gasCylinderCheckInfos.get(i).getGascylinderid());
            List<GasCylinder> gasCylinders = gasService.selectByExample(CALLER,
                    gasCylinderExample);
            if (0 < gasCylinders.size())
            {
                vehicleAndGasCylinderAndGasCylinderCheckInfo
                        .setGasCylinder(gasCylinders.get(0));
                // 获取车辆信息
                VehicleExample vehicleExample = new VehicleExample();
                VehicleExample.Criteria criteria = vehicleExample
                        .createCriteria();
                if (null != gasCylinders.get(0).getVehid()
                        && 0 < gasCylinders.get(0).getVehid())
                {
                    criteria.andIdEqualTo(
                            gasCylinders.get(0).getVehid().intValue());
                }
                else
                {
                    criteria.andIdEqualTo(0);
                }

                List<Vehicle> vehicles = cmServiceFactory.getVmVehicleService()
                        .selectByExample(CALLER, vehicleExample);
                if (0 < vehicles.size())
                {
                    for (int j = 0; j < vehicles.size(); j++)
                    {
                        vehicleAndGasCylinderAndGasCylinderCheckInfo
                                .setVehicle(vehicles.get(0));
                        logger.writeLog(logger.LOG_LEVEL_DEBUG,
                                logger.getExitMethodHint());
                    }
                }
                else
                {
                    Vehicle vehicle = new Vehicle();
                    vehicle.setCph("无");
                    vehicle.setOwnno("无");
                    vehicleAndGasCylinderAndGasCylinderCheckInfo
                            .setVehicle(vehicle);
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "查询", 0, 1, "未找到车辆数据" + CALLER);
                }

            }
            else
            {
                GasCylinder gasCylinder = new GasCylinder();
                gasCylinder.setNum("-1");
                gasCylinder.setPositionnum("-1");
                vehicleAndGasCylinderAndGasCylinderCheckInfo
                        .setGasCylinder(gasCylinder);
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "查询", 0, 1, "未找到气瓶数据" + CALLER);
            }
        }
        return vehicleAndGasCylinderAndGasCylinderCheckInfo;
    }

    /**
     * Description: 文件下载功能
     *
     * @param request
     * @param response
     * @throws Exception
     */
    @RequestMapping("/down")
    public void down(HttpServletRequest request, HttpServletResponse response)
            throws Exception
    {
        // 模拟文件,myfile.txt为需要下载的文件
        String fileName = request.getSession().getServletContext()
                .getRealPath("upload") + "/myfile.txt";
        // 获取输入流

        InputStream bis = new BufferedInputStream(
                new FileInputStream(new File(fileName)));
        // 假如以中文名下载的话
        String filename = "下载文件.txt";
        // 转码,免得文件名中文乱码
        filename = URLEncoder.encode(filename, "UTF-8");
        // 设置文件下载头

        response.addHeader("Content-Disposition",
                "attachment;filename=" + filename);
        // 1.设置文件ContentType类型,这样设置,会自动判断下载文件类型

        response.setContentType("multipart/form-data");
        BufferedOutputStream out = new BufferedOutputStream(
                response.getOutputStream());
        int len = 0;
        while ((len = bis.read()) != -1)
        {
            out.write(len);
            out.flush();
        }
        out.close();
    }

    /**
     * Description: 导出文件(WEB-INF/jsp/gm/air_test_info.jsp)
    
    
     *
     * @param cph 车辆条件做查询条件
    
    
     * @param num 气瓶编号
     * @return String null
     */
    @RequestMapping(value = "/config/export-GasCylinderCheckInfoExcel", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public String exportAllGasCylinderCheckInfoExcel(HttpServletRequest request,
            HttpServletResponse response,
            @RequestParam(value = "cph", required = false) String cph,
            @RequestParam(value = "num", required = false) String num,
            @RequestParam(value = "positionnum", required = false) String positionnum,
            @RequestParam(value = "firsttestdate1", required = false) String firsttestdate1,
            @RequestParam(value = "firsttestdate2", required = false) String firsttestdate2,
            @RequestParam(value = "orderByClause", required = false) String orderByClause)
    {
        String fileName = "气瓶定检";
        // 排序 默认id
        if (null == orderByClause || 0 == orderByClause.length())
        {
            orderByClause = "testdate DESC";
        }
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/export-GasCylinderCheckInfoExcel ";
        // 创建分页对象
        Page page = new Page();
        // 创建气瓶定检信息的List容器
        List<GasCylinderCheckInfo> gasCylinderCheckInfos = new ArrayList<GasCylinderCheckInfo>();
        try
        {
            request.setCharacterEncoding("utf-8");
            // 如果页面有传入气瓶参数做查询条件,需要获取车队ID
            List<Integer> vehicleIds = new ArrayList<Integer>();
            // 获取气瓶id
            List<Integer> GasCylinderIds = new ArrayList<Integer>();
            // 存放关联数据的集合

            List<VehicleAndGasCylinderAndGasCylinderCheckInfo> vehicleAndGasCylinderAndGasCylinderCheckInfos = new ArrayList<VehicleAndGasCylinderAndGasCylinderCheckInfo>();
            // 通过车辆查条件查询数据

            if ((null != cph && 0 < cph.trim().length()))
            {
                /* cph = new String(cph.getBytes("iso8859-1"),"utf-8"); */
                cph = URLDecoder.decode(cph, "UTF-8");
                VehicleExample vehicleExample = new VehicleExample();
                VehicleExample.Criteria vehicleExampleCriteria = vehicleExample
                        .createCriteria();
                // 车牌号

                vehicleExampleCriteria.andCphEqualTo(cph.trim());
                List<Vehicle> vehicles = cmServiceFactory.getVmVehicleService()
                        .selectByExample(CALLER, vehicleExample);
                if (0 < vehicles.size())
                {
                    for (int j = 0; j < vehicles.size(); j++)
                    {
                        // 通过车辆条件获取到已配置气瓶的车辆id(车辆id放容器中用做获取气瓶信息的条件)
                        vehicleIds.add(vehicles.get(j).getId().intValue());
                    }
                }
                else
                {
                    vehicleIds.add(0);
                }
            }
            /*
             * =================================================================
             */
            // 页面有传入气瓶编号或气瓶位置编号做查询条件

            // 创建气瓶查询条件
            if ((null != num && 0 < num.trim().length())
                    || (null != positionnum && 0 < positionnum.trim().length())
                    || (0 < vehicleIds.size()))
            {
                GasCylinderExample gasCylinderExample = new GasCylinderExample();
                GasCylinderExample.Criteria criteria2 = gasCylinderExample
                        .createCriteria();
                // 气瓶编号num
                if (null != num && 0 < num.trim().length())
                {
                    criteria2.andNumEqualTo(num.trim());
                }
                // 气瓶位置编号positionnum
                if (null != positionnum && 0 < positionnum.trim().length())
                {
                    /*
                     * positionnum = new String(
                     * positionnum.getBytes("iso8859-1"),"utf-8");
                     */
                    criteria2.andPositionnumEqualTo(positionnum.trim());
                }
                // 通过车辆id获取已经配置的配置信息

                if (0 < vehicleIds.size())
                {
                    List<Long> vehicleIdsL = new ArrayList<Long>();
                    for (int i = 0; i < vehicleIds.size(); i++)
                    {
                        vehicleIdsL.add(vehicleIds.get(i).longValue());
                    }
                    if (0 < vehicleIdsL.size())
                    {
                        criteria2.andVehidIn(vehicleIdsL);
                    }
                }
                // 必须显示已安装的气瓶,排除(Vehid= -1状态 为未安装的气瓶)
                long i = -1;
                /* criteria2.andVehidNotEqualTo(i); */
                List<GasCylinder> gasCylinders = gasService
                        .selectByExample(CALLER, gasCylinderExample);
                if (0 < gasCylinders.size())
                {
                    for (int j = 0; j < gasCylinders.size(); j++)
                    {
                        GasCylinderIds.add(gasCylinders.get(j).getId());
                    }
                }
                else
                {
                    GasCylinder gasCylinder = new GasCylinder();
                    gasCylinder.setNum("无气瓶信息");
                    // 当气瓶编号未查询到数据时,页面不应当有数据,所以这边的车辆ID集合中写入0;

                    GasCylinderIds.add(0);
                }
            }
            /*
             * =================================================================
             */
            // 构造气瓶定检查询条件
            GasCylinderCheckInfoExample gasCylinderCheckInfoExample = new GasCylinderCheckInfoExample();
            GasCylinderCheckInfoExample.Criteria criteria2 = gasCylinderCheckInfoExample
                    .createCriteria();
            if (0 < GasCylinderIds.size())
            {
                criteria2.andGascylinderidIn(GasCylinderIds);
            }
            // 按日期查询

            if (null != firsttestdate1 && 0 < firsttestdate1.length())
            {
                criteria2.andTestdateEqualTo(firsttestdate1);
            }
            /*
             * if(null != firsttestdate1 && 0 < firsttestdate1.length() && null
             * != firsttestdate2 && 0 < firsttestdate2.length()){
             * criteria2.andFirsttestdateBetween(firsttestdate1,firsttestdate2);
             * } if((null != firsttestdate1 && 0 < firsttestdate1.length()) &&
             * (null == firsttestdate2 || 0 == firsttestdate2.length())){
             * criteria2.andFirsttestdateEqualTo(firsttestdate1); } if((null !=
             * firsttestdate2 && 0 < firsttestdate2.length()) && (null ==
             * firsttestdate1 || 0 == firsttestdate1.length())){
             * criteria2.andFirsttestdateEqualTo(firsttestdate2); }
             */
            gasCylinderCheckInfos = gasCylinderCheckInfoService.selectByExample(
                    CALLER, gasCylinderCheckInfoExample, orderByClause);
            if (0 < gasCylinderCheckInfos.size())
            {
                for (int i = 0; i < gasCylinderCheckInfos.size(); i++)
                {
                    VehicleAndGasCylinderAndGasCylinderCheckInfo vehicleAndGasCylinderAndGasCylinderCheckInfo = getVehicleAndGasCylinderAndGasCylinderCheckInfo(
                            CALLER, request,
                            vehicleAndGasCylinderAndGasCylinderCheckInfos,
                            gasCylinderCheckInfos, cph, i);
                    vehicleAndGasCylinderAndGasCylinderCheckInfos
                            .add(vehicleAndGasCylinderAndGasCylinderCheckInfo);
                }
                /*
                 * ============================================Excel导出==========
                 */
                // 创建存放需要导出数据的map容器
                Map<String, Object> vehicleAndGasCylinderAndGasCylinderCheckInfopMap = new HashMap<String, Object>();
                // 创建存放map的list容器
                List<Map<String, Object>> vehicleAndVehGroupsList = new ArrayList<Map<String, Object>>();
                vehicleAndGasCylinderAndGasCylinderCheckInfopMap
                        .put("sheetName", "sheet1");
                vehicleAndVehGroupsList
                        .add(vehicleAndGasCylinderAndGasCylinderCheckInfopMap);
                if (0 < vehicleAndGasCylinderAndGasCylinderCheckInfos.size())
                {
                    // 导出方法
                    excelOut(request, response, fileName,
                            vehicleAndGasCylinderAndGasCylinderCheckInfos,
                            vehicleAndVehGroupsList);
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("未获得数据!");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "导出", 0, 1, "未获得数据!" + CALLER);
                }
            }
            else
            {
                BaseController.saveLog(
                        SecurityUtils.getSubject().getPrincipals().toString(),
                        startTime,
                        DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                        BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                        "导出", 0, 1, "未找到气瓶定检数据!" + CALLER);
            }
            page.setResultCode(200);
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "导出", 1, 1, "" + CALLER);
        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "导出", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return null;
        }
    }

    // excel导出
    private void excelOut(HttpServletRequest request,
            HttpServletResponse response, String fileName,
            List<VehicleAndGasCylinderAndGasCylinderCheckInfo> vehicleAndGasCylinderAndGasCylinderCheckInfos,
            List<Map<String, Object>> vehicleAndVehGroupsList)
            throws IOException
    {
        Map<String, Object> vehicleAndGasCylinderAndGasCylinderCheckInfopMap;
        for (int i = 0; i < vehicleAndGasCylinderAndGasCylinderCheckInfos
                .size(); i++)
        {
            vehicleAndGasCylinderAndGasCylinderCheckInfopMap = new HashMap<String, Object>();
            vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put("cph",
                    vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i)
                            .getVehicle().getCph()); // 车牌号

            vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put("num",
                    vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i)
                            .getGasCylinder().getNum()); // 气瓶编号
            if ("待配置气瓶!".equals(vehicleAndGasCylinderAndGasCylinderCheckInfos
                    .get(i).getGasCylinder().getPositionnum()))
            {
                vehicleAndGasCylinderAndGasCylinderCheckInfopMap
                        .put("positionnum", "气瓶已经卸载!"); // 气瓶位置编号
            }
            else
            {
                vehicleAndGasCylinderAndGasCylinderCheckInfopMap
                        .put("positionnum",
                                vehicleAndGasCylinderAndGasCylinderCheckInfos
                                        .get(i).getGasCylinder()
                                        .getPositionnum()); // 气瓶位置编号
            }

            vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put("testdate",
                    vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i)
                            .getGasCylinderCheckInfo().getTestdate()); // 首次检验日期

            vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put("testunit",
                    vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i)
                            .getGasCylinderCheckInfo().getTestunit()); // 首次检验单位

            vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put("testresult",
                    vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i)
                            .getGasCylinderCheckInfo().getTestresult()); // 首次检验结果

            /*
             * vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put(
             * "recenttestdate",
             * vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i).
             * getGasCylinderCheckInfo().getRecenttestdate()); //最近检验日期
             * 
             * 
             * vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put(
             * "recentinspectunit",
             * vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i).
             * getGasCylinderCheckInfo().getRecentinspectunit()); //最近检验单位
             *
             *
             * 
             * 
             * vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put(
             * "recentinspectresult",
             * vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i).
             * getGasCylinderCheckInfo().getRecentinspectresult()); //最近检验结果
             * 
             * 
             */
            /*
             * vehicleAndGasCylinderAndGasCylinderCheckInfopMap.put(
             * "nexttesttime",
             * vehicleAndGasCylinderAndGasCylinderCheckInfos.get(i).
             * getGasCylinderCheckInfo().getNexttesttime()); //下次定检日期
             */
            vehicleAndVehGroupsList
                    .add(vehicleAndGasCylinderAndGasCylinderCheckInfopMap);

        }
        String[][] columnNames =
        {
                {},
                { "车牌号", "气瓶编号", "位置编号", "检验日期", "检验单位", "检验结果" } }; // 列名
        String[] keys =
        { "cph", "num", "positionnum", "testdate", "testunit", "testresult" }; // map中的key
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        ExcelUtil.createWorkBook(vehicleAndVehGroupsList, keys, columnNames)
                .write(os);
        ExcelUtil.inputExcel(request, response, fileName, os);
    }


    /*=================主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片==================================*/
    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(产品合格证url)
     * 此图片保存后需要,将其它同气瓶编号的气瓶信息一并同步成同一图片;
     * @return page
     * @throws IOException
     * @RequestParam("productqualifyurlFile") CommonsMultipartFile file
     */
    @RequestMapping(value = "/config/add-GasCylinderCheckInfoProductqualifyurlUpload1", method = RequestMethod.POST)
    @ResponseBody
    public Page GasCylinderCheckInfoProductqualifyurlUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {

        /*
         * =====================================================================
         */
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfoProductqualifyurlUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo.setProductqualifyurl(urls.toString());
                        int i = gasCylinderCheckInfoService.updateImageByPrimaryKeySelective(CALLER,
                                gasCylinderCheckInfo);

                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(检验报告)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }


    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(质量证明书url)
     *
     * @return page
     * @throws IOException
     * @RequestParam("qualitycertificateurlFile") CommonsMultipartFile file
     */

    @RequestMapping(value = "/config/add-GasCylinderCheckInfoQualitycertificateurlUpload1", method = RequestMethod.POST)
    @ResponseBody
    public Page GasCylinderCheckInfoQualitycertificateurlUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {

        /*
         * =====================================================================
         */
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfoQualitycertificateurlUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo
                                .setQualitycertificateurl(urls.toString());
                        int i = gasCylinderCheckInfoService.updateImageByPrimaryKeySelective(CALLER,
                                gasCylinderCheckInfo);
                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(检验报告)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(质量说明书)
     *
     * @return page
     * @throws IOException
     * @RequestParam("qualityspecifyurlFile") CommonsMultipartFile file
     */

    @RequestMapping(value = "/config/add-GasCylinderCheckInfoQualityspecifyurlUpload1", method = RequestMethod.POST)
    @ResponseBody
    public Page GasCylinderCheckInfoQualityspecifyurlUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {

        /*
         * =====================================================================
         */
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfoQualityspecifyurlUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo
                                .setQualityspecifyurl(urls.toString());
                        int i = gasCylinderCheckInfoService.updateImageByPrimaryKeySelective(CALLER,
                                gasCylinderCheckInfo);
                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(检验报告)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(使用说明书url)
     *
     * @return page
     * @throws IOException
     * @RequestParam("instructionmanualurlFile") CommonsMultipartFile file
     */
    @RequestMapping(value = "/config/add-GasCylinderCheckInfoInstructionmanualurlUpload1", method = RequestMethod.POST)
    @ResponseBody

    public Page GasCylinderCheckInfoInstructionmanualurlUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {

        /*
         * =====================================================================
         */
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfoInstructionmanualurlUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo
                                .setInstructionmanualurl(urls.toString());
                        int i = gasCylinderCheckInfoService.updateImageByPrimaryKeySelective(CALLER,
                                gasCylinderCheckInfo);
                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(检验报告)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }


    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(检验报告)
     *
     * @return page
     * @throws IOException
     * @RequestParam("inspectereporturlFile") CommonsMultipartFile file
     */
    @RequestMapping(value = "/config/add-GasCylinderCheckInfoInspectereporturlUpload1", method = RequestMethod.POST)
    @ResponseBody
    public Page GasCylinderCheckInfoInspectereporturlUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {

        /*
         * =====================================================================
         */
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_/config/add-GasCylinderCheckInfoInspectereporturlUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {
            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo
                                .setInspectereporturl(urls.toString());
                        int i = gasCylinderCheckInfoService
                                .updateByPrimaryKeySelective(CALLER,
                                        gasCylinderCheckInfo);
                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(检验报告)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

    /**
     * Description:主页文件上传功能(上传完图片直接将URL更新数到据库)、上传图片(日常检验记录)
     * @return page
     * @throws IOException
     * @RequestParam("dailyinspectrecordurlFile") CommonsMultipartFile file
     */
    @RequestMapping(value = "/config/add-GasCylinderCheckInfoDailyinspectrecordurlFileUpload1", method = RequestMethod.POST)
    @ResponseBody
    public Page GasCylinderCheckInfoDailyinspectrecordurlFileUpload1(
            @RequestParam("file") List<CommonsMultipartFile> files,
            HttpServletRequest request, Integer gasCylinderCheckInfoId,
            Integer ii) throws IOException
    {
        String startTime = DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");
        String CALLER = "GasCylinderCheckInfoController_GasCylinderCheckInfoDailyinspectrecordurlFileUpload1 ";
        String fileName = "";
        String fileType = "";
        Page page = new Page();
        String urls = "";
        try
        {

            if (null != files && 0 < files.size())
            {
                for (int i = 0; i < files.size(); i++)
                {
                    if (!files.get(i).isEmpty())
                    {
                        // 文件保存路径
                        CommonsMultipartFile file = (CommonsMultipartFile) files
                                .get(i);
                        fileName = file.getOriginalFilename();
                        if (null != fileName && 0 < fileName.length())
                        {
                            fileType = fileName
                                    .substring(fileName.lastIndexOf(".") + 1);
                        }
                        String url = OSSUploadUtil.uploadFile(file, fileType);
                        if (null != url && 0 < url.length())
                        {
                            urls += url + ",";
                            System.out.println(url);
                        }
                        else
                        {
                            page.setFailDesc("图片上传不成功!");
                            page.setResultCode(505);
                            return page;
                        }
                    }
                }
                if (null != gasCylinderCheckInfoId
                        && 0 < gasCylinderCheckInfoId)
                {
                    if (null != urls && 0 < urls.length())
                    {
                        GasCylinderCheckInfo gasCylinderCheckInfo = new GasCylinderCheckInfo();
                        gasCylinderCheckInfo.setId(gasCylinderCheckInfoId);
                        gasCylinderCheckInfo
                                .setDailyinspectrecordurl(urls.toString());
                        int i = gasCylinderCheckInfoService
                                .updateByPrimaryKeySelective(CALLER,
                                        gasCylinderCheckInfo);
                        if (0 < i)
                        {
                            page.setResultCode(200);
                            page.setFailDesc("上传成功!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传(日常检验记录)", 1, 1,
                                    "" + CALLER);
                        }
                        else
                        {
                            page.setResultCode(505);
                            page.setFailDesc("上传失败!");
                            BaseController.saveLog(
                                    SecurityUtils.getSubject().getPrincipals()
                                            .toString(),
                                    startTime,
                                    DateUtils.getCurrentDate(
                                            "yyyy-MM-dd HH:mm:ss"),
                                    BaseController.getRequestIp(request),
                                    "气瓶信息", "气瓶定检信息", "点击上传", 0, 1,
                                    "上传失败!" + CALLER);
                        }
                    }
                    else
                    {
                        page.setResultCode(505);
                        page.setFailDesc("上传失败,未返回文件路径!");
                        BaseController.saveLog(
                                SecurityUtils.getSubject().getPrincipals()
                                        .toString(),
                                startTime,
                                DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                                BaseController.getRequestIp(request), "气瓶信息",
                                "气瓶定检信息", "点击上传", 0, 1, "未返回文件路径" + CALLER);
                    }
                }
                else
                {
                    page.setResultCode(505);
                    page.setFailDesc("上传失败,未获得气瓶定检id");
                    BaseController.saveLog(
                            SecurityUtils.getSubject().getPrincipals()
                                    .toString(),
                            startTime,
                            DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                            BaseController.getRequestIp(request), "气瓶信息",
                            "气瓶定检信息", "点击上传", 0, 1, "未获得气瓶定检id" + CALLER);
                }

                page.setFieldString(urls);
                page.setFailDesc("图片上传成功!");
                page.setResultCode(200);

            }
            else
            {
                page.setFailDesc("未获取到文件信息!");
                page.setResultCode(505);
            }

        }
        catch (Exception e)
        {
            BaseController.saveLog(
                    SecurityUtils.getSubject().getPrincipals().toString(),
                    startTime, DateUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss"),
                    BaseController.getRequestIp(request), "气瓶信息", "气瓶定检信息",
                    "点击上传", 0, 1, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR, "" + CALLER);
            logger.writeLog(logger.LOG_LEVEL_ERROR,
                    logger.getExceptionMethodHint(), e);
        }
        finally
        {
            logger.writeLog(logger.LOG_LEVEL_DEBUG, logger.getExitMethodHint());
            return page;
        }

    }

}

 

猜你喜欢

转载自blog.csdn.net/qq_15204179/article/details/82771053