Browse Source

历史排班

28169 1 year ago
parent
commit
93374dd4c5
4 changed files with 140 additions and 73 deletions
  1. 1 1
      conf/app.conf
  2. 16 4
      controllers/sign_api_controller.go
  3. 14 12
      models/new_stock_models.go
  4. 109 56
      service/sign_service.go

+ 1 - 1
conf/app.conf View File

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4 4
 #dev/prod
5 5
 
6 6
 #

+ 16 - 4
controllers/sign_api_controller.go View File

@@ -40,6 +40,9 @@ func SignApiRegistRouters() {
40 40
 
41 41
 	//后台签署(返回签署文件)
42 42
 	beego.Router("/api/sign/createbackstagesign", &SignApiController{}, "Get:CreateBackStageSign")
43
+
44
+	//创建企业印章并添加授权用户
45
+	beego.Router("/api/sign/totestelment", &SignApiController{}, "Get:CreateEnterprise")
43 46
 }
44 47
 
45 48
 // 短信服务接口
@@ -259,7 +262,7 @@ func (this *SignApiController) CreateBackStageSign() {
259 262
 	signControl := make(map[string]interface{})
260 263
 	signControl["1"] = "123456"
261 264
 	signFiles["signControl"] = signControl
262
-	signFiles["docId"] = "156002269974758623"
265
+	signFiles["docId"] = "156190809375377646"
263 266
 	inputDataArrThree := make([]map[string]interface{}, 0)
264 267
 	inputDataArrThree = append(inputDataArrThree, signFiles)
265 268
 
@@ -268,11 +271,11 @@ func (this *SignApiController) CreateBackStageSign() {
268 271
 	signer["signerId"] = "156002269974758623"
269 272
 	signer["isUserWishes"] = true
270 273
 	signer["userWishesWay"] = 1
271
-	signer["codeNumber"] = "msg202308101550388589355"
272
-	signer["verifyCode"] = "123456"
274
+	signer["codeNumber"] = "msg202308111444501897422"
275
+	signer["verifyCode"] = "978176"
273 276
 	signer["signFiles"] = inputDataArrThree
274 277
 	maprequest := make(map[string]interface{})
275
-	maprequest["contractId"] = "156002172264252635"
278
+	maprequest["contractId"] = "156190809375377645"
276 279
 	maprequest["signer"] = signer
277 280
 
278 281
 	this.ServeSuccessJSON(map[string]interface{}{
@@ -290,3 +293,12 @@ func (this *SignApiController) GetVerificationCode() {
290 293
 	})
291 294
 	return
292 295
 }
296
+
297
+func (this *SignApiController) CreateEnterprise() {
298
+
299
+	sign := service.CreateEnterprise()
300
+	this.ServeSuccessJSON(map[string]interface{}{
301
+		"sign": sign,
302
+	})
303
+	return
304
+}

+ 14 - 12
models/new_stock_models.go View File

@@ -262,18 +262,20 @@ func (VmNewStockFlowTwenty) TableName() string {
262 262
 }
263 263
 
264 264
 type GoodInfoTwenty struct {
265
-	ID                     int64                   `gorm:"column:id" json:"id" form:"id"`
266
-	SpecificationName      string                  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
267
-	GoodTypeId             int64                   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
268
-	BuyPrice               float64                 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
269
-	Manufacturer           int64                   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
270
-	Status                 int64                   `gorm:"column:status" json:"status" form:"status"`
271
-	OrgId                  int64                   `gorm:"column:org_id" json:"org_id" form:"org_id"`
272
-	GoodName               string                  `gorm:"column:good_name" json:"good_name" form:"good_name"`
273
-	RetailPrice            float64                 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
274
-	PackingUnit            string                  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
275
-	PackingPrice           float64                 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
276
-	StWarehousingInfo      []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
265
+	ID                int64                `gorm:"column:id" json:"id" form:"id"`
266
+	SpecificationName string               `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
267
+	GoodTypeId        int64                `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
268
+	BuyPrice          float64              `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
269
+	Manufacturer      int64                `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
270
+	Status            int64                `gorm:"column:status" json:"status" form:"status"`
271
+	OrgId             int64                `gorm:"column:org_id" json:"org_id" form:"org_id"`
272
+	GoodName          string               `gorm:"column:good_name" json:"good_name" form:"good_name"`
273
+	RetailPrice       float64              `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
274
+	PackingUnit       string               `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
275
+	PackingPrice      float64              `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
276
+	GoodNumber        string               `gorm:"column:good_number" json:"good_number" form:"good_number"`
277
+	StWarehousingInfo []*StWarehousingInfo `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
278
+
277 279
 	WarehousingInfoOne     []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
278 280
 	WarehousingInfoStart   []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
279 281
 	WarehousingInfoEnd     []*StartWarehousingInfo `gorm:"json:"warehouse_info_end"`

+ 109 - 56
service/sign_service.go View File

@@ -110,11 +110,11 @@ func CreateUserName(phone string, disPlayName string) (string, string) {
110 110
 	url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createUserRealName"
111 111
 	var phoneOne string
112 112
 
113
-	phoneOne = "13318464649"
113
+	phoneOne = "13318464642"
114 114
 
115 115
 	var disPlayNameOne string
116 116
 
117
-	disPlayNameOne = "王老师"
117
+	disPlayNameOne = "马云的朋友"
118 118
 
119 119
 	var authentication string
120 120
 	//测试环境用true
@@ -206,11 +206,11 @@ func CreatePersionSeal(user_id string, person_seal_type int64, person_seal_name
206 206
 
207 207
 	maprequest := make(map[string]interface{})
208 208
 
209
-	maprequest["userId"] = "DVVZ65G1JTC1BH3AHYY2KYAE"
209
+	maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
210 210
 
211 211
 	maprequest["personSealType"] = 1
212 212
 
213
-	maprequest["personSealName"] = "测试印章"
213
+	maprequest["personSealName"] = "马云朋友的印章"
214 214
 
215 215
 	var url string
216 216
 
@@ -275,11 +275,11 @@ func CreateUploadPact(contractcode string, contractname string, signcount int64,
275 275
 
276 276
 	//maprequest["contractCode"] = "102020620701056856"
277 277
 
278
-	maprequest["contractName"] = "汽车购买交易合同"
278
+	maprequest["contractName"] = "电脑购买交易合同"
279 279
 
280 280
 	maprequest["signCount"] = 10
281 281
 
282
-	maprequest["docName"] = "员工保密协议"
282
+	maprequest["docName"] = "电脑员工保密协议"
283 283
 
284 284
 	file := "C:/Users/28169/Desktop/打印单.pdf"
285 285
 	fileBytes, err := ioutil.ReadFile(file) // 读取file
@@ -289,7 +289,7 @@ func CreateUploadPact(contractcode string, contractname string, signcount int64,
289 289
 	maprequest["contractBase64"] = contractBase64
290 290
 
291 291
 	//添加企业成员 里面的USERID
292
-	maprequest["creator"] = "DCBCD8QR2TU6B83XFF3FOHJL"
292
+	maprequest["creator"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
293 293
 
294 294
 	maprequest["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
295 295
 
@@ -347,7 +347,7 @@ func CreateEnterPriseRealName(enterprisename string) string {
347 347
 	customerReq["idCardType"] = "N"
348 348
 	customerReq["idCardNum"] = "430526199408156511"
349 349
 
350
-	maprequest["enterpriseName"] = "深圳益森科技有限公司"
350
+	maprequest["enterpriseName"] = "深圳德马西科技有限公司"
351 351
 	maprequest["authentication"] = true
352 352
 	maprequest["customerAuthReq"] = customerReq
353 353
 
@@ -398,7 +398,7 @@ func CreateUserId(userId string, displayName string) string {
398 398
 	maprequest := make(map[string]interface{})
399 399
 
400 400
 	maprequest["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
401
-	maprequest["userId"] = "DCBCD8QR2TU6B83XFF3FOHJL"
401
+	maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
402 402
 
403 403
 	byterequest, _ := json.Marshal(maprequest)
404 404
 	reader := bytes.NewReader(byterequest)
@@ -477,54 +477,55 @@ func AddContractSignatory(contractId string, signers string, contract models.New
477 477
 
478 478
 	serviceCode := beego.AppConfig.String("serviceCode")
479 479
 
480
-	sealTimestampFiles := make(map[string]interface{})
481
-	fontsFiles := make(map[string]interface{})
482
-	inputDataArr := make([]map[string]interface{}, 0)
483 480
 	signFiles := make(map[string]interface{})
484
-	for _, item := range sealTimestampFiles {
485
-		fmt.Println(item)
486
-		keywordSignControls := make(map[string]interface{})
487
-		keywordSignControls["controlsKey"] = "2"
488
-		keywordSignControls["pattern"] = "1"
489
-		keywordSignControls["color"] = "#FF0000"
490
-		inputDataArr = append(inputDataArr, keywordSignControls)
491
-	}
492 481
 
493
-	sealTimestampFiles["allAddTimestamp"] = false
494
-	sealTimestampFiles["someTimestampStyle"] = inputDataArr
482
+	signFiles["docId"] = "156190809375377646"
495 483
 
496
-	inputDataArrOne := make([]map[string]interface{}, 0)
497
-	for _, item := range fontsFiles {
498
-		fmt.Println("item", item)
499
-		keySignControls := make(map[string]interface{})
500
-		keySignControls["controlsKey"] = "1"
501
-		keySignControls["fontType"] = 1
502
-		keySignControls["fontSize"] = 8.5
503
-		keySignControls["fontColor"] = "#56600F"
504
-		keySignControls["alignment"] = 1
505
-		inputDataArrOne = append(inputDataArrOne, keySignControls)
506
-	}
507
-	signFiles["fonts"] = inputDataArrOne
508
-	signFiles["showTimestamp"] = false
509
-	signFiles["sealTimestamp"] = sealTimestampFiles
510
-	signControl := make(map[string]interface{})
511
-	signControl["1"] = "234535"
512
-	signFiles["signControl"] = signControl
484
+	inputDataArr := make([]map[string]interface{}, 0)
513 485
 
486
+	for _, item := range signFiles {
487
+		fmt.Println("item", item)
488
+		xySignControls := make(map[string]interface{})
489
+		xySignControls["key"] = "1"
490
+		xySignControls["type"] = "autograph"
491
+		xySignControls["pageNum"] = 1
492
+		xySignControls["positionX"] = 100
493
+		xySignControls["positionY"] = 100
494
+		inputDataArr = append(inputDataArr, xySignControls)
495
+	}
496
+	inputDataArrTwo := make([]map[string]interface{}, 0)
497
+	for _, item := range signFiles {
498
+		fmt.Println(item)
499
+		keywordSignControls := make(map[string]interface{})
500
+		keywordSignControls["key"] = "2"
501
+		keywordSignControls["type"] = "autograph"
502
+		keywordSignControls["pageNum"] = 1
503
+		keywordSignControls["keyword"] = "盖章"
504
+		keywordSignControls["offsetX"] = 100
505
+		keywordSignControls["offsetY"] = 100
506
+		inputDataArrTwo = append(inputDataArrTwo, keywordSignControls)
507
+	}
508
+	signFiles["xySignControls"] = inputDataArr
509
+	signFiles["keywordSignControls"] = inputDataArrTwo
514 510
 	inputDataArrThree := make([]map[string]interface{}, 0)
515 511
 	inputDataArrThree = append(inputDataArrThree, signFiles)
516 512
 
517
-	signer := make(map[string]interface{})
513
+	signersFiles := make(map[string]interface{})
514
+
515
+	signersFiles["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
516
+	signersFiles["signerType"] = "1"
517
+	signersFiles["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
518
+	signersFiles["sequence"] = "8"
519
+	signersFiles["sendMsg"] = false
520
+	signersFiles["signFiles"] = inputDataArrThree
521
+
522
+	inputDataArrFour := make([]map[string]interface{}, 0)
523
+
524
+	inputDataArrFour = append(inputDataArrFour, signersFiles)
518 525
 
519
-	signer["signerId"] = "156002269974758623"
520
-	signer["isUserWishes"] = true
521
-	signer["userWishesWay"] = 1
522
-	signer["codeNumber"] = "1004"
523
-	signer["verifyCode"] = "13006"
524
-	signer["signFiles"] = inputDataArrThree
525 526
 	maprequest := make(map[string]interface{})
526
-	maprequest["contractId"] = "156002172264252635"
527
-	maprequest["signer"] = signer
527
+	maprequest["contractId"] = "156190809375377645"
528
+	maprequest["signers"] = inputDataArrFour
528 529
 
529 530
 	byterequest, _ := json.Marshal(maprequest)
530 531
 	reader := bytes.NewReader(byterequest)
@@ -595,22 +596,22 @@ func CreateBackStageSign(contractId string, signers string) string {
595 596
 	signFiles["showTimestamp"] = false
596 597
 	signFiles["sealTimestamp"] = sealTimestampFiles
597 598
 	signControl := make(map[string]interface{})
598
-	signControl["1"] = "123456"
599
+	signControl["1"] = "autograph"
599 600
 	signFiles["signControl"] = signControl
600
-	signFiles["docId"] = "156002269974758623"
601
+	signFiles["docId"] = "156190809375377646"
601 602
 	inputDataArrThree := make([]map[string]interface{}, 0)
602 603
 	inputDataArrThree = append(inputDataArrThree, signFiles)
603 604
 
604 605
 	signer := make(map[string]interface{})
605 606
 
606
-	signer["signerId"] = "156002269974758623"
607
+	signer["signerId"] = "156190965067942129"
607 608
 	signer["isUserWishes"] = true
608 609
 	signer["userWishesWay"] = 1
609
-	signer["codeNumber"] = "msg202308101909098052578"
610
-	signer["verifyCode"] = "123456"
610
+	signer["codeNumber"] = "msg202308111745462623789"
611
+	signer["verifyCode"] = "930788"
611 612
 	signer["signFiles"] = inputDataArrThree
612 613
 	maprequest := make(map[string]interface{})
613
-	maprequest["contractId"] = "156002172264252635"
614
+	maprequest["contractId"] = "156190809375377645"
614 615
 	maprequest["signer"] = signer
615 616
 
616 617
 	byterequest, _ := json.Marshal(maprequest)
@@ -656,8 +657,8 @@ func GetVerificationCode() string {
656 657
 	serviceCode := beego.AppConfig.String("serviceCode")
657 658
 
658 659
 	maprequest := make(map[string]interface{})
659
-	maprequest["contractId"] = "156002172264252635"
660
-	maprequest["userId"] = "DCBCD8QR2TU6B83XFF3FOHJL"
660
+	maprequest["contractId"] = "156190809375377645"
661
+	maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
661 662
 
662 663
 	byterequest, _ := json.Marshal(maprequest)
663 664
 	reader := bytes.NewReader(byterequest)
@@ -689,3 +690,55 @@ func GetVerificationCode() string {
689 690
 
690 691
 	return str
691 692
 }
693
+
694
+func CreateEnterprise() string {
695
+
696
+	var url string
697
+
698
+	url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/sendSmsCode"
699
+	appId := beego.AppConfig.String("sign_appid")
700
+
701
+	serviceKye := beego.AppConfig.String("serviceKye")
702
+
703
+	serviceCode := beego.AppConfig.String("serviceCode")
704
+
705
+	maprequest := make(map[string]interface{})
706
+	maprequest["contractId"] = "156190809375377645"
707
+	maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
708
+	maprequest["sealType"] = 1
709
+	maprequest["sealName"] = "测试用章"
710
+	maprequest["sealBase64"] = ""
711
+	maprequest["color"] = 1
712
+	maprequest["width"] = 40
713
+	maprequest["authUserId"] = ""
714
+	maprequest["sealCreateType"] = false
715
+	byterequest, _ := json.Marshal(maprequest)
716
+	reader := bytes.NewReader(byterequest)
717
+
718
+	signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
719
+
720
+	request, err := http.NewRequest("POST", url, reader)
721
+	if err != nil {
722
+		fmt.Println(err.Error())
723
+	}
724
+
725
+	request.Header.Set("appId", appId)
726
+	request.Header.Set("serviceCode", serviceCode)
727
+	request.Header.Set("Content-Type", "application/json;charset=UTF-8")
728
+	request.Header.Set("Content-Signature", signatureStr)
729
+	client := http.Client{}
730
+
731
+	resp, err := client.Do(request)
732
+	if err != nil {
733
+		fmt.Println(err.Error())
734
+
735
+	}
736
+	respBytes, err := ioutil.ReadAll(resp.Body)
737
+	if err != nil {
738
+		fmt.Println(err.Error())
739
+
740
+	}
741
+	str := string(respBytes)
742
+
743
+	return str
744
+}