fix: 修复中介导入成功条数计算错误
问题: - 导入成功条数显示为负数 - 原因:成功数量计算使用 validRecords.size() - failures.size() - 但没有使用实际的数据库操作返回值 修复: - saveBatchWithUpsert 和 saveBatch 方法现在返回 int - 累加实际的数据库影响行数 - 使用 actualSuccessCount 变量跟踪真实成功数量 影响范围: - CcdiIntermediaryPersonImportServiceImpl - CcdiIntermediaryEntityImportServiceImpl
This commit is contained in:
122
doc/test-data/purchase_transaction/node_modules/buffers/README.markdown
generated
vendored
Normal file
122
doc/test-data/purchase_transaction/node_modules/buffers/README.markdown
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
buffers
|
||||
=======
|
||||
|
||||
Treat a collection of Buffers as a single contiguous partially mutable Buffer.
|
||||
|
||||
Where possible, operations execute without creating a new Buffer and copying
|
||||
everything over.
|
||||
|
||||
This is a cleaner more Buffery rehash of
|
||||
[bufferlist](http://github.com/substack/node-bufferlist).
|
||||
|
||||
example
|
||||
=======
|
||||
|
||||
slice
|
||||
-----
|
||||
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer([1,2,3]));
|
||||
bufs.push(new Buffer([4,5,6,7]));
|
||||
bufs.push(new Buffer([8,9,10]));
|
||||
|
||||
console.dir(bufs.slice(2,8))
|
||||
|
||||
output:
|
||||
|
||||
$ node examples/slice.js
|
||||
<Buffer 03 04 05 06 07 08>
|
||||
|
||||
splice
|
||||
------
|
||||
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers([
|
||||
new Buffer([1,2,3]),
|
||||
new Buffer([4,5,6,7]),
|
||||
new Buffer([8,9,10]),
|
||||
]);
|
||||
|
||||
var removed = bufs.splice(2, 4);
|
||||
console.dir({
|
||||
removed : removed.slice(),
|
||||
bufs : bufs.slice(),
|
||||
});
|
||||
|
||||
output:
|
||||
|
||||
$ node examples/splice.js
|
||||
{ removed: <Buffer 03 04 05 06>,
|
||||
bufs: <Buffer 01 02 07 08 09 0a> }
|
||||
|
||||
methods
|
||||
=======
|
||||
|
||||
Buffers(buffers)
|
||||
----------------
|
||||
|
||||
Create a Buffers with an array of `Buffer`s if specified, else `[]`.
|
||||
|
||||
.push(buf1, buf2...)
|
||||
--------------------
|
||||
|
||||
Push buffers onto the end. Just like `Array.prototype.push`.
|
||||
|
||||
.unshift(buf1, buf2...)
|
||||
-----------------------
|
||||
|
||||
Unshift buffers onto the head. Just like `Array.prototype.unshift`.
|
||||
|
||||
.slice(i, j)
|
||||
------------
|
||||
|
||||
Slice a range out of the buffer collection as if it were contiguous.
|
||||
Works just like the `Array.prototype.slice` version.
|
||||
|
||||
.splice(i, howMany, replacements)
|
||||
---------------------------------
|
||||
|
||||
Splice the buffer collection as if it were contiguous.
|
||||
Works just like `Array.prototype.splice`, even the replacement part!
|
||||
|
||||
.copy(dst, dstStart, start, end)
|
||||
--------------------------------
|
||||
|
||||
Copy the buffer collection as if it were contiguous to the `dst` Buffer with the
|
||||
specified bounds.
|
||||
Works just like `Buffer.prototype.copy`.
|
||||
|
||||
.get(i)
|
||||
-------
|
||||
|
||||
Get a single element at index `i`.
|
||||
|
||||
.set(i, x)
|
||||
----------
|
||||
|
||||
Set a single element's value at index `i`.
|
||||
|
||||
.indexOf(needle, offset)
|
||||
----------
|
||||
|
||||
Find a string or buffer `needle` inside the buffer collection. Returns
|
||||
the position of the search string or -1 if the search string was not
|
||||
found.
|
||||
|
||||
Provide an `offset` to skip that number of characters at the beginning
|
||||
of the search. This can be used to find additional matches.
|
||||
|
||||
This function will return the correct result even if the search string
|
||||
is spread out over multiple internal buffers.
|
||||
|
||||
.toBuffer()
|
||||
-----------
|
||||
|
||||
Convert the buffer collection to a single buffer, equivalent with `.slice(0, buffers.length)`;
|
||||
|
||||
.toString(encoding, start, end)
|
||||
-----------
|
||||
|
||||
Decodes and returns a string from the buffer collection.
|
||||
Works just like `Buffer.prototype.toString`
|
||||
9
doc/test-data/purchase_transaction/node_modules/buffers/examples/slice.js
generated
vendored
Normal file
9
doc/test-data/purchase_transaction/node_modules/buffers/examples/slice.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers();
|
||||
bufs.push(new Buffer([1,2,3]));
|
||||
bufs.push(new Buffer([4,5,6,7]));
|
||||
bufs.push(new Buffer([8,9,10]));
|
||||
|
||||
console.dir(bufs.slice(2,8))
|
||||
|
||||
// Output: <Buffer 03 04 05 06 07 08>
|
||||
17
doc/test-data/purchase_transaction/node_modules/buffers/examples/splice.js
generated
vendored
Normal file
17
doc/test-data/purchase_transaction/node_modules/buffers/examples/splice.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
var Buffers = require('buffers');
|
||||
var bufs = Buffers([
|
||||
new Buffer([1,2,3]),
|
||||
new Buffer([4,5,6,7]),
|
||||
new Buffer([8,9,10]),
|
||||
]);
|
||||
|
||||
var removed = bufs.splice(2, 4, new Buffer('ab'), new Buffer('cd'));
|
||||
console.dir({
|
||||
removed : removed.slice(),
|
||||
bufs : bufs.slice(),
|
||||
});
|
||||
|
||||
/* Output:
|
||||
{ removed: <Buffer 03 04 05 06>,
|
||||
bufs: <Buffer 01 02 07 08 09 0a> }
|
||||
*/
|
||||
269
doc/test-data/purchase_transaction/node_modules/buffers/index.js
generated
vendored
Normal file
269
doc/test-data/purchase_transaction/node_modules/buffers/index.js
generated
vendored
Normal file
@@ -0,0 +1,269 @@
|
||||
module.exports = Buffers;
|
||||
|
||||
function Buffers (bufs) {
|
||||
if (!(this instanceof Buffers)) return new Buffers(bufs);
|
||||
this.buffers = bufs || [];
|
||||
this.length = this.buffers.reduce(function (size, buf) {
|
||||
return size + buf.length
|
||||
}, 0);
|
||||
}
|
||||
|
||||
Buffers.prototype.push = function () {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (!Buffer.isBuffer(arguments[i])) {
|
||||
throw new TypeError('Tried to push a non-buffer');
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var buf = arguments[i];
|
||||
this.buffers.push(buf);
|
||||
this.length += buf.length;
|
||||
}
|
||||
return this.length;
|
||||
};
|
||||
|
||||
Buffers.prototype.unshift = function () {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (!Buffer.isBuffer(arguments[i])) {
|
||||
throw new TypeError('Tried to unshift a non-buffer');
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var buf = arguments[i];
|
||||
this.buffers.unshift(buf);
|
||||
this.length += buf.length;
|
||||
}
|
||||
return this.length;
|
||||
};
|
||||
|
||||
Buffers.prototype.copy = function (dst, dStart, start, end) {
|
||||
return this.slice(start, end).copy(dst, dStart, 0, end - start);
|
||||
};
|
||||
|
||||
Buffers.prototype.splice = function (i, howMany) {
|
||||
var buffers = this.buffers;
|
||||
var index = i >= 0 ? i : this.length - i;
|
||||
var reps = [].slice.call(arguments, 2);
|
||||
|
||||
if (howMany === undefined) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
else if (howMany > this.length - index) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
|
||||
for (var i = 0; i < reps.length; i++) {
|
||||
this.length += reps[i].length;
|
||||
}
|
||||
|
||||
var removed = new Buffers();
|
||||
var bytes = 0;
|
||||
|
||||
var startBytes = 0;
|
||||
for (
|
||||
var ii = 0;
|
||||
ii < buffers.length && startBytes + buffers[ii].length < index;
|
||||
ii ++
|
||||
) { startBytes += buffers[ii].length }
|
||||
|
||||
if (index - startBytes > 0) {
|
||||
var start = index - startBytes;
|
||||
|
||||
if (start + howMany < buffers[ii].length) {
|
||||
removed.push(buffers[ii].slice(start, start + howMany));
|
||||
|
||||
var orig = buffers[ii];
|
||||
//var buf = new Buffer(orig.length - howMany);
|
||||
var buf0 = new Buffer(start);
|
||||
for (var i = 0; i < start; i++) {
|
||||
buf0[i] = orig[i];
|
||||
}
|
||||
|
||||
var buf1 = new Buffer(orig.length - start - howMany);
|
||||
for (var i = start + howMany; i < orig.length; i++) {
|
||||
buf1[ i - howMany - start ] = orig[i]
|
||||
}
|
||||
|
||||
if (reps.length > 0) {
|
||||
var reps_ = reps.slice();
|
||||
reps_.unshift(buf0);
|
||||
reps_.push(buf1);
|
||||
buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
|
||||
ii += reps_.length;
|
||||
reps = [];
|
||||
}
|
||||
else {
|
||||
buffers.splice(ii, 1, buf0, buf1);
|
||||
//buffers[ii] = buf;
|
||||
ii += 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
removed.push(buffers[ii].slice(start));
|
||||
buffers[ii] = buffers[ii].slice(0, start);
|
||||
ii ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (reps.length > 0) {
|
||||
buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
|
||||
ii += reps.length;
|
||||
}
|
||||
|
||||
while (removed.length < howMany) {
|
||||
var buf = buffers[ii];
|
||||
var len = buf.length;
|
||||
var take = Math.min(len, howMany - removed.length);
|
||||
|
||||
if (take === len) {
|
||||
removed.push(buf);
|
||||
buffers.splice(ii, 1);
|
||||
}
|
||||
else {
|
||||
removed.push(buf.slice(0, take));
|
||||
buffers[ii] = buffers[ii].slice(take);
|
||||
}
|
||||
}
|
||||
|
||||
this.length -= removed.length;
|
||||
|
||||
return removed;
|
||||
};
|
||||
|
||||
Buffers.prototype.slice = function (i, j) {
|
||||
var buffers = this.buffers;
|
||||
if (j === undefined) j = this.length;
|
||||
if (i === undefined) i = 0;
|
||||
|
||||
if (j > this.length) j = this.length;
|
||||
|
||||
var startBytes = 0;
|
||||
for (
|
||||
var si = 0;
|
||||
si < buffers.length && startBytes + buffers[si].length <= i;
|
||||
si ++
|
||||
) { startBytes += buffers[si].length }
|
||||
|
||||
var target = new Buffer(j - i);
|
||||
|
||||
var ti = 0;
|
||||
for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
|
||||
var len = buffers[ii].length;
|
||||
|
||||
var start = ti === 0 ? i - startBytes : 0;
|
||||
var end = ti + len >= j - i
|
||||
? Math.min(start + (j - i) - ti, len)
|
||||
: len
|
||||
;
|
||||
|
||||
buffers[ii].copy(target, ti, start, end);
|
||||
ti += end - start;
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
Buffers.prototype.pos = function (i) {
|
||||
if (i < 0 || i >= this.length) throw new Error('oob');
|
||||
var l = i, bi = 0, bu = null;
|
||||
for (;;) {
|
||||
bu = this.buffers[bi];
|
||||
if (l < bu.length) {
|
||||
return {buf: bi, offset: l};
|
||||
} else {
|
||||
l -= bu.length;
|
||||
}
|
||||
bi++;
|
||||
}
|
||||
};
|
||||
|
||||
Buffers.prototype.get = function get (i) {
|
||||
var pos = this.pos(i);
|
||||
|
||||
return this.buffers[pos.buf].get(pos.offset);
|
||||
};
|
||||
|
||||
Buffers.prototype.set = function set (i, b) {
|
||||
var pos = this.pos(i);
|
||||
|
||||
return this.buffers[pos.buf].set(pos.offset, b);
|
||||
};
|
||||
|
||||
Buffers.prototype.indexOf = function (needle, offset) {
|
||||
if ("string" === typeof needle) {
|
||||
needle = new Buffer(needle);
|
||||
} else if (needle instanceof Buffer) {
|
||||
// already a buffer
|
||||
} else {
|
||||
throw new Error('Invalid type for a search string');
|
||||
}
|
||||
|
||||
if (!needle.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!this.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var i = 0, j = 0, match = 0, mstart, pos = 0;
|
||||
|
||||
// start search from a particular point in the virtual buffer
|
||||
if (offset) {
|
||||
var p = this.pos(offset);
|
||||
i = p.buf;
|
||||
j = p.offset;
|
||||
pos = offset;
|
||||
}
|
||||
|
||||
// for each character in virtual buffer
|
||||
for (;;) {
|
||||
while (j >= this.buffers[i].length) {
|
||||
j = 0;
|
||||
i++;
|
||||
|
||||
if (i >= this.buffers.length) {
|
||||
// search string not found
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
var char = this.buffers[i][j];
|
||||
|
||||
if (char == needle[match]) {
|
||||
// keep track where match started
|
||||
if (match == 0) {
|
||||
mstart = {
|
||||
i: i,
|
||||
j: j,
|
||||
pos: pos
|
||||
};
|
||||
}
|
||||
match++;
|
||||
if (match == needle.length) {
|
||||
// full match
|
||||
return mstart.pos;
|
||||
}
|
||||
} else if (match != 0) {
|
||||
// a partial match ended, go back to match starting position
|
||||
// this will continue the search at the next character
|
||||
i = mstart.i;
|
||||
j = mstart.j;
|
||||
pos = mstart.pos;
|
||||
match = 0;
|
||||
}
|
||||
|
||||
j++;
|
||||
pos++;
|
||||
}
|
||||
};
|
||||
|
||||
Buffers.prototype.toBuffer = function() {
|
||||
return this.slice();
|
||||
}
|
||||
|
||||
Buffers.prototype.toString = function(encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding);
|
||||
}
|
||||
14
doc/test-data/purchase_transaction/node_modules/buffers/package.json
generated
vendored
Normal file
14
doc/test-data/purchase_transaction/node_modules/buffers/package.json
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name" : "buffers",
|
||||
"description" : "Treat a collection of Buffers as a single contiguous partially mutable Buffer.",
|
||||
"version" : "0.1.1",
|
||||
"repository" : "http://github.com/substack/node-buffers.git",
|
||||
"author" : "James Halliday <mail@substack.net> (http://substack.net)",
|
||||
"main" : "./index",
|
||||
"scripts" : {
|
||||
"test" : "expresso"
|
||||
},
|
||||
"engines" : {
|
||||
"node" : ">=0.2.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user