| 
                
               | 
              
                
               | 
              
                @@ -92,7 +92,6 @@ def generate_files_from_qiniu(file_urls): 
               | 
            
            
            
              | 
                92
               | 
              
                92
               | 
              
                  
               | 
            
            
            
              | 
                93
               | 
              
                93
               | 
              
                 def upload_contribution_images(contribution_id): 
               | 
            
            
            
              | 
                94
               | 
              
                94
               | 
              
                     # 上传MemberActivityContributionInfo图片 https://qian.tencent.com/developers/companyApis/templatesAndFiles/UploadFiles 
               | 
            
            
            
              | 
                95
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                96
               | 
              
                95
               | 
              
                     contribtuon = MemberActivityContributionInfo.objects.get(contribution_id=contribution_id) 
               | 
            
            
            
              | 
                97
               | 
              
                96
               | 
              
                  
               | 
            
            
            
              | 
                98
               | 
              
                97
               | 
              
                     file_urls = [image['image_url'] for image in contribtuon.images] 
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -119,7 +118,6 @@ def upload_contribution_images(contribution_id): 
               | 
            
            
            
              | 
                119
               | 
              
                118
               | 
              
                  
               | 
            
            
            
              | 
                120
               | 
              
                119
               | 
              
                 def create_contribution_contract_flow(lensman): 
               | 
            
            
            
              | 
                121
               | 
              
                120
               | 
              
                     # 创建签署流程 https://qian.tencent.com/developers/companyApis/startFlows/CreateFlow 
               | 
            
            
            
              | 
                122
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                123
               | 
              
                121
               | 
              
                     # 创建签署流程参数 Operator 
               | 
            
            
            
              | 
                124
               | 
              
                122
               | 
              
                     FlowName = lensman.identity_card_name + u"的投稿合同" + tc.local_string(format='%Y%m%d') 
               | 
            
            
            
              | 
                125
               | 
              
                123
               | 
              
                     FlowType = u"活动投稿授权书" 
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -141,8 +139,10 @@ def create_contribution_contract_flow(lensman): 
               | 
            
            
            
              | 
                141
               | 
              
                139
               | 
              
                  
               | 
            
            
            
              | 
                142
               | 
              
                140
               | 
              
                 def create_contribution_contract_document(lensman, contribution_id, file_ids, FlowId): 
               | 
            
            
            
              | 
                143
               | 
              
                141
               | 
              
                     # 创建电子签文档 https://qian.tencent.com/developers/companyApis/startFlows/CreateDocument 
               | 
            
            
            
              | 
                144
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                145
               | 
              
                
               | 
              
                -    income = LensmanContributionActivityIncomeExpensesInfo.objects.get(contribution_id=contribution_id, lensman_id=lensman.lensman_id) 
               | 
            
            
            
              | 
                
               | 
              
                142
               | 
              
                +    try: 
               | 
            
            
            
              | 
                
               | 
              
                143
               | 
              
                +        amount = LensmanContributionActivityIncomeExpensesInfo.objects.get(contribution_id=contribution_id, lensman_id=lensman.lensman_id).amount 
               | 
            
            
            
              | 
                
               | 
              
                144
               | 
              
                +    except LensmanContributionActivityIncomeExpensesInfo.DoesNotExist: 
               | 
            
            
            
              | 
                
               | 
              
                145
               | 
              
                +        amount = 0 
               | 
            
            
            
              | 
                146
               | 
              
                146
               | 
              
                  
               | 
            
            
            
              | 
                147
               | 
              
                147
               | 
              
                     FormFields = [{
               | 
            
            
            
              | 
                148
               | 
              
                148
               | 
              
                         "ComponentId": "ComponentId_0", 
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -152,10 +152,10 @@ def create_contribution_contract_document(lensman, contribution_id, file_ids, Fl 
               | 
            
            
            
              | 
                152
               | 
              
                152
               | 
              
                         "ComponentValue": lensman.identity_card_number, 
               | 
            
            
            
              | 
                153
               | 
              
                153
               | 
              
                     }, {
               | 
            
            
            
              | 
                154
               | 
              
                154
               | 
              
                         "ComponentId": "ComponentId_2", 
               | 
            
            
            
              | 
                155
               | 
              
                
               | 
              
                -        "ComponentValue": str(income.amount), 
               | 
            
            
            
              | 
                
               | 
              
                155
               | 
              
                +        "ComponentValue": str(amount), 
               | 
            
            
            
              | 
                156
               | 
              
                156
               | 
              
                     }, {
               | 
            
            
            
              | 
                157
               | 
              
                157
               | 
              
                         "ComponentId": "ComponentId_3", 
               | 
            
            
            
              | 
                158
               | 
              
                
               | 
              
                -        "ComponentValue": cn2an.an2cn(income.amount, mode='rmb'), 
               | 
            
            
            
              | 
                
               | 
              
                158
               | 
              
                +        "ComponentValue": cn2an.an2cn(amount, mode='rmb'), 
               | 
            
            
            
              | 
                159
               | 
              
                159
               | 
              
                     }] 
               | 
            
            
            
              | 
                160
               | 
              
                160
               | 
              
                  
               | 
            
            
            
              | 
                161
               | 
              
                161
               | 
              
                     for idx, file_id in enumerate(file_ids): 
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -172,7 +172,6 @@ def create_contribution_contract_document(lensman, contribution_id, file_ids, Fl 
               | 
            
            
            
              | 
                172
               | 
              
                172
               | 
              
                  
               | 
            
            
            
              | 
                173
               | 
              
                173
               | 
              
                 def start_contribution_contract_flow(FlowId): 
               | 
            
            
            
              | 
                174
               | 
              
                174
               | 
              
                     # 发起签署流程 https://qian.tencent.com/developers/companyApis/startFlows/StartFlow 
               | 
            
            
            
              | 
                175
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                176
               | 
              
                175
               | 
              
                     start_flow_result = start_flow(flow_id=FlowId) 
               | 
            
            
            
              | 
                177
               | 
              
                176
               | 
              
                     if not start_flow_result: 
               | 
            
            
            
              | 
                178
               | 
              
                177
               | 
              
                         return '' 
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -182,7 +181,6 @@ def start_contribution_contract_flow(FlowId): 
               | 
            
            
            
              | 
                182
               | 
              
                181
               | 
              
                  
               | 
            
            
            
              | 
                183
               | 
              
                182
               | 
              
                 def get_contribtion_contract_sign_mppath(lensman, FlowId): 
               | 
            
            
            
              | 
                184
               | 
              
                183
               | 
              
                     # 获取签署链接 https://qian.tencent.com/developers/companyApis/startFlows/CreateSchemeUrl 
               | 
            
            
            
              | 
                185
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                186
               | 
              
                184
               | 
              
                     create_scheme_url_result = create_scheme_url(flow_id=FlowId, name=lensman.identity_card_name, mobile=lensman.phone, card_type='ID_CARD', card_number=lensman.identity_card_number) 
               | 
            
            
            
              | 
                187
               | 
              
                185
               | 
              
                     if not create_scheme_url_result: 
               | 
            
            
            
              | 
                188
               | 
              
                186
               | 
              
                         return '' 
               |