update restropect chaincode

parent e7d540c7
......@@ -2,5 +2,6 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/src/bean" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
......@@ -21,14 +21,14 @@ type Medical struct {
}
/*
公司信息
公司信息
*/
type CompanyInfo struct {
Id uint64`json:"id"`
BusinessLicense string `json:"businessLicense"`
Cname string `json:"cname"`
CmpanyAddress string `json:"cmpanyAddress"`
CompanyDesc string `json:"companyDesc"`
CompanyDesc string `json:"companyDesc"`/**/
CompanyType string `json:"companyType"`
ContactPhone string `json:"contactPhone"`
Contacts string `json:"contacts"`
......@@ -234,7 +234,7 @@ func AddBusinessInfo(args []string,stub shim.ChaincodeStubInterface) pb.Response
}
/*
技术人员添加使用信息
技术人员添加使用信息
*/
func AddUseInfo(args []string,stub shim.ChaincodeStubInterface) pb.Response{
if len(args) > 1 {
......@@ -394,4 +394,7 @@ func main() {
if err != nil {
fmt.Printf("Error starting medical chaincode: %s", err)
}
}
\ No newline at end of file
}
......@@ -43,7 +43,8 @@ var(
packagingInfo =`{"packid":"1101","cid":"1101","baseId":"baseId","plotId":"plotId","sid":"1101","bno":"1102","packInfo":"packInfo","bizType":"bizType","pno":"bizType","packCount":0,"packUnit":"packUnit","packDate":"packUnit","packPics":["speciesDesc","speciesDesc"],"principalId":"packUnit","principal":"packUnit"}`
salesInfo =`{"id":"1101","cid":"1101","baseId":"baseId","plotId":"plotId","sid":"sid","bno":"1101","saleInfo":"saleInfo","bizType":"bizType","sno":"1101","customer":"customer","saleCount":0,"packingSize":"customer","saleDate":"saleDate","salePics":"salePics","trackingNo":"trackingNo","logisticsName":"logisticsName","did":0,"principalId":"principalId","principal":"principalId","commissionRatio":0}`
qrcode =`{"p_no":"1102","start_number":0,"count":100,"product_show":{"product_name":true,"pick_date":true,"expiration_date":10,"product_type":true,"product_no":true,"stoage_mode":"低温保存","product_des":true,"product_files":["speciesDesc","speciesDesc"]},"retrospect_show":{"base_name":"1101","polt_name":"1101","species_name":"1101","plant_activity":"1101","plant_test":"1101","plant_pick":"1101",
"quality_test":"1101","packaging":"1101","sale_info":"1101","logistics_info":false,"base_files":["speciesDesc","speciesDesc"]},"quality_test_show":{"qtId":"1101","detection":false,"detection_mode":false,"detection_tiem":false,"detection_result":false,"detection_people":false,"write_detection_paper":false,"air_detection_paper":false},"company_show":{"cid":"1101","company_name":false,"company_person":false,"company_address":false,"company_intro":false,"business_license":false}}`
"quality_test":"1101","packaging":"1101","sale_info":"1101","logistics_info":false,"base_files":["speciesDesc","speciesDesc"]},"quality_test_show":{"qtId":"1101","detection":false,"detection_mode":false,"detection_tiem":false,"detection_result":false,"detection_people":false,"detection_paper":false,"land_detection_paper":false,"write_detection_paper":false,"air_detection_paper":false},"company_show":
{"cid":"1101","principal":false,"principal_phone":false,"company_name":false,"company_person":false,"company_address":false,"company_intro":false,"business_license":false}}`
)
func TestAddActivityInfo(t *testing.T) {
......
......@@ -435,12 +435,12 @@ type QualityTestShow struct {
QtId string `json:"qtId"` //质检信息ID 当前这一批次对应的质检信息ID
Detection bool `json:"detection"` //检测机构
DetectionMode bool `json:"detection_mode"` //检测方式
DetectionTiem bool `json:"detection_tiem"` //检测时间
DetectionTime bool `json:"detection_time"` //检测时间
DetectionResult bool `json:"detection_result"` //检测结果
DetectionPeople bool `json:"detection_people"` //检测人
DetectionPaper bool `json:"detection_paper"` //质量检测报告
WaterDetectionPaper bool `json:"write_detection_paper"` //水检测报告
LandDetectionPaper bool `json:"detection_paper"` //土地检测报告
LandDetectionPaper bool `json:"land_detection_paper"` //土地检测报告
AirDetectionPaper bool `json:"air_detection_paper"` //空气检测报告
}
......@@ -451,7 +451,7 @@ type CompanyShow struct {
Cid string `json:"cid"` //企业Id 当前这一批次对应的企业信息ID
CompanyName bool `json:"company_name"`
Principal bool `json:"principal"` //负责人
PrincipalPhone bool `json:"principal"` //负责人联系电话
PrincipalPhone bool `json:"principal_phone"` //负责人联系电话
CompanyPerson bool `json:"company_person"` //公司法人
CompanyAddress bool `json:"company_address"` //公司地址
CompanyIntro bool `json:"company_intro"` //公司简介
......@@ -533,7 +533,7 @@ func (ret *Retrospect) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
case "addsaleInfo": //增加销售信息
return AddsaleInfo( args, stub)
case "searchRespectInfo": //查询溯源信息
return SearchRespectInfo( args, stub)
return SearchRespectInfo(args, stub)
case "testCheck": //测试接口
return TestCheck(args, stub)
default:
......
package main
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
type TestCC struct {
}
func (ret *TestCC) Init(stub shim.ChaincodeStubInterface) pb.Response {
return shim.Success([]byte("retrospect chain init success"))
}
// Invoke is called to update or query the ledger in a proposal transaction.
// Updated state variables are not committed to the ledger until the
// transaction is committed.
func (ret *TestCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
functionName, args := stub.GetFunctionAndParameters()
switch functionName {
case "testCheck": //测试接口
return TestCheck(args, stub)
default:
return shim.Error(fmt.Sprintf("%s Unsupported function name ", functionName))
}
return pb.Response{}
}
func TestCheck(args []string, stub shim.ChaincodeStubInterface) pb.Response {
if len(args) == 0 {
return shim.Success([]byte("参数内容为空"))
}
return shim.Success([]byte(args[0]))
}
func main() {
err := shim.Start(&TestCC{})
if err != nil {
fmt.Printf("Error starting medical chaincode: %s", err)
}
}
package main
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
"testing"
)
func TestBeanChainCode_Invoke(t *testing.T) {
cc := new(TestCC)
stub := shim.NewMockStub("BeanCC", cc)
stub.MockInit("init", nil)
fmt.Println("========================================invoke FinancingInfoBean Management getFinancingById============================================")
responseByAddFin := stub.MockInvoke("invoke1", [][]byte{[]byte("testCheck")})
if responseByAddFin.Status != 200 {
t.Error(fmt.Printf("Invoke status %d,message %s and payload %s\n", responseByAddFin.Status, responseByAddFin.Message, string(responseByAddFin.Payload)))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment