network_test.go 5.9 KB

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