Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chaincode
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘星星@五瓣科技
chaincode
Commits
7900ce74
Commit
7900ce74
authored
Mar 09, 2021
by
刘星星@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update restropect chaincode
parent
e7d540c7
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
271 additions
and
109 deletions
+271
-109
vcs.xml
.idea/vcs.xml
+1
-0
workspace.xml
.idea/workspace.xml
+190
-100
medical.go
src/medical_chain/medical.go
+7
-4
medical_chain
src/medical_chain/medical_chain
+0
-0
restropect_test.go
src/retrospect_chain/restropect_test.go
+2
-1
retrospect.go
src/retrospect_chain/retrospect.go
+4
-4
testcc.go
src/testcc/testcc.go
+47
-0
testcc_test.go
src/testcc/testcc_test.go
+20
-0
No files found.
.idea/vcs.xml
View file @
7900ce74
...
...
@@ -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
.idea/workspace.xml
View file @
7900ce74
This diff is collapsed.
Click to expand it.
src/medical_chain/medical.go
View file @
7900ce74
...
...
@@ -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
}
src/medical_chain/medical_chain
0 → 100755
View file @
7900ce74
File added
src/retrospect_chain/restropect_test.go
View file @
7900ce74
...
...
@@ -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
)
{
...
...
src/retrospect_chain/retrospect.go
View file @
7900ce74
...
...
@@ -435,12 +435,12 @@ type QualityTestShow struct {
QtId
string
`json:"qtId"`
//质检信息ID 当前这一批次对应的质检信息ID
Detection
bool
`json:"detection"`
//检测机构
DetectionMode
bool
`json:"detection_mode"`
//检测方式
DetectionTi
em
bool
`json:"detection_tiem
"`
//检测时间
DetectionTi
me
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
:
...
...
src/testcc/testcc.go
0 → 100644
View file @
7900ce74
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
)
}
}
src/testcc/testcc_test.go
0 → 100644
View file @
7900ce74
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
)))
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment