123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- package service
- import (
- "context"
- "encoding/json"
- "fmt"
- "log"
- "testing"
- . "app.yhyue.com/moapp/jybase/common"
- . "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
- "bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
- "bp.jydev.jianyu360.cn/CRM/networkManage/service"
- )
- //go test -test.run=TestAddCustomService -fs=../../etc/crmapplication.yaml -lf=../../etc/logs.yaml -df=../../etc/db.yaml -pf=../../etc/push.yaml
- func TestAddOrUpdate(t *testing.T) {
- InitConf()
- defer Catch()
- res1 := Network.AddOrUpdate(&types.AddOrUpdateReq{
- PositionId: 943,
- Company_name: "王传进的89",
- Contact_person: "王传进",
- Contact_phone: "15037870765",
- Type: "middleman",
- Introduce_owner_id: "5aebc2c37a624e8bacc40c1802a57041",
- Introduce_owner_name: "北京影业(北京)有限公司",
- Introduce_project_id: "5aebc2c37a624e8bacc40c1802a57041,北京物业服务",
- })
- log.Println(res1)
- return
- //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
- for _, v := range []string{"firstparty", "supplier", "adiffb", "middleman", "agency"} {
- text := ""
- switch v {
- case "firstparty":
- text = "甲方"
- case "supplier":
- text = "供应商"
- case "adiffb":
- text = "同甲异业"
- case "middleman":
- text = "中间人"
- case "agency":
- text = "招标代理机构"
- }
- text += "_2"
- res := Network.AddOrUpdate(&types.AddOrUpdateReq{
- PositionId: 943,
- Company_id: "112233445566",
- Company_name: "王传进的" + text,
- Contact_person: "王传进",
- Contact_phone: "15037870765",
- Introduce_owner_id: "11,22,33",
- Introduce_owner_name: "aa,bb,cc",
- Introduce_project_id: "44,55,66",
- Introduce_project_name: "dd,ee,ff",
- Type: "middleman",
- })
- log.Println(res)
- }
- }
- func TestAssociate(t *testing.T) {
- InitConf()
- //log.Println(NetworkCom.GetEntTagSeat(2))
- //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 middleman_owner:中间人-业主 middleman_project:中间人-项目 agency:招标代理机构
- //
- res := Network.Associate(&types.AssociateReq{
- //EntName: "深圳市光明区马田街道市政管理和建设工程事务中心",
- //EntAccountId: 64,
- Name: "北京",
- Type: "middleman",
- })
- log.Println(res.Data)
- }
- func TestNetWorkList(t *testing.T) {
- InitConf()
- //类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
- res := Network.List(&types.NetWorkListReq{
- EntAccountId: 64,
- UserId: "1205591997",
- PositionId: 1205591997,
- //PositionId: 1205592003,
- //PositionId: 935,
- Current_page: 1,
- Page_size: 10,
- //PositionId: 935,
- //Order_amount: -1,
- // Monitorcount_start: 1,
- // Monitorcount_end: 1,
- //Monitor: 1,
- //Project_matchme: 1,
- //Starttime: "2024-04-23",
- //Endtime: "2024-04-23",
- //Type: "middleman",
- Name: "新疆",
- })
- for k, v := range res.Data.(map[string]interface{}) {
- if k == "list" {
- continue
- }
- log.Println(k, v)
- }
- for _, v := range res.Data.(map[string]interface{})["list"].([]*map[string]interface{}) {
- log.Println(v)
- }
- }
- func TestAllProject(t *testing.T) {
- InitConf()
- res := Network.AllProject(&types.AllprojectReq{
- EntAccountId: 64,
- PositionId: 935,
- //PositionId: 1205591997, //刘苗
- //PositionId: 1205592003,//刘亚丽
- //Id: "009c313ef8e740e59d57432aea777102",
- //Type: "firstparty",
- })
- b, _ := json.Marshal(res.Data)
- log.Println(string(b))
- }
- func TestOwner(t *testing.T) {
- InitConf()
- ownerService := &OwnerService{
- Intermediary: "30157",
- PositionId: 1205591997,
- PageIndex: 1,
- PageSize: 100,
- }
- data := ownerService.OwnerlList()
- b, _ := json.Marshal(data)
- log.Println(string(b))
- }
- func TestAddCustomService(t *testing.T) {
- InitConf()
- cs := &service.CustomService{
- PositionId: 1205591997,
- AppId: "10000",
- CustomType: 35,
- Summary: "1",
- CustomAllName: "1",
- CustomAbbreviation: "1",
- CustomLevel: 1,
- CustomIndustry: 11,
- CustomDetailIndustry: 24,
- Province: "000000",
- NextfollowUpTime: 1714406400,
- Types: 1,
- User: []int64{1205591997},
- CreateName: "刘苗苗",
- OwnerId: "875037a55d374627b1bc919c3cd84668",
- }
- cs.Add(context.Background())
- }
- func TestCandidateChannel(t *testing.T) {
- InitConf()
- ownerService := &OwnerService{
- PartyA: "15e4d804ce194a029e9fba645fda0cf0,90e9db9308024d3782a1a03e11ccd684,ed856df4ac4f4eb78a8d1ae9a5a98006,009c313ef8e740e59d57432aea777102,9df7aa60510d45a6875205c2069d550b,2c5ecd5d2a0d4c62884c30e472c95ffe",
- //Supplier: "0d732efa7adc40529100609e6096baad",
- //Intermediary: "30154",
- //Heterotophy: req.Heterotophy,
- //Agency: req.Agency,
- Type: "adiffb",
- EntAccountId: 64,
- PositionId: 1205591999,
- }
- data, a1, a2, a3, a4 := ownerService.CandidateChannel()
- for _, v := range *data {
- log.Println(fmt.Sprintf("%+v", v))
- }
- log.Println(a1)
- log.Println(a2)
- log.Println(a3)
- log.Println(a4)
- }
- func TestProjectHistory(t *testing.T) {
- InitConf()
- data := GetData3("2", "128a81f9facb4aefb817244dc2c0e655", "北京城市之光生态环境有限公司")
- for _, v := range data {
- log.Println(fmt.Sprintf("%+v", v))
- }
- }
- func TestChanceAdd(t *testing.T) {
- chance := &service.SaleChanceService{
- PositionId: 935,
- AppId: "10000",
- ChanceName: "王传进的销售机会5", //机会名称
- Summary: "王传进的销售机会5", //概要信息
- ChanceClassify: 30, //机会分类
- ExpectedOrderTime: 0, //最初预计落单段时间 时间戳
- CustomName: "王传进测试", //客户全称
- BusinessType: 3, //业务类型
- NextfollowUpTime: 1715097600, //下次跟进时间戳
- Types: 1, //处理方式 1自办;2转办
- User: []int64{935}, //企业用户id
- CustomId: 300069, //客户id
- CreateName: "企业管理员",
- ChanceSource: 54,
- BusinessId: "",
- }
- status, _ := chance.Add(context.Background())
- log.Println(status)
- }
|