use of com.topcom.tjs.domain.TjsAccident in project topcom-cloud by 545314690.
the class CreateAccidentInvestigation method create.
@Test
public void create() {
List<TjsAccident> accList = tjsAccidentManager.findAll();
List<TjsAccidentInvestigation> investigations = new ArrayList<>();
for (int i = 0; i < accList.size(); i++) {
TjsAccident acc = accList.get(i);
TjsAccidentInvestigation investigation = new TjsAccidentInvestigation();
investigation.setAccident(acc);
investigation.setCLDCZRQ(acc.getHappenedTime());
investigation.setDJCFA(random.nextInt(2));
investigation.setDJCFB(random.nextInt(5));
investigation.setDJCFC(random.nextInt(10));
investigation.setDJCFD(random.nextInt(10));
investigation.setDJCFE(random.nextInt(10));
investigation.setDJCFJGA(random.nextInt(2));
investigation.setDJCFJGB(random.nextInt(5));
investigation.setDJCFJGC(random.nextInt(10));
investigation.setDJCFJGD(random.nextInt(10));
investigation.setDJCFJGE(random.nextInt(10));
investigation.setDJCFQYA(random.nextInt(2));
investigation.setDJCFQYB(random.nextInt(5));
investigation.setDJCFQYC(random.nextInt(10));
investigation.setDJCFQYD(random.nextInt(10));
investigation.setDJCFQYE(random.nextInt(10));
investigation.setFZR(acc.getCompany().getHead());
investigation.setGBRQ(acc.getHappenedTime());
investigation.setGPDB(acc.getDeathNumber() > 10);
// 挂牌督办 编号
investigation.setGPDBDWJWH("");
/**
* 四分之一的有举报奖励金额 2k到5w
*/
investigation.setJBJLJE((double) (random.nextInt() % 4 == 0 ? CreateDataUtil.getGaussianRandom(2000, 50000) : 0));
investigation.setJYFKE((double) CreateDataUtil.getGaussianRandom(20000, 5000000));
investigation.setPFRQ(new Date(acc.getHappenedTime().getTime() + 3 * 24 * 3600 * 1000));
investigation.setSGMC(acc.getCompanyName() + "事故");
investigation.setTBR(nameList.get(random.nextInt(nameList.size() - 1)));
investigation.setTBRQ(new Date(acc.getHappenedTime().getTime() + 8 * 3600 * 1000));
investigation.setTJSGDCBGRQ(new Date(acc.getHappenedTime().getTime() + 2 * 24 * 3600 * 1000));
investigation.setTJSHR(nameList.get(random.nextInt(nameList.size() - 1)));
investigation.setZJDJCFA(random.nextInt(1));
investigation.setZJDJCFB(random.nextInt(2));
investigation.setZJDJCFC(random.nextInt(3));
investigation.setZJDJCFD(random.nextInt(5));
investigation.setZJDJCFE(random.nextInt(10));
investigation.setZJDJCFJGA(random.nextInt(1));
investigation.setZJDJCFJGB(random.nextInt(2));
investigation.setZJDJCFJGC(random.nextInt(3));
investigation.setZJDJCFJGD(random.nextInt(5));
investigation.setZJDJCFJGE(random.nextInt(10));
investigation.setZJDJCFQYA(random.nextInt(2));
investigation.setZJDJCFQYB(random.nextInt(3));
investigation.setZJDJCFQYC(random.nextInt(8));
investigation.setZJDJCFQYD(random.nextInt(10));
investigation.setZJDJCFQYE(random.nextInt(10));
investigation.setZJXSZRA(random.nextInt(1));
investigation.setZJXSZRC(random.nextInt(2));
investigation.setZJXSZRB(random.nextInt(3));
investigation.setZJXSZRD(random.nextInt(5));
investigation.setZJXSZRE(random.nextInt(10));
investigation.setZJXSZRJGA(random.nextInt(1));
investigation.setZJXSZRJGB(random.nextInt(2));
investigation.setZJXSZRJGC(random.nextInt(3));
investigation.setZJXSZRJGD(random.nextInt(5));
investigation.setZJXSZRJGE(random.nextInt(10));
investigation.setZJXSZRQYA(random.nextInt(1));
investigation.setZJXSZRQYB(random.nextInt(2));
investigation.setZJXSZRQYC(random.nextInt(3));
investigation.setZJXSZRQYD(random.nextInt(5));
investigation.setZJXSZRQYE(random.nextInt(10));
investigations.add(investigation);
if (i % 5000 == 0) {
manager.save(investigations);
System.out.println("------------------------------------");
System.out.println(i);
System.out.println("------------------------------------");
}
}
manager.save(investigations);
}
use of com.topcom.tjs.domain.TjsAccident 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);
}
use of com.topcom.tjs.domain.TjsAccident in project topcom-cloud by 545314690.
the class CreateAccidentTest method createAndSave.
@Test
public void createAndSave() {
List<TjsSpecialCompany> all = tjsSpecialCompanyManager.findAll();
List<DBObject> dbObjectList = MongoDBUtil.selectAll("acc");
List<TjsAccident> accidentList = new ArrayList<>();
for (int i = 0; i < 30000; i++) {
try {
TjsSpecialCompany company = all.get(random.nextInt(all.size() - 1));
DBObject object = dbObjectList.get(i);
TjsAccident tjsAccident = new TjsAccident();
tjsAccident.setAddress(company.getAddress());
tjsAccident.setCity(company.getCity());
tjsAccident.setCompany(company);
tjsAccident.setCompanyAttribute(company.getCompanyAttribute());
tjsAccident.setCompanyIndustry(company.getIndustryType());
tjsAccident.setCompanyName(company.getCompanyName());
// 企业的详细情况
tjsAccident.setCompanyProfile("");
tjsAccident.setCompanyScale(company.getCompanyType());
tjsAccident.setCompanyType(company.getLogoType());
tjsAccident.setCounty(company.getCounty());
// 死亡人数 0-100 左边重的正态分布
tjsAccident.setDeathNumber((Integer) object.get("deathnumber"));
tjsAccident.setDescription("");
tjsAccident.setFactors(factors[random.nextInt(factors.length - 1)]);
// tjsAccident.setHappenedTime((Date) object.get("adate"));
tjsAccident.setHappenedTime(CreateDataUtil.getRandomDate(new DateParam("2016-05-05", "2018-06-06")));
tjsAccident.setInjuredNumber(CreateDataUtil.getGaussianRandomBigLeft(0, 100));
tjsAccident.setLat(company.getLat());
tjsAccident.setLng(company.getLng());
// 经济损失单位万
tjsAccident.setLoss((double) CreateDataUtil.getGaussianRandom(10, 9000));
tjsAccident.setManageType(company.getIndustryType());
tjsAccident.setProfile("");
tjsAccident.setReport(random.nextBoolean());
tjsAccident.setProvince(company.getProvince());
tjsAccident.setSCC(company.getSCC());
tjsAccident.setTerribleNumber(CreateDataUtil.getGaussianRandomBigLeft(0, tjsAccident.getInjuredNumber()));
tjsAccident.setType(object.get("atype").toString());
accidentList.add(tjsAccident);
} catch (Exception e) {
e.printStackTrace();
continue;
}
if (accidentList.size() % 5000 == 0) {
accidentManager.save(accidentList);
accidentList.clear();
System.out.println(i);
}
}
accidentManager.save(accidentList);
}
Aggregations