var fnDataCamcel = require('../../Plugins/fn-common-data-camcel.js');
var fnBusiness = require('../../Plugins/fn-common-data-business.js');
const dayjs = require('../../Plugins/dayjs/dayjs.min.js');
module.exports = function (callback, result, params, args) {
let argResult = JSON.parse(result);
let paramsTemp = JSON.parse(params);
fnDataCamcel.toLowerCamcelByObject(argResult, paramsTemp["_null"] !== "true");
if (argResult.children) {
fnDataCamcel.mergeBsObject(argResult.data, argResult.children);
delete argResult.children;
}
//自定义业务数据特殊处理,通过 params={_rmt,_mkey,_resField}l
argResult = fnBusiness.doBusiness(argResult, paramsTemp);
if (argResult.success === true) {
//进行业务数据处理
//保障年数 bdYear bzJfMethod.value 1 年缴 2 月缴
let dimStatus = {};
argResult.dimension.status.forEach(temp => {
dimStatus[temp.value] = temp;
});
argResult.data.forEach(temp => {
let bdStartDateT = temp.policy.bdStartDate.value;
let bzJfMethod = (temp.bzJfMethod || {}).value || 1;
let bdYear = temp.bdYear||30;
let step = 1;
let bdQ = bdYear * 12;
if (bzJfMethod === 1) {
step = 12;
}
let i = 0;
let statusT = {};
temp.mqStatus.forEach(tempS => {
statusT[tempS.paymentDate.name] = tempS;
});
//重新清空数据
temp.mqStatus = [];
while (i < bdQ) {
let dataC = {
paymentDate: {
name: dayjs(bdStartDateT).add(i, "month").format('YYYY-MM-DD'),
value: dayjs(bdStartDateT).add(8, 'hour').add(i, "month"),
},
status: dimStatus['0'],
policyStatusId: null,
policyItemId: temp.policyItemId
};
if (statusT[dataC.paymentDate.name]) {
statusT[dataC.paymentDate.name].batO = "ui";
temp.mqStatus.push(statusT[dataC.paymentDate.name]);
} else {
dataC.batO = "ui";
temp.mqStatus.push(dataC);
}
i = i + step;
}
temp.bdStartDateT = bdStartDateT;
});
}
if (argResult.dimension) {
delete argResult.dimension;
}
if (argResult.schema) {
delete argResult.schema;
}
callback(null, argResult);
};
文档更新时间: 2021-07-04 08:00 作者:admin