Commit 9c110e9a8f19a1b3fc4809bd38539d80ef56794c
1 parent
ebeb57f1
未检人员列表、详情、新增、编辑
Showing
20 changed files
with
1050 additions
and
440 deletions
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java
| ... | ... | @@ -13,6 +13,7 @@ import org.jeecg.common.util.oConvertUtils; |
| 13 | 13 | import org.jeecg.modules.system.entity.*; |
| 14 | 14 | import org.jeecg.modules.system.service.*; |
| 15 | 15 | import org.jeecg.modules.system.util.IDNumberUtil; |
| 16 | +import org.jeecg.modules.system.util.getRandomId; | |
| 16 | 17 | import org.jeecg.modules.system.vo.GaPunishVo; |
| 17 | 18 | import org.jeecg.modules.system.vo.SpecialStudentVo; |
| 18 | 19 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -69,12 +70,13 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 69 | 70 | @Resource |
| 70 | 71 | private ISysDictService dictService; |
| 71 | 72 | |
| 72 | - private final List<Family> resultFamily = new ArrayList<>();//分析后家庭的数据 | |
| 73 | +// private final List<Family> resultFamily = new ArrayList<>();//分析后家庭的数据 | |
| 73 | 74 | private final List<Minor> resultMinor = new ArrayList<>();//分析后未成年人的信息 |
| 74 | 75 | private final List<MrSchool> resultSchools = new ArrayList<>();//分析后学籍的信息 |
| 76 | + private final Set<String> testIdCards = new HashSet<>();//存储户号 | |
| 75 | 77 | private static final int corePoolSize = Runtime.getRuntime().availableProcessors(); |
| 76 | 78 | private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, corePoolSize + 1, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(1000)); |
| 77 | - | |
| 79 | + private Integer random_number=000000; | |
| 78 | 80 | |
| 79 | 81 | @AutoLog(value = "来源数据管理-分页列表查询") |
| 80 | 82 | @ApiOperation(value = "来源数据管理-分页列表查询", notes = "来源数据管理-分页列表查询") |
| ... | ... | @@ -86,14 +88,14 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 86 | 88 | List<SysDepart> departs = sysDepartService.querySysDeparts(); |
| 87 | 89 | getData(departs); |
| 88 | 90 | System.out.println("开始数据分析" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); |
| 89 | - System.out.println("家庭成员数据批量新增总条数" + resultFamily.size()); | |
| 91 | +// System.out.println("家庭成员数据批量新增总条数" + resultFamily.size()); | |
| 90 | 92 | System.out.println("未成年人数据批量新增总条数" + resultMinor.size()); |
| 91 | 93 | System.out.println("学籍信息数据批量新增总条数" + resultSchools.size()); |
| 92 | 94 | long startTime2 = System.currentTimeMillis(); |
| 93 | 95 | minorService.insertBatch(resultMinor); |
| 94 | 96 | System.out.println("未成年人数据批量新增所用时间" + (System.currentTimeMillis() - startTime2) / 1000 + "秒"); |
| 95 | 97 | long startTime1 = System.currentTimeMillis(); |
| 96 | - familyService.insertBatch(resultFamily); | |
| 98 | +// familyService.insertBatch(resultFamily); | |
| 97 | 99 | System.out.println("家庭成员数据批量新增所用时间" + (System.currentTimeMillis() - startTime1) / 1000 + "秒"); |
| 98 | 100 | long startTime3 = System.currentTimeMillis(); |
| 99 | 101 | schoolService.insertBatch(resultSchools); |
| ... | ... | @@ -434,62 +436,67 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 434 | 436 | long startTime = System.currentTimeMillis(); |
| 435 | 437 | try { |
| 436 | 438 | Map<String, Minor> minorMap = new HashMap<>(); |
| 439 | + Map<String, MrSchool> schools=new HashMap<>(); | |
| 437 | 440 | System.out.println("***********************交集总数**********************************************" + intersection.size()); |
| 438 | 441 | System.out.println("***********************人口信息总数**********************************************" + gaHouseholds.size()); |
| 439 | 442 | System.out.println("交集数据里的所属单位开始" + (System.currentTimeMillis() - startTime) / 1000); |
| 443 | + Date creatDate = new Date(); | |
| 440 | 444 | if (oConvertUtils.isNotEmpty(intersection) && oConvertUtils.isNotEmpty(departs) && departs.size() > 0) { |
| 441 | 445 | for (SysDepart d : departs) { |
| 442 | 446 | intersection.stream().forEach(i -> { |
| 443 | - if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getSchool()) && oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode())) { | |
| 444 | - if (d.getCommonCode().contains(i.getSchool())) { | |
| 445 | - i.setSysOrgCode(d.getOrgCode()); | |
| 447 | + Minor minor = new Minor(); | |
| 448 | + if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getIdentity()) && IDNumberUtil.checkID(i.getIdentity())) { | |
| 449 | + String idCard=i.getIdentity(); | |
| 450 | + if(oConvertUtils.isNotEmpty(minorMap) && oConvertUtils.isNotEmpty(minorMap.get(idCard))){ | |
| 451 | + Minor minMap=minorMap.get(idCard); | |
| 452 | + if(oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(minMap.getSchoolName())){ | |
| 453 | + if (d.getCommonCode().contains(minMap.getSchoolName())) { | |
| 454 | + minMap.setSysOrgCode(d.getOrgCode()); | |
| 455 | + i.setSysOrgCode(d.getOrgCode()); | |
| 456 | + } | |
| 457 | + } | |
| 458 | + if(oConvertUtils.isNotEmpty(schools) && oConvertUtils.isNotEmpty(schools.get(idCard)) ){ | |
| 459 | + schools.get(idCard).setSysOrgCode(i.getSysOrgCode()); | |
| 460 | + } | |
| 446 | 461 | }else { |
| 447 | - i.setSysOrgCode(""); | |
| 462 | + if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(i.getSchool())) { | |
| 463 | + if (d.getCommonCode().contains(i.getSchool())) { | |
| 464 | + minor.setSysOrgCode(d.getOrgCode()); | |
| 465 | + i.setSysOrgCode(d.getOrgCode()); | |
| 466 | + } | |
| 467 | + } | |
| 468 | + minor.setSchool(Minor.SCHOOL_STATUS_NO); | |
| 469 | + if (oConvertUtils.isNotEmpty(i.getName())) { | |
| 470 | + minor.setName(i.getName()); | |
| 471 | + } | |
| 472 | + minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(i.getIdentity()))); | |
| 473 | + if (oConvertUtils.isNotEmpty(i.getAddress())) { | |
| 474 | + minor.setAddress(i.getAddress()); | |
| 475 | + } | |
| 476 | + if (oConvertUtils.isNotEmpty(i.getSchool())) { | |
| 477 | + minor.setSchoolName(i.getSchool()); | |
| 478 | + } | |
| 479 | + if (oConvertUtils.isNotEmpty(i.getAdmissionDate())) { | |
| 480 | + minor.setStartYear(i.getAdmissionDate()); | |
| 481 | + } | |
| 482 | + if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(i.getIdentity()))) { | |
| 483 | + minor.setNumber(gaHouseholds.get(i.getIdentity()).getNumber()); | |
| 484 | + minor.setHouseholdNum(gaHouseholds.get(i.getIdentity()).getHouseholdNum()); | |
| 485 | + } | |
| 486 | + minor.setIdentity(i.getIdentity()); | |
| 487 | + minor.setCreateTime(creatDate); | |
| 488 | + i.setCreateTime(creatDate); | |
| 489 | + minorMap.put(i.getIdentity(), minor); | |
| 490 | + schools.put(i.getIdentity(), i); | |
| 448 | 491 | } |
| 449 | - }else { | |
| 450 | - i.setSysOrgCode(""); | |
| 451 | 492 | } |
| 452 | 493 | }); |
| 453 | 494 | } |
| 454 | 495 | } |
| 455 | 496 | System.out.println("交集数据里的所属单位结束总数"+intersection.size()+"交集数据里的所属单位结束" + (System.currentTimeMillis() - startTime) / 1000); |
| 456 | - Date creatDate = new Date(); | |
| 457 | - if (oConvertUtils.isNotEmpty(intersection)) { | |
| 458 | - intersection.stream().forEach(i -> { | |
| 459 | - if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getIdentity()) && IDNumberUtil.checkID(i.getIdentity())) { | |
| 460 | - Minor minor = new Minor(); | |
| 461 | - //身份证号 | |
| 462 | - String idCard = i.getIdentity(); | |
| 463 | - if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(idCard))) { | |
| 464 | - minor.setSchool(Minor.SCHOOL_STATUS_NO); | |
| 465 | - minor.setSchoolName(i.getSchool()); | |
| 466 | - minor.setStartYear(i.getAdmissionDate()); | |
| 467 | - minor.setNumber(gaHouseholds.get(idCard).getNumber()); | |
| 468 | - minor.setHouseholdNum(gaHouseholds.get(idCard).getHouseholdNum()); | |
| 469 | - } else { | |
| 470 | - minor.setSchool(Minor.SCHOOL_STATUS_YES); | |
| 471 | - } | |
| 472 | - if (oConvertUtils.isNotEmpty(i.getName())) { | |
| 473 | - minor.setName(i.getName()); | |
| 474 | - } | |
| 475 | - if (oConvertUtils.isNotEmpty(i.getAddress())) { | |
| 476 | - minor.setAddress(i.getAddress()); | |
| 477 | - } | |
| 478 | - if (oConvertUtils.isNotEmpty(idCard)) { | |
| 479 | - minor.setGender(Integer.parseInt(IDNumberUtil.judgeGender(idCard))); | |
| 480 | - } | |
| 481 | - minor.setIdentity(idCard); | |
| 482 | - minor.setSysOrgCode(i.getSysOrgCode()); | |
| 483 | - minor.setCreateTime(creatDate); | |
| 484 | - i.setCreateTime(creatDate); | |
| 485 | - minorMap.put(idCard, minor); | |
| 486 | - } | |
| 487 | - }); | |
| 488 | - } | |
| 489 | 497 | System.out.println("户籍信息里的未成年人的单位" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); |
| 490 | 498 | long startTime1 = System.currentTimeMillis(); |
| 491 | -// schoolService.insertBatch(intersection); | |
| 492 | - resultSchools.addAll(intersection); | |
| 499 | + resultSchools.addAll(schools.values()); | |
| 493 | 500 | System.out.println("人口信息he交集总数总数" + minorMap.size()); |
| 494 | 501 | getSpecialStudent(minorMap, specialStudentVos, mzUnsupporteds, mzLeftBehinds, mzAdoptions, gaPunishVos, mzOrphans,gaHouseholds); |
| 495 | 502 | } catch (Exception e) { |
| ... | ... | @@ -504,52 +511,68 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 504 | 511 | List<String> mzOrphans, Map<String, Family> gaHouseholds) { |
| 505 | 512 | try { |
| 506 | 513 | Map<String, Minor> minorMap = new HashMap<>(); |
| 514 | + Map<String, MrSchool> schools=new HashMap<>(); | |
| 507 | 515 | long startTime = System.currentTimeMillis(); |
| 508 | 516 | System.out.println("根据差集数据判断所属单位" + difference.size()); |
| 509 | 517 | System.out.println("未成年人总数" + difference.size()); |
| 510 | 518 | Date creatTime = new Date(); |
| 511 | - if (oConvertUtils.isNotEmpty(difference) && oConvertUtils.isNotEmpty(departs) && departs.size() > 0) { | |
| 519 | + if (oConvertUtils.isNotEmpty(difference) && oConvertUtils.isNotEmpty(departs)) { | |
| 512 | 520 | for (SysDepart d : departs) { |
| 513 | 521 | difference.stream().forEach(m -> { |
| 514 | 522 | Minor minor = new Minor(); |
| 515 | 523 | if (oConvertUtils.isNotEmpty(m) && oConvertUtils.isNotEmpty(m.getIdentity()) && IDNumberUtil.checkID(m.getIdentity())) { |
| 516 | - if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(m.getSchool())) { | |
| 517 | - if (d.getCommonCode().contains(m.getSchool())) { | |
| 518 | - minor.setSysOrgCode(d.getOrgCode()); | |
| 519 | - m.setSysOrgCode(d.getOrgCode()); | |
| 524 | + String idCard=m.getIdentity(); | |
| 525 | + if(oConvertUtils.isNotEmpty(minorMap) && oConvertUtils.isNotEmpty(minorMap.get(idCard))){ | |
| 526 | + Minor minMap=minorMap.get(idCard); | |
| 527 | + if(oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(minMap.getSchoolName())){ | |
| 528 | + if (d.getCommonCode().contains(minMap.getSchoolName())) { | |
| 529 | + minMap.setSysOrgCode(d.getOrgCode()); | |
| 530 | + m.setSysOrgCode(d.getOrgCode()); | |
| 531 | + } | |
| 532 | + } | |
| 533 | + if(oConvertUtils.isNotEmpty(schools) && oConvertUtils.isNotEmpty(schools.get(idCard)) ){ | |
| 534 | + schools.get(idCard).setSysOrgCode(m.getSysOrgCode()); | |
| 520 | 535 | } |
| 536 | + }else { | |
| 537 | + if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(m.getSchool())) { | |
| 538 | + if (d.getCommonCode().contains(m.getSchool())) { | |
| 539 | + minor.setSysOrgCode(d.getOrgCode()); | |
| 540 | + m.setSysOrgCode(d.getOrgCode()); | |
| 541 | + } | |
| 542 | + } | |
| 543 | + minor.setSchool(Minor.SCHOOL_STATUS_NO); | |
| 544 | + if (oConvertUtils.isNotEmpty(m.getName())) { | |
| 545 | + minor.setName(m.getName()); | |
| 546 | + } | |
| 547 | + minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(m.getIdentity()))); | |
| 548 | + if (oConvertUtils.isNotEmpty(m.getAddress())) { | |
| 549 | + minor.setAddress(m.getAddress()); | |
| 550 | + } | |
| 551 | + if (oConvertUtils.isNotEmpty(m.getSchool())) { | |
| 552 | + minor.setSchoolName(m.getSchool()); | |
| 553 | + } | |
| 554 | + if (oConvertUtils.isNotEmpty(m.getAdmissionDate())) { | |
| 555 | + minor.setStartYear(m.getAdmissionDate()); | |
| 556 | + } | |
| 557 | + if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(m.getIdentity()))) { | |
| 558 | + minor.setNumber(gaHouseholds.get(m.getIdentity()).getNumber()); | |
| 559 | + minor.setHouseholdNum(gaHouseholds.get(m.getIdentity()).getHouseholdNum()); | |
| 560 | + } | |
| 561 | + minor.setIdentity(m.getIdentity()); | |
| 562 | + minor.setCreateTime(creatTime); | |
| 563 | + m.setCreateTime(creatTime); | |
| 564 | + minorMap.put(m.getIdentity(), minor); | |
| 565 | + schools.put(m.getIdentity(), m); | |
| 521 | 566 | } |
| 522 | - minor.setSchool(Minor.SCHOOL_STATUS_NO); | |
| 523 | - if (oConvertUtils.isNotEmpty(m.getName())) { | |
| 524 | - minor.setName(m.getName()); | |
| 525 | - } | |
| 526 | - minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(m.getIdentity()))); | |
| 527 | - if (oConvertUtils.isNotEmpty(m.getAddress())) { | |
| 528 | - minor.setAddress(m.getAddress()); | |
| 529 | - } | |
| 530 | - if (oConvertUtils.isNotEmpty(m.getSchool())) { | |
| 531 | - minor.setSchoolName(m.getSchool()); | |
| 532 | - } | |
| 533 | - if (oConvertUtils.isNotEmpty(m.getAdmissionDate())) { | |
| 534 | - minor.setStartYear(m.getAdmissionDate()); | |
| 535 | - } | |
| 536 | - if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(m.getIdentity()))) { | |
| 537 | - minor.setNumber(gaHouseholds.get(m.getIdentity()).getNumber()); | |
| 538 | - minor.setHouseholdNum(gaHouseholds.get(m.getIdentity()).getHouseholdNum()); | |
| 539 | - } | |
| 540 | - minor.setIdentity(m.getIdentity()); | |
| 541 | - minor.setCreateTime(creatTime); | |
| 542 | - m.setCreateTime(creatTime); | |
| 543 | - minorMap.put(m.getIdentity(), minor); | |
| 544 | - } | |
| 545 | 567 | |
| 568 | + } | |
| 546 | 569 | }); |
| 547 | 570 | } |
| 548 | 571 | } |
| 549 | 572 | System.out.println("根据不在人口基础信息里的学生和单位信息判断所属单位" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); |
| 550 | 573 | long startTime1 = System.currentTimeMillis(); |
| 551 | 574 | // schoolService.insertBatch(difference); |
| 552 | - resultSchools.addAll(difference); | |
| 575 | + resultSchools.addAll(schools.values()); | |
| 553 | 576 | System.out.println("有学籍信息但没有人口基本信息的数据" + minorMap.size()); |
| 554 | 577 | getSpecialStudent(minorMap, specialStudentVos, mzUnsupporteds, mzLeftBehinds, mzAdoptions, gaPunishVos, mzOrphans,gaHouseholds); |
| 555 | 578 | } catch (Exception e) { |
| ... | ... | @@ -572,11 +595,9 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 572 | 595 | if (oConvertUtils.isNotEmpty(specialStudentVos) && oConvertUtils.isNotEmpty(minors)) { |
| 573 | 596 | for (SpecialStudentVo s : specialStudentVos) { |
| 574 | 597 | if (oConvertUtils.isNotEmpty(s.getIdentity()) && oConvertUtils.isNotEmpty(minors.get(s.getIdentity()))) { |
| 575 | -// if (minors.get(s.getIdentity()).getIdentity().equals(s.getIdentity())) { | |
| 576 | - minors.get(s.getIdentity()).setSpecialReason(s.getReason()); | |
| 577 | - minors.get(s.getIdentity()).setRemark(s.getRemark()); | |
| 578 | - minors.get(s.getIdentity()).setReason(Minor.ATTENTION_REASON_STUDENT); | |
| 579 | -// } | |
| 598 | + minors.get(s.getIdentity()).setSpecialReason(s.getReason()); | |
| 599 | + minors.get(s.getIdentity()).setRemark(s.getRemark()); | |
| 600 | + minors.get(s.getIdentity()).setReason(String.valueOf(Minor.ATTENTION_REASON_STUDENT)); | |
| 580 | 601 | } |
| 581 | 602 | } |
| 582 | 603 | } |
| ... | ... | @@ -600,8 +621,12 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 600 | 621 | |
| 601 | 622 | if (oConvertUtils.isNotEmpty(minors) && oConvertUtils.isNotEmpty(mzUnsupporteds)) { |
| 602 | 623 | for (String s : mzUnsupporteds) { |
| 603 | - if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s))) { | |
| 604 | - minors.get(s).setReason(Minor.ATTENTION_REASON_UNSUPPORTED); | |
| 624 | + if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s)) ) { | |
| 625 | + if(oConvertUtils.isNotEmpty(minors.get(s).getReason()) && !minors.get(s).getReason().contains(String.valueOf(Minor.ATTENTION_REASON_UNSUPPORTED))){ | |
| 626 | + minors.get(s).setReason(minors.get(s).getReason()+","+Minor.ATTENTION_REASON_UNSUPPORTED); | |
| 627 | + }else { | |
| 628 | + minors.get(s).setReason(String.valueOf(Minor.ATTENTION_REASON_UNSUPPORTED)); | |
| 629 | + } | |
| 605 | 630 | } |
| 606 | 631 | } |
| 607 | 632 | } |
| ... | ... | @@ -624,7 +649,11 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 624 | 649 | if (oConvertUtils.isNotEmpty(minors) && oConvertUtils.isNotEmpty(mzAdoptions)) { |
| 625 | 650 | for (String s : mzAdoptions) { |
| 626 | 651 | if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s)) ) { |
| 627 | - minors.get(s).setReason(Minor.ATTENTION_REASON_UNSUPPORTED); | |
| 652 | + if(oConvertUtils.isNotEmpty(minors.get(s).getReason()) && !minors.get(s).getReason().contains(String.valueOf(Minor.ATTENTION_REASON_ADOPTION))){ | |
| 653 | + minors.get(s).setReason(minors.get(s).getReason()+","+Minor.ATTENTION_REASON_ADOPTION); | |
| 654 | + }else { | |
| 655 | + minors.get(s).setReason(String.valueOf(Minor.ATTENTION_REASON_ADOPTION)); | |
| 656 | + } | |
| 628 | 657 | } |
| 629 | 658 | } |
| 630 | 659 | } |
| ... | ... | @@ -646,8 +675,12 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 646 | 675 | System.out.println("留守儿童"); |
| 647 | 676 | if (oConvertUtils.isNotEmpty(minors) && oConvertUtils.isNotEmpty(mzLeftBehinds)) { |
| 648 | 677 | for (String s : mzLeftBehinds) { |
| 649 | - if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s)) ) { | |
| 650 | - minors.get(s).setReason(Minor.ATTENTION_REASON_CHILDREN); | |
| 678 | + if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s))) { | |
| 679 | + if(oConvertUtils.isNotEmpty(minors.get(s).getReason()) && !minors.get(s).getReason().contains(String.valueOf(Minor.ATTENTION_REASON_CHILDREN))){ | |
| 680 | + minors.get(s).setReason(minors.get(s).getReason()+","+Minor.ATTENTION_REASON_CHILDREN); | |
| 681 | + }else { | |
| 682 | + minors.get(s).setReason(String.valueOf(Minor.ATTENTION_REASON_CHILDREN)); | |
| 683 | + } | |
| 651 | 684 | } |
| 652 | 685 | } |
| 653 | 686 | } |
| ... | ... | @@ -670,7 +703,11 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 670 | 703 | if (oConvertUtils.isNotEmpty(minors) && oConvertUtils.isNotEmpty(mzOrphans)) { |
| 671 | 704 | for (String s : mzOrphans) { |
| 672 | 705 | if (oConvertUtils.isNotEmpty(s) && oConvertUtils.isNotEmpty(minors.get(s)) ) { |
| 673 | - minors.get(s).setReason(Minor.ATTENTION_REASON_ORPHAN); | |
| 706 | + if(oConvertUtils.isNotEmpty(minors.get(s).getReason()) && !minors.get(s).getReason().contains(String.valueOf(Minor.ATTENTION_REASON_ORPHAN))){ | |
| 707 | + minors.get(s).setReason(minors.get(s).getReason()+","+Minor.ATTENTION_REASON_ORPHAN); | |
| 708 | + }else { | |
| 709 | + minors.get(s).setReason(String.valueOf(Minor.ATTENTION_REASON_ORPHAN)); | |
| 710 | + } | |
| 674 | 711 | } |
| 675 | 712 | } |
| 676 | 713 | } |
| ... | ... | @@ -690,22 +727,23 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 690 | 727 | public void getFamilyRelationship(Map<String, Minor> minors, Map<String, Family> gaHouseholds, Map<String, GaPunishVo> gaPunishVos) { |
| 691 | 728 | long startTime = System.currentTimeMillis(); |
| 692 | 729 | try { |
| 693 | - List<Family> familys = new ArrayList<>(); | |
| 694 | - //犯罪人员身份证号-户号关系 | |
| 695 | - Map<String, String> idCards = new HashMap<>(); | |
| 730 | +// List<Family> familys = new ArrayList<>(); | |
| 731 | + //户号-是否犯罪关系 | |
| 732 | + Map<String, Boolean> idCards = new HashMap<>(); | |
| 696 | 733 | //户号-家庭成员关系 |
| 697 | 734 | Map<String, List<Family>> familyMaps = new HashMap<>(); |
| 698 | 735 | //人员身份证号-与监护人的关系 |
| 699 | 736 | Map<String, String> relations = new HashMap<>(); |
| 700 | 737 | //户号-与监护人 |
| 701 | 738 | Map<String, Family> guardians = new HashMap<>(); |
| 739 | + Date createTime = new Date(); | |
| 702 | 740 | if (oConvertUtils.isNotEmpty(gaHouseholds)) { |
| 703 | - int i=0; | |
| 741 | + getRandomId idWorker = new getRandomId(0, 0); | |
| 704 | 742 | for (Map.Entry<String, Family> m : gaHouseholds.entrySet()) { |
| 743 | + long id = idWorker.nextId(); | |
| 705 | 744 | String mapKey = m.getKey(); |
| 706 | 745 | Family family = m.getValue(); |
| 707 | 746 | if (oConvertUtils.isNotEmpty(family)) { |
| 708 | - i=i+1; | |
| 709 | 747 | if (oConvertUtils.isNotEmpty(gaPunishVos) && oConvertUtils.isNotEmpty(gaPunishVos.get(mapKey))) { |
| 710 | 748 | family.setCrime(Family.IS_CRIME); |
| 711 | 749 | if (oConvertUtils.isNotEmpty(gaPunishVos.get(mapKey).getAjmc())) { |
| ... | ... | @@ -717,6 +755,11 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 717 | 755 | } else { |
| 718 | 756 | family.setCrime(Family.IS_NOT_CRIME); |
| 719 | 757 | } |
| 758 | + if(IDNumberUtil.checkID(mapKey)){ | |
| 759 | + family.setGender(Integer.valueOf(IDNumberUtil.judgeGender(mapKey))); | |
| 760 | + } | |
| 761 | + family.setId(String.valueOf(id)); | |
| 762 | + family.setCreateTime(createTime); | |
| 720 | 763 | } |
| 721 | 764 | if (oConvertUtils.isNotEmpty(family) && oConvertUtils.isNotEmpty(family.getHouseholdNum()) && oConvertUtils.isNotEmpty(family.getIdentity())) { |
| 722 | 765 | String houseNum = family.getHouseholdNum(); |
| ... | ... | @@ -725,22 +768,20 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 725 | 768 | relations.put(family.getIdentity(), family.getRelation()); |
| 726 | 769 | } |
| 727 | 770 | if (oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum))) { |
| 728 | - list.addAll(familyMaps.get(houseNum)); | |
| 729 | - | |
| 771 | + familyMaps.get(houseNum).add(family); | |
| 730 | 772 | } else { |
| 731 | 773 | list.add(family); |
| 774 | + familyMaps.put(houseNum, list); | |
| 732 | 775 | } |
| 733 | 776 | if (oConvertUtils.isNotEmpty(family.getCrime()) && family.getCrime().equals(Family.IS_CRIME)) { |
| 734 | - idCards.put(family.getIdentity(), houseNum); | |
| 777 | + idCards.put(houseNum,true); | |
| 735 | 778 | } |
| 736 | - if (oConvertUtils.isNotEmpty(family.getName()) && family.getName().contains("户主")) { | |
| 779 | + if (oConvertUtils.isNotEmpty(family.getRelation()) && family.getRelation().equals("户主")) { | |
| 737 | 780 | guardians.put(houseNum, family); |
| 738 | 781 | } |
| 739 | - familyMaps.put(houseNum, list); | |
| 740 | 782 | } |
| 741 | 783 | } |
| 742 | 784 | } |
| 743 | - | |
| 744 | 785 | System.out.println("建立未成年人和家庭成员关系"); |
| 745 | 786 | getFamilyCrime(minors, idCards, familyMaps, guardians, relations); |
| 746 | 787 | } catch (Exception e) { |
| ... | ... | @@ -756,13 +797,15 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 756 | 797 | * @param idCards |
| 757 | 798 | * @param familyMaps |
| 758 | 799 | */ |
| 759 | - public void getFamilyCrime(Map<String, Minor> minors, Map<String, String> idCards, Map<String, List<Family>> familyMaps, Map<String, Family> guardians, Map<String, String> relations) { | |
| 800 | + public void getFamilyCrime(Map<String, Minor> minors, Map<String, Boolean> idCards, Map<String, List<Family>> familyMaps, Map<String, Family> guardians, Map<String, String> relations) { | |
| 760 | 801 | long startTime = System.currentTimeMillis(); |
| 761 | 802 | try { |
| 762 | 803 | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| 763 | 804 | System.out.println("家庭成员是否犯罪"); |
| 764 | 805 | List<Minor> minorList = new ArrayList<>(); |
| 765 | - List<Family> familys = new ArrayList<>(); | |
| 806 | + Set<Family> familys = new HashSet<>(); | |
| 807 | + //存放已经被放入minor里面的户号,避免数据重复 | |
| 808 | + Set<String> houseSet=new HashSet<>(); | |
| 766 | 809 | Date createTime = new Date(); |
| 767 | 810 | if (oConvertUtils.isNotEmpty(minors)) { |
| 768 | 811 | for (Map.Entry<String, Minor> m : minors.entrySet()) { |
| ... | ... | @@ -772,30 +815,38 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 772 | 815 | if (oConvertUtils.isNotEmpty(user) && oConvertUtils.isNotEmpty(user.getId())) { |
| 773 | 816 | minor.setCreateBy(user.getId()); |
| 774 | 817 | } |
| 775 | - //判断家庭成员是否犯罪 | |
| 776 | - if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(idCards) && oConvertUtils.isNotEmpty(idCards.get(idCard))) { | |
| 777 | - minor.setReason(Minor.ATTENTION_REASON_CRIME); | |
| 778 | - } | |
| 818 | + List<Family> f=new ArrayList<>(); | |
| 779 | 819 | //判断是否是一个家庭的人员 |
| 780 | 820 | if (oConvertUtils.isNotEmpty(minor.getHouseholdNum())) { |
| 781 | 821 | String houseNum = minor.getHouseholdNum(); |
| 782 | - if (oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum))) { | |
| 783 | - familys.addAll(familyMaps.get(houseNum)); | |
| 822 | + if(oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum)) ){ | |
| 823 | + if(!testIdCards.contains(houseNum) ){ | |
| 824 | + f.addAll(familyMaps.get(houseNum)); | |
| 825 | +// resultFamily.addAll(familyMaps.get(houseNum)); | |
| 826 | + testIdCards.add(houseNum); | |
| 827 | + } | |
| 828 | + } | |
| 829 | + minor.setFamilies(f); | |
| 830 | + //获取监护人 | |
| 831 | + if (oConvertUtils.isNotEmpty(houseNum) && oConvertUtils.isNotEmpty(guardians) && oConvertUtils.isNotEmpty(guardians.get(houseNum))) { | |
| 832 | + minor.setGuardian(guardians.get(houseNum).getName()); | |
| 833 | + } | |
| 834 | + //判断家庭成员是否犯罪 | |
| 835 | + if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(idCards) && oConvertUtils.isNotEmpty(idCards.get(houseNum))) { | |
| 836 | + if(oConvertUtils.isNotEmpty(minor.getReason()) && !minor.getReason().contains(String.valueOf(Minor.ATTENTION_REASON_CRIME))){ | |
| 837 | + minor.setReason(minor.getReason()+","+Minor.ATTENTION_REASON_CRIME); | |
| 838 | + }else { | |
| 839 | + minor.setReason(String.valueOf(Minor.ATTENTION_REASON_CRIME)); | |
| 840 | + } | |
| 784 | 841 | } |
| 785 | 842 | } |
| 786 | 843 | //获取与监护人关系 |
| 787 | 844 | if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(relations) && oConvertUtils.isNotEmpty(relations.get(idCard))) { |
| 788 | 845 | minor.setRelation(relations.get(idCard)); |
| 789 | 846 | } |
| 790 | - //获取监护人 | |
| 791 | - if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(guardians) && oConvertUtils.isNotEmpty(guardians.get(idCard))) { | |
| 792 | - minor.setGuardian(guardians.get(idCard).getName()); | |
| 793 | - } | |
| 794 | - minorList.add(minor); | |
| 847 | + resultMinor.add(minor); | |
| 795 | 848 | } |
| 796 | 849 | } |
| 797 | - resultMinor.addAll(minorList); | |
| 798 | - resultFamily.addAll(familys); | |
| 799 | 850 | } catch (Exception e) { |
| 800 | 851 | e.printStackTrace(); |
| 801 | 852 | log.info(String.valueOf(e)); |
| ... | ... | @@ -804,5 +855,4 @@ public class AnalyzeController extends JeecgController<GaDemographic, IGaDemogra |
| 804 | 855 | |
| 805 | 856 | } |
| 806 | 857 | |
| 807 | - | |
| 808 | 858 | } | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/MinorController.java
| 1 | 1 | package org.jeecg.modules.system.controller; |
| 2 | 2 | |
| 3 | +import java.io.OutputStream; | |
| 3 | 4 | import java.io.UnsupportedEncodingException; |
| 4 | 5 | import java.io.IOException; |
| 5 | 6 | import java.net.URLDecoder; |
| 6 | -import java.util.ArrayList; | |
| 7 | -import java.util.Arrays; | |
| 8 | -import java.util.List; | |
| 9 | -import java.util.Map; | |
| 7 | +import java.util.*; | |
| 10 | 8 | import java.util.stream.Collectors; |
| 11 | 9 | |
| 12 | 10 | import javax.servlet.http.HttpServletRequest; |
| 13 | 11 | import javax.servlet.http.HttpServletResponse; |
| 14 | 12 | |
| 13 | +import org.apache.poi.ss.usermodel.Workbook; | |
| 15 | 14 | import org.jeecg.modules.system.entity.Family; |
| 16 | 15 | import org.jeecg.modules.system.entity.Minor; |
| 16 | +import org.jeecg.modules.system.entity.SysUser; | |
| 17 | 17 | import org.jeecg.modules.system.service.IFamilyService; |
| 18 | 18 | import org.jeecg.modules.system.service.IMinorService; |
| 19 | 19 | import org.jeecg.modules.system.vo.MinorPage; |
| 20 | +import org.jeecg.modules.system.vo.MinorVo; | |
| 21 | +import org.jeecgframework.poi.excel.ExcelExportUtil; | |
| 20 | 22 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| 21 | 23 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| 22 | 24 | import org.jeecgframework.poi.excel.entity.ExportParams; |
| 23 | 25 | import org.jeecgframework.poi.excel.entity.ImportParams; |
| 26 | +import org.jeecgframework.poi.excel.entity.enmus.ExcelType; | |
| 24 | 27 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| 25 | 28 | import org.jeecg.common.system.vo.LoginUser; |
| 26 | 29 | import org.apache.shiro.SecurityUtils; |
| ... | ... | @@ -42,220 +45,294 @@ import io.swagger.annotations.Api; |
| 42 | 45 | import io.swagger.annotations.ApiOperation; |
| 43 | 46 | import org.jeecg.common.aspect.annotation.AutoLog; |
| 44 | 47 | |
| 45 | - /** | |
| 48 | +/** | |
| 46 | 49 | * @Description: 未成年人 |
| 47 | 50 | * @Author: jeecg-boot |
| 48 | - * @Date: 2022-07-13 | |
| 51 | + * @Date: 2022-07-13 | |
| 49 | 52 | * @Version: V1.0 |
| 50 | 53 | */ |
| 51 | -@Api(tags="未成年人") | |
| 54 | +@Api(tags = "未成年人") | |
| 52 | 55 | @RestController |
| 53 | 56 | @RequestMapping("/sys/minor") |
| 54 | 57 | @Slf4j |
| 55 | 58 | public class MinorController { |
| 56 | - @Autowired | |
| 57 | - private IMinorService minorService; | |
| 58 | - @Autowired | |
| 59 | - private IFamilyService familyService; | |
| 60 | - | |
| 59 | + @Autowired | |
| 60 | + private IMinorService minorService; | |
| 61 | + @Autowired | |
| 62 | + private IFamilyService familyService; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 分页列表查询 | |
| 66 | + * | |
| 67 | + * @param minor | |
| 68 | + * @param pageNo | |
| 69 | + * @param pageSize | |
| 70 | + * @param req | |
| 71 | + * @return | |
| 72 | + */ | |
| 73 | + @AutoLog(value = "未成年人-分页列表查询") | |
| 74 | + @ApiOperation(value = "未成年人-分页列表查询", notes = "未成年人-分页列表查询") | |
| 75 | + @GetMapping(value = "/list") | |
| 76 | + public Result<?> queryPageList(Minor minor, | |
| 77 | + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
| 78 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, | |
| 79 | + HttpServletRequest req) { | |
| 80 | + QueryWrapper<Minor> queryWrapper = QueryGenerator.initQueryWrapper(minor, req.getParameterMap()); | |
| 81 | + Page<Minor> page = new Page<Minor>(pageNo, pageSize); | |
| 82 | +// IPage<Minor> pageList = minorService.page(page, queryWrapper); | |
| 83 | + | |
| 84 | + IPage<Minor> pageList = minorService.queryPageList(page,minor.getName()); | |
| 85 | + return Result.OK(pageList); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 添加 | |
| 90 | + * | |
| 91 | + * @param minorPage | |
| 92 | + * @return | |
| 93 | + */ | |
| 94 | + @AutoLog(value = "未成年人-添加") | |
| 95 | + @ApiOperation(value = "未成年人-添加", notes = "未成年人-添加") | |
| 96 | + @PostMapping(value = "/add") | |
| 97 | + public Result<?> add(@RequestBody MinorPage minorPage) { | |
| 98 | + Minor minor = new Minor(); | |
| 99 | + BeanUtils.copyProperties(minorPage, minor); | |
| 100 | + minorService.saveMain(minor, minorPage.getFamilyList()); | |
| 101 | + return Result.OK("添加成功!"); | |
| 102 | + } | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 编辑 | |
| 106 | + * | |
| 107 | + * @param minorPage | |
| 108 | + * @return | |
| 109 | + */ | |
| 110 | + @AutoLog(value = "未成年人-编辑") | |
| 111 | + @ApiOperation(value = "未成年人-编辑", notes = "未成年人-编辑") | |
| 112 | + @PutMapping(value = "/edit") | |
| 113 | + public Result<?> edit(@RequestBody MinorPage minorPage) { | |
| 114 | + Minor minor = new Minor(); | |
| 115 | + BeanUtils.copyProperties(minorPage, minor); | |
| 116 | + Minor minorEntity = minorService.getById(minor.getId()); | |
| 117 | + if (minorEntity == null) { | |
| 118 | + return Result.error("未找到对应数据"); | |
| 119 | + } | |
| 120 | + minorService.updateMain(minor, minorPage.getFamilyList()); | |
| 121 | + return Result.OK("编辑成功!"); | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 通过id删除 | |
| 126 | + * | |
| 127 | + * @param id | |
| 128 | + * @return | |
| 129 | + */ | |
| 130 | + @AutoLog(value = "未成年人-通过id删除") | |
| 131 | + @ApiOperation(value = "未成年人-通过id删除", notes = "未成年人-通过id删除") | |
| 132 | + @DeleteMapping(value = "/delete") | |
| 133 | + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { | |
| 134 | + minorService.delMain(id); | |
| 135 | + return Result.OK("删除成功!"); | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * 批量删除 | |
| 140 | + * | |
| 141 | + * @param ids | |
| 142 | + * @return | |
| 143 | + */ | |
| 144 | + @AutoLog(value = "未成年人-批量删除") | |
| 145 | + @ApiOperation(value = "未成年人-批量删除", notes = "未成年人-批量删除") | |
| 146 | + @DeleteMapping(value = "/deleteBatch") | |
| 147 | + public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { | |
| 148 | + this.minorService.delBatchMain(Arrays.asList(ids.split(","))); | |
| 149 | + return Result.OK("批量删除成功!"); | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * 通过id查询 | |
| 154 | + * | |
| 155 | + * @param id | |
| 156 | + * @return | |
| 157 | + */ | |
| 158 | + @AutoLog(value = "未成年人-通过id查询") | |
| 159 | + @ApiOperation(value = "未成年人-通过id查询", notes = "未成年人-通过id查询") | |
| 160 | + @GetMapping(value = "/queryById") | |
| 161 | + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { | |
| 162 | + Minor minor = minorService.getById(id); | |
| 163 | + if (minor == null) { | |
| 164 | + return Result.error("未找到对应数据"); | |
| 165 | + } | |
| 166 | + return Result.OK(minor); | |
| 167 | + | |
| 168 | + } | |
| 169 | + | |
| 170 | + /** | |
| 171 | + * 通过householdNum查询 | |
| 172 | + * | |
| 173 | + * @param householdNum | |
| 174 | + * @return | |
| 175 | + */ | |
| 176 | + @AutoLog(value = "家庭成员表通过主表householdNum查询") | |
| 177 | + @ApiOperation(value = "家庭成员表主表householdNum查询", notes = "家庭成员表-通主表householdNum查询") | |
| 178 | + @GetMapping(value = "/queryFamilyByMainId") | |
| 179 | + public Result<?> queryFamilyListByMainId(@RequestParam(name = "householdNum", required = true) String householdNum) { | |
| 180 | + List<Family> familyList = familyService.selectByHouseholdNum(householdNum); | |
| 181 | + return Result.OK(familyList); | |
| 182 | + } | |
| 183 | + | |
| 61 | 184 | /** |
| 62 | - * 分页列表查询 | |
| 185 | + * 导出excel | |
| 63 | 186 | * |
| 187 | + * @param request | |
| 64 | 188 | * @param minor |
| 65 | - * @param pageNo | |
| 66 | - * @param pageSize | |
| 67 | - * @param req | |
| 68 | - * @return | |
| 69 | 189 | */ |
| 70 | - @AutoLog(value = "未成年人-分页列表查询") | |
| 71 | - @ApiOperation(value="未成年人-分页列表查询", notes="未成年人-分页列表查询") | |
| 72 | - @GetMapping(value = "/list") | |
| 73 | - public Result<?> queryPageList(Minor minor, | |
| 74 | - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
| 75 | - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
| 76 | - HttpServletRequest req) { | |
| 77 | - QueryWrapper<Minor> queryWrapper = QueryGenerator.initQueryWrapper(minor, req.getParameterMap()); | |
| 78 | - Page<Minor> page = new Page<Minor>(pageNo, pageSize); | |
| 79 | - IPage<Minor> pageList = minorService.page(page, queryWrapper); | |
| 80 | - return Result.OK(pageList); | |
| 81 | - } | |
| 82 | - | |
| 83 | - /** | |
| 84 | - * 添加 | |
| 85 | - * | |
| 86 | - * @param minorPage | |
| 87 | - * @return | |
| 88 | - */ | |
| 89 | - @AutoLog(value = "未成年人-添加") | |
| 90 | - @ApiOperation(value="未成年人-添加", notes="未成年人-添加") | |
| 91 | - @PostMapping(value = "/add") | |
| 92 | - public Result<?> add(@RequestBody MinorPage minorPage) { | |
| 93 | - Minor minor = new Minor(); | |
| 94 | - BeanUtils.copyProperties(minorPage, minor); | |
| 95 | - minorService.saveMain(minor, minorPage.getFamilyList()); | |
| 96 | - return Result.OK("添加成功!"); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * 编辑 | |
| 101 | - * | |
| 102 | - * @param minorPage | |
| 103 | - * @return | |
| 104 | - */ | |
| 105 | - @AutoLog(value = "未成年人-编辑") | |
| 106 | - @ApiOperation(value="未成年人-编辑", notes="未成年人-编辑") | |
| 107 | - @PutMapping(value = "/edit") | |
| 108 | - public Result<?> edit(@RequestBody MinorPage minorPage) { | |
| 109 | - Minor minor = new Minor(); | |
| 110 | - BeanUtils.copyProperties(minorPage, minor); | |
| 111 | - Minor minorEntity = minorService.getById(minor.getId()); | |
| 112 | - if(minorEntity==null) { | |
| 113 | - return Result.error("未找到对应数据"); | |
| 190 | + @RequestMapping(value = "/exportXls") | |
| 191 | + public ModelAndView exportXls(HttpServletRequest request, Minor minor) { | |
| 192 | + // Step.1 组装查询条件查询数据 | |
| 193 | + QueryWrapper<Minor> queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); | |
| 194 | + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
| 195 | + | |
| 196 | + //Step.2 获取导出数据 | |
| 197 | + List<Minor> queryList = minorService.list(queryWrapper); | |
| 198 | + // 过滤选中数据 | |
| 199 | + String selections = request.getParameter("selections"); | |
| 200 | + List<Minor> minorList = new ArrayList<Minor>(); | |
| 201 | + if(oConvertUtils.isEmpty(selections)) { | |
| 202 | + minorList = queryList; | |
| 203 | + }else { | |
| 204 | + List<String> selectionList = Arrays.asList(selections.split(",")); | |
| 205 | + minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); | |
| 114 | 206 | } |
| 115 | - minorService.updateMain(minor, minorPage.getFamilyList()); | |
| 116 | - return Result.OK("编辑成功!"); | |
| 117 | - } | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * 通过id删除 | |
| 121 | - * | |
| 122 | - * @param id | |
| 123 | - * @return | |
| 124 | - */ | |
| 125 | - @AutoLog(value = "未成年人-通过id删除") | |
| 126 | - @ApiOperation(value="未成年人-通过id删除", notes="未成年人-通过id删除") | |
| 127 | - @DeleteMapping(value = "/delete") | |
| 128 | - public Result<?> delete(@RequestParam(name="id",required=true) String id) { | |
| 129 | - minorService.delMain(id); | |
| 130 | - return Result.OK("删除成功!"); | |
| 131 | - } | |
| 132 | - | |
| 133 | - /** | |
| 134 | - * 批量删除 | |
| 135 | - * | |
| 136 | - * @param ids | |
| 137 | - * @return | |
| 138 | - */ | |
| 139 | - @AutoLog(value = "未成年人-批量删除") | |
| 140 | - @ApiOperation(value="未成年人-批量删除", notes="未成年人-批量删除") | |
| 141 | - @DeleteMapping(value = "/deleteBatch") | |
| 142 | - public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
| 143 | - this.minorService.delBatchMain(Arrays.asList(ids.split(","))); | |
| 144 | - return Result.OK("批量删除成功!"); | |
| 145 | - } | |
| 146 | - | |
| 147 | - /** | |
| 148 | - * 通过id查询 | |
| 149 | - * | |
| 150 | - * @param id | |
| 151 | - * @return | |
| 152 | - */ | |
| 153 | - @AutoLog(value = "未成年人-通过id查询") | |
| 154 | - @ApiOperation(value="未成年人-通过id查询", notes="未成年人-通过id查询") | |
| 155 | - @GetMapping(value = "/queryById") | |
| 156 | - public Result<?> queryById(@RequestParam(name="id",required=true) String id) { | |
| 157 | - Minor minor = minorService.getById(id); | |
| 158 | - if(minor==null) { | |
| 159 | - return Result.error("未找到对应数据"); | |
| 207 | + // Step.3 组装pageList | |
| 208 | + List<MinorPage> pageList = new ArrayList<MinorPage>(); | |
| 209 | + for (Minor main : minorList) { | |
| 210 | + MinorPage vo = new MinorPage(); | |
| 211 | + BeanUtils.copyProperties(main, vo); | |
| 212 | + List<Family> familyList = familyService.selectByHouseholdNum(main.getHouseholdNum()); | |
| 213 | + vo.setFamilyList(familyList); | |
| 214 | + pageList.add(vo); | |
| 160 | 215 | } |
| 161 | - return Result.OK(minor); | |
| 162 | 216 | |
| 217 | + // Step.4 AutoPoi 导出Excel | |
| 218 | + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |
| 219 | + mv.addObject(NormalExcelConstants.FILE_NAME, "未成年人列表"); | |
| 220 | + mv.addObject(NormalExcelConstants.CLASS, MinorPage.class); | |
| 221 | + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("未成年人数据", "导出人:"+sysUser.getRealname(), "未成年人")); | |
| 222 | + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | |
| 223 | + return mv; | |
| 163 | 224 | } |
| 164 | - | |
| 165 | - /** | |
| 166 | - * 通过id查询 | |
| 167 | - * | |
| 168 | - * @param id | |
| 169 | - * @return | |
| 170 | - */ | |
| 171 | - @AutoLog(value = "家庭成员表通过主表ID查询") | |
| 172 | - @ApiOperation(value="家庭成员表主表ID查询", notes="家庭成员表-通主表ID查询") | |
| 173 | - @GetMapping(value = "/queryFamilyByMainId") | |
| 174 | - public Result<?> queryFamilyListByMainId(@RequestParam(name="id",required=true) String id) { | |
| 175 | - List<Family> familyList = familyService.selectByMainId(id); | |
| 176 | - return Result.OK(familyList); | |
| 177 | - } | |
| 178 | - | |
| 179 | - /** | |
| 180 | - * 导出excel | |
| 181 | - * | |
| 182 | - * @param request | |
| 183 | - * @param minor | |
| 184 | - */ | |
| 185 | - @RequestMapping(value = "/exportXls") | |
| 186 | - public ModelAndView exportXls(HttpServletRequest request, Minor minor) { | |
| 187 | - // Step.1 组装查询条件查询数据 | |
| 188 | - QueryWrapper<Minor> queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); | |
| 189 | - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
| 190 | - queryWrapper.last("limit 1"); | |
| 191 | - //Step.2 获取导出数据 | |
| 192 | - List<Minor> queryList = minorService.list(queryWrapper); | |
| 193 | - // 过滤选中数据 | |
| 194 | - String selections = request.getParameter("selections"); | |
| 195 | - List<Minor> minorList = new ArrayList<Minor>(); | |
| 196 | - if(oConvertUtils.isEmpty(selections)) { | |
| 197 | - minorList = queryList; | |
| 198 | - }else { | |
| 199 | - List<String> selectionList = Arrays.asList(selections.split(",")); | |
| 200 | - minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); | |
| 201 | - } | |
| 202 | 225 | |
| 203 | - // Step.3 组装pageList | |
| 204 | - List<MinorPage> pageList = new ArrayList<MinorPage>(); | |
| 205 | - for (Minor main : minorList) { | |
| 206 | - MinorPage vo = new MinorPage(); | |
| 207 | - BeanUtils.copyProperties(main, vo); | |
| 208 | - List<Family> familyList = familyService.selectByMainId(main.getId()); | |
| 209 | - vo.setFamilyList(familyList); | |
| 210 | - pageList.add(vo); | |
| 211 | - } | |
| 226 | +// /** | |
| 227 | +// * 导出excel | |
| 228 | +// * | |
| 229 | +// * @param request | |
| 230 | +// * @param minor | |
| 231 | +// */ | |
| 232 | +// @RequestMapping(value = "/exportXls") | |
| 233 | +// public void exportXls(HttpServletRequest request, Minor minor, HttpServletResponse response) throws IOException { | |
| 234 | +// | |
| 235 | +// OutputStream outputStream = response.getOutputStream(); | |
| 236 | +// // Step.1 组装查询条件查询数据 | |
| 237 | +// QueryWrapper<Minor> queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); | |
| 238 | +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
| 239 | +// queryWrapper.last("limit 1"); | |
| 240 | +// //Step.2 获取导出数据 | |
| 241 | +// List<Minor> queryList = minorService.list(queryWrapper); | |
| 242 | +// // 过滤选中数据 | |
| 243 | +// String selections = request.getParameter("selections"); | |
| 244 | +// List<Minor> minorList = new ArrayList<Minor>(); | |
| 245 | +// if (oConvertUtils.isEmpty(selections)) { | |
| 246 | +// minorList = queryList; | |
| 247 | +// } else { | |
| 248 | +// List<String> selectionList = Arrays.asList(selections.split(",")); | |
| 249 | +// minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); | |
| 250 | +// } | |
| 251 | +// // Step.3 组装pageList | |
| 252 | +// List<MinorPage> pageList = new ArrayList<MinorPage>(); | |
| 253 | +// List<Family> familyList = new ArrayList<>(); | |
| 254 | +// for (Minor main : minorList) { | |
| 255 | +// familyList = familyService.selectByHouseholdNum(main.getHouseholdNum()); | |
| 256 | +// } | |
| 257 | +// //多个map,对应了多个sheet | |
| 258 | +// List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 259 | +// Map<String, Object> minorMap = new HashMap<String, Object>(); | |
| 260 | +// minorMap.put("title", getExportParams("未成年人表"));//表格title | |
| 261 | +// minorMap.put("entity", Minor.class);//表格对应实体 | |
| 262 | +// //数据封装方式二:实体类 | |
| 263 | +// minorMap.put("data", minorList); | |
| 264 | +// listMap.add(minorMap); | |
| 265 | +// Map<String, Object> familyMap = new HashMap<String, Object>(); | |
| 266 | +// familyMap.put("title", getExportParams("家庭成员表"));//表格title | |
| 267 | +// familyMap.put("entity", Family.class);//表格对应实体 | |
| 268 | +// //数据封装方式二:实体类 | |
| 269 | +// familyMap.put("data", familyList); | |
| 270 | +// listMap.add(familyMap); | |
| 271 | +// try { | |
| 272 | +// Workbook wb = ExcelExportUtil.exportExcel(listMap, ExcelType.XSSF); | |
| 273 | +// response.reset(); | |
| 274 | +// response.setHeader("Content-disposition", "attachment; filename=details.xls"); | |
| 275 | +// response.setContentType("application/msexcel"); | |
| 276 | +// wb.write(outputStream); | |
| 277 | +// outputStream.close(); | |
| 278 | +// } catch (IOException e) { | |
| 279 | +// log.error("模板下载失败" + e.getMessage()); | |
| 280 | +// response.setStatus(404); | |
| 281 | +// e.printStackTrace(); | |
| 282 | +// } finally { | |
| 283 | +// if (outputStream != null) { | |
| 284 | +// try { | |
| 285 | +// outputStream.close(); | |
| 286 | +// } catch (IOException e) { | |
| 287 | +// log.error(e.getMessage(), e); | |
| 288 | +// } | |
| 289 | +// } | |
| 290 | +// } | |
| 291 | +// } | |
| 212 | 292 | |
| 213 | - // Step.4 AutoPoi 导出Excel | |
| 214 | - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |
| 215 | - mv.addObject(NormalExcelConstants.FILE_NAME, "未成年人列表"); | |
| 216 | - mv.addObject(NormalExcelConstants.CLASS, MinorPage.class); | |
| 217 | - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("未成年人数据", "导出人:"+sysUser.getRealname(), "未成年人")); | |
| 218 | - mv.addObject(NormalExcelConstants.DATA_LIST, pageList); | |
| 219 | - return mv; | |
| 293 | + //导出参数 | |
| 294 | + public static ExportParams getExportParams(String name) { | |
| 295 | + //表格名称,sheet名称,导出版本 | |
| 296 | + return new ExportParams(name, name, ExcelType.XSSF); | |
| 220 | 297 | } |
| 221 | 298 | |
| 222 | 299 | /** |
| 223 | - * 通过excel导入数据 | |
| 224 | - * | |
| 225 | - * @param request | |
| 226 | - * @param response | |
| 227 | - * @return | |
| 228 | - */ | |
| 300 | + * 通过excel导入数据 | |
| 301 | + * | |
| 302 | + * @param request | |
| 303 | + * @param response | |
| 304 | + * @return | |
| 305 | + */ | |
| 229 | 306 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| 230 | 307 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| 231 | - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | |
| 232 | - Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | |
| 233 | - for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | |
| 234 | - MultipartFile file = entity.getValue();// 获取上传文件对象 | |
| 235 | - ImportParams params = new ImportParams(); | |
| 236 | - params.setTitleRows(2); | |
| 237 | - params.setHeadRows(1); | |
| 238 | - params.setNeedSave(true); | |
| 239 | - try { | |
| 240 | - List<MinorPage> list = ExcelImportUtil.importExcel(file.getInputStream(), MinorPage.class, params); | |
| 241 | - for (MinorPage page : list) { | |
| 242 | - Minor po = new Minor(); | |
| 243 | - BeanUtils.copyProperties(page, po); | |
| 244 | - minorService.saveMain(po, page.getFamilyList()); | |
| 245 | - } | |
| 246 | - return Result.OK("文件导入成功!数据行数:" + list.size()); | |
| 247 | - } catch (Exception e) { | |
| 248 | - log.error(e.getMessage(),e); | |
| 249 | - return Result.error("文件导入失败:"+e.getMessage()); | |
| 250 | - } finally { | |
| 251 | - try { | |
| 252 | - file.getInputStream().close(); | |
| 253 | - } catch (IOException e) { | |
| 254 | - e.printStackTrace(); | |
| 255 | - } | |
| 256 | - } | |
| 257 | - } | |
| 258 | - return Result.OK("文件导入失败!"); | |
| 308 | + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | |
| 309 | + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | |
| 310 | + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | |
| 311 | + MultipartFile file = entity.getValue();// 获取上传文件对象 | |
| 312 | + ImportParams params = new ImportParams(); | |
| 313 | + params.setTitleRows(2); | |
| 314 | + params.setHeadRows(1); | |
| 315 | + params.setNeedSave(true); | |
| 316 | + try { | |
| 317 | + List<MinorPage> list = ExcelImportUtil.importExcel(file.getInputStream(), MinorPage.class, params); | |
| 318 | + for (MinorPage page : list) { | |
| 319 | + Minor po = new Minor(); | |
| 320 | + BeanUtils.copyProperties(page, po); | |
| 321 | + minorService.saveMain(po, page.getFamilyList()); | |
| 322 | + } | |
| 323 | + return Result.OK("文件导入成功!数据行数:" + list.size()); | |
| 324 | + } catch (Exception e) { | |
| 325 | + log.error(e.getMessage(), e); | |
| 326 | + return Result.error("文件导入失败:" + e.getMessage()); | |
| 327 | + } finally { | |
| 328 | + try { | |
| 329 | + file.getInputStream().close(); | |
| 330 | + } catch (IOException e) { | |
| 331 | + e.printStackTrace(); | |
| 332 | + } | |
| 333 | + } | |
| 334 | + } | |
| 335 | + return Result.OK("文件导入失败!"); | |
| 259 | 336 | } |
| 260 | 337 | |
| 261 | 338 | } | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Family.java
| ... | ... | @@ -30,9 +30,9 @@ public class Family implements Serializable { |
| 30 | 30 | public static final Integer IS_CRIME=1;//是 |
| 31 | 31 | public static final Integer IS_NOT_CRIME=0;//否 |
| 32 | 32 | |
| 33 | - @TableId(type = IdType.AUTO) | |
| 33 | + @TableId(type = IdType.ASSIGN_ID) | |
| 34 | 34 | @ApiModelProperty(value = "主键") |
| 35 | - private Integer id; | |
| 35 | + private String id; | |
| 36 | 36 | /**创建人*/ |
| 37 | 37 | @ApiModelProperty(value = "创建人") |
| 38 | 38 | private String createBy; | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Minor.java
| ... | ... | @@ -3,6 +3,9 @@ package org.jeecg.modules.system.entity; |
| 3 | 3 | import java.io.Serializable; |
| 4 | 4 | import java.io.UnsupportedEncodingException; |
| 5 | 5 | import java.util.Date; |
| 6 | +import java.util.List; | |
| 7 | +import java.util.Set; | |
| 8 | + | |
| 6 | 9 | import com.baomidou.mybatisplus.annotation.IdType; |
| 7 | 10 | import com.baomidou.mybatisplus.annotation.TableField; |
| 8 | 11 | import com.baomidou.mybatisplus.annotation.TableId; |
| ... | ... | @@ -79,29 +82,14 @@ public class Minor implements Serializable { |
| 79 | 82 | @ApiModelProperty(value = "性别") |
| 80 | 83 | @Dict(dicCode = "sex") |
| 81 | 84 | private Integer gender; |
| 82 | - /**家庭住址*/ | |
| 83 | - @Excel(name = "家庭住址", width = 15) | |
| 84 | - @ApiModelProperty(value = "家庭住址") | |
| 85 | - private String address; | |
| 86 | 85 | /**身份证号*/ |
| 87 | 86 | @Excel(name = "身份证号", width = 15) |
| 88 | 87 | @ApiModelProperty(value = "身份证号") |
| 89 | 88 | private String identity; |
| 90 | - | |
| 91 | - /** | |
| 92 | - * 监护人 | |
| 93 | - */ | |
| 94 | - @Excel(name = "监护人", width = 15) | |
| 95 | - @ApiModelProperty(value = "监护人") | |
| 96 | - private String guardian; | |
| 97 | - | |
| 98 | - /** | |
| 99 | - * 监护人关系 | |
| 100 | - */ | |
| 101 | - @Excel(name = "监护人关系", width = 15) | |
| 102 | - @ApiModelProperty(value = "监护人关系") | |
| 103 | - private String relation; | |
| 104 | - | |
| 89 | + /**家庭住址*/ | |
| 90 | + @Excel(name = "家庭住址", width = 15) | |
| 91 | + @ApiModelProperty(value = "家庭住址") | |
| 92 | + private String address; | |
| 105 | 93 | /**是否失学*/ |
| 106 | 94 | @Excel(name = "是否失学", width = 15,dicCode = "school_status") |
| 107 | 95 | @ApiModelProperty(value = "是否失学") |
| ... | ... | @@ -116,13 +104,25 @@ public class Minor implements Serializable { |
| 116 | 104 | @Excel(name = "入学年份", width = 15) |
| 117 | 105 | @ApiModelProperty(value = "入学年份") |
| 118 | 106 | private String startYear; |
| 107 | + /** | |
| 108 | + * 监护人 | |
| 109 | + */ | |
| 110 | + @Excel(name = "监护人", width = 15) | |
| 111 | + @ApiModelProperty(value = "监护人") | |
| 112 | + private String guardian; | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 监护人关系 | |
| 116 | + */ | |
| 117 | + @Excel(name = "监护人关系", width = 15) | |
| 118 | + @ApiModelProperty(value = "监护人关系") | |
| 119 | + private String relation; | |
| 119 | 120 | |
| 120 | 121 | /**重点关注原因*/ |
| 121 | 122 | @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") |
| 122 | 123 | @ApiModelProperty(value = "重点关注原因") |
| 123 | 124 | @Dict(dicCode = "attention_reason") |
| 124 | - private Integer reason; | |
| 125 | - | |
| 125 | + private String reason; | |
| 126 | 126 | /**特殊原因*/ |
| 127 | 127 | @Excel(name = "特殊原因", width = 15) |
| 128 | 128 | @ApiModelProperty(value = "特殊原因") |
| ... | ... | @@ -135,4 +135,10 @@ public class Minor implements Serializable { |
| 135 | 135 | @Excel(name = "行政区划", width = 15) |
| 136 | 136 | @ApiModelProperty(value = "行政区划") |
| 137 | 137 | private String division; |
| 138 | + | |
| 139 | + @TableField(exist = false) | |
| 140 | + private List<Family> families; | |
| 141 | + | |
| 142 | + @TableField(exist = false) | |
| 143 | + private String age; | |
| 138 | 144 | } | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/FamilyMapper.java
| ... | ... | @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param; |
| 5 | 5 | import org.jeecg.modules.system.entity.Family; |
| 6 | 6 | |
| 7 | 7 | import java.util.List; |
| 8 | +import java.util.Set; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * @Description: 家庭成员表 |
| ... | ... | @@ -16,7 +17,7 @@ public interface FamilyMapper extends BaseMapper<Family> { |
| 16 | 17 | |
| 17 | 18 | public boolean deleteByMainId(@Param("mainId") String mainId); |
| 18 | 19 | |
| 19 | - public List<Family> selectByMainId(@Param("mainId") String mainId); | |
| 20 | + public List<Family> selectByHouseholdNum(@Param("householdNum") String householdNum); | |
| 20 | 21 | |
| 21 | 22 | public List<Family> getFamilyByMinorId(@Param("minorId") String minorId); |
| 22 | 23 | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java
| 1 | 1 | package org.jeecg.modules.system.mapper; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 4 | 7 | import org.jeecg.modules.system.entity.Family; |
| 5 | 8 | import org.jeecg.modules.system.entity.Minor; |
| 9 | +import org.jeecg.modules.system.entity.SysUser; | |
| 10 | +import org.jeecg.modules.system.vo.MinorVo; | |
| 6 | 11 | |
| 7 | 12 | import java.util.List; |
| 8 | 13 | |
| ... | ... | @@ -16,4 +21,12 @@ public interface MinorMapper extends BaseMapper<Minor> { |
| 16 | 21 | |
| 17 | 22 | public Integer insertBatch(List<Minor> list); |
| 18 | 23 | |
| 24 | + /** | |
| 25 | + * 分页查询未成年人信息 | |
| 26 | + * @param page | |
| 27 | + * @return | |
| 28 | + */ | |
| 29 | + IPage<Minor> queryPageList(Page page,@Param("name") String name); | |
| 30 | + | |
| 31 | + | |
| 19 | 32 | } | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/FamilyMapper.xml
| ... | ... | @@ -8,23 +8,24 @@ |
| 8 | 8 | WHERE |
| 9 | 9 | minor_id = #{mainId} </delete> |
| 10 | 10 | |
| 11 | - <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.system.entity.Family"> | |
| 11 | + <select id="selectByHouseholdNum" parameterType="java.lang.String" resultType="org.jeecg.modules.system.entity.Family"> | |
| 12 | 12 | SELECT * |
| 13 | 13 | FROM mr_family |
| 14 | 14 | WHERE |
| 15 | - minor_id = #{mainId} </select> | |
| 16 | - | |
| 17 | -<!-- <insert id="insertBatch" > | |
| 18 | - INSERT INTO mr_family (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,crime,reason, other)VALUES | |
| 19 | - <foreach collection="list" item="b" separator=","> | |
| 20 | - (#{b.id},#{b.createTime},#{b.sysOrgCode},#{b.householdNum},#{b.number},#{b.name},#{b.identity},#{b.gender},#{b.relation},#{b.address},#{b.crime},#{b.reason},#{b.other}) | |
| 21 | - </foreach> | |
| 22 | - </insert>--> | |
| 15 | + household_num = #{householdNum} | |
| 16 | + </select> | |
| 23 | 17 | |
| 24 | 18 | <insert id="insertBatch" > |
| 25 | - INSERT INTO mr_family (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,crime,reason, other)VALUES | |
| 19 | + INSERT INTO mr_family (id,create_time,sys_org_code,household_num,number,name,identity,gender,relation,address,crime,reason,other)VALUES | |
| 26 | 20 | <foreach collection="list" item="b" separator=","> |
| 27 | 21 | (#{b.id},#{b.createTime},#{b.sysOrgCode},#{b.householdNum},#{b.number},#{b.name},#{b.identity},#{b.gender},#{b.relation},#{b.address},#{b.crime},#{b.reason},#{b.other}) |
| 28 | 22 | </foreach> |
| 29 | 23 | </insert> |
| 24 | + | |
| 25 | +<!-- <insert id="insertBatch" >--> | |
| 26 | +<!-- INSERT INTO mr_family (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,crime,reason, other)VALUES--> | |
| 27 | +<!-- <foreach collection="list" item="b" separator=",">--> | |
| 28 | +<!-- (#{b.id},#{b.createTime},#{b.sysOrgCode},#{b.householdNum},#{b.number},#{b.name},#{b.identity},#{b.gender},#{b.relation},#{b.address},#{b.crime},#{b.reason},#{b.other})--> | |
| 29 | +<!-- </foreach>--> | |
| 30 | +<!-- </insert>--> | |
| 30 | 31 | </mapper> | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | -<mapper namespace="package org.jeecg.modules.system.mapper.MinorMapper"> | |
| 3 | +<mapper namespace="org.jeecg.modules.system.mapper.MinorMapper"> | |
| 4 | + | |
| 5 | + <resultMap id="minor" type="org.jeecg.modules.system.entity.Minor"> | |
| 6 | + <result column="id" property="id"/> | |
| 7 | + <result column="createTime" property="createTime"/> | |
| 8 | + <result column="sysOrgCode" property="sysOrgCode"/> | |
| 9 | + <result column="householdNum" property="householdNum"/> | |
| 10 | + <result column="number" property="number"/> | |
| 11 | + <result column="name" property="name"/> | |
| 12 | + <result column="gender" property="gender"/> | |
| 13 | + <result column="identity" property="identity"/> | |
| 14 | + <result column="school" property="school"/> | |
| 15 | + <result column="schoolName" property="schoolName"/> | |
| 16 | + <result column="startYear" property="startYear"/> | |
| 17 | + <result column="address" property="address"/> | |
| 18 | + <result column="guardian" property="guardian"/> | |
| 19 | + <result column="relation" property="relation"/> | |
| 20 | + <result column="reason" property="reason"/> | |
| 21 | + <result column="specialReason" property="specialReason"/> | |
| 22 | + <result column="remark" property="remark"/> | |
| 23 | + <result column="age" property="age"/> | |
| 24 | + </resultMap> | |
| 25 | + | |
| 4 | 26 | <insert id="insertBatch" > |
| 5 | 27 | INSERT INTO mr_minor (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,guardian, |
| 6 | 28 | school,schoolName, startYear,reason,specialReason,remark)VALUES |
| ... | ... | @@ -9,4 +31,15 @@ |
| 9 | 31 | #{b.school},#{b.schoolName},#{b.startYear},#{b.reason},#{b.specialReason},#{b.remark}) |
| 10 | 32 | </foreach> |
| 11 | 33 | </insert> |
| 34 | +<!-- ORDER BY create_time desc LIMIT #{pageNum},#{pageSize}--> | |
| 35 | + <select id="queryPageList" resultMap="minor"> | |
| 36 | + select timestampdiff(year, substring(identity, 7, 8), now()) as age,identity,create_time as createTime,sys_org_code as sysOrgCode,household_num as householdNum, | |
| 37 | + number,name,gender,school,school_name as schoolName,start_year as startYear,address,guardian,relation,reason,special_reason as specialReason,remark | |
| 38 | + FROM mr_minor | |
| 39 | + WHERE (timestampdiff(year, substring(identity, 7, 8), now())) < 18 | |
| 40 | + <if test="name!=null and name!=''"> | |
| 41 | + and name like concat('%',#{name},'%') | |
| 42 | + </if> | |
| 43 | + </select> | |
| 44 | + | |
| 12 | 45 | </mapper> |
| 13 | 46 | \ No newline at end of file | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IFamilyService.java
| ... | ... | @@ -6,6 +6,7 @@ import org.jeecg.modules.system.entity.Minor; |
| 6 | 6 | import org.jeecg.modules.system.entity.SysDepart; |
| 7 | 7 | |
| 8 | 8 | import java.util.List; |
| 9 | +import java.util.Set; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * @Description: 家庭成员表 |
| ... | ... | @@ -15,7 +16,7 @@ import java.util.List; |
| 15 | 16 | */ |
| 16 | 17 | public interface IFamilyService extends IService<Family> { |
| 17 | 18 | |
| 18 | - public List<Family> selectByMainId(String mainId); | |
| 19 | + public List<Family> selectByHouseholdNum(String householdNum); | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | public Integer insertBatch(List<Family> list); | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java
| 1 | 1 | package org.jeecg.modules.system.service; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 3 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
| 4 | 6 | import org.jeecg.modules.system.entity.Family; |
| 5 | 7 | import org.jeecg.modules.system.entity.Minor; |
| 6 | 8 | import org.jeecg.modules.system.entity.SysDepart; |
| 9 | +import org.jeecg.modules.system.vo.MinorVo; | |
| 7 | 10 | |
| 8 | 11 | import java.io.Serializable; |
| 9 | 12 | import java.util.Collection; |
| ... | ... | @@ -41,4 +44,6 @@ public interface IMinorService extends IService<Minor> { |
| 41 | 44 | |
| 42 | 45 | |
| 43 | 46 | public Integer insertBatch(List<Minor> list); |
| 47 | + | |
| 48 | + IPage<Minor> queryPageList(Page<Minor> page,String name); | |
| 44 | 49 | } | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java
| ... | ... | @@ -2,8 +2,6 @@ package org.jeecg.modules.system.service.impl; |
| 2 | 2 | |
| 3 | 3 | import org.jeecg.common.util.oConvertUtils; |
| 4 | 4 | import org.jeecg.modules.system.entity.Family; |
| 5 | -import org.jeecg.modules.system.entity.Minor; | |
| 6 | -import org.jeecg.modules.system.entity.SysDepart; | |
| 7 | 5 | import org.jeecg.modules.system.mapper.FamilyMapper; |
| 8 | 6 | import org.jeecg.modules.system.service.IFamilyService; |
| 9 | 7 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| ... | ... | @@ -17,7 +15,6 @@ import java.util.concurrent.TimeUnit; |
| 17 | 15 | import java.util.stream.Collectors; |
| 18 | 16 | |
| 19 | 17 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 20 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | 18 | import org.springframework.transaction.TransactionDefinition; |
| 22 | 19 | import org.springframework.transaction.TransactionStatus; |
| 23 | 20 | import org.springframework.transaction.annotation.Transactional; |
| ... | ... | @@ -43,8 +40,8 @@ public class FamilyServiceImpl extends ServiceImpl<FamilyMapper, Family> impleme |
| 43 | 40 | private TransactionDefinition transactionDefinition; |
| 44 | 41 | |
| 45 | 42 | @Override |
| 46 | - public List<Family> selectByMainId(String mainId) { | |
| 47 | - return familyMapper.selectByMainId(mainId); | |
| 43 | + public List<Family> selectByHouseholdNum(String householdNum){ | |
| 44 | + return familyMapper.selectByHouseholdNum(householdNum); | |
| 48 | 45 | } |
| 49 | 46 | |
| 50 | 47 | private Integer random_number=00000000; |
| ... | ... | @@ -57,49 +54,53 @@ public class FamilyServiceImpl extends ServiceImpl<FamilyMapper, Family> impleme |
| 57 | 54 | @Override |
| 58 | 55 | @Transactional |
| 59 | 56 | public Integer insertBatch(List<Family> list) { |
| 57 | + System.out.println("源数据条数***************************************"+list.size()); | |
| 58 | + List<Family> families= list.stream().distinct().collect(Collectors.toList());; | |
| 60 | 59 | // if(oConvertUtils.isNotEmpty(list)){ |
| 61 | -// for(int i=0;i<list.size();i++){ | |
| 62 | -// String id=System.currentTimeMillis()+String.valueOf((random_number+i)); | |
| 63 | -// System.out.println(id); | |
| 64 | -// list.get(i).setId(id); | |
| 65 | -// } | |
| 60 | +// list.stream().forEach(h -> { | |
| 61 | +// families.add(h); | |
| 62 | +// }); | |
| 66 | 63 | // } |
| 67 | - updateStudentWithThreads(list); | |
| 64 | + System.out.println("去重后数据条数***************************************"+families.size()); | |
| 65 | + updateStudentWithThreads(families); | |
| 68 | 66 | return list.size(); |
| 69 | 67 | } |
| 70 | 68 | private void addBatch(List<Family> list, CountDownLatch threadLatch){ |
| 71 | -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 69 | + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 72 | 70 | System.out.println("子线程:" + Thread.currentThread().getName()); |
| 73 | 71 | try { |
| 74 | - list.forEach(s -> { | |
| 75 | - if(oConvertUtils.isNotEmpty(s)){ | |
| 76 | - familyMapper.insert(s); | |
| 77 | - } | |
| 78 | - }); | |
| 79 | -// familyMapper.insertBatch(list); | |
| 80 | -// dataSourceTransactionManager.commit(transactionStatus); | |
| 72 | +// list.forEach(s -> { | |
| 73 | +// if(oConvertUtils.isNotEmpty(s)){ | |
| 74 | +// familyMapper.insert(s); | |
| 75 | +// } | |
| 76 | +// }); | |
| 77 | + if(list.size()>0){ | |
| 78 | + familyMapper.insertBatch(list); | |
| 79 | + } | |
| 80 | + dataSourceTransactionManager.commit(transactionStatus); | |
| 81 | 81 | threadLatch.countDown(); |
| 82 | 82 | } catch (Throwable e) { |
| 83 | 83 | e.printStackTrace(); |
| 84 | -// dataSourceTransactionManager.rollback(transactionStatus); | |
| 84 | + dataSourceTransactionManager.rollback(transactionStatus); | |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | public void updateStudentWithThreads(List<Family> list) { |
| 90 | 90 | // 线程数量 |
| 91 | - final Integer threadCount = 8; | |
| 91 | + final Integer threadCount = 10; | |
| 92 | 92 | |
| 93 | 93 | //每个线程处理的数据量 |
| 94 | 94 | final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; |
| 95 | - // 创建多线程处理任务 | |
| 95 | +// // 创建多线程处理任务 | |
| 96 | 96 | ExecutorService studentThreadPool = Executors.newFixedThreadPool(threadCount); |
| 97 | 97 | CountDownLatch threadLatchs = new CountDownLatch(threadCount); |
| 98 | 98 | |
| 99 | 99 | for (int i = 0; i < threadCount; i++) { |
| 100 | 100 | // 每个线程处理的数据 |
| 101 | - List<Family> threadDatas = list.stream() | |
| 101 | + List<Family> threadDatas = list.stream() | |
| 102 | 102 | .skip(i * dataPartionLength).limit(dataPartionLength).collect(Collectors.toList()); |
| 103 | +// addBatch(threadDatas); | |
| 103 | 104 | studentThreadPool.execute(() -> { |
| 104 | 105 | addBatch(threadDatas, threadLatchs); |
| 105 | 106 | }); | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java
| 1 | 1 | package org.jeecg.modules.system.service.impl; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 3 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | 6 | import javassist.bytecode.analysis.Executor; |
| 5 | 7 | import org.jeecg.common.util.oConvertUtils; |
| ... | ... | @@ -9,6 +11,7 @@ import org.jeecg.modules.system.entity.SysDepart; |
| 9 | 11 | import org.jeecg.modules.system.mapper.FamilyMapper; |
| 10 | 12 | import org.jeecg.modules.system.mapper.MinorMapper; |
| 11 | 13 | import org.jeecg.modules.system.service.IMinorService; |
| 14 | +import org.jeecg.modules.system.vo.MinorVo; | |
| 12 | 15 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 13 | 16 | import org.springframework.stereotype.Service; |
| 14 | 17 | import org.springframework.transaction.TransactionDefinition; |
| ... | ... | @@ -131,29 +134,39 @@ public class MinorServiceImpl extends ServiceImpl<MinorMapper, Minor> implements |
| 131 | 134 | return list.size(); |
| 132 | 135 | } |
| 133 | 136 | |
| 137 | + @Override | |
| 138 | + public IPage<Minor> queryPageList(Page<Minor> page,String name) { | |
| 139 | + return minorMapper.queryPageList(page,name); | |
| 140 | + } | |
| 141 | + | |
| 134 | 142 | |
| 135 | 143 | private void addBatch(List<Minor> list, CountDownLatch threadLatch){ |
| 136 | -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 144 | + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 137 | 145 | System.out.println("子线程:" + Thread.currentThread().getName()); |
| 138 | 146 | try { |
| 139 | 147 | list.forEach(s -> { |
| 140 | 148 | if(oConvertUtils.isNotEmpty(s)){ |
| 141 | 149 | minorMapper.insert(s); |
| 150 | + if(oConvertUtils.isNotEmpty(s.getFamilies())){ | |
| 151 | + if(s.getFamilies().size()>0){ | |
| 152 | + familyMapper.insertBatch(s.getFamilies()); | |
| 153 | + } | |
| 154 | + } | |
| 142 | 155 | } |
| 143 | 156 | }); |
| 144 | 157 | // minorMapper.insertBatch(list); |
| 145 | -// dataSourceTransactionManager.commit(transactionStatus); | |
| 158 | + dataSourceTransactionManager.commit(transactionStatus); | |
| 146 | 159 | threadLatch.countDown(); |
| 147 | 160 | } catch (Throwable e) { |
| 148 | 161 | e.printStackTrace(); |
| 149 | -// dataSourceTransactionManager.rollback(transactionStatus); | |
| 162 | + dataSourceTransactionManager.rollback(transactionStatus); | |
| 150 | 163 | } |
| 151 | 164 | } |
| 152 | 165 | |
| 153 | 166 | |
| 154 | 167 | public void updateStudentWithThreads(List<Minor> list) { |
| 155 | 168 | // 线程数量 |
| 156 | - final Integer threadCount = 8; | |
| 169 | + final Integer threadCount = 5; | |
| 157 | 170 | |
| 158 | 171 | //每个线程处理的数据量 |
| 159 | 172 | final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java
| ... | ... | @@ -57,12 +57,9 @@ public class MrSchoolServiceImpl extends ServiceImpl<MrSchoolMapper, MrSchool> i |
| 57 | 57 | return list.size(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | -// public static void main(String[] args){ | |
| 61 | -// System.out.println(System.currentTimeMillis()+"00000000"+1); | |
| 62 | -// } | |
| 63 | 60 | |
| 64 | 61 | private void addBatch(List<MrSchool> list, CountDownLatch threadLatch){ |
| 65 | -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 62 | + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); | |
| 66 | 63 | System.out.println("子线程:" + Thread.currentThread().getName()); |
| 67 | 64 | try { |
| 68 | 65 | list.forEach(s -> { |
| ... | ... | @@ -71,18 +68,18 @@ public class MrSchoolServiceImpl extends ServiceImpl<MrSchoolMapper, MrSchool> i |
| 71 | 68 | schoolMapper.insert(s); |
| 72 | 69 | } |
| 73 | 70 | }); |
| 74 | -// dataSourceTransactionManager.commit(transactionStatus); | |
| 71 | + dataSourceTransactionManager.commit(transactionStatus); | |
| 75 | 72 | threadLatch.countDown(); |
| 76 | 73 | } catch (Throwable e) { |
| 77 | 74 | e.printStackTrace(); |
| 78 | -// dataSourceTransactionManager.rollback(transactionStatus); | |
| 75 | + dataSourceTransactionManager.rollback(transactionStatus); | |
| 79 | 76 | } |
| 80 | 77 | } |
| 81 | 78 | |
| 82 | 79 | |
| 83 | 80 | public void updateStudentWithThreads(List<MrSchool> list) { |
| 84 | 81 | // 线程数量 |
| 85 | - final Integer threadCount = 8; | |
| 82 | + final Integer threadCount = 5; | |
| 86 | 83 | |
| 87 | 84 | //每个线程处理的数据量 |
| 88 | 85 | final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/getRandomId.java
0 → 100644
| 1 | +package org.jeecg.modules.system.util; | |
| 2 | + | |
| 3 | +import org.jeecg.common.util.oConvertUtils; | |
| 4 | +import org.jeecg.modules.system.entity.Family; | |
| 5 | +import org.jeecg.modules.system.entity.Minor; | |
| 6 | + | |
| 7 | +import java.util.*; | |
| 8 | + | |
| 9 | +public class getRandomId { | |
| 10 | + | |
| 11 | + // ==============================Fields=========================================== | |
| 12 | + /** | |
| 13 | + * 开始时间截 (2018-07-03) | |
| 14 | + */ | |
| 15 | + | |
| 16 | + private final long twepoch = 1530607760000L; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 机器id所占的位数 | |
| 20 | + */ | |
| 21 | + private final long workerIdBits = 5L; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 数据标识id所占的位数 | |
| 25 | + */ | |
| 26 | + private final long datacenterIdBits = 5L; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) | |
| 30 | + */ | |
| 31 | + private final long maxWorkerId = -1L ^ (-1L << workerIdBits); | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 支持的最大数据标识id,结果是31 | |
| 35 | + */ | |
| 36 | + private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 序列在id中占的位数 | |
| 40 | + */ | |
| 41 | + private final long sequenceBits = 12L; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 机器ID向左移12位 | |
| 45 | + */ | |
| 46 | + private final long workerIdShift = sequenceBits; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 数据标识id向左移17位(12+5) | |
| 50 | + */ | |
| 51 | + private final long datacenterIdShift = sequenceBits + workerIdBits; | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * 时间截向左移22位(5+5+12) | |
| 55 | + */ | |
| 56 | + private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) | |
| 60 | + */ | |
| 61 | + private final long sequenceMask = -1L ^ (-1L << sequenceBits); | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 工作机器ID(0~31) | |
| 65 | + */ | |
| 66 | + private long workerId; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 数据中心ID(0~31) | |
| 70 | + */ | |
| 71 | + private long datacenterId; | |
| 72 | + | |
| 73 | + /** | |
| 74 | + * 毫秒内序列(0~4095) | |
| 75 | + */ | |
| 76 | + private long sequence = 0L; | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 上次生成ID的时间截 | |
| 80 | + */ | |
| 81 | + private long lastTimestamp = -1L; | |
| 82 | + | |
| 83 | + //==============================Constructors===================================== | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 构造函数 | |
| 87 | + * | |
| 88 | + * @param workerId 工作ID (0~31) | |
| 89 | + * @param datacenterId 数据中心ID (0~31) | |
| 90 | + */ | |
| 91 | + public getRandomId(long workerId, long datacenterId) { | |
| 92 | + if (workerId > maxWorkerId || workerId < 0) { | |
| 93 | + throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); | |
| 94 | + } | |
| 95 | + if (datacenterId > maxDatacenterId || datacenterId < 0) { | |
| 96 | + throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); | |
| 97 | + } | |
| 98 | + this.workerId = workerId; | |
| 99 | + this.datacenterId = datacenterId; | |
| 100 | + } | |
| 101 | + | |
| 102 | + // ==============================Methods========================================== | |
| 103 | + | |
| 104 | + /** | |
| 105 | + * 获得下一个ID (该方法是线程安全的) | |
| 106 | + * | |
| 107 | + * @return SnowflakeId | |
| 108 | + */ | |
| 109 | + public synchronized long nextId() { | |
| 110 | + long timestamp = timeGen(); | |
| 111 | + | |
| 112 | + //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 | |
| 113 | + if (timestamp < lastTimestamp) { | |
| 114 | + throw new RuntimeException( | |
| 115 | + String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); | |
| 116 | + } | |
| 117 | + | |
| 118 | + //如果是同一时间生成的,则进行毫秒内序列 | |
| 119 | + if (lastTimestamp == timestamp) { | |
| 120 | + sequence = (sequence + 1) & sequenceMask; | |
| 121 | + //毫秒内序列溢出 | |
| 122 | + if (sequence == 0) { | |
| 123 | + //阻塞到下一个毫秒,获得新的时间戳 | |
| 124 | + timestamp = tilNextMillis(lastTimestamp); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + //时间戳改变,毫秒内序列重置 | |
| 128 | + else { | |
| 129 | + sequence = 0L; | |
| 130 | + } | |
| 131 | + | |
| 132 | + //上次生成ID的时间截 | |
| 133 | + lastTimestamp = timestamp; | |
| 134 | + | |
| 135 | + //移位并通过或运算拼到一起组成64位的ID | |
| 136 | + return (((timestamp - twepoch) << timestampLeftShift) | |
| 137 | + | (datacenterId << datacenterIdShift) | |
| 138 | + | (workerId << workerIdShift) | |
| 139 | + | sequence); | |
| 140 | + } | |
| 141 | + | |
| 142 | + /** | |
| 143 | + * 阻塞到下一个毫秒,直到获得新的时间戳 | |
| 144 | + * | |
| 145 | + * @param lastTimestamp 上次生成ID的时间截 | |
| 146 | + * @return 当前时间戳 | |
| 147 | + */ | |
| 148 | + protected long tilNextMillis(long lastTimestamp) { | |
| 149 | + long timestamp = timeGen(); | |
| 150 | + while (timestamp <= lastTimestamp) { | |
| 151 | + timestamp = timeGen(); | |
| 152 | + } | |
| 153 | + return timestamp; | |
| 154 | + } | |
| 155 | + | |
| 156 | + /** | |
| 157 | + * 返回以毫秒为单位的当前时间 | |
| 158 | + * | |
| 159 | + * @return 当前时间(毫秒) | |
| 160 | + */ | |
| 161 | + protected long timeGen() { | |
| 162 | + return System.currentTimeMillis(); | |
| 163 | + } | |
| 164 | + | |
| 165 | + //==============================Test============================================= | |
| 166 | + | |
| 167 | + /** | |
| 168 | + * 测试 | |
| 169 | + */ | |
| 170 | + public static void main(String[] args) { | |
| 171 | + long startTime = System.currentTimeMillis(); | |
| 172 | + Set<Family> familys = new HashSet<>(); | |
| 173 | + //存放已经被放入minor里面的户号,避免数据重复 | |
| 174 | + Set<String> houseSet=new HashSet<>(); | |
| 175 | + Map<String, Minor> minors=getMinors(); | |
| 176 | + Map<String, List<Family>> familyMaps=getFamilyMaps(); | |
| 177 | + if (oConvertUtils.isNotEmpty(minors)) { | |
| 178 | + for (Map.Entry<String, Minor> m : minors.entrySet()) { | |
| 179 | + String idCard = m.getKey(); | |
| 180 | + Minor minor = m.getValue(); | |
| 181 | + Set<Family> f=new HashSet<>(); | |
| 182 | + //判断是否是一个家庭的人员 | |
| 183 | + if (oConvertUtils.isNotEmpty(minor.getHouseholdNum())) { | |
| 184 | + String houseNum = minor.getHouseholdNum(); | |
| 185 | + if(oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum)) ){ | |
| 186 | + if(!houseSet.contains(houseNum) ){ | |
| 187 | + familys.addAll(familyMaps.get(houseNum)); | |
| 188 | + houseSet.add(houseNum); | |
| 189 | + } | |
| 190 | + } | |
| 191 | + minor.setFamilies(f); | |
| 192 | + } | |
| 193 | + } | |
| 194 | + } | |
| 195 | + long endTime = System.currentTimeMillis(); | |
| 196 | + | |
| 197 | + System.out.println("endTime-startTime:" + (endTime - startTime)); | |
| 198 | + } | |
| 199 | + public static Map<String, List<Family>> getFamilyMaps(){ | |
| 200 | + Map<String, List<Family>> familyMaps=new HashMap<>(); | |
| 201 | + List<Family> familys=getFamilys(); | |
| 202 | + for(int i=0;i<familys.size();i++){ | |
| 203 | + Family family=familys.get(i); | |
| 204 | + if(oConvertUtils.isNotEmpty(family.getHouseholdNum())){ | |
| 205 | + if(oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(family.getHouseholdNum()))){ | |
| 206 | + familyMaps.get(family.getHouseholdNum()).add(family); | |
| 207 | + }else { | |
| 208 | + List<Family> list = new ArrayList<>(); | |
| 209 | + list.add(family); | |
| 210 | + familyMaps.put(family.getHouseholdNum(),list); | |
| 211 | + } | |
| 212 | + | |
| 213 | + } | |
| 214 | + } | |
| 215 | + return familyMaps; | |
| 216 | + | |
| 217 | + } | |
| 218 | + | |
| 219 | + public static List<Family> getFamilys(){ | |
| 220 | + List<Family> familys=new ArrayList<>(); | |
| 221 | + for(int i=0;i<25;i++){ | |
| 222 | + Family f=new Family(); | |
| 223 | + if(i<5){ | |
| 224 | + f.setIdentity("#####################"+i); | |
| 225 | + f.setHouseholdNum("**************house"+0); | |
| 226 | + }else if(i<10){ | |
| 227 | + f.setIdentity("#####################"+i); | |
| 228 | + f.setHouseholdNum("**************house"+1); | |
| 229 | + }else if(i<15){ | |
| 230 | + f.setIdentity("#####################"+i); | |
| 231 | + f.setHouseholdNum("**************house"+2); | |
| 232 | + }else if(i<20){ | |
| 233 | + f.setIdentity("#####################"+i); | |
| 234 | + f.setHouseholdNum("**************house"+3); | |
| 235 | + }else if(i<25){ | |
| 236 | + f.setIdentity("#####################"+i); | |
| 237 | + f.setHouseholdNum("**************house"+4); | |
| 238 | + } | |
| 239 | + familys.add(f); | |
| 240 | + } | |
| 241 | + return familys; | |
| 242 | + | |
| 243 | + } | |
| 244 | + | |
| 245 | + public static Map<String, Minor> getMinors(){ | |
| 246 | + Map<String, Minor> minors=new HashMap<>(); | |
| 247 | + for(int i=0;i<10;i++){ | |
| 248 | + if(i<5){ | |
| 249 | + Minor m=new Minor(); | |
| 250 | + m.setIdentity("**************id"+i); | |
| 251 | + m.setHouseholdNum("**************house"+i); | |
| 252 | + minors.put("**************id"+i,m); | |
| 253 | + }else if(i<10){ | |
| 254 | + Minor m=new Minor(); | |
| 255 | + m.setIdentity("**************id"+i); | |
| 256 | + m.setHouseholdNum("**************house"+(i-5)); | |
| 257 | + minors.put("**************id"+i,m); | |
| 258 | + } | |
| 259 | + } | |
| 260 | + return minors; | |
| 261 | + | |
| 262 | + } | |
| 263 | + | |
| 264 | +} | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java
| ... | ... | @@ -67,6 +67,18 @@ public class MinorPage { |
| 67 | 67 | @Excel(name = "身份证号", width = 20,needMerge=true) |
| 68 | 68 | @ApiModelProperty(value = "身份证号") |
| 69 | 69 | private String identity; |
| 70 | + /**是否失学*/ | |
| 71 | + @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) | |
| 72 | + @ApiModelProperty(value = "是否失学") | |
| 73 | + @Dict(dicCode = "school_status") | |
| 74 | + private Integer school; | |
| 75 | + /**学校名称*/ | |
| 76 | + @Excel(name = "学校名称", width = 15,needMerge=true) | |
| 77 | + @ApiModelProperty(value = "学校名称") | |
| 78 | + private String schoolName; | |
| 79 | + @Excel(name = "入学年份", width = 15) | |
| 80 | + @ApiModelProperty(value = "入学年份") | |
| 81 | + private String startYear; | |
| 70 | 82 | /**家庭住址*/ |
| 71 | 83 | @Excel(name = "家庭住址", width = 20,needMerge=true) |
| 72 | 84 | @ApiModelProperty(value = "家庭住址") |
| ... | ... | @@ -84,18 +96,6 @@ public class MinorPage { |
| 84 | 96 | @Excel(name = "监护人关系", width = 15,needMerge=true) |
| 85 | 97 | @ApiModelProperty(value = "监护人关系") |
| 86 | 98 | private String relation; |
| 87 | - /**是否失学*/ | |
| 88 | - @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) | |
| 89 | - @ApiModelProperty(value = "是否失学") | |
| 90 | - @Dict(dicCode = "school_status") | |
| 91 | - private Integer school; | |
| 92 | - /**学校名称*/ | |
| 93 | - @Excel(name = "学校名称", width = 15,needMerge=true) | |
| 94 | - @ApiModelProperty(value = "学校名称") | |
| 95 | - private String schoolName; | |
| 96 | - @Excel(name = "入学年份", width = 15) | |
| 97 | - @ApiModelProperty(value = "入学年份") | |
| 98 | - private String startYear; | |
| 99 | 99 | /**重点关注原因*/ |
| 100 | 100 | @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") |
| 101 | 101 | @ApiModelProperty(value = "重点关注原因") | ... | ... |
juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorVo.java
0 → 100644
| 1 | +package org.jeecg.modules.system.vo; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import io.swagger.annotations.ApiModel; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | +import org.jeecg.common.aspect.annotation.Dict; | |
| 8 | +import org.jeecg.modules.system.entity.Family; | |
| 9 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
| 10 | +import org.jeecgframework.poi.excel.annotation.ExcelCollection; | |
| 11 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 12 | + | |
| 13 | +import java.util.Date; | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * @Description: 未成年人 | |
| 18 | + * @Author: jeecg-boot | |
| 19 | + * @Date: 2022-07-13 | |
| 20 | + * @Version: V1.0 | |
| 21 | + */ | |
| 22 | +@Data | |
| 23 | +@ApiModel(value="mr_minorPage对象", description="未成年人") | |
| 24 | +public class MinorVo { | |
| 25 | + | |
| 26 | + /**主键*/ | |
| 27 | + @ApiModelProperty(value = "主键") | |
| 28 | + private String id; | |
| 29 | + /**创建日期*/ | |
| 30 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | |
| 31 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | |
| 32 | + @ApiModelProperty(value = "创建日期") | |
| 33 | + private Date createTime; | |
| 34 | + /**所属部门*/ | |
| 35 | + @ApiModelProperty(value = "所属部门") | |
| 36 | + @Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") | |
| 37 | + private String sysOrgCode; | |
| 38 | + /**户号*/ | |
| 39 | + @Excel(name = "户号", width = 25,needMerge=true) | |
| 40 | + @ApiModelProperty(value = "户号") | |
| 41 | + private String householdNum; | |
| 42 | + /**人员编号*/ | |
| 43 | + @Excel(name = "人员编号", width = 25,needMerge=true) | |
| 44 | + @ApiModelProperty(value = "人员编号") | |
| 45 | + private String number; | |
| 46 | + /**姓名*/ | |
| 47 | + @Excel(name = "姓名", width = 15,needMerge=true) | |
| 48 | + @ApiModelProperty(value = "姓名") | |
| 49 | + private String name; | |
| 50 | + /**性别*/ | |
| 51 | + @Excel(name = "性别", width = 15,dicCode = "sex",needMerge=true) | |
| 52 | + @ApiModelProperty(value = "性别") | |
| 53 | + @Dict(dicCode = "sex") | |
| 54 | + private Integer gender; | |
| 55 | + /**身份证号*/ | |
| 56 | + @Excel(name = "身份证号", width = 20,needMerge=true) | |
| 57 | + @ApiModelProperty(value = "身份证号") | |
| 58 | + private String identity; | |
| 59 | + /**是否失学*/ | |
| 60 | + @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) | |
| 61 | + @ApiModelProperty(value = "是否失学") | |
| 62 | + @Dict(dicCode = "school_status") | |
| 63 | + private Integer school; | |
| 64 | + /**学校名称*/ | |
| 65 | + @Excel(name = "学校名称", width = 15,needMerge=true) | |
| 66 | + @ApiModelProperty(value = "学校名称") | |
| 67 | + private String schoolName; | |
| 68 | + @Excel(name = "入学年份", width = 15) | |
| 69 | + @ApiModelProperty(value = "入学年份") | |
| 70 | + private String startYear; | |
| 71 | + /**家庭住址*/ | |
| 72 | + @Excel(name = "家庭住址", width = 20,needMerge=true) | |
| 73 | + @ApiModelProperty(value = "家庭住址") | |
| 74 | + private String address; | |
| 75 | + /** | |
| 76 | + * 监护人 | |
| 77 | + */ | |
| 78 | + @Excel(name = "监护人", width = 15,needMerge=true) | |
| 79 | + @ApiModelProperty(value = "监护人") | |
| 80 | + private String guardian; | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 监护人关系 | |
| 84 | + */ | |
| 85 | + @Excel(name = "监护人关系", width = 15,needMerge=true) | |
| 86 | + @ApiModelProperty(value = "监护人关系") | |
| 87 | + private String relation; | |
| 88 | + /**重点关注原因*/ | |
| 89 | + @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") | |
| 90 | + @ApiModelProperty(value = "重点关注原因") | |
| 91 | + @Dict(dicCode = "attention_reason") | |
| 92 | + private Integer reason; | |
| 93 | + /**特殊原因*/ | |
| 94 | + @Excel(name = "特殊原因", width = 15) | |
| 95 | + @ApiModelProperty(value = "特殊原因") | |
| 96 | + private String specialReason; | |
| 97 | + /**备注*/ | |
| 98 | + @Excel(name = "备注", width = 25,needMerge=true) | |
| 99 | + @ApiModelProperty(value = "备注") | |
| 100 | + private String remark; | |
| 101 | + | |
| 102 | + private String age; | |
| 103 | + | |
| 104 | +} | ... | ... |
juvenile-prosecution-vue/src/utils/util.js
| ... | ... | @@ -568,7 +568,7 @@ export function removeArrayElement(array, prod, value) { |
| 568 | 568 | * @constructor |
| 569 | 569 | */ |
| 570 | 570 | export function GetAge(identityCard) { |
| 571 | - console.log(identityCard) | |
| 571 | + // console.log(identityCard) | |
| 572 | 572 | var len = (identityCard + "").length; |
| 573 | 573 | if (len == 0) { |
| 574 | 574 | return 0; |
| ... | ... | @@ -590,8 +590,8 @@ export function GetAge(identityCard) { |
| 590 | 590 | var birthDate = new Date(strBirthday); |
| 591 | 591 | var nowDateTime = new Date(); |
| 592 | 592 | var age = nowDateTime.getFullYear() - birthDate.getFullYear(); |
| 593 | - console.log(nowDateTime.getFullYear()) | |
| 594 | - console.log(birthDate.getFullYear()) | |
| 593 | + // console.log(nowDateTime.getFullYear()) | |
| 594 | + // console.log(birthDate.getFullYear()) | |
| 595 | 595 | //再考虑月、天的因素;.getMonth()获取的是从0开始的,这里进行比较,不需要加1 |
| 596 | 596 | if (nowDateTime.getMonth() < birthDate.getMonth() || (nowDateTime.getMonth() == birthDate.getMonth() && nowDateTime.getDate() < birthDate.getDate())) { |
| 597 | 597 | age--; | ... | ... |
juvenile-prosecution-vue/src/views/business/MinorList.vue
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | ref="table" |
| 50 | 50 | size="middle" |
| 51 | 51 | bordered |
| 52 | - rowKey="id" | |
| 52 | + rowKey="identity" | |
| 53 | 53 | class="j-table-force-nowrap" |
| 54 | 54 | :scroll="{x:true}" |
| 55 | 55 | :columns="columns" |
| ... | ... | @@ -71,8 +71,10 @@ |
| 71 | 71 | |
| 72 | 72 | <minor-modal ref="modalForm" @ok="modalFormOk" /> |
| 73 | 73 | <!-- 详情 --> |
| 74 | - <a-modal v-model:visible="infoVisible" title="未成年信息" :footer=null :width="1000"> | |
| 74 | + <a-modal v-model:visible="infoVisible" title="未成年信息" :footer=null :width="1000" > | |
| 75 | 75 | <a-descriptions bordered layout="vertical" :column="4"> |
| 76 | + <a-descriptions-item label="户号">{{ info.householdNum }}</a-descriptions-item> | |
| 77 | + <a-descriptions-item label="人员编号">{{ info.number }}</a-descriptions-item> | |
| 76 | 78 | <a-descriptions-item label="姓名">{{ info.name }}</a-descriptions-item> |
| 77 | 79 | <a-descriptions-item label="性别">{{ info.gender_dictText }}</a-descriptions-item> |
| 78 | 80 | <a-descriptions-item label="年龄">{{ getAgeByIdentity(info.identity) }}</a-descriptions-item> |
| ... | ... | @@ -85,13 +87,16 @@ |
| 85 | 87 | <a-descriptions-item label="学校名称">{{ info.schoolName }}</a-descriptions-item> |
| 86 | 88 | <a-descriptions-item label="监护人">{{ info.guardian }}</a-descriptions-item> |
| 87 | 89 | <a-descriptions-item label="监护人关系">{{ info.relation }}</a-descriptions-item> |
| 88 | - <a-descriptions-item label="重点关注原因">{{ info.reason_dictText }}</a-descriptions-item> | |
| 89 | - <a-descriptions-item label="特殊原因">{{ info.specialReason }}</a-descriptions-item> | |
| 90 | + <a-descriptions-item label="重点关注原因" :span="2">{{ info.reason_dictText }}</a-descriptions-item> | |
| 91 | + <a-descriptions-item label="特殊原因" :span="4">{{ info.specialReason }}</a-descriptions-item> | |
| 90 | 92 | <a-descriptions-item label="备注" :span="4">{{ info.remark }}</a-descriptions-item> |
| 91 | 93 | </a-descriptions> |
| 92 | 94 | <a-tabs v-model:activeKey="activeKey"> |
| 93 | 95 | <a-tab-pane key="1" tab="家庭成员"> |
| 94 | - <a-table bordered :columns="familyColumns" :data-source="familyDatas" :scroll="{ x: true }" rowKey="id" :pagination="familyPagination"> | |
| 96 | + <a-table bordered :columns="familyColumns" :data-source="familyDatas" :scroll="{ x: true }" rowKey="id" :loading="familyLoading" :pagination="familyPagination"> | |
| 97 | + <span slot="num" slot-scope="text,record"> | |
| 98 | + <j-ellipsis :value="text" :length="8" /> | |
| 99 | + </span> | |
| 95 | 100 | <span slot="longText" slot-scope="text,record"> |
| 96 | 101 | <j-ellipsis :value="text" :length="18" /> |
| 97 | 102 | </span> |
| ... | ... | @@ -108,7 +113,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| 108 | 113 | import { GetAge } from '@/utils/util' |
| 109 | 114 | import MinorModal from './modules/MinorModal' |
| 110 | 115 | import '@/assets/less/TableExpand.less' |
| 111 | -import { getAction } from '@api/manage' | |
| 116 | +import { getAction,downFile } from '@api/manage' | |
| 112 | 117 | import { FormTypes } from '@/utils/JEditableTableUtil' |
| 113 | 118 | //引入JS方法 |
| 114 | 119 | import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil' |
| ... | ... | @@ -131,6 +136,7 @@ export default { |
| 131 | 136 | title: '序号', |
| 132 | 137 | dataIndex: '', |
| 133 | 138 | key: 'rowIndex', |
| 139 | + fixed: 'left', | |
| 134 | 140 | width: 60, |
| 135 | 141 | align: 'center', |
| 136 | 142 | customRender: function(t, r, index) { |
| ... | ... | @@ -140,6 +146,8 @@ export default { |
| 140 | 146 | { |
| 141 | 147 | title: '姓名', |
| 142 | 148 | align: 'center', |
| 149 | + fixed: 'left', | |
| 150 | + width: 80, | |
| 143 | 151 | dataIndex: 'name' |
| 144 | 152 | }, |
| 145 | 153 | { |
| ... | ... | @@ -219,16 +227,6 @@ export default { |
| 219 | 227 | // 表头 |
| 220 | 228 | familyColumns: [ |
| 221 | 229 | { |
| 222 | - title: '户号', | |
| 223 | - align: 'center', | |
| 224 | - dataIndex: 'householdNum' | |
| 225 | - }, | |
| 226 | - { | |
| 227 | - title: '人员编号', | |
| 228 | - align: 'center', | |
| 229 | - dataIndex: 'number' | |
| 230 | - }, | |
| 231 | - { | |
| 232 | 230 | title: '姓名', |
| 233 | 231 | align: 'center', |
| 234 | 232 | dataIndex: 'name' |
| ... | ... | @@ -280,15 +278,15 @@ export default { |
| 280 | 278 | /* 分页参数 */ |
| 281 | 279 | familyPagination: { |
| 282 | 280 | current: 1, |
| 283 | - pageSize: 3, | |
| 281 | + pageSize: 20, | |
| 284 | 282 | hideOnSinglePage: true, |
| 285 | 283 | showTotal: (total, range) => { |
| 286 | 284 | return range[0] + '-' + range[1] + ' 共' + total + '条' |
| 287 | 285 | }, |
| 288 | 286 | showQuickJumper: true, |
| 289 | - showSizeChanger: true, | |
| 290 | 287 | total: 0 |
| 291 | - } | |
| 288 | + }, | |
| 289 | + familyLoading:false, | |
| 292 | 290 | } |
| 293 | 291 | }, |
| 294 | 292 | created() { |
| ... | ... | @@ -304,16 +302,54 @@ export default { |
| 304 | 302 | return GetAge(identity) |
| 305 | 303 | }, |
| 306 | 304 | handleDetail(record) { |
| 307 | - var that = this | |
| 308 | - let params = { id: record.id } | |
| 309 | - getAction(this.url.familys, params).then(res => { | |
| 310 | - that.info = record | |
| 311 | - that.infoVisible = true | |
| 312 | - that.familyDatas = res.result || [] | |
| 313 | - }).finally(() => { | |
| 314 | - that.infoVisible = true | |
| 305 | + var that = this; | |
| 306 | + that.info = record; | |
| 307 | + that.infoVisible = true; | |
| 308 | + that.familyDatas=[]; | |
| 309 | + if(null!==record.householdNum && ''!==record.householdNum && undefined!==record.householdNum){ | |
| 310 | + let params = { householdNum: record.householdNum } | |
| 311 | + that.familyLoading=true; | |
| 312 | + getAction(this.url.familys, params).then(res => { | |
| 313 | + if (res.success) { | |
| 314 | + that.familyLoading=false; | |
| 315 | + that.familyDatas = res.result || [] | |
| 316 | + } else { | |
| 317 | + that.familyLoading=false; | |
| 318 | + } | |
| 319 | + }) | |
| 320 | + } | |
| 321 | + }, | |
| 322 | + handleImportModel: function(name, type) { | |
| 323 | + if (!name || typeof name != 'string') { | |
| 324 | + name = '导出文件' | |
| 325 | + } | |
| 326 | + let param = { 'fileName': name, 'type': type } | |
| 327 | + console.log('导出参数', param) | |
| 328 | + downFile(this.url.importExcelUrl, param).then((data) => { | |
| 329 | + console.log(data) | |
| 330 | + if (!data) { | |
| 331 | + this.$message.warning('文件下载失败') | |
| 332 | + return | |
| 333 | + } | |
| 334 | + console.log(window.navigator.msSaveBlob) | |
| 335 | + if (typeof window.navigator.msSaveBlob !== 'undefined') { | |
| 336 | + window.navigator.msSaveBlob(new Blob([data]), name + '.xlsx') | |
| 337 | + } else { | |
| 338 | + let url = window.URL.createObjectURL(new Blob([data])) | |
| 339 | + console.log(url) | |
| 340 | + let link = document.createElement('a') | |
| 341 | + console.log(link) | |
| 342 | + link.style.display = 'none' | |
| 343 | + link.href = url | |
| 344 | + link.setAttribute('download', name + '.xlsx') | |
| 345 | + console.log(link) | |
| 346 | + document.body.appendChild(link) | |
| 347 | + link.click() | |
| 348 | + console.log(link) | |
| 349 | + document.body.removeChild(link) //下载完成移除元素 | |
| 350 | + window.URL.revokeObjectURL(url) //释放掉blob对象 | |
| 351 | + } | |
| 315 | 352 | }) |
| 316 | - | |
| 317 | 353 | }, |
| 318 | 354 | initDictConfig() { |
| 319 | 355 | }, |
| ... | ... | @@ -332,11 +368,11 @@ export default { |
| 332 | 368 | </script> |
| 333 | 369 | <style scoped> |
| 334 | 370 | @import '~@assets/less/common.less'; |
| 335 | -.ant-modal-body { | |
| 336 | - overflow-y: auto !important; | |
| 337 | - height: 750px !important; | |
| 338 | -} | |
| 339 | 371 | </style> |
| 340 | -<style> | |
| 341 | 372 | |
| 342 | -</style> | |
| 343 | 373 | \ No newline at end of file |
| 374 | +<style> | |
| 375 | +.ant-modal-body{ | |
| 376 | + max-height: 700px; | |
| 377 | + overflow-y: auto; | |
| 378 | +} | |
| 379 | +</style> | ... | ... |
juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue
| ... | ... | @@ -15,6 +15,18 @@ |
| 15 | 15 | <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
| 16 | 16 | <a-row> |
| 17 | 17 | <a-col :span="12"> |
| 18 | + <a-form-model-item label="户号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="householdNum"> | |
| 19 | + <a-input v-model="model.householdNum" placeholder="请输入户号"></a-input> | |
| 20 | + </a-form-model-item> | |
| 21 | + </a-col> | |
| 22 | + <a-col :span="12"> | |
| 23 | + <a-form-model-item label="人员编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number"> | |
| 24 | + <a-input v-model="model.number" placeholder="请输入人员编号"></a-input> | |
| 25 | + </a-form-model-item> | |
| 26 | + </a-col> | |
| 27 | + </a-row> | |
| 28 | + <a-row> | |
| 29 | + <a-col :span="12"> | |
| 18 | 30 | <a-form-model-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> |
| 19 | 31 | <a-input v-model="model.name" placeholder="请输入姓名"></a-input> |
| 20 | 32 | </a-form-model-item> |
| ... | ... | @@ -25,6 +37,11 @@ |
| 25 | 37 | </a-form-model-item> |
| 26 | 38 | </a-col> |
| 27 | 39 | </a-row> |
| 40 | + <a-col :span="12"> | |
| 41 | + <a-form-model-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="identity"> | |
| 42 | + <a-input v-model="model.identity" placeholder="请输入身份证号"></a-input> | |
| 43 | + </a-form-model-item> | |
| 44 | + </a-col> | |
| 28 | 45 | <a-row> |
| 29 | 46 | <a-col :span="12"> |
| 30 | 47 | <a-form-model-item label="学校名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="schoolName"> |
| ... | ... | @@ -44,11 +61,6 @@ |
| 44 | 61 | </a-form-model-item> |
| 45 | 62 | </a-col> |
| 46 | 63 | <a-col :span="12"> |
| 47 | - <a-form-model-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="identity"> | |
| 48 | - <a-input v-model="model.identity" placeholder="请输入身份证号"></a-input> | |
| 49 | - </a-form-model-item> | |
| 50 | - </a-col> | |
| 51 | - <a-col :span="12"> | |
| 52 | 64 | <a-form-model-item label="家庭住址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address"> |
| 53 | 65 | <a-textarea v-model="model.address" placeholder="请输入家庭住址" :rows="1" ></a-textarea> |
| 54 | 66 | </a-form-model-item> |
| ... | ... | @@ -69,7 +81,7 @@ |
| 69 | 81 | <a-row> |
| 70 | 82 | <a-col :span="12"> |
| 71 | 83 | <a-form-model-item label="重点关注原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reason"> |
| 72 | - <a-textarea v-model="model.reason" placeholder="请输入重点关注原因"></a-textarea> | |
| 84 | + <j-dict-select-tag v-model="model.reason" dictCode="attention_reason" placeholder="请选择重点关注原因" /> | |
| 73 | 85 | </a-form-model-item> |
| 74 | 86 | </a-col> |
| 75 | 87 | <a-col :span="12"> |
| ... | ... | @@ -143,7 +155,6 @@ export default { |
| 143 | 155 | }, |
| 144 | 156 | validatorRules: { |
| 145 | 157 | householdNum:[ { required: true, message: '请输入户号' },], |
| 146 | - number:[ { required: true, message: '请输入人员编号' },], | |
| 147 | 158 | name:[ { required: true, message: '请输入姓名' },], |
| 148 | 159 | gender:[ { required: true, message: '请选择性别' },], |
| 149 | 160 | identity:[ {required: true,validator:this.validateIdCard}], |
| ... | ... | @@ -305,8 +316,8 @@ export default { |
| 305 | 316 | this.model = Object.assign({}, record) |
| 306 | 317 | this.visible = true |
| 307 | 318 | // 加载子表数据 |
| 308 | - if (this.model.id) { | |
| 309 | - let params = { id: this.model.id } | |
| 319 | + if (this.model.householdNum) { | |
| 320 | + let params = { householdNum: this.model.householdNum } | |
| 310 | 321 | this.requestTableData(this.url.familys, params) |
| 311 | 322 | } |
| 312 | 323 | }, | ... | ... |
juvenile-prosecution-vue/src/views/system/UserList.vue
| ... | ... | @@ -314,14 +314,11 @@ |
| 314 | 314 | }, |
| 315 | 315 | methods: { |
| 316 | 316 | doAnalyze(){ |
| 317 | - putAction('/sys/analyze/doAnalyzeData', {}).then((res) => { | |
| 318 | - console.log(res) | |
| 319 | - }) | |
| 317 | + putAction('/sys/analyze/doAnalyzeData', {}) | |
| 320 | 318 | // let self = this; |
| 321 | 319 | // let apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot"; |
| 322 | - // self.$axios.put('/sys/analyze/doAnalyzeData').then(res => { | |
| 320 | + // self.$axios.put(apiBaseUrl+'/sys/analyze/doAnalyzeData').then(res => { | |
| 323 | 321 | // console.log(res) |
| 324 | - // | |
| 325 | 322 | // }) |
| 326 | 323 | }, |
| 327 | 324 | getAvatarView: function (avatar) { | ... | ... |