network_test.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "log"
  7. "testing"
  8. . "app.yhyue.com/moapp/jybase/common"
  9. . "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
  10. "bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
  11. "bp.jydev.jianyu360.cn/CRM/networkManage/service"
  12. )
  13. //go test -test.run=TestAddCustomService -fs=../../etc/crmapplication.yaml -lf=../../etc/logs.yaml -df=../../etc/db.yaml -pf=../../etc/push.yaml
  14. func TestAddOrUpdate(t *testing.T) {
  15. InitConf()
  16. defer Catch()
  17. res1 := Network.AddOrUpdate(&types.AddOrUpdateReq{
  18. PositionId: 943,
  19. Company_name: "王传进的89",
  20. Contact_person: "王传进",
  21. Contact_phone: "15037870765",
  22. Type: "middleman",
  23. Introduce_owner_id: "5aebc2c37a624e8bacc40c1802a57041",
  24. Introduce_owner_name: "北京影业(北京)有限公司",
  25. Introduce_project_id: "5aebc2c37a624e8bacc40c1802a57041,北京物业服务",
  26. })
  27. log.Println(res1)
  28. return
  29. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
  30. for _, v := range []string{"firstparty", "supplier", "adiffb", "middleman", "agency"} {
  31. text := ""
  32. switch v {
  33. case "firstparty":
  34. text = "甲方"
  35. case "supplier":
  36. text = "供应商"
  37. case "adiffb":
  38. text = "同甲异业"
  39. case "middleman":
  40. text = "中间人"
  41. case "agency":
  42. text = "招标代理机构"
  43. }
  44. text += "_2"
  45. res := Network.AddOrUpdate(&types.AddOrUpdateReq{
  46. PositionId: 943,
  47. Company_id: "112233445566",
  48. Company_name: "王传进的" + text,
  49. Contact_person: "王传进",
  50. Contact_phone: "15037870765",
  51. Introduce_owner_id: "11,22,33",
  52. Introduce_owner_name: "aa,bb,cc",
  53. Introduce_project_id: "44,55,66",
  54. Introduce_project_name: "dd,ee,ff",
  55. Type: "middleman",
  56. })
  57. log.Println(res)
  58. }
  59. }
  60. func TestAssociate(t *testing.T) {
  61. InitConf()
  62. //log.Println(NetworkCom.GetEntTagSeat(2))
  63. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 middleman_owner:中间人-业主 middleman_project:中间人-项目 agency:招标代理机构
  64. //
  65. res := Network.Associate(&types.AssociateReq{
  66. //EntName: "深圳市光明区马田街道市政管理和建设工程事务中心",
  67. //EntAccountId: 64,
  68. Name: "北京",
  69. Type: "middleman",
  70. })
  71. log.Println(res.Data)
  72. }
  73. func TestNetWorkList(t *testing.T) {
  74. InitConf()
  75. //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
  76. res := Network.List(&types.NetWorkListReq{
  77. EntAccountId: 64,
  78. UserId: "1205591997",
  79. PositionId: 1205591997,
  80. //PositionId: 1205592003,
  81. //PositionId: 935,
  82. Current_page: 1,
  83. Page_size: 10,
  84. //PositionId: 935,
  85. //Order_amount: -1,
  86. // Monitorcount_start: 1,
  87. // Monitorcount_end: 1,
  88. //Monitor: 1,
  89. //Project_matchme: 1,
  90. //Starttime: "2024-04-23",
  91. //Endtime: "2024-04-23",
  92. //Type: "middleman",
  93. Name: "新疆",
  94. })
  95. for k, v := range res.Data.(map[string]interface{}) {
  96. if k == "list" {
  97. continue
  98. }
  99. log.Println(k, v)
  100. }
  101. for _, v := range res.Data.(map[string]interface{})["list"].([]*map[string]interface{}) {
  102. log.Println(v)
  103. }
  104. }
  105. func TestAllProject(t *testing.T) {
  106. InitConf()
  107. res := Network.AllProject(&types.AllprojectReq{
  108. EntAccountId: 64,
  109. PositionId: 935,
  110. //PositionId: 1205591997, //刘苗
  111. //PositionId: 1205592003,//刘亚丽
  112. //Id: "009c313ef8e740e59d57432aea777102",
  113. //Type: "firstparty",
  114. })
  115. b, _ := json.Marshal(res.Data)
  116. log.Println(string(b))
  117. }
  118. func TestOwner(t *testing.T) {
  119. InitConf()
  120. ownerService := &OwnerService{
  121. Intermediary: "30157",
  122. PositionId: 1205591997,
  123. PageIndex: 1,
  124. PageSize: 100,
  125. }
  126. data := ownerService.OwnerlList()
  127. b, _ := json.Marshal(data)
  128. log.Println(string(b))
  129. }
  130. func TestAddCustomService(t *testing.T) {
  131. InitConf()
  132. cs := &service.CustomService{
  133. PositionId: 1205591997,
  134. AppId: "10000",
  135. CustomType: 35,
  136. Summary: "1",
  137. CustomAllName: "1",
  138. CustomAbbreviation: "1",
  139. CustomLevel: 1,
  140. CustomIndustry: 11,
  141. CustomDetailIndustry: 24,
  142. Province: "000000",
  143. NextfollowUpTime: 1714406400,
  144. Types: 1,
  145. User: []int64{1205591997},
  146. CreateName: "刘苗苗",
  147. OwnerId: "875037a55d374627b1bc919c3cd84668",
  148. }
  149. cs.Add(context.Background())
  150. }
  151. func TestCandidateChannel(t *testing.T) {
  152. InitConf()
  153. ownerService := &OwnerService{
  154. PartyA: "15e4d804ce194a029e9fba645fda0cf0,90e9db9308024d3782a1a03e11ccd684,ed856df4ac4f4eb78a8d1ae9a5a98006,009c313ef8e740e59d57432aea777102,9df7aa60510d45a6875205c2069d550b,2c5ecd5d2a0d4c62884c30e472c95ffe",
  155. //Supplier: "0d732efa7adc40529100609e6096baad",
  156. //Intermediary: "30154",
  157. //Heterotophy: req.Heterotophy,
  158. //Agency: req.Agency,
  159. Type: "adiffb",
  160. EntAccountId: 64,
  161. PositionId: 1205591999,
  162. }
  163. data, a1, a2, a3, a4 := ownerService.CandidateChannel()
  164. for _, v := range *data {
  165. log.Println(fmt.Sprintf("%+v", v))
  166. }
  167. log.Println(a1)
  168. log.Println(a2)
  169. log.Println(a3)
  170. log.Println(a4)
  171. }
  172. func TestProjectHistory(t *testing.T) {
  173. InitConf()
  174. data := GetData3("2", "128a81f9facb4aefb817244dc2c0e655", "北京城市之光生态环境有限公司")
  175. for _, v := range data {
  176. log.Println(fmt.Sprintf("%+v", v))
  177. }
  178. }
  179. func TestChanceAdd(t *testing.T) {
  180. chance := &service.SaleChanceService{
  181. PositionId: 935,
  182. AppId: "10000",
  183. ChanceName: "王传进的销售机会5", //机会名称
  184. Summary: "王传进的销售机会5", //概要信息
  185. ChanceClassify: 30, //机会分类
  186. ExpectedOrderTime: 0, //最初预计落单段时间 时间戳
  187. CustomName: "王传进测试", //客户全称
  188. BusinessType: 3, //业务类型
  189. NextfollowUpTime: 1715097600, //下次跟进时间戳
  190. Types: 1, //处理方式 1自办;2转办
  191. User: []int64{935}, //企业用户id
  192. CustomId: 300069, //客户id
  193. CreateName: "企业管理员",
  194. ChanceSource: 54,
  195. BusinessId: "",
  196. }
  197. status, _ := chance.Add(context.Background())
  198. log.Println(status)
  199. }