Просмотр исходного кода

财税情况数据对接相关的修改

zhaozhiqiang лет назад: 5
Родитель
Сommit
6935a7806d

+ 8 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Cus_CustomerFinance.cs

@@ -71,6 +71,14 @@ namespace CallCenterApi.BLL
71 71
 
72 72
             return dal.GetModel(F_CusFinId);
73 73
         }
74
+        /// <summary>
75
+        /// 得到一个对象实体
76
+        /// </summary>
77
+        public CallCenterApi.Model.T_Cus_CustomerFinance GetModels(int F_CustomerId)
78
+        {
79
+
80
+            return dal.GetModels(F_CustomerId);
81
+        }
74 82
 
75 83
         /// <summary>
76 84
         /// 获得数据列表

+ 25 - 1
codegit/CallCenterApi/CallCenterApi.DAL/T_Cus_CustomerFinance.cs

@@ -318,7 +318,31 @@ namespace CallCenterApi.DAL
318 318
                 return null;
319 319
             }
320 320
         }
321
+        /// <summary>
322
+        /// 得到一个对象实体根据customerid
323
+        /// </summary>
324
+        public CallCenterApi.Model.T_Cus_CustomerFinance GetModels(int F_CustomerId)
325
+        {
326
+
327
+            StringBuilder strSql = new StringBuilder();
328
+            strSql.Append("select  top 1 * from T_Cus_CustomerFinance ");
329
+            strSql.Append(" where F_CustomerId=@F_CustomerId");
330
+            SqlParameter[] parameters = {
331
+                    new SqlParameter("@F_CustomerId", SqlDbType.Int,4)
332
+            };
333
+            parameters[0].Value = F_CustomerId;
321 334
 
335
+            CallCenterApi.Model.T_Cus_CustomerFinance model = new CallCenterApi.Model.T_Cus_CustomerFinance();
336
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
337
+            if (ds.Tables[0].Rows.Count > 0)
338
+            {
339
+                return DataRowToModel(ds.Tables[0].Rows[0]);
340
+            }
341
+            else
342
+            {
343
+                return null;
344
+            }
345
+        }
322 346
 
323 347
         /// <summary>
324 348
         /// 得到一个对象实体
@@ -334,7 +358,7 @@ namespace CallCenterApi.DAL
334 358
                 }
335 359
                 if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
336 360
                 {
337
-                    model.F_CustomerId = row["F_CustomerId"].ToString();
361
+                    model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
338 362
                 }
339 363
                 if (row["F_CustomerCode"] != null)
340 364
                 {

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.DAL/T_Cus_CustomerFinanceLog.cs

@@ -324,7 +324,7 @@ namespace CallCenterApi.DAL
324 324
                 }
325 325
                 if (row["F_CustomerId"] != null && row["F_CustomerId"].ToString() != "")
326 326
                 {
327
-                    model.F_CustomerId = row["F_CustomerId"].ToString();
327
+                    model.F_CustomerId = int.Parse(row["F_CustomerId"].ToString());
328 328
                 }
329 329
                 if (row["F_CustomerCode"] != null)
330 330
                 {

+ 326 - 194
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SignController.cs

@@ -30,31 +30,55 @@ namespace CallCenterApi.Interface.Controllers
30 30
         //获取客户信息 客户id
31 31
         public string  GetCustomers(string cusname)
32 32
         {
33
-            string strURL = "https://openapi.17win.com/gateway/openyqdz/manage/customer/queryCustomers";
34
-            var m = new
33
+            try
35 34
             {
36
-                customerLikeCriteria = new { fullName = cusname },
37
-                pageNo = 1,
38
-                pageSize = 20
39
-            };
35
+                string strURL = "https://openapi.17win.com/gateway/openyqdz/manage/customer/queryCustomers";
36
+                var m = new
37
+                {
38
+                    customerLikeCriteria = new { fullName = cusname },
39
+                    pageNo = 1,
40
+                    pageSize = 20
41
+                };
42
+
43
+                //实体序列化和反序列化
44
+                string json1 = JsonConvert.SerializeObject(m);
45
+                string strHTML = GetP(strURL, json1);
46
+
47
+                //验证返回的信息是否正确
48
+                JObject obj = Newtonsoft.Json.Linq.JObject.Parse(strHTML);
49
+                var a = obj["head"];
50
+                string state = obj["head"]["status"].ToString();
51
+                string meg = obj["head"]["msg"].ToString();
52
+                if (state == "N")
53
+                {
54
+                    string customid = "0";
55
+                    return customid;
56
+                }
57
+                else {
40 58
 
41
-            //实体序列化和反序列化
42
-            string json1 = JsonConvert.SerializeObject(m);
43
-            string strHTML = GetP(strURL, json1);
59
+                    //获取当前月份
60
+                    string accountPeriods = DateTime.Now.ToString("yyyyMM");
44 61
 
45
-            //获取当前月份
46
-            string accountPeriods = DateTime.Now.ToString("yyyyMM");
47
-            DockingCusResultDto jo1 = JsonConvert.DeserializeObject<DockingCusResultDto>(strHTML);
62
+                    DockingCusResultDto jo1 = JsonConvert.DeserializeObject<DockingCusResultDto>(strHTML);
48 63
 
49
-            string customid = "";
50
-            if (jo1.body.customerlist.Count>0)
51
-            {
52
-                foreach (var item in jo1.body.customerlist)
53
-                {
54
-                    customid = item.customerId;
64
+                    string customid = "";
65
+                    if (jo1.body.customerlist.Count > 0)
66
+                    {
67
+                        foreach (var item in jo1.body.customerlist)
68
+                        {
69
+                            customid = item.customerId;
70
+                        }
71
+                    }
72
+                    return customid;
55 73
                 }
74
+
75
+            }
76
+            catch (Exception e)
77
+            {
78
+
79
+                throw e;
56 80
             }
57
-            return customid;
81
+           
58 82
             
59 83
         }
60 84
         //获取客户信息 并获取财税情况 单个的
@@ -109,24 +133,24 @@ namespace CallCenterApi.Interface.Controllers
109 133
                 dt = cusbll.GetAllList().Tables[0];
110 134
                 if (dt != null)
111 135
                 {
112
-                   
113
-
114 136
                     for (int i = 0; i < dt.Rows.Count; i++)
115 137
                     {
116 138
                         cusname = dt.Rows[i]["F_CompanyName"].ToString();
117 139
                        string  CustomerCode= dt.Rows[i]["F_CustomerCode"].ToString();
118 140
 
119 141
                         //根据客户名称获取客户id
120
-                        string customid = GetCustomers(cusname);
121
-                     
122
-                         //获取到财税情况
123
-                         Model.CsqkInfo csqk = GetCsqk(cusname);
124
-                         if (csqk != null)
125
-                         {
126
-                             //给数据库财税情况表赋值
127
-                             Model.T_Cus_CustomerFinance model = new Model.T_Cus_CustomerFinance();
128
-                             //model.F_MonthState = input.F_MonthState;
129
-                             #region 设置数据
142
+                        int  customid = Convert.ToInt32(dt.Rows[i]["F_CustomerId"]);
143
+                        
144
+                            //获取到财税情况
145
+                            Model.CsqkInfo csqk = GetCsqk(cusname);
146
+                        if (csqk != null)
147
+                        {
148
+                            //给数据库财税情况表赋值
149
+                            Model.T_Cus_CustomerFinance model = finbll.GetModels(customid);
150
+                            if (model != null)
151
+                            {
152
+                                //model.F_MonthState = input.F_MonthState;
153
+                                #region 设置数据
130 154
                                 model.F_AnnualIncome = csqk.bnsr.ToString();//本年收入
131 155
                                 model.F_AnnualProfit = csqk.bnlr.ToString();//本年利润
132 156
                                 model.F_AnnualCost = csqk.bnfy.ToString();  //本年费用
@@ -143,20 +167,24 @@ namespace CallCenterApi.Interface.Controllers
143 167
                                 model.F_CustomerId = customid;   //客户id
144 168
                                 model.F_CustomerCode = CustomerCode;//客户编号
145 169
                                                                     //model.F_CreateBy = CurrentUser.UserData.F_UserCode;//当前操作人
146
-                                model.F_CreateBy = "8000";//当前操作人
170
+                                model.F_CreateBy = CurrentUser.UserData.F_UserCode;//当前操作人
147 171
                                 model.F_CreatedOn = DateTime.Now;        //创建时间
148 172
                                 model.F_DeleteFlag = 0;
149 173
                                 #endregion
150
-                             //如果添加成功则写入日志
151
-                             #region 写入日志
152
-                                if (finbll.Add(model) > 0)
174
+
175
+
176
+                                //如果添加成功则写入日志
177
+                                int findid = model.F_CusFinId;
178
+                                #region 写入日志
179
+                                if (finbll.Update(model))
153 180
                                 {
154 181
                                     var modellog = new Model.T_Cus_CustomerFinanceLog();
155 182
                                     #region 设置信息
183
+                                    modellog.F_CusFinId = findid;
156 184
                                     modellog.F_CustomerId = model.F_CustomerId;
157 185
                                     modellog.F_CustomerCode = model.F_CustomerCode;
158 186
                                     modellog.F_CreateBy = model.F_CreateBy;
159
-                                    modellog.F_CreatedOn =Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
187
+                                    modellog.F_CreatedOn = DateTime.Now;
160 188
                                     modellog.F_DeleteFlag = 0;
161 189
                                     // modellog.F_MonthState = model.F_MonthState;
162 190
                                     modellog.F_AnnualIncome = model.F_AnnualIncome;
@@ -179,8 +207,8 @@ namespace CallCenterApi.Interface.Controllers
179 207
                                     logbll.Add(modellog);
180 208
                                 }
181 209
                                 #endregion
182
-                         }
183
-                      
210
+                            }
211
+                        }
184 212
                           
185 213
                     }
186 214
 
@@ -197,70 +225,79 @@ namespace CallCenterApi.Interface.Controllers
197 225
                 {
198 226
                     //根据id获取客户信息实体
199 227
                     Model.T_Cus_CustomerBaseNew customs = cusbll.GetModel(Convert.ToInt32(item));
200
-                    //获取客户名称
201
-                    cusname = customs.F_CompanyName;
202
-
203
-                    //根据客户名称获取客户id
204
-                    string customid = GetCustomers(cusname);
205
-                    //获取到财税情况
206
-                    Model.CsqkInfo csqk = GetCsqk(cusname);
207
-                    if (csqk != null)
228
+                    if (customs != null)
208 229
                     {
209
-                        //给数据库财税情况表赋值
210
-                        Model.T_Cus_CustomerFinance model = new Model.T_Cus_CustomerFinance();
211
-                        //model.F_MonthState = input.F_MonthState;
212
-                        #region 设置数据
213
-                        model.F_AnnualIncome = csqk.bnsr.ToString();//本年收入
214
-                        model.F_AnnualProfit = csqk.bnlr.ToString();//本年利润
215
-                        model.F_AnnualCost = csqk.bnfy.ToString();  //本年费用
216
-                        model.F_AnnualWages = csqk.bngz.ToString(); //本年工资
217
-                        model.F_QuarterlyIncome = csqk.bjsr.ToString();//本季收入
218
-                        model.F_QuarterlyCost = csqk.bjfy.ToString();    //本季费用
219
-                        model.F_QuarterlyWages = csqk.bjgz.ToString();  //本季工资
220
-                        model.F_QPVAT = csqk.zzs.ToString();  //增值税
221
-                        model.F_QPSurtax = csqk.fjs.ToString();     //本季附加税
222
-                        model.F_QPTaxes = csqk.qysds.ToString();      // 本季企业所得税
223
-                        model.F_QPConTax = csqk.whsyjss.ToString();     // 本季文化事业建设税
224
-                        model.F_QPPerinTax = csqk.gs.ToString(); // 本季个税
225
-                        model.F_QPOtherTax = csqk.qtse.ToString(); // 本季其他税
226
-                        model.F_CustomerId = customid;   //客户id
227
-                        model.F_CustomerCode = customs.F_CustomerCode;//客户编号
228
-                                                                      //model.F_CreateBy = CurrentUser.UserData.F_UserCode;//当前操作人
229
-                        model.F_CreateBy = "8000";//当前操作人
230
-                        model.F_CreatedOn = DateTime.Now;        //创建时间
231
-                        model.F_DeleteFlag = 0;
232
-                        #endregion
233
-                        //如果添加成功则写入日志
234
-                        if (finbll.Add(model) > 0)
230
+                        //获取客户名称
231
+                        cusname = customs.F_CompanyName;
232
+                        
233
+                            //获取到财税情况
234
+                            Model.CsqkInfo csqk = GetCsqk(cusname);
235
+                        if (csqk != null)
235 236
                         {
236
-                            var modellog = new Model.T_Cus_CustomerFinanceLog();
237
-                            #region 设置信息
238
-                            modellog.F_CustomerId = model.F_CustomerId;
239
-                            modellog.F_CustomerCode = model.F_CustomerCode;
240
-                            modellog.F_CreateBy = model.F_CreateBy;
241
-                            modellog.F_CreatedOn = DateTime.Now;
242
-                            modellog.F_DeleteFlag = 0;
243
-                            // modellog.F_MonthState = model.F_MonthState;
244
-                            modellog.F_AnnualIncome = model.F_AnnualIncome;
245
-                            modellog.F_AnnualProfit = model.F_AnnualProfit;
246
-                            //modellog.F_AnnualPersonCount = model.F_AnnualPersonCount;
247
-                            modellog.F_AnnualWages = model.F_AnnualWages;
248
-                            modellog.F_AnnualCost = model.F_AnnualCost;
249
-                            modellog.F_QuarterlyCost = model.F_QuarterlyCost;
250
-                            //modellog.F_QuarterlyPersonCount = model.F_QuarterlyPersonCount;
251
-                            modellog.F_QuarterlyWages = model.F_QuarterlyWages;
252
-                            modellog.F_QuarterlyIncome = model.F_QuarterlyIncome;
253
-                            modellog.F_QPVAT = model.F_QPVAT;
254
-                            modellog.F_QPSurtax = model.F_QPSurtax;
255
-                            modellog.F_QPTaxes = model.F_QPTaxes;
256
-                            modellog.F_QPConTax = model.F_QPConTax;
257
-                            modellog.F_QPPerinTax = model.F_QPPerinTax;
258
-                            //modellog.F_QPStampTax = model.F_QPStampTax;
259
-                            modellog.F_QPOtherTax = model.F_QPOtherTax;
260
-                            #endregion
261
-                            logbll.Add(modellog);
237
+                            //给数据库财税情况表赋值
238
+                            Model.T_Cus_CustomerFinance model = finbll.GetModels(Convert.ToInt32(item));
239
+                            if (model != null)
240
+                            {
241
+                            
242
+                                //model.F_MonthState = input.F_MonthState;
243
+                                #region 设置数据
244
+                                model.F_AnnualIncome = csqk.bnsr.ToString();//本年收入
245
+                                model.F_AnnualProfit = csqk.bnlr.ToString();//本年利润
246
+                                model.F_AnnualCost = csqk.bnfy.ToString();  //本年费用
247
+                                model.F_AnnualWages = csqk.bngz.ToString(); //本年工资
248
+                                model.F_QuarterlyIncome = csqk.bjsr.ToString();//本季收入
249
+                                model.F_QuarterlyCost = csqk.bjfy.ToString();    //本季费用
250
+                                model.F_QuarterlyWages = csqk.bjgz.ToString();  //本季工资
251
+                                model.F_QPVAT = csqk.zzs.ToString();  //增值税
252
+                                model.F_QPSurtax = csqk.fjs.ToString();     //本季附加税
253
+                                model.F_QPTaxes = csqk.qysds.ToString();      // 本季企业所得税
254
+                                model.F_QPConTax = csqk.whsyjss.ToString();     // 本季文化事业建设税
255
+                                model.F_QPPerinTax = csqk.gs.ToString(); // 本季个税
256
+                                model.F_QPOtherTax = csqk.qtse.ToString(); // 本季其他税
257
+                                model.F_CustomerId = Convert.ToInt32(item);   //客户id
258
+                                model.F_CustomerCode = customs.F_CustomerCode;//客户编号
259
+                                                                              //model.F_CreateBy = CurrentUser.UserData.F_UserCode;//当前操作人
260
+                                model.F_CreateBy = CurrentUser.UserData.F_UserCode;//当前操作人
261
+                                model.F_CreatedOn = DateTime.Now;        //创建时间
262
+                                model.F_DeleteFlag = 0;
263
+                                #endregion
264
+                                //如果修改成功则写入日志
265
+                                int findid = model.F_CusFinId;
266
+                                if (finbll.Update(model))
267
+                                {
268
+                                    var modellog = new Model.T_Cus_CustomerFinanceLog();
269
+                                    #region 设置信息
270
+                                    modellog.F_CusFinId = findid;
271
+                                    modellog.F_CustomerId = model.F_CustomerId;
272
+                                    modellog.F_CustomerCode = model.F_CustomerCode;
273
+                                    modellog.F_CreateBy = model.F_CreateBy;
274
+                                    modellog.F_CreatedOn = DateTime.Now;
275
+                                    modellog.F_DeleteFlag = 0;
276
+                                    // modellog.F_MonthState = model.F_MonthState;
277
+                                    modellog.F_AnnualIncome = model.F_AnnualIncome;
278
+                                    modellog.F_AnnualProfit = model.F_AnnualProfit;
279
+                                    //modellog.F_AnnualPersonCount = model.F_AnnualPersonCount;
280
+                                    modellog.F_AnnualWages = model.F_AnnualWages;
281
+                                    modellog.F_AnnualCost = model.F_AnnualCost;
282
+                                    modellog.F_QuarterlyCost = model.F_QuarterlyCost;
283
+                                    //modellog.F_QuarterlyPersonCount = model.F_QuarterlyPersonCount;
284
+                                    modellog.F_QuarterlyWages = model.F_QuarterlyWages;
285
+                                    modellog.F_QuarterlyIncome = model.F_QuarterlyIncome;
286
+                                    modellog.F_QPVAT = model.F_QPVAT;
287
+                                    modellog.F_QPSurtax = model.F_QPSurtax;
288
+                                    modellog.F_QPTaxes = model.F_QPTaxes;
289
+                                    modellog.F_QPConTax = model.F_QPConTax;
290
+                                    modellog.F_QPPerinTax = model.F_QPPerinTax;
291
+                                    //modellog.F_QPStampTax = model.F_QPStampTax;
292
+                                    modellog.F_QPOtherTax = model.F_QPOtherTax;
293
+                                    #endregion
294
+                                    logbll.Add(modellog);
295
+                                }
296
+                            }
262 297
                         }
263 298
                     }
299
+                           
300
+                   
264 301
                   
265 302
                 }
266 303
                 return Success("更新成功");
@@ -284,40 +321,77 @@ namespace CallCenterApi.Interface.Controllers
284 321
 
285 322
             //获取当前月份
286 323
             string accountPeriods = DateTime.Now.ToString("yyyyMM");
287
-            DockingCusResultDto jo1 = JsonConvert.DeserializeObject<DockingCusResultDto>(strHTML);
288
-           
289
-            Model.CsqkInfo csqkobj = null;
290
-            if (jo1.body.customerlist.Count > 0)
324
+            //验证返回的信息是否正确
325
+            JObject obj = Newtonsoft.Json.Linq.JObject.Parse(strHTML);
326
+            var a = obj["head"];
327
+            string state = obj["head"]["status"].ToString();
328
+            string meg = obj["head"]["msg"].ToString();
329
+            if (state == "N")
291 330
             {
292
-                foreach (var item in jo1.body.customerlist)
331
+                Model.CsqkInfo csqkobj = null;
332
+                return csqkobj;
333
+            }
334
+            else {
335
+                DockingCusResultDto jo1 = JsonConvert.DeserializeObject<DockingCusResultDto>(strHTML);
336
+                Model.CsqkInfo csqkobj = null;
337
+                if (jo1.body.customerlist.Count > 0)
293 338
                 {
294
-                    csqkobj = GetCSQK(item.customerId, accountPeriods);
339
+                    foreach (var item in jo1.body.customerlist)
340
+                    {
341
+                        csqkobj = GetCSQK(item.customerId, accountPeriods);
342
+                    }
295 343
                 }
344
+                return csqkobj;
296 345
             }
297
-            return csqkobj;
346
+         
347
+           
348
+           
298 349
            
299 350
         }
300 351
         //获取科目余额
301 352
         public DockingBalanceResultDto GetAccountBalance(string customerId,string beginPeriod,string endPeriod)
302 353
         {
303
-           string strURL = "https://openapi.17win.com/gateway/openyqdz/finance/sheetController/queryAccountBalanceSheet";
304
-            var m = new
354
+            try
355
+            {
356
+                string strURL = "https://openapi.17win.com/gateway/openyqdz/finance/sheetController/queryAccountBalanceSheet";
357
+                var m = new
358
+                {
359
+                    customerId,
360
+                    beginPeriod,
361
+                    endPeriod,
362
+                    showAssistant = true,
363
+                    showTitle = true,
364
+                    showEndBalance0 = true,
365
+                    pageNo = 0,//页码从0开始
366
+                    pageSize = 100
367
+                };
368
+
369
+                //实体序列化和反序列化
370
+                string json1 = JsonConvert.SerializeObject(m);
371
+                string strHTML = GetP(strURL, json1);
372
+              
373
+                //验证返回的信息是否正确
374
+                JObject obj = Newtonsoft.Json.Linq.JObject.Parse(strHTML);
375
+                var a = obj["head"];
376
+                string state = obj["head"]["status"].ToString();
377
+                string meg =   obj["head"]["msg"].ToString();
378
+                if (state == "N")
379
+                {
380
+                    DockingBalanceResultDto jo1 = new DockingBalanceResultDto();
381
+                    return  jo1;
382
+                }
383
+                else {
384
+                    DockingBalanceResultDto jo1 = JsonConvert.DeserializeObject<DockingBalanceResultDto>(strHTML);
385
+                    return jo1;
386
+                }
387
+                
388
+            }
389
+            catch (Exception e)
305 390
             {
306
-                customerId,
307
-                beginPeriod,
308
-                endPeriod,
309
-                showAssistant = true,
310
-                showTitle=true,
311
-                showEndBalance0=true,
312
-                pageNo = 0,//页码从0开始
313
-                pageSize = 100
314
-            };
315 391
 
316
-            //实体序列化和反序列化
317
-            string json1 = JsonConvert.SerializeObject(m);
318
-            string strHTML = GetP(strURL, json1);
319
-            DockingBalanceResultDto jo1 = JsonConvert.DeserializeObject<DockingBalanceResultDto>(strHTML);
320
-            return jo1;
392
+                throw e;
393
+            }
394
+         
321 395
 
322 396
 
323 397
         }
@@ -335,10 +409,63 @@ namespace CallCenterApi.Interface.Controllers
335 409
             dic.Add("accountPeriod", accountPeriod);
336 410
            
337 411
             string strHTML = GetP1(strURL,dic);
338
-           
339
-            DocAllYearMonthResultDto jo1 = JsonConvert.DeserializeObject<DocAllYearMonthResultDto>(strHTML);
412
+
413
+            ///最大会计期
414
+            //string maxperiod = "";
415
+            //DocCloseresultDto docc = CloseInfo(customerId);
416
+            //if (docc.body != null)
417
+            //{
418
+            //    foreach (var item in docc.body)
419
+            //    {
420
+            //        maxperiod = item.list[0].maxClosePeriod;
421
+            //    }
422
+            //}
423
+            ////判断如果当前日期小于最大会计期才能继续执行
424
+            //if (Convert.ToInt32(accountPeriod) < Convert.ToInt32(maxperiod))
425
+            //{
426
+                //验证返回的信息是否正确
427
+                JObject obj = Newtonsoft.Json.Linq.JObject.Parse(strHTML);
428
+                var a = obj["head"];
429
+                string state = obj["head"]["status"].ToString();
430
+                string meg = obj["head"]["msg"].ToString();
431
+                if (state == "N")
432
+                {
433
+                    DocAllYearMonthResultDto jo1 = null;
434
+                    return jo1;
435
+                }
436
+                else
437
+                {
438
+                    DocAllYearMonthResultDto jo1 = JsonConvert.DeserializeObject<DocAllYearMonthResultDto>(strHTML);
439
+                    return jo1;
440
+                }
441
+          //}
442
+          //  else
443
+          //  {
444
+          //      DocAllYearMonthResultDto jo1 = null;
445
+          //      return jo1;
446
+          //  }
447
+
448
+}
449
+        /// <summary>
450
+        /// 获取结账信息接口信息最大会计期
451
+        /// </summary>
452
+        /// <param name="customerIds"></param>
453
+        /// <returns></returns>
454
+        public DocCloseresultDto CloseInfo(string customerId)
455
+        {
456
+            
457
+            string strURL = "https://openapi.17win.com/gateway/openyqdz/alice/closeInfo/getCloseInfo";
458
+            var m = new
459
+            {
460
+                customerIds = customerId
461
+            };
462
+
463
+            //实体序列化和反序列化
464
+            string json1 = JsonConvert.SerializeObject(m);
465
+            string strHTML = GetP(strURL, json1);
466
+            DocCloseresultDto jo1 = JsonConvert.DeserializeObject<DocCloseresultDto>(strHTML);
340 467
             return jo1;
341
-           
468
+
342 469
         }
343 470
         /// <summary>
344 471
         /// 获取财税情况
@@ -391,85 +518,87 @@ namespace CallCenterApi.Interface.Controllers
391 518
              DocAllYearMonthResultDto jo1 = null;
392 519
             
393 520
              jo1 = GetselectQuarterIncomeSheet(customerId, accountPeriod.ToString());
394
-                 
395
-             //判断是否有数据
396
-             if (jo1.body != null)
397
-             {
398
-                 #region 循环遍历赋值
399
-                    foreach (var item in jo1.body)
400
-                    {
401
-                        //营业收入
402
-                        if (item.accountTitleName.Contains("营业收入"))
521
+            if(jo1!=null)
522
+            {
523
+                 //判断是否有数据
524
+                 if (jo1.body != null)
525
+                 {
526
+                     #region 循环遍历赋值
527
+                        foreach (var item in jo1.body)
403 528
                         {
404
-                            //本年收入
405
-                            bnsr += item.yearAccumulated;
406
-                            #region 本季度收入
407
-                            //第一季度
408
-                            if (monnum == "01")
409
-                           
529
+                            //营业收入
530
+                            if (item.accountTitleName.Contains("营业收入"))
410 531
                             {
411
-                                 bjsr += item.quarterOne;
532
+                                //本年收入
533
+                                bnsr += item.yearAccumulated;
534
+                                #region 本季度收入
535
+                                //第一季度
536
+                                if (monnum == "01")
537
+                           
538
+                                {
539
+                                     bjsr += item.quarterOne;
412 540
                                
541
+                                }
542
+                                //第二季度
543
+                                if (monnum == "04")
544
+                                {
545
+                                    bjsr += item.quarterTwo;
546
+                                }
547
+                                //第三季度
548
+                                if (monnum == "07")
549
+                                {
550
+                                    bjsr += item.quarterThree;
551
+                                }
552
+                                //第四季度
553
+                                if (monnum == "10")
554
+                                {
555
+                                    bjsr += item.quarterFour;
556
+                                }
557
+                                #endregion
558
+
413 559
                             }
414
-                            //第二季度
415
-                            if (monnum == "04")
416
-                            {
417
-                                bjsr += item.quarterTwo;
418
-                            }
419
-                            //第三季度
420
-                            if (monnum == "07")
421
-                            {
422
-                                bjsr += item.quarterThree;
423
-                            }
424
-                            //第四季度
425
-                            if (monnum == "10")
560
+                            //本年利润=营业利润+营业外收入-营业外支出
561
+                            if (item.accountTitleName.Contains("利润总额") )
426 562
                             {
427
-                                bjsr += item.quarterFour;
428
-                            }
429
-                            #endregion
430
-
431
-                        }
432
-                        //本年利润=营业利润+营业外收入-营业外支出
433
-                        if (item.accountTitleName.Contains("利润总额") )
434
-                        {
435
-                            //本年利润
436
-                            bnlr += item.yearAccumulated;
563
+                                //本年利润
564
+                                bnlr += item.yearAccumulated;
437 565
 
438 566
 
439
-                        }
440
-                        ///本年费用: =管理费用+销售费用+财务费用
441
-                        if (item.accountTitleName.Contains("管理费用") || item.accountTitleName.Contains("销售费用") || item.accountTitleName.Contains("财务费用"))
442
-                        {
443
-                            //本年费用
444
-                            bnfy += item.yearAccumulated;
445
-                            #region 本季度费用
446
-                            //第一季度
447
-                            if (monnum == "01")
448
-                            {
449
-                                bjfy += item.quarterOne;
450
-                            }
451
-                            //第二季度
452
-                            if (monnum == "04")
453
-                            {
454
-                                bjfy += item.quarterTwo;
455 567
                             }
456
-                            //第三季度
457
-                            if (monnum == "07")
568
+                            ///本年费用: =管理费用+销售费用+财务费用
569
+                            if (item.accountTitleName.Contains("管理费用") || item.accountTitleName.Contains("销售费用") || item.accountTitleName.Contains("财务费用"))
458 570
                             {
459
-                                bjfy += item.quarterThree;
460
-                            }
461
-                            //第四季度
462
-                            if (monnum == "10")
463
-                            {
464
-                                bjfy += item.quarterFour;
571
+                                //本年费用
572
+                                bnfy += item.yearAccumulated;
573
+                                #region 本季度费用
574
+                                //第一季度
575
+                                if (monnum == "01")
576
+                                {
577
+                                    bjfy += item.quarterOne;
578
+                                }
579
+                                //第二季度
580
+                                if (monnum == "04")
581
+                                {
582
+                                    bjfy += item.quarterTwo;
583
+                                }
584
+                                //第三季度
585
+                                if (monnum == "07")
586
+                                {
587
+                                    bjfy += item.quarterThree;
588
+                                }
589
+                                //第四季度
590
+                                if (monnum == "10")
591
+                                {
592
+                                    bjfy += item.quarterFour;
593
+                                }
594
+                                #endregion
595
+
465 596
                             }
466
-                            #endregion
467 597
 
468 598
                         }
469
-
470
-                    }
471
-                    #endregion
472
-             }
599
+                        #endregion
600
+                 }
601
+            }
473 602
             #region 定义科目余额表接口能获得的数据
474 603
 
475 604
             ///本年工资
@@ -499,9 +628,11 @@ namespace CallCenterApi.Interface.Controllers
499 628
                 obj = GetAccountBalance(customerId, i.ToString(), i.ToString());
500 629
                 
501 630
                 //判断是否有数据
502
-                if (obj.body.list.Count!=0)
631
+                if (obj.body!=null)
503 632
                 {
504
-                    #region 循环遍历赋值
633
+                    if(obj.body.list.Count != 0)
634
+                    { 
635
+                          #region 循环遍历赋值
505 636
                     foreach (var item in obj.body.list)
506 637
                     {
507 638
                         #region 本年工资、本季工资
@@ -576,7 +707,8 @@ namespace CallCenterApi.Interface.Controllers
576 707
                         }
577 708
                         #endregion
578 709
                     }
579
-                    #endregion
710
+                        #endregion
711
+                    }
580 712
                 }
581 713
             }
582 714
             #endregion

+ 3 - 3
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerNewController.cs

@@ -778,7 +778,7 @@ namespace CallCenterApi.Interface.Controllers.customer
778 778
             }
779 779
             else
780 780
             {
781
-                model.F_CustomerId = input.F_CustomerId.ToString();
781
+                model.F_CustomerId = input.F_CustomerId;
782 782
                 model.F_CustomerCode = input.F_CustomerCode;
783 783
                 model.F_CreateBy = input.F_CreateBy;
784 784
                 model.F_CreatedOn = DateTime.Now;
@@ -794,7 +794,7 @@ namespace CallCenterApi.Interface.Controllers.customer
794 794
         {
795 795
             var model = new Model.T_Cus_CustomerFinanceLog();
796 796
             #region 设置信息
797
-            model.F_CustomerId = input.F_CustomerId.ToString();
797
+            model.F_CustomerId = input.F_CustomerId;
798 798
             model.F_CustomerCode = input.F_CustomerCode;
799 799
             model.F_CreateBy = input.F_CreateBy;
800 800
             model.F_CreatedOn = DateTime.Now;
@@ -971,7 +971,7 @@ namespace CallCenterApi.Interface.Controllers.customer
971 971
                             #endregion
972 972
                             #region 添加财税情况
973 973
                             var finmodel = new Model.T_Cus_CustomerFinance();
974
-                            finmodel.F_CustomerId = n.ToString();
974
+                            finmodel.F_CustomerId = n;
975 975
                             finmodel.F_CustomerCode = cusmodel.F_CustomerCode;
976 976
                             finmodel.F_CreateBy = cusmodel.F_CreateBy;
977 977
                             finmodel.F_CreatedOn = DateTime.Now;

+ 23 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Models/Dto/DockingCustomerListDto.cs

@@ -392,6 +392,27 @@ namespace CallCenterApi.Interface.Models.Dto
392 392
     }
393 393
 
394 394
     #endregion
395
+
396
+    public class DocCloseDto
397
+    {
398
+        public string companyId { get; set; }//机构ID
399
+        public string customerId { get; set; }//企业ID
400
+        public string accountSetId { get; set; }//账套ID
401
+        public string maxClosePeriod { get; set; }//最大结账会计期
402
+        public string createPeriod { get; set; }//建账会计期
403
+    }
404
+    //body
405
+    public class DocCloseMonthtDto
406
+    {
407
+        public List<DocCloseDto> list { get; set; }
408
+    }
409
+    //result 结账信息
410
+    public class DocCloseresultDto
411
+    {
412
+        public DockingHeadDto head { get; set; }
413
+        public List<DocCloseMonthtDto> body { get; set; }
414
+    }
415
+
395 416
     #region 税种表
396 417
 
397 418
     public class DocTaxListDto
@@ -642,6 +663,8 @@ namespace CallCenterApi.Interface.Models.Dto
642 663
         public DocAssetsDebtSheetDto body { get; set; }
643 664
     } 
644 665
     #endregion
666
+
667
+
645 668
     public class DockingHeadDto
646 669
     {
647 670
         public string code { get; set; }

+ 2 - 2
codegit/CallCenterApi/CallCenterApi.Model/T_Cus_CustomerFinance.cs

@@ -16,7 +16,7 @@ namespace CallCenterApi.Model
16 16
         { }
17 17
         #region Model
18 18
         private int _f_cusfinid;
19
-        private string _f_customerid;
19
+        private int? _f_customerid;
20 20
         private string _f_customercode;
21 21
         private string _f_monthstate;
22 22
         private string _f_annualincome;
@@ -57,7 +57,7 @@ namespace CallCenterApi.Model
57 57
         /// <summary>
58 58
         /// 客户ID
59 59
         /// </summary>
60
-        public string  F_CustomerId
60
+        public int?  F_CustomerId
61 61
         {
62 62
             set { _f_customerid = value; }
63 63
             get { return _f_customerid; }

+ 2 - 2
codegit/CallCenterApi/CallCenterApi.Model/T_Cus_CustomerFinanceLog.cs

@@ -17,7 +17,7 @@ namespace CallCenterApi.Model
17 17
         #region Model
18 18
         private int _f_cusfinlogid;
19 19
         private int? _f_cusfinid;
20
-        private string _f_customerid;
20
+        private int? _f_customerid;
21 21
         private string _f_customercode;
22 22
         private string _f_monthstate;
23 23
         private string _f_annualincome;
@@ -66,7 +66,7 @@ namespace CallCenterApi.Model
66 66
         /// <summary>
67 67
         /// 客户ID
68 68
         /// </summary>
69
-        public string  F_CustomerId
69
+        public int?  F_CustomerId
70 70
         {
71 71
             set { _f_customerid = value; }
72 72
             get { return _f_customerid; }