network_test.go 6.1 KB

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