network_test.go 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. EntId: 221,
  107. PositionId: 935,
  108. //ClickId: "30126",
  109. //ClickId: "a2c934cc9fda4561864077f2cf7f44ba",
  110. //CheckCode: "同甲异业渠道,同甲异业渠道:ffe7b3b526f048f9999b803a4241ce77",
  111. //PositionId: 1205591997, //刘苗
  112. //PositionId: 1205592003,//刘亚丽
  113. //Id: "009c313ef8e740e59d57432aea777102",
  114. //Type: "firstparty",
  115. })
  116. b, _ := json.Marshal(res.Data)
  117. log.Println(string(b))
  118. }
  119. func TestOwner(t *testing.T) {
  120. InitConf()
  121. ownerService := &OwnerService{
  122. //PartyA: "ffe7b3b526f048f9999b803a4241ce77",
  123. Heterotophy: "ffe7b3b526f048f9999b803a4241ce77",
  124. //Agency: "wcj_11111111c,112233445566,001dfe3364b8480c965f81ab64d76bb4,00172d07d1fd4d90bd95fe5a348a845d",
  125. //Agency: "00172d07d1fd4d90bd95fe5a348a845d",
  126. //Supplier: "ffe7b3b526f048f9999b803a4241ce77",
  127. PageIndex: 1,
  128. PageSize: 100,
  129. ProjectType: "1",
  130. PositionId: 935,
  131. EntId: 221,
  132. //PositionId: 1205591997,
  133. //EntId: 146318,
  134. //SourceType: "2",
  135. }
  136. data := ownerService.OwnerlList()
  137. b, _ := json.Marshal(data)
  138. log.Println(string(b))
  139. }
  140. func TestProjectHistory(t *testing.T) {
  141. InitConf()
  142. data := GetData3("2", "128a81f9facb4aefb817244dc2c0e655", "北京城市之光生态环境有限公司")
  143. for _, v := range data {
  144. log.Println(fmt.Sprintf("%+v", v))
  145. }
  146. }
  147. func TestCoopHistoryService(t *testing.T) {
  148. InitConf()
  149. result := GetPrList(&types.CoopHistoryReq{
  150. PositionId: 935,
  151. EntId: 221,
  152. Buyer: "武汉市中心医院",
  153. ChannelType: "2",
  154. })
  155. log.Println(result.Size_1, result.Size_2, result.Size_3, result.Size_4)
  156. for _, v := range result.Result {
  157. log.Println(fmt.Sprintf("%+v", v))
  158. }
  159. }
  160. func TestInitNetwork(t *testing.T) {
  161. //安徽公共资源交易集团项目管理有限公司
  162. //广州粤华物业有限公司
  163. //
  164. InitConf()
  165. inw := InitNetwork{
  166. PositionId: 935,
  167. EntId: 221,
  168. DeptId: 498,
  169. UserId: 195,
  170. EntName: "武汉市中心医院",
  171. BusinessType: "建筑工程,机械设备,信息技术",
  172. }
  173. inw.Init()
  174. }
  175. func TestDeleteCache(t *testing.T) {
  176. InitConf()
  177. Network.DeleteCache(935)
  178. }
  179. func TestIntroduceSupplier(t *testing.T) {
  180. InitConf()
  181. for k, v := range Network.Introduce_Supplier([]string{"fb180e2267d74081a0e177692df92b42"}, []string{"建筑工程", "机械设备", "信息技术"}) {
  182. log.Println(k, fmt.Sprintf("%+v", v))
  183. }
  184. }
  185. func TestGetProjectList(t *testing.T) {
  186. InitConf()
  187. req := &types.ProjectListReq{
  188. PositionId: 935,
  189. EntId: 221,
  190. PartyA: "30604a74c36f47daa532503ac496914c",
  191. Supplier: "",
  192. Heterotophy: "",
  193. Intermediary: "",
  194. Agency: "",
  195. PageNum: 1,
  196. PageSize: 10,
  197. BusinessType: "全部",
  198. // Area: "广东",
  199. // Amount: "2,3,4,5",
  200. }
  201. resp := GetProjectList(req)
  202. log.Println(resp.HasNextPage, resp.Count)
  203. for _, v := range resp.PList {
  204. log.Println(v)
  205. }
  206. }