use of com.topcom.tjs.domain.TjsDeathPerson in project topcom-cloud by 545314690.
the class CreateDeathPerson method create.
@Test
public void create() {
List<TjsAccident> accList = tjsAccidentManager.findAll();
List<TjsDeathPerson> personList = new ArrayList<>();
int count = 0;
for (int i = 0; i < accList.size(); i++) {
TjsAccident acc = accList.get(i);
// 死亡人数
Integer deathNumber = acc.getDeathNumber();
// 重伤人数
Integer terribleNumber = acc.getTerribleNumber();
if (deathNumber != null && deathNumber > 0) {
for (int j = 0; j < deathNumber; j++) {
TjsDeathPerson person = new TjsDeathPerson();
person.setStatus("死亡");
person = initDeathNuber(acc, person);
personList.add(person);
}
}
if (terribleNumber != null && terribleNumber > 0) {
for (int j = 0; j < terribleNumber; j++) {
TjsDeathPerson person = new TjsDeathPerson();
person.setStatus("重伤");
person = initDeathNuber(acc, person);
personList.add(person);
}
}
if (personList.size() % 5000 == 0) {
count = count + personList.size();
tjsDeathPersonManager.save(personList);
personList.clear();
System.out.println("-----------------------------------------------------------");
System.out.println(i);
System.out.println("保存:" + count + "条");
System.out.println("-----------------------------------------------------------");
}
}
tjsDeathPersonManager.save(personList);
}
Aggregations