use of com.kendy.entity.ShangmaNextday in project financial by greatkendy123.
the class ShangmaService method addNextDaySMDetailAction.
/**
* 实时上码新增次日上码
*
* @time 2018年2月4日
*/
public static void addNextDaySMDetailAction() {
ShangmaInfo smInfo = getSelectShangma();
if (smInfo == null) {
ShowUtil.show("请先选择要增加次日的玩家记录!");
return;
}
if (smInfo != null && smInfo.getShangmaName() != null) {
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle("次日上码:" + smInfo.getShangmaName());
dialog.setHeaderText(null);
ButtonType loginButtonType = new ButtonType("确定", ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 20, 20, 20));
TextField shangmaJu = new TextField();
TextField shangmaVal = new TextField();
grid.add(new Label("第X局:"), 0, 0);
grid.add(shangmaJu, 1, 0);
grid.add(new Label("上码:"), 0, 1);
grid.add(shangmaVal, 1, 1);
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
loginButton.setDisable(true);
shangmaJu.textProperty().addListener((observable, oldValue, newValue) -> {
loginButton.setDisable(newValue.trim().isEmpty());
});
dialog.getDialogPane().setContent(grid);
Platform.runLater(() -> shangmaJu.requestFocus());
dialog.setResultConverter(dialogButton -> {
if (dialogButton == loginButtonType) {
return new Pair<>(shangmaJu.getText(), shangmaVal.getText());
}
return null;
});
Optional<Pair<String, String>> result = dialog.showAndWait();
result.ifPresent(shangmaJuAndVal -> {
log.info("新增次日上码:shangmaJu=" + shangmaJuAndVal.getKey() + ", shangmaVal=" + shangmaJuAndVal.getValue());
try {
Integer.valueOf(shangmaJuAndVal.getKey());
Integer.valueOf(shangmaJuAndVal.getValue());
} catch (NumberFormatException e) {
ShowUtil.show("非法数值:" + shangmaJuAndVal.getKey() + "或" + shangmaJuAndVal.getValue() + "!");
return;
}
ShangmaNextday nextday = new ShangmaNextday();
nextday.setPlayerId(smInfo.getShangmaPlayerId());
nextday.setPlayerName(smInfo.getShangmaName());
nextday.setChangci(getShangmaPaiju(shangmaJuAndVal.getKey()));
nextday.setShangma(shangmaJuAndVal.getValue());
nextday.setTime(TimeUtil.getDateTime2());
// 新增玩家的次日数据
addNewRecord_nextday(tableND, nextday);
});
}
}
Aggregations