123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- package service
- import (
- "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"
- )
- //go test -test.run=TestNetWorkList -fs=../../etc/networkmanage.yaml -lf=../../etc/logs.yaml -df=../../etc/db.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{
- EntId: 221,
- //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: "agency",
- //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{
- EntId: 1,
- PositionId: 65858,
- //ClickId: "30126", //甲方 有多级
- //ClickId: "60090", //甲方 有一级
- //ClickId: "13", //供应商
- //ClickId: "a2c934cc9fda4561864077f2cf7f44ba",
- //CheckCode: "同甲异业渠道:ffe7b3b526f048f9999b803a4241ce77",
- //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{
- PartyA: "ffe7b3b526f048f9999b803a4241ce77",
- Heterotophy: "ffe7b3b526f048f9999b803a4241ce77",
- //Agency: "wcj_11111111c,112233445566,001dfe3364b8480c965f81ab64d76bb4,00172d07d1fd4d90bd95fe5a348a845d",
- Agency: "00172d07d1fd4d90bd95fe5a348a845d",
- Supplier: "ffe7b3b526f048f9999b803a4241ce77",
- PageIndex: 1,
- PageSize: 100,
- ProjectType: "1",
- PositionId: 935,
- EntId: 221,
- //PositionId: 1205591997,
- //EntId: 146318,
- //SourceType: "2",
- }
- data := ownerService.OwnerlList()
- b, _ := json.Marshal(data)
- log.Println(string(b))
- }
- func TestProjectHistory(t *testing.T) {
- InitConf()
- data := GetData3("2", "128a81f9facb4aefb817244dc2c0e655", "北京城市之光生态环境有限公司")
- for _, v := range data {
- log.Println(fmt.Sprintf("%+v", v))
- }
- }
- func TestCoopHistoryService(t *testing.T) {
- InitConf()
- result := GetPrList(&types.CoopHistoryReq{
- PositionId: 935,
- EntId: 221,
- Buyer: "武汉市中心医院",
- ChannelType: "0",
- })
- log.Println(result.Size_1, result.Size_2, result.Size_3, result.Size_4)
- for _, v := range result.Result {
- log.Println(fmt.Sprintf("%+v", v))
- }
- }
- func TestInitNetwork(t *testing.T) {
- //安徽公共资源交易集团项目管理有限公司
- //广州粤华物业有限公司
- //
- InitConf()
- inw := InitNetwork{
- PositionId: 935,
- EntId: 221,
- DeptId: 498,
- UserId: 195,
- EntName: "武汉市中心医院",
- BusinessType: "建筑工程,机械设备,信息技术",
- }
- inw.Init()
- }
- func TestDeleteCache(t *testing.T) {
- InitConf()
- Network.DeleteCache(935)
- }
- func TestIntroduceSupplier(t *testing.T) {
- InitConf()
- for k, v := range Network.Introduce_Supplier([]string{"fb180e2267d74081a0e177692df92b42"}, []string{"建筑工程", "机械设备", "信息技术"}, true) {
- log.Println(k, fmt.Sprintf("%+v", v))
- }
- }
- func TestGetProjectList(t *testing.T) {
- InitConf()
- req := &types.ProjectListReq{
- PositionId: 935,
- EntId: 221,
- PartyA: "30604a74c36f47daa532503ac496914c",
- Supplier: "",
- Heterotophy: "",
- Intermediary: "",
- Agency: "",
- PageNum: 1,
- PageSize: 10,
- BusinessType: "全部",
- // Area: "广东",
- // Amount: "2,3,4,5",
- }
- resp := GetProjectList(req)
- log.Println(resp.HasNextPage, resp.Count)
- for _, v := range resp.PList {
- log.Println(v)
- }
- }
|