SOURCE

var biaozhangMoney = "[{\"id\":1,\"company\":\"两湖街道办\",\"rewardmoney\":3.5},{\"id\":2,\"company\":\"洧川镇\",\"rewardmoney\":1.5},{\"id\":3,\"company\":\"张市镇\",\"rewardmoney\":1.5},{\"id\":4,\"company\":\"水坡镇\",\"rewardmoney\":4},{\"id\":5,\"company\":\"邢庄乡\",\"rewardmoney\":4.5},{\"id\":6,\"company\":\"庄头镇\",\"rewardmoney\":1.5},{\"id\":7,\"company\":\"大营镇\",\"rewardmoney\":0.5},{\"id\":8,\"company\":\"大马乡\",\"rewardmoney\":2},{\"id\":9,\"company\":\"岗李乡\",\"rewardmoney\":1.5},{\"id\":10,\"company\":\"门楼任乡\",\"rewardmoney\":0.5},{\"id\":11,\"company\":\"大桥乡\",\"rewardmoney\":2.5},{\"id\":12,\"company\":\"南曹乡\",\"rewardmoney\":1.5},{\"id\":13,\"company\":\"产业集聚区(东区)\",\"rewardmoney\":1},{\"id\":14,\"company\":\"产业聚集区(西区)\",\"rewardmoney\":1},{\"id\":15,\"company\":\"检察院\",\"rewardmoney\":0.3},{\"id\":16,\"company\":\"总工会\",\"rewardmoney\":0.3},{\"id\":17,\"company\":\"信访局\",\"rewardmoney\":0.3},{\"id\":18,\"company\":\"县志办\",\"rewardmoney\":0.3},{\"id\":19,\"company\":\"农业农村局\",\"rewardmoney\":1},{\"id\":20,\"company\":\"交通局\",\"rewardmoney\":0.5},{\"id\":21,\"company\":\"公路局\",\"rewardmoney\":0.5},{\"id\":22,\"company\":\"发改委\",\"rewardmoney\":0.3},{\"id\":23,\"company\":\"城管局\",\"rewardmoney\":0.3},{\"id\":24,\"company\":\"生态环境局\",\"rewardmoney\":0.5},{\"id\":25,\"company\":\"人社局\",\"rewardmoney\":0.8},{\"id\":26,\"company\":\"金融局\",\"rewardmoney\":0.6},{\"id\":27,\"company\":\"公安局\",\"rewardmoney\":0.5},{\"id\":28,\"company\":\"教体局\",\"rewardmoney\":0.5},{\"id\":29,\"company\":\"自然资源局\",\"rewardmoney\":0.5},{\"id\":30,\"company\":\"消防大队\",\"rewardmoney\":0.5}]"

var leaderMoney ="[{\"id\":1,\"company\":\"两湖街道办\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":2,\"company\":\"洧川镇\",\"leaderreward\":0.8,\"leaderpiping\":-0.3},{\"id\":3,\"company\":\"朱曲镇\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":4,\"company\":\"蔡庄镇\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":5,\"company\":\"永兴镇\",\"leaderreward\":1.1,\"leaderpiping\":-0.3},{\"id\":6,\"company\":\"张市镇\",\"leaderreward\":0.5,\"leaderpiping\":-0.6},{\"id\":7,\"company\":\"十八里镇\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":8,\"company\":\"水坡镇\",\"leaderreward\":1.1,\"leaderpiping\":-0.3},{\"id\":9,\"company\":\"邢庄乡\",\"leaderreward\":1.1,\"leaderpiping\":0},{\"id\":10,\"company\":\"庄头镇\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":11,\"company\":\"大营镇\",\"leaderreward\":0.8,\"leaderpiping\":0},{\"id\":12,\"company\":\"大马乡\",\"leaderreward\":0.8,\"leaderpiping\":0},{\"id\":13,\"company\":\"岗李乡\",\"leaderreward\":0.8,\"leaderpiping\":-0.5},{\"id\":14,\"company\":\"大桥乡\",\"leaderreward\":0.8,\"leaderpiping\":0},{\"id\":15,\"company\":\"南曹乡\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":16,\"company\":\"小陈乡\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":17,\"company\":\"产业集聚区(东区)\",\"leaderreward\":0.5,\"leaderpiping\":-0.3},{\"id\":18,\"company\":\"门楼任乡\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":19,\"company\":\"产业集聚区产业集聚区(西区)\",\"leaderreward\":0.8,\"leaderpiping\":-0.3},{\"id\":20,\"company\":\"农业农村局\",\"leaderreward\":0,\"leaderpiping\":0},{\"id\":21,\"company\":\"市场监管局\",\"leaderreward\":0.3,\"leaderpiping\":0},{\"id\":22,\"company\":\"住建局\",\"leaderreward\":0.6,\"leaderpiping\":0},{\"id\":23,\"company\":\"重点项目办\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":24,\"company\":\"统计局\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":25,\"company\":\"财政局\",\"leaderreward\":0.5,\"leaderpiping\":0},{\"id\":26,\"company\":\"卫健委\",\"leaderreward\":0.3,\"leaderpiping\":0},{\"id\":27,\"company\":\"疾控中心\",\"leaderreward\":0.3,\"leaderpiping\":0},{\"id\":28,\"company\":\"纪委\",\"leaderreward\":0.3,\"leaderpiping\":0},{\"id\":29,\"company\":\"自然资源局\",\"leaderreward\":0.6,\"leaderpiping\":0}]"

var duchaMoney = "[{\"id\":1,\"company\":\"洧川镇\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":2,\"company\":\"蔡庄镇\",\"duchareward\":0.5,\"duchapiping\":-0.5},{\"id\":3,\"company\":\"永兴镇\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":4,\"company\":\"张市镇\",\"duchareward\":0,\"duchapiping\":-0.5},{\"id\":5,\"company\":\"庄头镇\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":6,\"company\":\"大营镇\",\"duchareward\":1,\"duchapiping\":0},{\"id\":7,\"company\":\"岗李乡\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":8,\"company\":\"门楼任乡\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":9,\"company\":\"大桥乡\",\"duchareward\":0,\"duchapiping\":-0.5},{\"id\":10,\"company\":\"南曹乡\",\"duchareward\":0,\"duchapiping\":-0.5},{\"id\":11,\"company\":\"产业集聚区(东区)\",\"duchareward\":0.5,\"duchapiping\":0},{\"id\":12,\"company\":\"产业集聚区(西区)\",\"duchareward\":0,\"duchapiping\":-0.5},{\"id\":13,\"company\":\"房屋征收办\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":14,\"company\":\"纪委\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":15,\"company\":\"法院\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":16,\"company\":\"信访局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":17,\"company\":\"残联\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":18,\"company\":\"乡村振兴局\",\"duchareward\":0.6,\"duchapiping\":0},{\"id\":19,\"company\":\"农业农村局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":20,\"company\":\"气象局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":21,\"company\":\"科工信局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":22,\"company\":\"交通局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":23,\"company\":\"电信公司\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":24,\"company\":\"供电公司\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":25,\"company\":\"商务局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":26,\"company\":\"招商中心\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":27,\"company\":\"发改委\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":28,\"company\":\"城管局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":29,\"company\":\"生态环境局\",\"duchareward\":0.6,\"duchapiping\":0},{\"id\":30,\"company\":\"财政局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":31,\"company\":\"金融局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":32,\"company\":\"公安局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":33,\"company\":\"民政局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":34,\"company\":\"职教中心\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":35,\"company\":\"消防大队\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":36,\"company\":\"UK中心小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":37,\"company\":\"爱卫办\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":38,\"company\":\"城关第二供电所\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":39,\"company\":\"城市今典小区\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":40,\"company\":\"电大附中\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":41,\"company\":\"福润隆苑小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":42,\"company\":\"橄榄城二期小区\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":43,\"company\":\"橄榄城三期御府小区\",\"duchareward\":0,\"duchapiping\":-0.4},{\"id\":44,\"company\":\"工商行\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":45,\"company\":\"供电光利尉氏分公司\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":46,\"company\":\"光明花园小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":47,\"company\":\"国寿保险\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":48,\"company\":\"韩庄小学\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":49,\"company\":\"合益银行\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":50,\"company\":\"宏宇国际城一期小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":51,\"company\":\"宏宇壹号院小区\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":52,\"company\":\"汇金华府小区\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":53,\"company\":\"机关事务局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":54,\"company\":\"建设路派出所\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":55,\"company\":\"建设路税务分局\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":56,\"company\":\"建设银行尉氏支行\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":57,\"company\":\"交通地方管理所\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":58,\"company\":\"金润城市花园小区\",\"duchareward\":0,\"duchapiping\":-0.4},{\"id\":59,\"company\":\"金沙国际小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":60,\"company\":\"金沙湾VIP公寓小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":61,\"company\":\"锦绣花园小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":62,\"company\":\"开封二实高\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":63,\"company\":\"绿城林苑小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":64,\"company\":\"农发行尉氏支行\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":65,\"company\":\"农行\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":66,\"company\":\"农商银行\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":67,\"company\":\"农业中心\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":68,\"company\":\"清华苑小区\",\"duchareward\":0,\"duchapiping\":-0.6},{\"id\":69,\"company\":\"人保公司\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":70,\"company\":\"人寿公司尉氏分公司\",\"duchareward\":0,\"duchapiping\":-0.4},{\"id\":71,\"company\":\"三师附小(南校区)\",\"duchareward\":0.6,\"duchapiping\":0},{\"id\":72,\"company\":\"三星花园小区\",\"duchareward\":0,\"duchapiping\":-0.6},{\"id\":73,\"company\":\"三中(南校区)\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":74,\"company\":\"森林公安局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":75,\"company\":\"上海公馆小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":76,\"company\":\"实验二小\",\"duchareward\":0,\"duchapiping\":-0.4},{\"id\":77,\"company\":\"实验中学\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":78,\"company\":\"水岸皇城小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":79,\"company\":\"宋韵尚品小区\",\"duchareward\":0,\"duchapiping\":-0.6},{\"id\":80,\"company\":\"太平洋财险\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":81,\"company\":\"天御华府小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":82,\"company\":\"尉氏碧桂园小区\",\"duchareward\":0.6,\"duchapiping\":0},{\"id\":83,\"company\":\"武警中队\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":84,\"company\":\"县二院\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":85,\"company\":\"县社\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":86,\"company\":\"县直第二幼儿园\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":87,\"company\":\"县直第一幼儿园\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":88,\"company\":\"应急局\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":89,\"company\":\"永美大公馆小区\",\"duchareward\":0.9,\"duchapiping\":0},{\"id\":90,\"company\":\"邮储银行\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":91,\"company\":\"御景城小区\",\"duchareward\":0,\"duchapiping\":-0.2},{\"id\":92,\"company\":\"中国人民银行尉氏支行\",\"duchareward\":0.6,\"duchapiping\":0},{\"id\":93,\"company\":\"中国邮政公司尉氏分公司\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":94,\"company\":\"中医院\",\"duchareward\":0.3,\"duchapiping\":0},{\"id\":95,\"company\":\"中原农险\",\"duchareward\":0,\"duchapiping\":-0.2}]"

ResultData = function (id, company, biaozhangMoney, leaderReward, leaderpiping, duchaReward, duchapiping) {
    this.id = id,
        this.company = company,
        this.biaozhangMoney = biaozhangMoney,
        this.leaderReward = leaderReward,
        this.leaderpiping = leaderpiping,
        this.duchaReward = duchaReward,
        this.duchapiping = duchapiping
}

var resultDatas = new Array;
var itemId = 0
/***************首先将表彰表内容加入结果表中************** */
var biaozhangData = JSON.parse(biaozhangMoney)
for (var i = 0; i < biaozhangData.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: biaozhangData[i].company,
        biaozhangMoney: biaozhangData[i].rewardmoney,
        leaderReward: 0,
        leaderpiping: 0,
        duchaReward: 0,
        duchapiping: 0
    };
    resultDatas.push(resultdata)
}

/**************然后,将领导奖罚表数据填充至结果表中***************** */
var leaderDatas = JSON.parse(leaderMoney)

for (var j = 0; j < resultDatas.length; j++) {
    var nowCompany = resultDatas[j].company
    for (var i = leaderDatas.length - 1; i >= 0; i--) {

        if (leaderDatas[i].company == nowCompany) {

            resultDatas[j].leaderReward = leaderDatas[i].leaderreward
            resultDatas[j].leaderpiping = leaderDatas[i].leaderpiping

            leaderDatas.splice(i, 1);
            break;
        }
    }
}

for (var i = 0; i < leaderDatas.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: leaderDatas[i].company,
        biaozhangMoney: 0,
        leaderReward: leaderDatas[i].leaderreward,
        leaderpiping: leaderDatas[i].leaderpiping,
        duchaReward: 0,
        duchapiping: 0
    }
    resultDatas.push(resultdata)
}

/*********************处理督查通报问题************************** */
var duchaDatas = JSON.parse(duchaMoney)
for (var j = 0; j < resultDatas.length; j++) {
    var nowCompany = resultDatas[j].company
    for (var i = duchaDatas.length - 1; i >= 0; i--) {

        if (duchaDatas[i].company == nowCompany) {

            resultDatas[j].duchaReward = duchaDatas[i].duchareward
            resultDatas[j].duchapiping = duchaDatas[i].duchapiping

            duchaDatas.splice(i, 1);
            break;
        }
    }
}
for (var i = 0; i < duchaDatas.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: duchaDatas[i].company,
        biaozhangMoney: 0,
        leaderReward: 0,
        leaderpiping: 0,
        duchaReward: duchaDatas[i].duchareward,
        duchapiping: duchaDatas[i].duchapiping
    }
    resultDatas.push(resultdata)
}



document.write( JSON.stringify(resultDatas))
console 命令行工具 X clear

                    
>
console