更新文章
This commit is contained in:
@@ -6,14 +6,448 @@ password: simeng
|
|||||||
---
|
---
|
||||||
|
|
||||||
## 题目一
|
## 题目一
|
||||||
## 题目二
|
|
||||||
## 题目三
|
|
||||||
## 题目四
|
|
||||||
原题:
|
原题:
|
||||||
|
|
||||||
|
1.食品信息(FoodInfoItem)的接口编码
|
||||||
|
|
||||||
|
(1)编写食品信息实体的接口,完成可溯源食品信息初始化,实现可追溯的原始生产商食品信息上链功能
|
||||||
|
|
||||||
|
(2)编写分销商食品上链信息接口,根据食品溯源智能合约地址获取分销商上链食品的信息
|
||||||
|
|
||||||
|
(3)编写超市进行食品上链信息的接口,根据食品溯源智能合约地址获取超市上链食品信息。
|
||||||
|
|
||||||
|
2.食品溯源(Trace)的接口编码
|
||||||
|
|
||||||
|
(1)编写食品溯源智能合约生产商Producer添加食品接口,必须生产商才能添加可溯源的食品,实现溯源功能
|
||||||
|
|
||||||
|
(2)编写食品溯源智能合约分销商Distributor添加食品接口,必须分销商才能添加可溯源的食品,实现溯源功能
|
||||||
|
|
||||||
|
(3)编写食品溯源智能合约超市Retailer添加食品接口,必须超市才能添加可溯源的食品,实现溯源功能
|
||||||
|
|
||||||
|
3.角色(Role)管理的接口编码
|
||||||
|
|
||||||
|
(1)编写食品溯源增加角色接口,必须是未增加的角色才能被添加,实现添加角色的功能
|
||||||
|
|
||||||
|
(2)编写食品溯源移除角色接口,必须是已增加的角色才能被移除,实现移除角色的功能
|
||||||
|
|
||||||
|
(3)编写食品溯源角色授权接口,必须是授权的角色地址,实现角色权限管理功能
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab Distributor.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity ^0.4.25;
|
||||||
|
|
||||||
|
import "./Roles.sol";
|
||||||
|
|
||||||
|
//中间商角色
|
||||||
|
contract Distributor {
|
||||||
|
using Roles for Roles.Role;
|
||||||
|
|
||||||
|
event DistributorAdded(address indexed account);
|
||||||
|
event DistributorRemoved(address indexed account);
|
||||||
|
|
||||||
|
Roles.Role private _distributors;
|
||||||
|
|
||||||
|
constructor (address distributor ) public {
|
||||||
|
_addDistributor(distributor);
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyDistributor() {
|
||||||
|
require(isDistributor(msg.sender), "DistributorRole: caller does not have the Distributor role");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDistributor(address account) public view returns (bool) {
|
||||||
|
return _distributors.has(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addDistributor(address account) public onlyDistributor {
|
||||||
|
_addDistributor(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renounceDistributor() public {
|
||||||
|
_removeDistributor(msg.sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _addDistributor(address account) internal {
|
||||||
|
_distributors.add(account);
|
||||||
|
emit DistributorAdded(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _removeDistributor(address account) internal {
|
||||||
|
_distributors.remove(account);
|
||||||
|
emit DistributorRemoved(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@tab FoodInfoItem.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity >=0.4.22 <0.5.0;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
|
//食品信息管理合约
|
||||||
|
// 1. 保存食品基本信息:时间戳(流转过程中),用户名(流转过程中),用户地址信息(流转过程中),食品质量(流转过程中),食物名称,当前用户名称,质量,状态.
|
||||||
|
// 2. 对食品基本信息进行初始化
|
||||||
|
// 3. 实现两个方法:中间商添加食品信息;超市添加食品信息
|
||||||
|
// 4. 实现显示食品信息的方法
|
||||||
|
|
||||||
|
contract FoodInfoItem{
|
||||||
|
uint[] _timestamp;//①保存食品流转过程中各个阶段的时间戳
|
||||||
|
string[] _traceName;//②保存食品流转过程各个阶段的用户名
|
||||||
|
address[] _traceAddress;//③保存食品流转过程各个阶段的用户地址信息(和用户一一对应)
|
||||||
|
uint8[] _traceQuality;//④保存食品流转过程中各个阶段的质量
|
||||||
|
string _name;//⑤食品名称
|
||||||
|
string _currentTraceName;//⑥当前用户名称
|
||||||
|
uint8 _quality;//⑦质量(0=优质 1=合格 2=不合格)
|
||||||
|
uint8 _status;//⑧状态(0:生产 1:分销 2:出售)
|
||||||
|
address _owner;//⑨初始化owner
|
||||||
|
|
||||||
|
constructor (string name, string traceName, uint8 quality, address producer) public {
|
||||||
|
_timestamp.push(now);
|
||||||
|
_traceName.push(traceName);
|
||||||
|
_traceAddress.push(producer);
|
||||||
|
_traceQuality.push(quality);
|
||||||
|
_name = name;
|
||||||
|
_currentTraceName = traceName;
|
||||||
|
_quality = quality;
|
||||||
|
_status = 0;
|
||||||
|
_owner = msg.sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTraceInfoByDistributor(string traceName,address distributor, uint8 quality) public returns(bool) {
|
||||||
|
require(_status == 0 , "status must be producing");
|
||||||
|
require(_owner == msg.sender,"only trace contract can invoke")
|
||||||
|
//②
|
||||||
|
_timestamp.push(now);
|
||||||
|
_traceName.push(traceName);
|
||||||
|
_currentTraceName = traceName;
|
||||||
|
_traceAddress.push(distributor);
|
||||||
|
_quality = quality;
|
||||||
|
//③
|
||||||
|
//④
|
||||||
|
_traceQuality.push(_quality);
|
||||||
|
_status = 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTraceInfoByRetailer(string traceName,address retailer, uint8 quality) public returns(bool) {
|
||||||
|
require(_status == 1 , "status must be distributing");
|
||||||
|
require(_owner == msg.sender,"only trace contract can invoke")
|
||||||
|
//②
|
||||||
|
_timestamp.push(now);
|
||||||
|
_traceName.push(traceName);
|
||||||
|
_currentTraceName = traceName;
|
||||||
|
_traceAddress.push(retailer);
|
||||||
|
_quality = quality;
|
||||||
|
//③
|
||||||
|
//④
|
||||||
|
_traceQuality.push(_quality);
|
||||||
|
_status = 2;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function getTraceInfo() public constant returns(uint[], string[], address[], uint8[]) {
|
||||||
|
return(_timestamp, _traceName, _traceAddress, _traceQuality);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFood() public constant returns(uint, string, string, string, address, uint8) {
|
||||||
|
return(_timestamp[0], _traceName[0], _name, _currentTraceName, _traceAddress[0], _quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@tab Producer.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity ^0.4.25;
|
||||||
|
|
||||||
|
import "./Roles.sol";
|
||||||
|
|
||||||
|
//生产者角色
|
||||||
|
contract Producer {
|
||||||
|
using Roles for Roles.Role;
|
||||||
|
|
||||||
|
event ProducerAdded(address indexed account);
|
||||||
|
event ProducerRemoved(address indexed account);
|
||||||
|
|
||||||
|
Roles.Role private _producers;
|
||||||
|
|
||||||
|
constructor (address producer) public {
|
||||||
|
_addProducer(producer);
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyProducer() {
|
||||||
|
require(isProducer(msg.sender), "ProducerRole: caller does not have the Producer role");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isProducer(address account) public view returns (bool) {
|
||||||
|
return _producers.has(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addProducer(address account) public onlyProducer {
|
||||||
|
_addProducer(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renounceProducer() public {
|
||||||
|
_removeProducer(msg.sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _addProducer(address account) internal {
|
||||||
|
_producers.add(account);
|
||||||
|
emit ProducerAdded(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _removeProducer(address account) internal {
|
||||||
|
_producers.remove(account);
|
||||||
|
emit ProducerRemoved(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@tab Retailer.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity ^0.4.25;
|
||||||
|
|
||||||
|
import "./Roles.sol";
|
||||||
|
|
||||||
|
//零售商角色(超市)
|
||||||
|
contract Retailer {
|
||||||
|
using Roles for Roles.Role;
|
||||||
|
|
||||||
|
event RetailerAdded(address indexed account);
|
||||||
|
event RetailerRemoved(address indexed account);
|
||||||
|
|
||||||
|
Roles.Role private _retailers;
|
||||||
|
|
||||||
|
constructor (address retailer) public {
|
||||||
|
_addRetailer(retailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
modifier onlyRetailer() {
|
||||||
|
require(isRetailer(msg.sender), "RetailerRole: caller does not have the Retailer role");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isRetailer(address account) public view returns (bool) {
|
||||||
|
return _retailers.has(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addRetailer(address account) public onlyRetailer {
|
||||||
|
_addRetailer(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renounceRetailer() public {
|
||||||
|
_removeRetailer(msg.sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _addRetailer(address account) internal {
|
||||||
|
_retailers.add(account);
|
||||||
|
emit RetailerAdded(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _removeRetailer(address account) internal {
|
||||||
|
_retailers.remove(account);
|
||||||
|
emit RetailerRemoved(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@tab Roles.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity ^0.4.25;
|
||||||
|
//角色库(管理所有角色地址)
|
||||||
|
// 1. 实现增加角色地址
|
||||||
|
// 2. 移除角色地址
|
||||||
|
// 3. 判断角色地址是否被授权
|
||||||
|
library Roles {
|
||||||
|
struct Role {
|
||||||
|
mapping (address => bool) bearer;
|
||||||
|
}
|
||||||
|
function add(Role storage role, address account) internal {
|
||||||
|
require(!has(role, account), "Roles: account already has role");
|
||||||
|
role.bearer[account] = true;
|
||||||
|
}
|
||||||
|
function remove(Role storage role, address account) internal {
|
||||||
|
require(has(role, account), "Roles: account does not have role");
|
||||||
|
role.bearer[account] = false;
|
||||||
|
}
|
||||||
|
function has(Role storage role, address account) internal returns (bool) {
|
||||||
|
require(account != address(0), "Roles: account is the zero address");
|
||||||
|
return role.bearer[account];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@tab Trace.sol
|
||||||
|
```solidity
|
||||||
|
pragma solidity >=0.4.22 <0.7.0;
|
||||||
|
pragma experimental ABIEncoderV2;
|
||||||
|
import "./FoodInfoItem.sol";
|
||||||
|
import "./Distributor.sol";
|
||||||
|
import "./Producer.sol";
|
||||||
|
import "./Retailer.sol";
|
||||||
|
|
||||||
|
//食品溯源合约(负责具体食品溯源信息的生成)
|
||||||
|
// 1.实现生产食品的方法(新建食品信息)
|
||||||
|
// 2.实现食品分销过程中增加溯源信息的接口
|
||||||
|
// 3.实现食品出售过程中增加溯源信息的接口
|
||||||
|
// 4.实现获取食品溯源信息接口
|
||||||
|
|
||||||
|
contract Trace is Producer, Distributor, Retailer{
|
||||||
|
|
||||||
|
mapping (uint256 => address) foods;//食品溯源id到具体食品溯源合约的映射表
|
||||||
|
uint[] foodList;
|
||||||
|
|
||||||
|
//构造函数
|
||||||
|
constructor(address producer, address distributor, address retailer)
|
||||||
|
public Producer(producer)
|
||||||
|
Distributor(distributor)
|
||||||
|
Retailer(retailer){
|
||||||
|
|
||||||
|
}
|
||||||
|
//生成食品溯源信息接口
|
||||||
|
//只有Producer能调用
|
||||||
|
//name 食品名称
|
||||||
|
//traceNumber 食品溯源id
|
||||||
|
//traceName 当前用户名称
|
||||||
|
//quality 当前食品质量
|
||||||
|
function newFood(string name,uint256 traceNumber, string traceName, uint8 quality)
|
||||||
|
public onlyProducer returns(uint)
|
||||||
|
{
|
||||||
|
require(foods[traceNumber] == address(0),"traceName already exist");//④
|
||||||
|
FoodInfoItem food = new FoodInfoItem(name,traceName,quality,msg.sender);//⑤
|
||||||
|
foods[traceNumber] = food;//⑥
|
||||||
|
foodList.push(traceNumber);//⑦
|
||||||
|
retur food;//⑧
|
||||||
|
}
|
||||||
|
|
||||||
|
//食品分销过程中增加溯源信息的接口
|
||||||
|
//只有Distributor能调用
|
||||||
|
//traceNumber 食品溯源id
|
||||||
|
//traceName 当前用户名称
|
||||||
|
//quality 当前食品质量
|
||||||
|
function addTraceInfoByDistributor(uint256 traceNumber,string traceName, uint8 quality)
|
||||||
|
public onlyRetailer returns(bool) {
|
||||||
|
require(foods[traceNumber] != address(0),"traceNumber does not exist");
|
||||||
|
//③
|
||||||
|
return FoodInfoItem(foods[traceNumber]).addTraceInfoByDistributor(traceName,msg.sender, quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
//食品出售过程中增加溯源信息的接口
|
||||||
|
//只有Retailer能调用
|
||||||
|
//traceNumber 食品溯源id
|
||||||
|
//traceName 当前用户名称
|
||||||
|
//quality 当前食品质量
|
||||||
|
function addTraceInfoByRetailer(uint256 traceNumber,string traceName, uint8 quality)
|
||||||
|
public onlyRetailer returns(bool) {
|
||||||
|
require(foods[traceNumber != address(0)], "traceNumber does not exist");
|
||||||
|
return FoodInfoItem(foods[traceNumber]).addTraceInfoByRetailer(traceName,msg.sender, quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取食品溯源信息接口
|
||||||
|
//string[] 保存食品流转过程中各个阶段的相关信息
|
||||||
|
//address[] 保存食品流转过程各个阶段的用户地址信息(和用户一一对应)
|
||||||
|
//uint8[] 保存食品流转过程中各个阶段的状态变化
|
||||||
|
function getTraceInfo(uint256 traceNumber) public constant returns(uint[], string[], address[], uint8[]) {
|
||||||
|
require(foods[traceNumber] != address(0), "traceNumber does not exist");
|
||||||
|
return FoodInfoItem(foods[traceNumber]).getTraceInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFood(uint256 traceNumber) public constant returns(uint, string, string, string, address, uint8) {
|
||||||
|
require(foods[traceNumber] != address(0), "traceNumber does not exist");
|
||||||
|
return FoodInfoItem(foods[traceNumber]).getFood();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAllFood() public constant returns (uint[]) {
|
||||||
|
return foodList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
## 题目二
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
1.供应链金融实体信息编码(6分)
|
||||||
|
|
||||||
|
(1)编写供应链金融智能合约的实体接口,完成实体通用数据的初始化,实现企业和票据实体信息上链的功能;(2分)
|
||||||
|
|
||||||
|
(2)编写企业上链信息接口,实现供应链金融的企业信息上链;(2分)
|
||||||
|
|
||||||
|
(3)基于给定的智能合约代码以及注释,完成银行向企业交易的接口函数;(2分)
|
||||||
|
|
||||||
|
2.供应链金融公司与公司接口编码(6分)
|
||||||
|
|
||||||
|
(1)编写公司与公司之间进行交易的历史存证上链接口,实现公司与公司之间的交易功能;(2分)
|
||||||
|
|
||||||
|
(2)编写创建存证的接口,实现创建存证的功能;(2分)
|
||||||
|
|
||||||
|
(3)编写交易金额数量变化的接口,实现凭证交易双方资金的变化功能;(2分)
|
||||||
|
|
||||||
|
3.供应链金融公司与银行交易的接口编码(4分)
|
||||||
|
|
||||||
|
(1)编写公司与银行之间进行交易的历史存证上链接口,实现公司与银行之间的交易功能;(2分)
|
||||||
|
|
||||||
|
(2)编写创建存证的接口,实现创建存证的功能;(1分)
|
||||||
|
|
||||||
|
(3)编写交易金额数量变化的接口,实现凭证交易双方资金的变化功能;(1分)
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
## 题目三
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
子任务2-2-1:太阳能板管理接口编码
|
||||||
|
|
||||||
|
1. 根据文档要求,编写太阳能板新增接口功能,必须将新增太阳能板数据存入指定表中,在存储完成后需触发后事件并返回存储与否的标识;
|
||||||
|
|
||||||
|
2. 根据文档要求,编写太阳能板修改接口,必须通过指定表修改完成数据更新,在完成更新后需触发事件并返回更新与否的标识。
|
||||||
|
|
||||||
|
子任务2-2-2:能源管理接口编码
|
||||||
|
|
||||||
|
1. 根据文档要求,编写能源新增接口功能,必须将新增能源数据存入指定表中,在存储完成后需触发后事件并返回存储与否的标识;
|
||||||
|
|
||||||
|
2. 根据文档要求,编写能源修改接口,必须通过指定表修改完成数据更新,在完成更新后需触发事件并返回更新与否的标识。
|
||||||
|
|
||||||
|
子任务2-2-3:合约部署和调用
|
||||||
|
|
||||||
|
1. 解决代码错误和警告,正确编译并部署合约,成功获取部署的合约地址和ABI;
|
||||||
|
|
||||||
|
2. 调用太阳能板查询合约接口,完整验证业务流程;
|
||||||
|
|
||||||
|
3. 调用能源查询合约接口,完整验证业务流程。
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
## 题目四
|
||||||
|
|
||||||
|
原题:
|
||||||
|
|
||||||
1.编写原材料接口newMaterial,初始化原材料信息,返回合约地址,并实现原材料信息上链功能。
|
1.编写原材料接口newMaterial,初始化原材料信息,返回合约地址,并实现原材料信息上链功能。
|
||||||
|
|
||||||
2.编写获取存原材料接口getMaterial,根据合约地址获取原材料信息
|
2.编写获取存原材料接口getMaterial,根据合约地址获取原材料信息
|
||||||
|
|
||||||
3.编写食品物流上链接口addLogistic,实现食品物流信息上链功能
|
3.编写食品物流上链接口addLogistic,实现食品物流信息上链功能
|
||||||
|
|
||||||
4.编写获取食品物流信息的接口getLogistics,根据食品产品编号获取物流信息
|
4.编写获取食品物流信息的接口getLogistics,根据食品产品编号获取物流信息
|
||||||
|
|
||||||
::: code-tabs
|
::: code-tabs
|
||||||
@tab Logistics.sol
|
@tab Logistics.sol
|
||||||
```solidity
|
```solidity
|
||||||
@@ -84,6 +518,7 @@ contract Material {
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
参考答案:
|
参考答案:
|
||||||
|
|
||||||
::: code-tabs
|
::: code-tabs
|
||||||
@tab Logistics.sol
|
@tab Logistics.sol
|
||||||
```solidity
|
```solidity
|
||||||
@@ -154,8 +589,63 @@ contract Material {
|
|||||||
:::
|
:::
|
||||||
|
|
||||||
## 题目五
|
## 题目五
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
1.个人签章信息接口编码
|
||||||
|
|
||||||
|
(1)编写个人签章智能合约的实体接口,完成实体通用数据的初始化,实现签章和用户实体信息上链的功能
|
||||||
|
|
||||||
|
(2)编写签章信息上链的接口,实现Seal合约的构造函数;
|
||||||
|
|
||||||
|
(3)基于给定的智能合约代码以及注释,完成ElectronicSeal合约判断多人签章文件编号是否存在的函数。
|
||||||
|
|
||||||
|
2.电子印章接口编码
|
||||||
|
|
||||||
|
(1)基于给定的智能合约代码以及注释,完成ElectronicSeal合约获取多人签章信息函数;
|
||||||
|
|
||||||
|
(2)基于给定的智能合约代码以及注释,完成ElectronicSeal合约多人签章函数。
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```solidity
|
||||||
|
```
|
||||||
|
:::
|
||||||
## 题目六
|
## 题目六
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
1.食品信息(Food)、成员信息(Member)、生产订单信息(Productions)的结构体功能编码(6分)
|
||||||
|
|
||||||
|
(1)编写食品信息实体功能。(2分)
|
||||||
|
|
||||||
|
(2)完善智能合约中用户结构体内容(2分)
|
||||||
|
|
||||||
|
(3)编写生产订单(Productions)结构体信息。(2分)
|
||||||
|
|
||||||
|
2.食品溯源(Trace)的接口编码(6分)
|
||||||
|
|
||||||
|
(1)根据食品信息结构体,完成食品信息添加相应功能(2分)
|
||||||
|
|
||||||
|
(2)编写食品溯源收购商创建收购订单功能。
|
||||||
|
|
||||||
|
(3)编写食品溯源创建运输订单功能。
|
||||||
|
|
||||||
|
3.角色(Role)管理的接口编码(4分)
|
||||||
|
|
||||||
|
(1)编写食品溯源增加角色接口,实现添加角色的功能。(1分)
|
||||||
|
|
||||||
|
(2)编写食品溯源获取角色功能。(1分)
|
||||||
|
|
||||||
|
(3)编写食品溯源修改角色功能。(2分)
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```
|
||||||
|
```
|
||||||
|
:::
|
||||||
## 题目七
|
## 题目七
|
||||||
|
|
||||||
原题:
|
原题:
|
||||||
**子任务2-2-1:航班延误保险购买合约编码(5分)**
|
**子任务2-2-1:航班延误保险购买合约编码(5分)**
|
||||||
|
|
||||||
@@ -355,5 +845,78 @@ contract FlightManagement {
|
|||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
## 题目八
|
## 题目八
|
||||||
|
|
||||||
|
题目:
|
||||||
|
子任务2-2-1:信息管理合约编码
|
||||||
|
1. 编写检索个人信息接口,完成患者通过身份证号检索其姓名、性别、年龄的功能;
|
||||||
|
2. 编写信息管理接口,完成允许患者与医院和科室进行信息管理,通过身份证号检索到患者的个人信息,将预约信息显示给患者,并发送到患者的账户地址中的功能;
|
||||||
|
子任务2-2-2:病历管理合约编码
|
||||||
|
1. 编写新建病历接口,实现检索病人对应科室既往病历,授权医生查看,如果没有既往病历则创建一个新的病历功能;
|
||||||
|
2. 编写结束就诊接口,实现检查病历是否已经填写,并结束病历咨询的功能。
|
||||||
|
子任务2-2-3:病历查看合约编码
|
||||||
|
根据需求用例文档在待补充源码中完成病历查看合约的编码,解决代码错误和警告,正确编译合约,功能调试正确,运行合约中的检查退款请求状态、自动批准退款请求接口功能。
|
||||||
|
1.编写查看病人个人信息接口,实现获取指定病人个人信息功能;
|
||||||
|
2.编写查看病人病情描述接口,实现获取指定病人病情描述功能。
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```
|
||||||
|
```
|
||||||
|
:::
|
||||||
## 题目九
|
## 题目九
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
子任务2-2-1:合同管理合约编码
|
||||||
|
|
||||||
|
(1)编写房东签署合同接口,完成本合同位置只允许房东签署,通过合同中的信息生成租赁合同的链上哈希,触发协议签署合同的功能,其中合同中的信息包括房东链上账户、租客链上账户、租赁开始时间、租赁结束时间、月租金额、押金金额、交租时间;
|
||||||
|
|
||||||
|
(2)编写租金支付接口,完成只允许租客支付租金的规则,检查支付的租金金额是否正确,触发记录租金支付情况的功能。
|
||||||
|
|
||||||
|
子任务2-2-2:违约管理合约编码
|
||||||
|
|
||||||
|
(1)编写房东终止合同接口,实现房东终止合同判断,如果租客已经终止合同则合同无效,如果合同有效,对合同终止状态进行标记,将剩余押金退还给租客的功能;
|
||||||
|
|
||||||
|
(2)编写租客终止合同接口,实现租客终止合同判断,如果房东已经终止合同则合同无效,如果合同有效,对合同终止状态进行标记,将剩余押金退还给房东的功能。
|
||||||
|
|
||||||
|
子任务2-2-3:押金管理合约编码
|
||||||
|
|
||||||
|
根据需求用例文档在待补充源码中完成押金管理合约的编码,解决代码错误和警告,正确编译合约,功能调试正确,运行合约中的租客缴纳押金情况查询、房东收取押金情况查询接口功能。
|
||||||
|
|
||||||
|
(1)编写租客缴纳押金情况查询接口,实现查询租客是狗已缴纳押金功能;
|
||||||
|
|
||||||
|
(2)编写房东收取押金情况查询接口,实现房东是否已收到押金的功能。
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```
|
||||||
|
```
|
||||||
|
:::
|
||||||
## 题目十
|
## 题目十
|
||||||
|
|
||||||
|
题目:
|
||||||
|
|
||||||
|
子任务2-2-1:账户管理合约编码
|
||||||
|
|
||||||
|
根据需求用例文档在待补充源码中完成账户管理合约的编码,解决代码错误和警告,正确编译合约,功能调试正确。需要编写生成账户接口,完成从外部部门检索姓名、年龄、雇主、开始日期、工资、缴费基数,将人员信息进行综合存储功能。
|
||||||
|
|
||||||
|
子任务2-2-2:费用管理合约编码
|
||||||
|
|
||||||
|
根据需求用例文档在待补充源码中完成费用管理合约的编码,解决代码错误和警告,正确编译合约,功能调试正确,运行添加新职工账户、添加新雇主账户。
|
||||||
|
|
||||||
|
1.编写添加新职工账户接口,实现当账户不存在,只有管理员可以添加职工账户,职工新账户中账户余额为0,未被赞助的功能;
|
||||||
|
|
||||||
|
2.编写添加新雇主账户接口,实现当账户不存在,只有管理员可以添加雇主账户,雇主新账户中账户余额为0,已被赞助的功能;
|
||||||
|
|
||||||
|
子任务2-2-3:保险转移合约编码
|
||||||
|
|
||||||
|
根据需求用例文档在待补充源码中完成保险转移合约的编码,解决代码错误和警告,正确编译合约,功能调试正确,运行合约中的申请转移关系、接收账户转移接口。
|
||||||
|
|
||||||
|
1.编写申请转移关系接口,实现创建申请、添加到申请列表功能,其中创建申请需要设置申请人地址、原城市、目标城市、停缴状态、批准状态;
|
||||||
|
|
||||||
|
2.编写接收账户转移接口,实现获取账户,进行账户授权状态、接收状态、个人账户基金、统筹账户基金、养老保险账户的信息设置;
|
||||||
|
|
||||||
|
::: code-tabs
|
||||||
|
@tab xxx.sol
|
||||||
|
```
|
||||||
|
```
|
||||||
|
:::
|
||||||
|
|||||||
Reference in New Issue
Block a user