本文整理汇总了Java中logbook.dto.MaterialDto类的典型用法代码示例。如果您正苦于以下问题:Java MaterialDto类的具体用法?Java MaterialDto怎么用?Java MaterialDto使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaterialDto类属于logbook.dto包,在下文中一共展示了MaterialDto类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaterialStoreBody
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 資材の内容
*
* @param materials 資材
* @return
*/
public static List<String[]> getMaterialStoreBody(List<MaterialDto> materials) {
List<String[]> body = new ArrayList<String[]>();
for (int i = 0; i < materials.size(); i++) {
MaterialDto material = materials.get(i);
body.add(new String[] {
Integer.toString(i + 1),
new SimpleDateFormat(AppConstants.DATE_FORMAT).format(material.getTime()),
Integer.toString(material.getFuel()),
Integer.toString(material.getAmmo()),
Integer.toString(material.getMetal()),
Integer.toString(material.getBauxite()),
Integer.toString(material.getBucket()),
Integer.toString(material.getBurner()),
Integer.toString(material.getResearch())
});
}
return body;
}
示例2: getMaterialStoreBody
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 資材の内容
*
* @param materials 資材
* @return
*/
public static List<String[]> getMaterialStoreBody(List<MaterialDto> materials) {
List<String[]> body = new ArrayList<String[]>();
for (int i = 0; i < materials.size(); i++) {
MaterialDto material = materials.get(i);
body.add(new String[] {
Integer.toString(i + 1),
new SimpleDateFormat(AppConstants.DATE_FORMAT).format(material.getTime()),
Integer.toString(material.getFuel()),
Integer.toString(material.getAmmo()),
Integer.toString(material.getMetal()),
Integer.toString(material.getBauxite()),
Integer.toString(material.getBucket()),
Integer.toString(material.getBurner()),
Integer.toString(material.getResearch())
});
}
return body;
}
示例3: storeMaterialReport
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 資材ログを書き込む
*
* @param material 資材
*/
public static void storeMaterialReport(MaterialDto material) {
try {
List<MaterialDto> dtoList = Collections.singletonList(material);
Path report = FileUtils.getStoreFile(AppConstants.LOG_RESOURCE, AppConstants.LOG_RESOURCE_ALT);
FileUtils.writeCsvStripFirstColumn(report,
CreateReportLogic.getMaterialHeader(),
CreateReportLogic.getMaterialStoreBody(dtoList), true);
} catch (IOException e) {
LoggerHolder.LOG.warn("報告書の保存に失敗しました", e);
}
}
示例4: storeMaterialReport
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 資材ログを書き込む
*
* @param material 資材
*/
public static void storeMaterialReport(MaterialDto material) {
try {
List<MaterialDto> dtoList = Collections.singletonList(material);
File report = getStoreFile(AppConstants.LOG_RESOURCE, AppConstants.LOG_RESOURCE_ALT);
CreateReportLogic.writeCsvStripFirstColumn(report,
CreateReportLogic.getMaterialHeader(),
CreateReportLogic.getMaterialStoreBody(dtoList), true);
} catch (IOException e) {
LOG.warn("報告書の保存に失敗しました", e);
}
}
示例5: storeMaterialReport
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 資材ログを書き込む
*
* @param material 資材
*/
public static void storeMaterialReport(MaterialDto material) {
try {
List<MaterialDto> dtoList = Collections.singletonList(material);
File report = getStoreFile(AppConstants.LOG_RESOURCE, AppConstants.LOG_RESOURCE_ALT);
CreateReportLogic.writeCsvStripFirstColumn(report,
CreateReportLogic.getMaterialHeader(),
CreateReportLogic.getMaterialStoreBody(dtoList), true);
} catch (IOException e) {
LOG.warn("Failed to save material report", e);
}
}
示例6: doMaterialSub
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 保有資材を更新する
*
* @param apidata
*/
private void doMaterialSub(JsonArray apidata) {
Date time = Calendar.getInstance().getTime();
MaterialDto dto = new MaterialDto();
dto.setTime(time);
for (JsonValue value : apidata) {
JsonObject entry = (JsonObject) value;
switch (entry.getInt("api_id")) {
case AppConstants.MATERIAL_FUEL:
dto.setFuel(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_AMMO:
dto.setAmmo(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_METAL:
dto.setMetal(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BAUXITE:
dto.setBauxite(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BURNER:
dto.setBurner(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BUCKET:
dto.setBucket(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_RESEARCH:
dto.setResearch(entry.getInt("api_value"));
break;
default:
break;
}
}
this.material = dto;
// 資材ログに書き込む
if ((this.materialLogLastUpdate == null)
|| (TimeUnit.MILLISECONDS.toSeconds(time.getTime() - this.materialLogLastUpdate.getTime()) >
AppConfig.get().getMaterialLogInterval())) {
CreateReportLogic.storeMaterialReport(this.material);
this.materialLogLastUpdate = time;
}
}
示例7: getMaterial
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 保有資材を取得します
* @return 保有資材
*/
@CheckForNull
public static MaterialDto getMaterial() {
return material;
}
示例8: doMaterialSub
import logbook.dto.MaterialDto; //导入依赖的package包/类
/**
* 保有資材を更新する
*
* @param apidata
*/
private static void doMaterialSub(JsonArray apidata) {
Date time = Calendar.getInstance().getTime();
MaterialDto dto = new MaterialDto();
dto.setTime(time);
for (JsonValue value : apidata) {
JsonObject entry = (JsonObject) value;
switch (entry.getInt("api_id")) {
case AppConstants.MATERIAL_FUEL:
dto.setFuel(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_AMMO:
dto.setAmmo(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_METAL:
dto.setMetal(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BAUXITE:
dto.setBauxite(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BURNER:
dto.setBurner(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_BUCKET:
dto.setBucket(entry.getInt("api_value"));
break;
case AppConstants.MATERIAL_RESEARCH:
dto.setResearch(entry.getInt("api_value"));
break;
default:
break;
}
}
material = dto;
// 資材ログに書き込む
if ((materialLogLastUpdate == null)
|| (TimeUnit.MILLISECONDS.toSeconds(time.getTime() - materialLogLastUpdate.getTime()) >
AppConfig.get().getMaterialLogInterval())) {
CreateReportLogic.storeMaterialReport(material);
materialLogLastUpdate = time;
}
}