-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
263 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.crumbs.models; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by low on 19/2/17 10:57 AM. | ||
*/ | ||
@Getter | ||
@Setter | ||
public class Prediction { | ||
|
||
private ProductVM product; | ||
private List<RemainingStock> stock = new ArrayList<>(); | ||
|
||
public void addToStockList(RemainingStock remainingStock) { | ||
stock.add(remainingStock); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
ethereum/src/main/java/com/crumbs/models/RemainingStock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.crumbs.models; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
/** | ||
* Created by low on 19/2/17 11:03 AM. | ||
*/ | ||
@Getter | ||
@Setter | ||
public class RemainingStock { | ||
|
||
private int quantity; | ||
private double urgency; | ||
private String urgencyLevel; | ||
private int percentExtra; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
ethereum/src/main/java/com/crumbs/rest/PredictionCtrl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
package com.crumbs.rest; | ||
|
||
import com.crumbs.models.Prediction; | ||
import com.crumbs.services.PredictionSrvc; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; | ||
import static org.springframework.web.bind.annotation.RequestMethod.GET; | ||
|
||
/** | ||
* Created by low on 16/2/17 10:33 PM. | ||
*/ | ||
@RestController | ||
public class PredictionCtrl { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(PredictionCtrl.class); | ||
|
||
@Autowired | ||
PredictionSrvc predictionSrvc; | ||
|
||
@RequestMapping(method = GET, produces = APPLICATION_JSON_VALUE) | ||
@ResponseBody | ||
public List<Prediction> getPredictions() { | ||
return predictionSrvc.getAllPredictions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.crumbs.util; | ||
|
||
import com.alibaba.fastjson.JSON; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* Created by low on 20/2/17 6:10 PM. | ||
*/ | ||
public class FoodList { | ||
|
||
public static Map<String, String> all; | ||
|
||
public static Map<String, String> allFood() { | ||
if (all == null) { | ||
Map<String, String> map = new HashMap<>(); | ||
map.put("Apple", "Fruits"); | ||
map.put("Orange", "Fruits"); | ||
map.put("Daisy Milk", "Dairy"); | ||
map.put("Yogurt", "Dairy"); | ||
all = map; | ||
} | ||
return all; | ||
} | ||
} |
Oops, something went wrong.