network_test.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. package service
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "log"
  6. "testing"
  7. . "app.yhyue.com/moapp/jybase/common"
  8. . "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
  9. "bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
  10. )
  11. //go test -test.run=TestNetWorkList -fs=../../etc/networkmanage.yaml -lf=../../etc/logs.yaml -df=../../etc/db.yaml
  12. func TestAddOrUpdate(t *testing.T) {
  13. InitConf()
  14. defer Catch()
  15. res1 := Network.AddOrUpdate(&types.AddOrUpdateReq{
  16. PositionId: 943,
  17. Company_name: "王传进的89",
  18. Contact_person: "王传进",
  19. Contact_phone: "15037870765",
  20. Type: "middleman",
  21. Introduce_owner_id: "5aebc2c37a624e8bacc40c1802a57041",
  22. Introduce_owner_name: "北京影业(北京)有限公司",
  23. Introduce_project_id: "5aebc2c37a624e8bacc40c1802a57041,北京物业服务",
  24. })
  25. log.Println(res1)
  26. return
  27. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
  28. for _, v := range []string{"firstparty", "supplier", "adiffb", "middleman", "agency"} {
  29. text := ""
  30. switch v {
  31. case "firstparty":
  32. text = "甲方"
  33. case "supplier":
  34. text = "供应商"
  35. case "adiffb":
  36. text = "同甲异业"
  37. case "middleman":
  38. text = "中间人"
  39. case "agency":
  40. text = "招标代理机构"
  41. }
  42. text += "_2"
  43. res := Network.AddOrUpdate(&types.AddOrUpdateReq{
  44. PositionId: 943,
  45. Company_id: "112233445566",
  46. Company_name: "王传进的" + text,
  47. Contact_person: "王传进",
  48. Contact_phone: "15037870765",
  49. Introduce_owner_id: "11,22,33",
  50. Introduce_owner_name: "aa,bb,cc",
  51. Introduce_project_id: "44,55,66",
  52. Introduce_project_name: "dd,ee,ff",
  53. Type: "middleman",
  54. })
  55. log.Println(res)
  56. }
  57. }
  58. func TestAssociate(t *testing.T) {
  59. InitConf()
  60. //log.Println(NetworkCom.GetEntTagSeat(2))
  61. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 middleman_owner:中间人-业主 middleman_project:中间人-项目 agency:招标代理机构
  62. //
  63. res := Network.Associate(&types.AssociateReq{
  64. //EntName: "深圳市光明区马田街道市政管理和建设工程事务中心",
  65. //EntAccountId: 64,
  66. Name: "北京",
  67. Type: "middleman",
  68. })
  69. log.Println(res.Data)
  70. }
  71. func TestNetWorkList(t *testing.T) {
  72. InitConf()
  73. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
  74. res := Network.List(&types.NetWorkListReq{
  75. EntAccountId: 64,
  76. UserId: "1205591997",
  77. //PositionId: 1205591997,
  78. //PositionId: 1205592003,
  79. PositionId: 935,
  80. Current_page: 1,
  81. Page_size: 10,
  82. //PositionId: 935,
  83. //Order_amount: -1,
  84. // Monitorcount_start: 1,
  85. // Monitorcount_end: 1,
  86. //Monitor: 1,
  87. Project_matchme: 1,
  88. //Starttime: "2024-04-23",
  89. //Endtime: "2024-04-23",
  90. //Type: "middleman",
  91. //Name: "新疆",
  92. })
  93. for k, v := range res.Data.(map[string]interface{}) {
  94. if k == "list" {
  95. continue
  96. }
  97. log.Println(k, v)
  98. }
  99. for _, v := range res.Data.(map[string]interface{})["list"].([]*map[string]interface{}) {
  100. log.Println(v)
  101. }
  102. }
  103. func TestAllProject(t *testing.T) {
  104. InitConf()
  105. res := Network.AllProject(&types.AllprojectReq{
  106. EntAccountId: 900824,
  107. PositionId: 1205621877,
  108. //PositionId: 1205591997, //刘苗
  109. //PositionId: 1205592003,//刘亚丽
  110. //Id: "009c313ef8e740e59d57432aea777102",
  111. //Type: "firstparty",
  112. })
  113. b, _ := json.Marshal(res.Data)
  114. log.Println(string(b))
  115. }
  116. func TestOwner(t *testing.T) {
  117. InitConf()
  118. ownerService := &OwnerService{
  119. //PartyA: "30604a74c36f47daa532503ac496914c",
  120. //Heterotophy: "ffe7b3b526f048f9999b803a4241ce77",
  121. Agency: "wcj_11111111c,112233445566,001dfe3364b8480c965f81ab64d76bb4,00172d07d1fd4d90bd95fe5a348a845d",
  122. PositionId: 935,
  123. PageIndex: 1,
  124. PageSize: 100,
  125. ProjectType: "1",
  126. EntId: 221,
  127. //SourceType: "2",
  128. }
  129. data := ownerService.OwnerlList()
  130. b, _ := json.Marshal(data)
  131. log.Println(string(b))
  132. }
  133. func TestProjectHistory(t *testing.T) {
  134. InitConf()
  135. data := GetData3("2", "128a81f9facb4aefb817244dc2c0e655", "北京城市之光生态环境有限公司")
  136. for _, v := range data {
  137. log.Println(fmt.Sprintf("%+v", v))
  138. }
  139. }
  140. func TestCoopHistoryService(t *testing.T) {
  141. InitConf()
  142. result := GetPrList(&types.CoopHistoryReq{
  143. PositionId: 935,
  144. EntId: 221,
  145. Buyer: "武汉市中心医院",
  146. ChannelType: "2",
  147. })
  148. log.Println(result.Size_1, result.Size_2, result.Size_3, result.Size_4)
  149. for _, v := range result.Result {
  150. log.Println(fmt.Sprintf("%+v", v))
  151. }
  152. }
  153. func TestInitNetwork(t *testing.T) {
  154. //安徽公共资源交易集团项目管理有限公司
  155. //广州粤华物业有限公司
  156. //
  157. InitConf()
  158. inw := InitNetwork{
  159. PositionId: 935,
  160. EntId: 221,
  161. DeptId: 498,
  162. UserId: 195,
  163. EntName: "武汉市中心医院",
  164. BusinessType: "建筑工程,机械设备,信息技术",
  165. }
  166. inw.Init()
  167. }
  168. func TestDeleteCache(t *testing.T) {
  169. InitConf()
  170. Network.DeleteCache(935)
  171. }
  172. func TestIntroduceSupplier(t *testing.T) {
  173. InitConf()
  174. for k, v := range Network.Introduce_Supplier([]string{"fb180e2267d74081a0e177692df92b42"}, []string{"建筑工程", "机械设备", "信息技术"}) {
  175. log.Println(k, fmt.Sprintf("%+v", v))
  176. }
  177. }