在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:techops-recsys-lateral-hiring/developer-joyofenergy-java开源软件地址:https://github.com/techops-recsys-lateral-hiring/developer-joyofenergy-java开源编程语言:Java 100.0%开源软件介绍:Welcome to PowerDalePowerDale is a small town with around 100 residents. Most houses have a smart meter installed that can save and send information about how much power a house is drawing/using. There are three major providers of energy in town that charge different amounts for the power they supply.
Introducing JOI EnergyJOI Energy is a new start-up in the energy industry. Rather than selling energy they want to differentiate themselves from the market by recording their customers' energy usage from their smart meters and recommending the best supplier to meet their needs. You have been placed into their development team, whose current goal is to produce an API which their customers and smart meters will interact with. Unfortunately, two members of the team are on annual leave, and another one has called in sick! You are left with another ThoughtWorker to progress with the current user stories on the story wall. This is your chance to make an impact on the business, improve the code base and deliver value. Story WallAt JOI energy the development team use a story wall or Kanban board to keep track of features or "stories" as they are worked on. The wall you will be working from today has 7 columns:
Examples can be found here https://leankit.com/learn/kanban/kanban-board/ UsersTo trial the new JOI software 5 people from the JOI accounts team have agreed to test the service and share their energy data.
These values are used in the code and in the following examples too. RequirementsThe project requires Java 1.8 or higher. The project makes use of Gradle and uses the Gradle wrapper, which means you don't need Gradle installed. Useful Gradle commandsThe project makes use of Gradle and uses the Gradle wrapper to help you out carrying some common tasks such as building the project or running it. List all Gradle tasksList all the tasks that Gradle can do, such as $ ./gradlew tasks Build the projectCompiles the project, runs the test and then creates an executable JAR file $ ./gradlew build Run the application using Java and the executable JAR file produced by the Gradle $ java -jar build/libs/joi-energy.jar Run the testsThere are two types of tests, the unit tests and the functional tests. These can be executed as follows.
Run the applicationRun the application which will be listening on port $ ./gradlew bootRun APIBelow is a list of API endpoints with their respective input and output. Please note that the application needs to be running for the following endpoints to work. For more information about how to run the application, please refer to run the application section above. Store ReadingsEndpoint
Example of body {
"smartMeterId": <smartMeterId>,
"electricityReadings": [
{
"time": <time>,
"reading": <reading>
}
]
} Parameters
Example readings
In the above example, the smart meter sampled readings, in The following POST request, is an example request using CURL, sends the readings shown in the table above. $ curl \
-X POST \
-H "Content-Type: application/json" \
"http://localhost:8080/readings/store" \
-d '{"smartMeterId":"smart-meter-0","electricityReadings":[{"time":1606636800,"reading":0.0503},{"time":1606636860,"reading":0.0621},{"time":1606636920,"reading":0.0222},{"time":1606636980,"reading":0.0423},{"time":1606637040,"reading":0.0191}]}' The above command does not return anything. Get Stored ReadingsEndpoint
Parameters
Retrieving readings using CURL $ curl "http://localhost:8080/readings/read/smart-meter-0" Example output [
{
"time": "2020-11-29T08:00:00Z",
"reading": 0.0503
},
{
"time": "2020-11-29T08:01:00Z",
"reading": 0.0621
},
{
"time": "2020-11-29T08:02:00Z",
"reading": 0.0222
},
{
"time": "2020-11-29T08:03:00Z",
"reading": 0.0423
},
{
"time": "2020-11-29T08:04:00Z",
"reading": 0.0191
}
] View Current Price Plan and Compare Usage Cost Against all Price PlansEndpoint
Parameters
Retrieving readings using CURL $ curl "http://localhost:8080/price-plans/compare-all/smart-meter-0" Example output {
"pricePlanComparisons": {
"price-plan-2": 0.0002,
"price-plan-1": 0.0004,
"price-plan-0": 0.002
},
"pricePlanId": "price-plan-0"
} View Recommended Price Plans for UsageEndpoint
Parameters
Retrieving readings using CURL $ curl "http://localhost:8080/price-plans/recommend/smart-meter-0?limit=2" Example output [
{
"price-plan-2": 0.0002
},
{
"price-plan-1": 0.0004
}
] |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论