fs-danaus
2024-02-21 0a4f165eec7585da85a0bd58444efb5eac06d35f
优化多附件上传功能及业绩宝接口代码更新
1个文件已添加
10个文件已修改
573 ■■■■■ 已修改文件
WebRoot/general/gridFileInput.jsp 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebRoot/js/bootstrap/fileinput/js/fileinput.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebRoot/js/index/funcLink.js 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/action/login/LoginAction.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/action/upload/AttachmentAction.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/qiyunfang/service/QiyunfangImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/yejibao/controller/YeJiBaoController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/yejibao/controller/YeJiBaoHandleController.java 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/yejibao/schedule/T150101Thread.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/yejibao/schedule/T150109Thread.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/yejibao/service/YeJiBaoImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebRoot/general/gridFileInput.jsp
@@ -121,7 +121,8 @@
        pubkey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
    };
    let arrayFileType = {};//保存上传返回的附件uuid;seq及文件类型
    var fileUploadCount = 0;//保存加载的附件数量
    let arrayFileSeq = {};//保存上传返回的附件uuid;seq及文件名称,用于删除时根据文件名称匹配到seq
    var fileUploadCount = 0;//保存附件总数
    //渲染出附件界面出来9,19
    const BootstrapFileInputOption = function (g) {
        let o = {
@@ -151,6 +152,7 @@
                allowedFileExtensions: null,//允许上传的文件扩展名列表。默认情况下设置为 null
                dropZoneTitle: '点击或拖拽文件',
                dropZoneClickTitle: '',
                multiple: g.type == 9 ? false : true,//by danaus 2024-02-19 17:39
                layoutTemplates: {
                    indicator: ''//去掉上传状态图标
                    , actionUpload: ''//去除缩略图中文件上传操作按钮的模板
@@ -222,12 +224,15 @@
                    F.fileinput('upload');
                }).on('filebatchuploadsuccess', function (event, data) {
                    // 此事件仅在ajax上传且文件批量上传成功之后触发
                    //debugger;
                    if (g) {
                        fileUploadCount++;
                        fileUploadCount += data.files.length;
                        let tmp = {};
                        let v = $('#file-inputv');
                        let oldKey = v.val();// 旧的值
                        let newKey = data.response.uuid ? data.response.uuid + ";" : "";   // 新的值
                        arrayFileSeq = JSON.parse(data.response.seqMap);
                        arrayFileType = JSON.parse(data.response.fileExtMap);
                        if (oldKey != "") {
                            let keys = oldKey.split(";");
                            for (let i = 1; i < keys.length; i++) {
@@ -243,7 +248,6 @@
                        let unId = data.response.uuid ? data.response.uuid : "";
                        let grid = g.id;
                        let obj = unId + ";" + data.response.fileType;//  by danaus 2020/4/30 11:32
                        arrayFileType[newKey.substring(0, newKey.length - 1)] = data.response.fileType;//去掉最后一个;号
                        grid.SetValue(g.row, g.col, obj, 0);
                        grid.RefreshCell(g.row, g.col);
                    }
@@ -278,8 +282,10 @@
                    }
                }).on('filesuccessremove', function (event, val) {
                    // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
                    let title = val.title;//文件名称,用于查找对应的seq
                    let delSeq = arrayFileSeq[title];//对应删除的seq
                    let uuid = val.key.split(";")[0];
                    let seq = val.key.split(";")[1];
                    //let seq = val.key.split(";")[1];
                    let hd = 0;//主从表标记,0表示从表
                    let formidType = g.id.gType;
                    if (formidType == 3 || formidType == 301 || formidType == 304 || formidType == 4 || formidType == 7 || formidType == 1) {
@@ -293,20 +299,20 @@
                        type: "POST",
                        dataType: 'json',
                        url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid='
                            + uuid + '&seq=' + seq + '&ishd=' + hd + '&fieldid=' + g.col + '&formid=' + g.id.formid,   // 删除路径
                            + uuid + '&seq=' + delSeq + '&ishd=' + hd + '&fieldid=' + g.col + '&formid=' + g.id.formid,   // 删除路径
                        success: function (data) {
                            if (data.status == 'success') {
                                if (g) {
                                    fileUploadCount--;
                                    delete arrayFileSeq[title];
                                    var grid = g.id;
                                    var obj = "";
                                    let key = val.key.substring(0, val.key.length - 1) + "";//去掉最后一个分号
                                    let key = uuid + ";" + delSeq;
                                    if (g.type == 19) {
                                        if (key != g.row[g.col + "_Img"]) {
                                        if (key != g.row[g.col + "_Img"] || fileUploadCount != 0) {
                                            //表示19类型且有多个附件
                                            let delseq = key.split(";")[1];
                                            let orgUnId = g.row[g.col + "_Img"];
                                            orgUnId = orgUnId.replace(";" + delseq, "");//在原值中去掉相关的seq
                                            orgUnId = orgUnId.replace(";" + delSeq, "");//在原值中去掉相关的seq
                                            g.row[g.col + "_Img"] = orgUnId;
                                            let arrayUnid = orgUnId.split(";");
@@ -315,6 +321,10 @@
                                                let newKey = arrayUnid[0] + ";" + arrayUnid[1];
                                                let newUnid = newKey + ";" + (arrayFileType[newKey] != undefined ? arrayFileType[newKey] : "jpg");
                                                g.row[g.col] = g.id.createPicPath(newUnid);
                                                let tmp = {};
                                                tmp.key = newUnid;
                                                $('#file-inputv').val(newKey);
                                                // data.thumbs.attr("data-key", JSON.stringify(tmp));
                                            }
                                        } else {
                                            //当前只有一个附件,直接清空
@@ -532,7 +542,7 @@
                    fileInput.option.uploadUrl = upURL; // 附件上传路径
                    // fileInput.option.maxFileCount = 1;   // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。
                    fileInput.option.maxTotalFileCount = g.type == 9 ? 1 : 0;  // 允许的总文件数。如果设置为0,则意味着允许的总文件数是无限的。默认值为0。
                    fileInput.option.isNine = g.type ? true : false;
                    fileInput.option.isNine = g.type == 9 ? true : false;
                    fileInput.option.validateInitialCount = true;   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
                    fileInput.option.overwriteInitial = false;   // 是否要覆盖初始预览内容和标题设置
                    if (jsons.length > 0) {
@@ -544,7 +554,7 @@
        } catch (e) {
            alert(e);
        } finally {
            fileInput.fileInput();// 加载图片显示
            fileInput.fileInput({multiple: g.type == 9 ? false : true});// 加载图片显示
            $(".image").addClass("hide");
            $(".fileInput").removeClass("hide");
        }
WebRoot/js/bootstrap/fileinput/js/fileinput.js
@@ -954,6 +954,9 @@
            if (!refreshMode) {
                self._cleanup();
            }
            if (self.multiple == true) {//by danaus 2024-02-19 10:58 增加多选文件的选项
                $el.attr('multiple', 'multiple');
            }
            self.duplicateErrors = [];
            self.$form = $el.closest('form');
            self._initTemplateDefaults();
@@ -1532,15 +1535,6 @@
                        chunkCount: rm.chunkCount
                    });
                    fnBefore = function (jqXHR) {
                        //处理表格多附件 by danaus 2024-02-01 11:00
                        let val = $('#file-inputv').val();
                        if (val != "") {
                            //更新最新的uuid,在附件全都是新上传时候,不处理会有问题,uuid每次都会不同
                            let url = self.options.uploadUrl.split("?");
                            let searchParams = new URLSearchParams(url[1]);
                            searchParams.set('uuid', val);
                            self.options.uploadUrl = url[0] + searchParams.toString();
                        }
                        outData = self._getOutData(fd, jqXHR);
                        self._raise('filetestbeforesend', [id, fm, rm, outData]);
                    };
@@ -3789,12 +3783,13 @@
                    var $thumb = $(this), $remove = $thumb.find('.kv-file-remove');
                    $remove.removeAttr('disabled');
                    self._handler($remove, 'click', function () {
                        if(self.isControl9){
                            self.isControl9=false;
                        if (self.isControl9) {
                            self.isControl9 = false;
                        }
                        var id = $thumb.attr('id'),
                            key= $thumb.data('key'),
                            out = self._raise('filesuccessremove', [key,id, $thumb.attr('data-fileindex')]);
                            key = $thumb.data('key');
                        key['title'] = $thumb.attr('title');
                        var out = self._raise('filesuccessremove', [key, id, $thumb.attr('data-fileindex')]);//增加文件名称输出,用于页面作为删除文件的key,通过后台传回来的kv值找到对应的seq,by danaus 2024-02-21 09:30
                        $h.cleanMemory($thumb);
                        if (out === false) {
                            return;
@@ -4065,7 +4060,11 @@
                        searchParams.set('uuid', '');
                        $('#file-inputv').val('');//清空原有值
                    } else {
                        searchParams.set('uuid', val.replaceAll("%3B", ";").substring(0, val.length - 1));
                        if (val.lastIndexOf(';') == val.length - 1) {//表示以;结尾
                            searchParams.set('uuid', val.replaceAll("%3B", ";").substring(0, val.length - 1));
                        } else {
                            searchParams.set('uuid', val.replaceAll("%3B", ";").substring(0, val.length));
                        }
                    }
                    return url[0] + "?" + searchParams.toString().replaceAll("%3B", ";");
                }
WebRoot/js/index/funcLink.js
@@ -1,17 +1,22 @@
var version = 0;// 版本号
var pwdCallBack = null;// 密码输入点击确定后回调函数
var obj22 = null;// 22类型传值对象
var shx=false;
var leftWidth="0";
var gridId=[];
var shx = false;
var leftWidth = "0";
var gridId = [];
//var uploadObj = null;
//var edit='';
var pic={};// 格线附件上传参数属性
var rsakey={
    pubkey:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
var pic = {};// 格线附件上传参数属性
var rsakey = {
    pubkey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkRupiYcKVGGUtDBDoR1t/1zm3ZtZgnte39iTJW6hlqjdY0UagKjpNiIv7J6XjtgfX7SgsR4AWnivqQHAICIvdPKfGZZzIs62OQ19MqrDTMoB/LvK5teNWhClv23WMUfRbP+EHgprT6hTw8U5apw1IB6i/y57NkLav792wiYBYRU4X45NoTaT+aiTSLFEflbfm94EXnhSS3vFkBmrZGy5BRNI8gmzafroslGx2Hk90CqlNdeKYxgZQ6xtvj+u33yrszWvPT6F9fsJT8aMjtvH050iYKRVct+x6Q7VRJgCI4MgvAexnTKdxW54YzvXCuO5bDiy5la7CgerWkTAq9dzXwIDAQAB"
};
let arrayFileType_Panel = {};//保存上传返回的附件uuid;seq及文件类型
let arrayFileSeq_Panel = {};//保存上传返回的附件uuid;seq及文件名称,用于删除时根据文件名称匹配到seq
let fileUploadCount_Panel = 0;//保存附件总数
let formid_Panel;
//拼接附件url
function getAttachmentUrl(staticUrl,formid,unid,domain,dbid,isShowOrgPic,width,height,fileExt,isDownLoad){
function getAttachmentUrl(staticUrl, formid, unid, domain, dbid, isShowOrgPic, width, height, fileExt, isDownLoad) {
    // if (staticUrl != null && staticUrl != "") {
    //     if (isDownLoad) {
    //         return unid + "_" + dbid + "_" + formid + "_" + fileExt;
@@ -108,12 +113,13 @@
            uploadAsync: false,   // bool是否多文件批量上传将并行异步/。默认为true
            showCaption: false,//是否显示被选文件的简介
            showBrowse: false,//是否显示文件浏览按钮
            showBatchDownload:true,//显示批量下载按钮
            showBatchDownload: true,//显示批量下载按钮
            showUpload: false,//是否显示上传按钮
            showCancel: false,//是否显示取消按钮
            showRemove: false,//是否显示移除按钮
            showDrag:false,//是否显示拖动按钮
            showDrag: false,//是否显示拖动按钮
            showClose: false,//是否显示关闭按钮
            multiple: id.type == 9 ? false : true,//by danaus 2024-02-19 17:39
            dropZoneEnabled: true,   //是否显示拖拽区域
            browseOnZoneClick: false,   //布尔值,是否在点击预览区域时触发文件浏览/选择。默认为false
            showUploadedThumbs: true,   // 是否在预览窗口中持续显示已经上传的文件缩略图(用于ajax上传),直到按下删除/清除按钮
@@ -122,8 +128,8 @@
            isNine: false,   // 19类型就为false,9类型就为true,下面有判断
            validateInitialCount: false,   // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false.
            overwriteInitial: true,   // 是否要覆盖初始预览内容和标题设置
            initialPreviewAsData:true,
            allowedFileExtensions:null,//允许上传的文件扩展名列表。默认情况下设置为 null
            initialPreviewAsData: true,
            allowedFileExtensions: null,//允许上传的文件扩展名列表。默认情况下设置为 null
            dropZoneTitle:'点击或拖拽文件',
            dropZoneClickTitle:'',
            layoutTemplates : {
@@ -238,16 +244,19 @@
                fileInputId.fileinput('upload');
            }).on('filebatchuploadsuccess', function(event, data) {
                // 此事件仅在ajax上传且文件批量上传成功之后触发
                let tmp={};
                let oldKey=id.val();// 旧的值
                let newKey=data.response.uuid?data.response.uuid+";":"";   // 新的值
                if(oldKey!=""){
                    var keys=oldKey.split(";");
                    for(var i=1;i<keys.length;i++){
                        newKey=newKey.replace(";"+keys[i]+";",";");
                fileUploadCount_Panel += data.files.length;
                arrayFileSeq_Panel = JSON.parse(data.response.seqMap);
                arrayFileType_Panel = JSON.parse(data.response.fileExtMap);
                let tmp = {};
                let oldKey = id.val();// 旧的值
                let newKey = data.response.uuid ? data.response.uuid + ";" : "";   // 新的值
                if (oldKey != "") {
                    var keys = oldKey.split(";");
                    for (var i = 1; i < keys.length; i++) {
                        newKey = newKey.replace(";" + keys[i] + ";", ";");
                    }
                }
                tmp.key=newKey;
                tmp.key = newKey;
                tmp.type=data.response.type;
                tmp.filedId=name;
                tmp.oldKey=oldKey;
@@ -257,10 +266,10 @@
                    data.thumbs.attr("data-key",JSON.stringify(tmp));
                }
                // 格线调用
                if(g){
                    let grid=g.id;
                    let obj=unid+";"+data.response.fileType;// by by danaus 2020/4/30 11:32
                    grid.SetValue(g.row, g.col,obj,0);
                if(g) {
                    let grid = g.id;
                    let obj = unid + ";" + data.response.fileType;// by danaus 2020/4/30 11:32
                    grid.SetValue(g.row, g.col, obj, 0);
                    grid.RefreshCell(g.row, g.col);
                }
            }).on('filebeforedelete', function(event, params) {
@@ -270,6 +279,8 @@
            }).on('filedeleted', function(event, key) {
                // 在删除initialPreview内容集中的每个缩略图文件之后触发此事件
                // 格线调用
                debugger;
                fileUploadCount_Panel--;
                if (isGrid != null && isGrid == 'grid') {
                    if (g) {
                        let grid = g.id;
@@ -280,6 +291,7 @@
                } else {   // 面板
                    let va = id.val();
                    key = key.split(";")[1];
                    delete arrayFileType_Panel[key];
                    va = va.replace(";" + key, "");
                    if (va.indexOf(";") < 0) {
                        va = "";
@@ -289,20 +301,21 @@
                }
            }).on('filesuccessremove', function(event, val) {
                // 使用缩略图删除按钮删除成功上传的缩略图后,会触发此事件
                if(val!=null && val.key!=null){
                    let vals = val.key.split(";");
                    let uuid;
                    let seq = 0;
                    if (vals.length > 1) {
                        uuid = val.key.split(";")[0];
                        seq = val.key.split(";")[1];
                    }
                debugger;
                if(val!=null && val.key!=null) {
                    let title = val.title;//文件名称,用于查找对应的seq
                    let delSeq = arrayFileSeq_Panel[title];//对应删除的seq
                    let uuid = val.key.split(";")[0];
                    $.ajax({
                        type: "POST",
                        dataType: 'json',
                        url: '/attachment/deleteOwnerAttachment.do?type=' + val.type + '&unid=' + uuid + '&seq=' + seq,   // 删除路径
                        url: '/attachment/deleteOwnerAttachment.do?formid=' + formid_Panel + '&fieldid=' + val.filedId + '&ishd=1&type=' + val.type + '&unid=' + uuid + '&seq=' + delSeq,   // 删除路径
                        success: function (data) {
                            let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + seq, "");
                            fileUploadCount_Panel--;
                            delete arrayFileSeq_Panel[title];
                            delete arrayFileType_Panel[uuid + ";" + delSeq];
                            // let newUid = val.oldKey == "" ? "" : val.oldKey.replace(";" + delSeq, "");
                            let newUid = val.key == "" ? "" : val.key.replace(";" + delSeq, "");//by danaus 2024-02-21 16:56
                            id.val(newUid);
                        }
                    });
@@ -427,6 +440,7 @@
    var isReadOnly = false;
    try {
        // 上传附件需要的参数
        formid_Panel = formid;
        var param = {};
        var panelautoSave = "";//标记是否为单据
        var readerUserCodes = $('#readerusercodes').val();
src/com/yc/action/login/LoginAction.java
@@ -417,7 +417,6 @@
                                    return null;// 验证出错返回'
                                }
                                userCode = userAccount.getUserCode();//转成ERP的usercode进行登陆
                                password = userAccount.getPassword();//转成ERP的密码进行登陆
                            }else {
                                //处理输入的密码在不在所列出账号里面,不存在说明密码错误,存在则标记是哪一个账号
                                final String pwd=password;
src/com/yc/action/upload/AttachmentAction.java
@@ -1,5 +1,6 @@
package com.yc.action.upload;
import com.alibaba.fastjson.JSON;
import com.google.gson.JsonObject;
import com.yc.action.BaseAction;
import com.yc.action.grid.GridUtils;
@@ -1278,7 +1279,7 @@
            picEntity.setIp(ip);
            boolean success = attachmentIfc.deleteAttachment(picEntity);
            if (success) {
                printJson(response, "{\"status\":\"success\"}");
                printJson(response, "{\"status\":\"success\",\"key\":\"" + (unid + ";" + seq) + "\"}");
            } else {
                printJson(response, "{\"status\":\"failed\"}");
            }
@@ -1527,6 +1528,8 @@
            byte[] orgBinaryimages = null;//源文件
            byte[] smallBinaryimages = null;//缩略图
            String fileExt = "";
            Map<String, String> seqMap = new HashMap<>();
            Map<String, String> fileExtMap = new HashMap<>();
            //图片缩小处理
            for (UpFile upFile : upFiles) {
                Integer seq = null;
@@ -1580,7 +1583,8 @@
                else {
                    seqString += attachmentWhereEntity.getSeq() + ";";
                }
                seqMap.put(upFile.getOldFileName(), attachmentWhereEntity.getSeq() + "");
                fileExtMap.put(uuid + ";" + attachmentWhereEntity.getSeq(), fileExt);
                //处理水印
                if (ImageUtils.isPicture(upFile.getOldFileName())) {
                    ImageUtils.waterMark(fileName, request);
@@ -1662,7 +1666,9 @@
            m.put("status", "success");
            m.put("uuid", seqString);
            m.put("type", type);
            m.put("fileType", fileExt);
            m.put("seqMap", JSON.toJSONString(seqMap));
            m.put("fileExtMap", JSON.toJSONString(fileExtMap));
            m.put("fileType", fileExt);//这里只返回最后一个附件的文件类型,在多附件时会有问题
            m.put("path", "|/getImage.do?type=0&uuid=" + seqString + "&r=" + Math.random() + JsonUtil.IMGRANG);
            return m;
src/com/yc/open/qiyunfang/service/QiyunfangImpl.java
@@ -80,7 +80,7 @@
                " a.Amount5 as AMT_5 , --25-36个月(金额)\n" +
                " a.Amount6 as AMT_6 , --37-48个月(金额)\n" +
                " a.Amount7 as AMT_7  --48个月以上(金额)\n" +
                " from f140933(@companyid,@periodid,'','','',30,150,180,360,360,360) a", new BeanPropertyRowMapper<>(InventoryAgeDataEntry.class));
                " from f140933(@companyid,@periodid,'','','',30,150,180,360,360,360) a where isnull(a.EndDigit,0)<>0 and isnull(a.EndAmount,0)<>0", new BeanPropertyRowMapper<>(InventoryAgeDataEntry.class));
    }
    @Override
    public List<CustomerDataEntry> getCustomerData() {
src/com/yc/open/yejibao/controller/YeJiBaoController.java
@@ -442,7 +442,7 @@
        PostDataBaseService mPostDataBaseService = (PostDataBaseService) FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t120201H  a where a.doccode='" + cancelEntry.getDocCode() + "'", Integer.class);
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t120201H  a where a.doccode='" + cancelEntry.getDocCode() + "' \n select @@rowcount", Integer.class);
        } catch (Exception ex) {
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    120201,
@@ -480,7 +480,7 @@
        PostDataBaseService mPostDataBaseService = (PostDataBaseService) FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t120201H  a where a.doccode='" + t120201Entity.getDocCode() + "'", Integer.class);
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t120201H  a where a.doccode='" + t120201Entity.getDocCode() + "' \n select @@rowcount", Integer.class);
        } catch (Exception ex) {
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    120201,
src/com/yc/open/yejibao/controller/YeJiBaoHandleController.java
New file
@@ -0,0 +1,285 @@
package com.yc.open.yejibao.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yc.entity.DataSourceEntity;
import com.yc.exception.ApplicationException;
import com.yc.exception.CallBackMessage;
import com.yc.factory.FactoryBean;
import com.yc.multiData.MultiDataSource;
import com.yc.multiData.SpObserver;
import com.yc.open.controller.BaseController;
import com.yc.open.deli.entity.T110565Entity;
import com.yc.open.deli.service.PostDataBaseService;
import com.yc.open.init.InitSystemTaks;
import com.yc.open.init.Task;
import com.yc.open.mutual.schedule.GateEntity;
import com.yc.open.yejibao.entry.T150101DetailEntity;
import com.yc.open.yejibao.entry.T150101Entity;
import com.yc.open.yejibao.entry.T150109DetailEntity;
import com.yc.open.yejibao.entry.T150109Entity;
import com.yc.open.yejibao.service.YeJiBaoIfc;
import com.yc.service.build.type.T_22_Ifc;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
 * 业绩宝相关
 */
@RestController
@RequestMapping("/yejibao")
@Slf4j
public class YeJiBaoHandleController extends BaseController {
    @Autowired
    T_22_Ifc t22ifc;
    @Autowired
    YeJiBaoIfc yeJiBaoIfc;
    @Autowired
    YeJiBaoController yeJiBaoController;
    @RequestMapping(value = "/push120101.do")
    public void push120101(HttpServletRequest request, HttpServletResponse response) {
        String docCode = null;//单号
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            Map<String, String> map = null;
            DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);
            try {
                SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源
                map = t22ifc.getParamMap(request);
            } catch (Exception e) {
                e.printStackTrace();
                log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
                this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e)));
                return;
            } finally {
                SpObserver.setDBtoInstance();
            }
            if (map != null) {
                docCode = map.get("doccode");
            }
            if (docCode == null) {
                if (log.isDebugEnabled()) {
                    log.error("通过22类型传进来组装出来的map:" + map.toString());
                }
                this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空"));
                return;
            }
            GateEntity gateEntity = new GateEntity();
            gateEntity.setDocCode(docCode);
            gateEntity.setFormid(120201);
            gateEntity.setDbid(dataSourceEntity.getDbId() + "");
            Task soTask = InitSystemTaks.getTask(gateEntity, "OP0070");
            soTask.setCurrentDocStatus(100);
            yeJiBaoController.pushT120201(gateEntity, soTask);
            this.printJson(response, callBackMessage.toJSONStringByMemo("同步成功:" + docCode));
        } catch (Exception e) {
            //写错误日志
            e.printStackTrace();
            this.sendErrorLog(120201, docCode, e);
            String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage());
            this.printJson(response, callBackMessage.sendErrorMessage(errorMsg));
        }
    }
    @RequestMapping(value = "/push150101.do")
    public void push150101(HttpServletRequest request, HttpServletResponse response) {
        String docCode = null;//单号
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            Map<String, String> map = null;
            DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);
            try {
                SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源
                map = t22ifc.getParamMap(request);
            } catch (Exception e) {
                e.printStackTrace();
                log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
                this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e)));
                return;
            } finally {
                SpObserver.setDBtoInstance();
            }
            if (map != null) {
                docCode = map.get("doccode");
            }
            if (docCode == null) {
                if (log.isDebugEnabled()) {
                    log.error("通过22类型传进来组装出来的map:" + map.toString());
                }
                this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空"));
                return;
            }
            GateEntity gateEntity = new GateEntity();
            gateEntity.setDocCode(docCode);
            gateEntity.setFormid(150101);
            gateEntity.setDbid(dataSourceEntity.getDbId() + "");
            Task soTask = InitSystemTaks.getTask(gateEntity, "OP0071");
            soTask.setCurrentDocStatus(100);
            call150101(gateEntity, soTask);
            this.printJson(response, callBackMessage.toJSONStringByMemo("同步成功:" + docCode));
        } catch (Exception e) {
            //写错误日志
            e.printStackTrace();
            this.sendErrorLog(150105, docCode, e);
            String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage());
            this.printJson(response, callBackMessage.sendErrorMessage(errorMsg));
        }
    }
    public void call150101(GateEntity entity, Task task) throws Exception {
        T150101Entity result = this.yeJiBaoIfc.getT150101List(entity.getDocCode(), task);
        if (result != null) {
            for (T150101DetailEntity detail : result.getReceive()) {
                if (detail.getSoDocStatus() != null && detail.getSoDocStatus() != 100) {
                    //推送不是确认状态销售订单
                    GateEntity gateEntity = new GateEntity();
                    gateEntity.setDocCode(detail.getSoDoccode());
                    gateEntity.setFormid(120201);
                    gateEntity.setDbid(entity.getDbid());
                    Task soTask = InitSystemTaks.getTask(gateEntity, "OP0070");
                    soTask.setCurrentDocStatus(detail.getSoDocStatus());
                    yeJiBaoController.pushT120201(gateEntity, soTask);
                }
            }
            String data = JSON.toJSONString(result, SerializerFeature.SortField);
            CallBackMessage callBackMessage = yeJiBaoController.doPost(task.getApiUrl(), result.getCompanyID(), data);
            if (callBackMessage.getState() == 0) {
                Map<String, String> map = JSON.parseObject(callBackMessage.getData(), Map.class);
                if (String.valueOf(map.get("code")).equals("1")) {
                    //成功
                    callBackMessage.sendSuccessMessage("推送成功");
                    updateState150101(result, callBackMessage, entity);
                } else {
                    throw new ApplicationException(map.get("msg"));
                }
            } else {
                throw new ApplicationException(callBackMessage.getError());
            }
        }
    }
    private void updateState150101(T150101Entity t150101Entity, CallBackMessage callBackMessage, GateEntity entity) {
        PostDataBaseService mPostDataBaseService = (PostDataBaseService) FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t150101H  a where a.doccode='" + t150101Entity.getDocCode() + "' \n select @@rowcount", Integer.class);
        } catch (Exception ex) {
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    150101,
                    t150101Entity.getDocCode(),
                    null,
                    "收款单150101",
                    ex.getMessage().replaceAll("'", "''")
            ));
        } finally {
            SpObserver.setDBtoInstance();
        }
    }
    @RequestMapping(value = "/push150109.do")
    public void push150109(HttpServletRequest request, HttpServletResponse response) {
        String docCode = null;//单号
        CallBackMessage callBackMessage = new CallBackMessage();
        try {
            Map<String, String> map = null;
            DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap(request);
            try {
                SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());//切换数据源
                map = t22ifc.getParamMap(request);
            } catch (Exception e) {
                e.printStackTrace();
                log.error(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
                this.printJson(response, callBackMessage.sendErrorMessage(this.getErrorMsg(e)));
                return;
            } finally {
                SpObserver.setDBtoInstance();
            }
            if (map != null) {
                docCode = map.get("doccode");
            }
            if (docCode == null) {
                if (log.isDebugEnabled()) {
                    log.error("通过22类型传进来组装出来的map:" + map.toString());
                }
                this.printJson(response, callBackMessage.sendErrorMessage("单号不能为空"));
                return;
            }
            GateEntity gateEntity = new GateEntity();
            gateEntity.setDocCode(docCode);
            gateEntity.setFormid(150109);
            gateEntity.setDbid(dataSourceEntity.getDbId() + "");
            Task soTask = InitSystemTaks.getTask(gateEntity, "OP0072");
            soTask.setCurrentDocStatus(100);
            call150109(gateEntity, soTask);
            this.printJson(response, callBackMessage.toJSONStringByMemo("同步成功:" + docCode));
        } catch (Exception e) {
            //写错误日志
            e.printStackTrace();
            this.sendErrorLog(150109, docCode, e);
            String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage());
            this.printJson(response, callBackMessage.sendErrorMessage(errorMsg));
        }
    }
    public void call150109(GateEntity entity, Task task) throws Exception {
        T150109Entity result = this.yeJiBaoIfc.getT150109List(entity.getDocCode(), task);
        if (result != null) {
            for (T150109DetailEntity detail : result.getRefund()) {
                if (detail.getSoDocStatus() != null && detail.getSoDocStatus() != 100) {
                    //推送不是确认状态销售订单
                    GateEntity gateEntity = new GateEntity();
                    gateEntity.setDocCode(detail.getSoDoccode());
                    gateEntity.setFormid(120201);
                    gateEntity.setDbid(entity.getDbid());
                    Task soTask = InitSystemTaks.getTask(gateEntity, "OP0070");
                    soTask.setCurrentDocStatus(detail.getSoDocStatus());
                    yeJiBaoController.pushT120201(gateEntity, soTask);
                }
            }
            String data = JSON.toJSONString(result, SerializerFeature.SortField);
            CallBackMessage callBackMessage = yeJiBaoController.doPost(task.getApiUrl(), result.getCompanyID(), data);
            if (callBackMessage.getState() == 0) {
                Map<String, String> map = JSON.parseObject(callBackMessage.getData(), Map.class);
                if (String.valueOf(map.get("code")).equals("1")) {
                    //成功
                    callBackMessage.sendSuccessMessage("推送成功");
                    updateState150109(result, callBackMessage, entity);
                } else {
                    throw new ApplicationException(map.get("msg"));
                }
            } else {
                throw new ApplicationException(callBackMessage.getError());
            }
        }
    }
    private void updateState150109(T150109Entity t150109Entity, CallBackMessage callBackMessage, GateEntity entity) {
        PostDataBaseService mPostDataBaseService = (PostDataBaseService) FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" + callBackMessage.getState() + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t150109H  a where a.doccode='" + t150109Entity.getDocCode() + "' \n select @@rowcount", Integer.class);
        } catch (Exception ex) {
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    150109,
                    t150109Entity.getDocCode(),
                    null,
                    "退款单150109",
                    ex.getMessage().replaceAll("'", "''")
            ));
        } finally {
            SpObserver.setDBtoInstance();
        }
    }
}
src/com/yc/open/yejibao/schedule/T150101Thread.java
@@ -1,25 +1,15 @@
package com.yc.open.yejibao.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yc.exception.ApplicationException;
import com.yc.exception.CallBackMessage;
import com.yc.factory.FactoryBean;
import com.yc.multiData.SpObserver;
import com.yc.open.deli.entity.T110565Entity;
import com.yc.open.deli.service.PostDataBaseService;
import com.yc.open.init.BaseGate;
import com.yc.open.init.InitSystemTaks;
import com.yc.open.init.Task;
import com.yc.open.mutual.schedule.GateEntity;
import com.yc.open.yejibao.controller.YeJiBaoController;
import com.yc.open.yejibao.entry.T150101DetailEntity;
import com.yc.open.yejibao.entry.T150101Entity;
import com.yc.open.yejibao.controller.YeJiBaoHandleController;
import com.yc.open.yejibao.service.YeJiBaoIfc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
 * 推送收款单
@@ -44,35 +34,8 @@
            Task task = checkPoint(entity, TASKID);
            //满足条件才执行
            if (task != null && task.getResult() == 1) {
                T150101Entity result = this.yeJiBaoIfc.getT150101List(entity.getDocCode(), task);
                if (result != null) {
                    for (T150101DetailEntity detail : result.getReceive()) {
                        if (detail.getSoDocStatus() != null && detail.getSoDocStatus() != 100) {
                            //推送不是确认状态销售订单
                            GateEntity gateEntity = new GateEntity();
                            gateEntity.setDocCode(detail.getSoDoccode());
                            gateEntity.setFormid(120201);
                            gateEntity.setDbid(entity.getDbid());
                            Task soTask = InitSystemTaks.getTask(gateEntity, "OP0070");
                            soTask.setCurrentDocStatus(0);
                            yeJiBaoController.pushT120201(gateEntity, soTask);
                        }
                    }
                    String data = JSON.toJSONString(result, SerializerFeature.SortField);
                    CallBackMessage callBackMessage = yeJiBaoController.doPost(task.getApiUrl(), result.getCompanyID(), data);
                    if (callBackMessage.getState() == 0) {
                        Map<String, String> map = JSON.parseObject(callBackMessage.getData(), Map.class);
                        if (String.valueOf(map.get("code")).equals("1")) {
                            //成功
                            callBackMessage.sendSuccessMessage("推送成功");
                            updateState(result, callBackMessage);
                        } else {
                            throw new ApplicationException(map.get("msg"));
                        }
                    }else {
                        throw new ApplicationException(callBackMessage.getError());
                    }
                }
                YeJiBaoHandleController yeJiBaoHandleController = (YeJiBaoHandleController) FactoryBean.getBean("yeJiBaoHandleController");
                yeJiBaoHandleController.call150101(entity, task);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
@@ -82,21 +45,5 @@
            SpObserver.setDBtoInstance();
        }
    }
    private void updateState(T150101Entity t150101Entity,CallBackMessage callBackMessage){
        PostDataBaseService mPostDataBaseService= (PostDataBaseService)FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" +callBackMessage.getState()  + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t150101H  a where a.doccode='" + t150101Entity.getDocCode()+"'",Integer.class);
        }catch (Exception ex){
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    150101,
                    t150101Entity.getDocCode(),
                    null,
                    "收款单150101",
                    ex.getMessage().replaceAll("'", "''")
            ));
        }finally {
            SpObserver.setDBtoInstance();
        }
    }
}
src/com/yc/open/yejibao/schedule/T150109Thread.java
@@ -1,25 +1,15 @@
package com.yc.open.yejibao.schedule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yc.exception.ApplicationException;
import com.yc.exception.CallBackMessage;
import com.yc.factory.FactoryBean;
import com.yc.multiData.SpObserver;
import com.yc.open.deli.entity.T110565Entity;
import com.yc.open.deli.service.PostDataBaseService;
import com.yc.open.init.BaseGate;
import com.yc.open.init.InitSystemTaks;
import com.yc.open.init.Task;
import com.yc.open.mutual.schedule.GateEntity;
import com.yc.open.yejibao.controller.YeJiBaoController;
import com.yc.open.yejibao.entry.T150109DetailEntity;
import com.yc.open.yejibao.entry.T150109Entity;
import com.yc.open.yejibao.controller.YeJiBaoHandleController;
import com.yc.open.yejibao.service.YeJiBaoIfc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
/**
 * 推送收款单
@@ -44,35 +34,8 @@
            Task task = checkPoint(entity, TASKID);
            //满足条件才执行
            if (task != null && task.getResult() == 1) {
                T150109Entity result = this.yeJiBaoIfc.getT150109List(entity.getDocCode(), task);
                if (result != null) {
                    for (T150109DetailEntity detail : result.getRefund()) {
                        if (detail.getSoDocStatus() != null && detail.getSoDocStatus() != 100) {
                            //推送不是确认状态销售订单
                            GateEntity gateEntity = new GateEntity();
                            gateEntity.setDocCode(detail.getSoDoccode());
                            gateEntity.setFormid(120201);
                            gateEntity.setDbid(entity.getDbid());
                            Task soTask = InitSystemTaks.getTask(gateEntity, "OP0070");
                            soTask.setCurrentDocStatus(0);
                            yeJiBaoController.pushT120201(gateEntity, soTask);
                        }
                    }
                    String data = JSON.toJSONString(result, SerializerFeature.SortField);
                    CallBackMessage callBackMessage = yeJiBaoController.doPost(task.getApiUrl(), result.getCompanyID(), data);
                    if (callBackMessage.getState() == 0) {
                        Map<String, String> map = JSON.parseObject(callBackMessage.getData(), Map.class);
                        if (String.valueOf(map.get("code")).equals("1")) {
                            //成功
                            callBackMessage.sendSuccessMessage("推送成功");
                            updateState(result, callBackMessage);
                        } else {
                            throw new ApplicationException(map.get("msg"));
                        }
                    }else {
                        throw new ApplicationException(callBackMessage.getError());
                    }
                }
                YeJiBaoHandleController yeJiBaoHandleController = (YeJiBaoHandleController) FactoryBean.getBean("yeJiBaoHandleController");
                yeJiBaoHandleController.call150109(entity, task);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
@@ -82,21 +45,5 @@
            SpObserver.setDBtoInstance();
        }
    }
    private void updateState(T150109Entity t150109Entity,CallBackMessage callBackMessage){
        PostDataBaseService mPostDataBaseService= (PostDataBaseService)FactoryBean.getBean("postDataBaseService");
        try {
            SpObserver.setDBtoInstance("_" + entity.getDbid());
            mPostDataBaseService.getSimpleJdbcTemplate().queryForObject("update a set a.YeJiBaoPushStatus=" +callBackMessage.getState()  + ",a.YeJiBaoPushDate=getdate(),a.YeJiBaoPushTimes=isnull(a.YeJiBaoPushTimes,0)+1,a.YeJiBaoPushMsg='" + callBackMessage.getSuccess() + "'  from t150109H  a where a.doccode='" + t150109Entity.getDocCode()+"'",Integer.class);
        }catch (Exception ex){
            mPostDataBaseService.doLogBy110565(new T110565Entity(
                    150109,
                    t150109Entity.getDocCode(),
                    null,
                    "退款单150109",
                    ex.getMessage().replaceAll("'", "''")
            ));
        }finally {
            SpObserver.setDBtoInstance();
        }
    }
}
src/com/yc/open/yejibao/service/YeJiBaoImpl.java
@@ -693,7 +693,7 @@
                "    c.discount, c.cv2, c.unsubscribeDoccode\n" +
                " from t120201H b join t120201D c on b.doccode = c.doccode \n" ;
                " from t120201H b left join t120201D c on b.doccode = c.doccode \n";
        sql += " where isnull(b.cccode,'') <> '' \n"+
@@ -748,13 +748,13 @@
                " end \n" +
                " close mycurDeli\n" +
                " deallocate mycurDeli \n" +
                " select sumtotalmoney2,docCode,convert(varchar(10),preSendDate,120) as preSendDate,docType,\n" +
                " select isnull(sumtotalmoney2,0) as sumtotalmoney2,docCode,convert(varchar(10),preSendDate,120) as preSendDate,docType,\n" +
                "    cltCode,cltName,linkMan,ccCode,ccName,hDMemo, tel, \n" +
                "    tel2, propertyAddress,sellerName, shopGuideName,serviceName, \n" +
                "    dengjiname, referralsName,docStatus, docStatusName,convert(varchar(10),docDate,120) as docDate, \n" +
                "    actname,refCode, EnterName,companyId ,companyName,shopGuideCode,\n" +
                "    rowid,DocItem,MatCode ,MatName , special ,\n" +
                "    uom,digit,price,totalmoney,stcode,stname,ItemMemo, \n" +
                "    uom,isnull(digit,0) as digit,isnull(price,0) as price,isnull(totalmoney,0) as totalmoney,stcode,stname,ItemMemo, \n" +
                "    locationName, brand, trademarkPrice, \n" +
                "    discount, cv2, unsubscribeDoccode\n" +
@@ -1033,7 +1033,7 @@
                " declare mycurDeli cursor for\n" +
                " select a.docDate,a.docCode,a.cltCode,a.cltName,a.companyID,a.companyName,a.ccCode,a.ccName,a.amount as sumAmount,a.hdMemo,b.soDoccode,b.amount,a.docType\n" +
                " from t150181H a join t150181D b on a.doccode = b.doccode \n" +
                " from t150181H a left join t150181D b on a.doccode = b.doccode \n" +
                " where  a.docStatus=@mydocStatus \n" +
                "    and a.docCode=@myDocCode \n" +
                " order by a.DocCode\n" +