liming %!s(int64=4) %!d(string=hai) anos
pai
achega
5271595fd8

+ 1 - 1
app/controller/.tPolicyDeclaration.js

@@ -20,7 +20,7 @@ module.exports = {
             'current_approval_id',
             'current_approval',
             'approval_info',
-            '!image',
+            'image',
             'create_time',
             'update_time',
             'enclosure'

+ 6 - 0
app/controller/tGovernmentStatistics.js

@@ -85,6 +85,12 @@ class TGovernmentStatisticsController extends Controller {
         this.ctx.ok({ data: res });
     }
 
+    // 银行统计
+    async bank() {
+        const res = await this.service.bank(this.ctx.query);
+        this.ctx.ok({ ...res });
+    }
+
 }
 
 module.exports = CrudController(TGovernmentStatisticsController, meta);

+ 1 - 1
app/model/tPolicyDeclaration.js

@@ -41,7 +41,7 @@ const TPolicyDeclarationSchema = {
     current_approval: {type: String, default: ''},//审批人
     approval_info: {type: [approvalInfo], required: false}, // 审批信息
     enclosure: {type: [enclosure], required: false}, // 附件
-    image: {type: String, required: true},//图片
+    image: {type: String, required: false},//图片
     create_time: {type: Number, default: Date.now},//创建时间
     update_time: {type: Number, default: Date.now},//更新时间
 };

+ 1 - 0
app/router.js

@@ -170,6 +170,7 @@ module.exports = app => {
   router.get('/api/financial/tGovernmentStatistics/financialProducts', controller.tGovernmentStatistics.financialProducts);
   router.get('/api/financial/tGovernmentStatistics/financialInstitution', controller.tGovernmentStatistics.financialInstitution);
   router.get('/api/financial/tGovernmentStatistics/pageSelect', controller.tGovernmentStatistics.pageSelect);
+  router.get('/api/financial/tGovernmentStatistics/bank', controller.tGovernmentStatistics.bank);
   router.resources('tGovernmentStatistics', '/api/financial/tGovernmentStatistics', controller.tGovernmentStatistics); // index、create、show、destroy
   router.post('tGovernmentStatistics', '/api/financial/tGovernmentStatistics/update/:id', controller.tGovernmentStatistics.update);
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1186 - 0
app/service/tGovernmentStatistics.js


+ 322 - 0
app/service/tNewAssign.js

@@ -342,6 +342,73 @@ class TNewAssignService extends CrudService {
 
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "t_finance_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [   {
+                                                        $eq: ['$finceType', "0"]
+                                                    },
+                                                        {
+                                                            $eq: ['$finceId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "t_finance_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$t_finance_follows"
+                                }, 0]
+                            },
+                            then: {orcredit:"9"},
+                            else : { $arrayElemAt: [ "$t_finance_follows", 0 ] },
+                        }
+                    },
+
+                }
+            },
             {
                 $match: match,
 
@@ -617,6 +684,73 @@ class TNewAssignService extends CrudService {
 
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "t_finance_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [   {
+                                                        $eq: ['$finceType', "0"]
+                                                    },
+                                                        {
+                                                            $eq: ['$finceId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "t_finance_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$t_finance_follows"
+                                }, 0]
+                            },
+                            then: {orcredit:"9"},
+                            else : { $arrayElemAt: [ "$t_finance_follows", 0 ] },
+                        }
+                    },
+
+                }
+            },
             {
                 $match: match,
 
@@ -945,6 +1079,100 @@ class TNewAssignService extends CrudService {
                     when: 1,
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "intelligent_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [
+                                                        {
+                                                            $eq: ['$intelligentId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "intelligent_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    intelligent_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$intelligent_follows"
+                                }, 0]
+                            },
+                            then: {creditStatus:"9"},
+                            else : { $arrayElemAt: [ "$intelligent_follows", 0 ] },
+                        }
+                    },
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    finance_follow: {orcredit:"$intelligent_follow.creditStatus"},
+                }
+            },
             {
                 $match: match,
 
@@ -1219,6 +1447,100 @@ class TNewAssignService extends CrudService {
                     when: 1,
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "intelligent_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [
+                                                        {
+                                                            $eq: ['$intelligentId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "intelligent_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    intelligent_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$intelligent_follows"
+                                }, 0]
+                            },
+                            then: {creditStatus:"9"},
+                            else : { $arrayElemAt: [ "$intelligent_follows", 0 ] },
+                        }
+                    },
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    finance_follow: {orcredit:"$intelligent_follow.creditStatus"},
+                }
+            },
             {
                 $match: match,
 

+ 526 - 0
app/service/tUrgeHandle.js

@@ -342,6 +342,175 @@ class TUrgeHandleService extends CrudService {
 
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "t_finance_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [   {
+                                                        $eq: ['$finceType', "0"]
+                                                    },
+                                                        {
+                                                            $eq: ['$finceId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "t_finance_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$t_finance_follows"
+                                }, 0]
+                            },
+                            then: {
+                                orcredit: "9",
+                                credit_time: {
+                                    $toDouble: "$meta.createdAt"
+                                }
+                            },
+                            else : {
+                                $arrayElemAt: ["$t_finance_follows", 0]
+                            },
+
+                        }
+                    },
+                    demand_time: {
+                        $toDouble: "$meta.createdAt"
+                    },
+
+                }
+            },
+            {
+                $addFields: {
+                    current_time: Date.now(),
+
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: 1,
+                    demand_time: 1,
+                    current_time: 1,
+                    next_is_timeout: {
+                        $switch:
+                            {
+                                branches: [
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '9']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', '$finance_follow.credit_time' ] }, 86400000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '0']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', {$toDouble: "$finance_follow.meta.createdAt"} ] }, 604800000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '2']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', {$toDouble: '$finance_follow.credit_time'} ] }, 604800000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                ],
+                                default: "2"
+                            }
+                    },
+
+                }
+            },
             {
                 $match: match,
 
@@ -617,6 +786,175 @@ class TUrgeHandleService extends CrudService {
 
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "t_finance_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [   {
+                                                        $eq: ['$finceType', "0"]
+                                                    },
+                                                        {
+                                                            $eq: ['$finceId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "t_finance_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$t_finance_follows"
+                                }, 0]
+                            },
+                            then: {
+                                orcredit: "9",
+                                credit_time: {
+                                    $toDouble: "$meta.createdAt"
+                                }
+                            },
+                            else : {
+                                $arrayElemAt: ["$t_finance_follows", 0]
+                            },
+
+                        }
+                    },
+                    demand_time: {
+                        $toDouble: "$meta.createdAt"
+                    },
+
+                }
+            },
+            {
+                $addFields: {
+                    current_time: Date.now(),
+
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    use: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    project_status: 1,
+                    remarks: 1,
+                    cdata: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    finance_follow: 1,
+                    demand_time: 1,
+                    current_time: 1,
+                    next_is_timeout: {
+                        $switch:
+                            {
+                                branches: [
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '9']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', '$finance_follow.credit_time' ] }, 86400000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '0']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', {$toDouble: "$finance_follow.meta.createdAt"} ] }, 604800000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                    {
+                                        case: {
+                                            $eq: ['$finance_follow.orcredit', '2']
+                                        },
+                                        then: {
+                                            $cond: {
+                                                if : {
+                                                    $gt: [{ $subtract: [ '$current_time', {$toDouble: '$finance_follow.credit_time'} ] }, 604800000]
+                                                },
+                                                then: '1',
+                                                else : '2',
+
+                                            }
+                                        },
+
+                                    },
+                                ],
+                                default: "2"
+                            }
+                    },
+
+                }
+            },
             {
                 $match: match,
 
@@ -945,6 +1283,100 @@ class TUrgeHandleService extends CrudService {
                     when: 1,
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "intelligent_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [
+                                                        {
+                                                            $eq: ['$intelligentId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "intelligent_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    intelligent_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$intelligent_follows"
+                                }, 0]
+                            },
+                            then: {creditStatus:"9"},
+                            else : { $arrayElemAt: [ "$intelligent_follows", 0 ] },
+                        }
+                    },
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    finance_follow: {orcredit:"$intelligent_follow.creditStatus"},
+                }
+            },
             {
                 $match: match,
 
@@ -1219,6 +1651,100 @@ class TUrgeHandleService extends CrudService {
                     when: 1,
                 }
             },
+            {
+                $lookup:
+                    {
+                        from: "intelligent_follow",
+                        let: {
+                            demand_id: "$demand_id"
+                        },
+                        pipeline: [
+                            {
+                                $match:
+                                    {
+                                        $expr:
+                                            {
+                                                $and:
+                                                    [
+                                                        {
+                                                            $eq: ['$intelligentId', "$$demand_id"]
+                                                        },
+
+                                                    ]
+                                            }
+                                    }
+                            },
+
+                        ],
+                        as: "intelligent_follows"
+                    }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    intelligent_follow: {
+                        $cond: {
+                            if : {
+                                $eq: [{
+                                    $size: "$intelligent_follows"
+                                }, 0]
+                            },
+                            then: {creditStatus:"9"},
+                            else : { $arrayElemAt: [ "$intelligent_follows", 0 ] },
+                        }
+                    },
+                }
+            },
+            {
+                $project: {
+                    jg_id: 1,
+                    jg_pro_id: 1,
+                    userid: 1,
+                    money: 1,
+                    mongey_min_rate: 1,
+                    mongey_max_rate: 1,
+                    claims_min_term: 1,
+                    claims_max_term: 1,
+                    remarks: 1,
+                    ensure_id: 1,
+                    ensure_name: 1,
+                    demand_id: 1,
+                    company_name: 1,
+                    institution_name: 1,
+                    product_name: 1,
+                    is_exist: 1,
+                    information: 1,
+                    meta: 1,
+                    person: 1,
+                    phone: 1,
+                    opening_bank: 1,
+                    orientation: 1,
+                    when: 1,
+                    finance_follow: {orcredit:"$intelligent_follow.creditStatus"},
+                }
+            },
             {
                 $match: match,