diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java index 633f66e..f43611b 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/AnalyzeController.java +++ b/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; import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.service.*; import org.jeecg.modules.system.util.IDNumberUtil; +import org.jeecg.modules.system.util.getRandomId; import org.jeecg.modules.system.vo.GaPunishVo; import org.jeecg.modules.system.vo.SpecialStudentVo; import org.springframework.web.bind.annotation.*; @@ -69,12 +70,13 @@ public class AnalyzeController extends JeecgController resultFamily = new ArrayList<>();//分析后家庭的数据 +// private final List resultFamily = new ArrayList<>();//分析后家庭的数据 private final List resultMinor = new ArrayList<>();//分析后未成年人的信息 private final List resultSchools = new ArrayList<>();//分析后学籍的信息 + private final Set testIdCards = new HashSet<>();//存储户号 private static final int corePoolSize = Runtime.getRuntime().availableProcessors(); private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, corePoolSize + 1, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue(1000)); - + private Integer random_number=000000; @AutoLog(value = "来源数据管理-分页列表查询") @ApiOperation(value = "来源数据管理-分页列表查询", notes = "来源数据管理-分页列表查询") @@ -86,14 +88,14 @@ public class AnalyzeController extends JeecgController departs = sysDepartService.querySysDeparts(); getData(departs); System.out.println("开始数据分析" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); - System.out.println("家庭成员数据批量新增总条数" + resultFamily.size()); +// System.out.println("家庭成员数据批量新增总条数" + resultFamily.size()); System.out.println("未成年人数据批量新增总条数" + resultMinor.size()); System.out.println("学籍信息数据批量新增总条数" + resultSchools.size()); long startTime2 = System.currentTimeMillis(); minorService.insertBatch(resultMinor); System.out.println("未成年人数据批量新增所用时间" + (System.currentTimeMillis() - startTime2) / 1000 + "秒"); long startTime1 = System.currentTimeMillis(); - familyService.insertBatch(resultFamily); +// familyService.insertBatch(resultFamily); System.out.println("家庭成员数据批量新增所用时间" + (System.currentTimeMillis() - startTime1) / 1000 + "秒"); long startTime3 = System.currentTimeMillis(); schoolService.insertBatch(resultSchools); @@ -434,62 +436,67 @@ public class AnalyzeController extends JeecgController minorMap = new HashMap<>(); + Map schools=new HashMap<>(); System.out.println("***********************交集总数**********************************************" + intersection.size()); System.out.println("***********************人口信息总数**********************************************" + gaHouseholds.size()); System.out.println("交集数据里的所属单位开始" + (System.currentTimeMillis() - startTime) / 1000); + Date creatDate = new Date(); if (oConvertUtils.isNotEmpty(intersection) && oConvertUtils.isNotEmpty(departs) && departs.size() > 0) { for (SysDepart d : departs) { intersection.stream().forEach(i -> { - if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getSchool()) && oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode())) { - if (d.getCommonCode().contains(i.getSchool())) { - i.setSysOrgCode(d.getOrgCode()); + Minor minor = new Minor(); + if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getIdentity()) && IDNumberUtil.checkID(i.getIdentity())) { + String idCard=i.getIdentity(); + if(oConvertUtils.isNotEmpty(minorMap) && oConvertUtils.isNotEmpty(minorMap.get(idCard))){ + Minor minMap=minorMap.get(idCard); + if(oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(minMap.getSchoolName())){ + if (d.getCommonCode().contains(minMap.getSchoolName())) { + minMap.setSysOrgCode(d.getOrgCode()); + i.setSysOrgCode(d.getOrgCode()); + } + } + if(oConvertUtils.isNotEmpty(schools) && oConvertUtils.isNotEmpty(schools.get(idCard)) ){ + schools.get(idCard).setSysOrgCode(i.getSysOrgCode()); + } }else { - i.setSysOrgCode(""); + if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(i.getSchool())) { + if (d.getCommonCode().contains(i.getSchool())) { + minor.setSysOrgCode(d.getOrgCode()); + i.setSysOrgCode(d.getOrgCode()); + } + } + minor.setSchool(Minor.SCHOOL_STATUS_NO); + if (oConvertUtils.isNotEmpty(i.getName())) { + minor.setName(i.getName()); + } + minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(i.getIdentity()))); + if (oConvertUtils.isNotEmpty(i.getAddress())) { + minor.setAddress(i.getAddress()); + } + if (oConvertUtils.isNotEmpty(i.getSchool())) { + minor.setSchoolName(i.getSchool()); + } + if (oConvertUtils.isNotEmpty(i.getAdmissionDate())) { + minor.setStartYear(i.getAdmissionDate()); + } + if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(i.getIdentity()))) { + minor.setNumber(gaHouseholds.get(i.getIdentity()).getNumber()); + minor.setHouseholdNum(gaHouseholds.get(i.getIdentity()).getHouseholdNum()); + } + minor.setIdentity(i.getIdentity()); + minor.setCreateTime(creatDate); + i.setCreateTime(creatDate); + minorMap.put(i.getIdentity(), minor); + schools.put(i.getIdentity(), i); } - }else { - i.setSysOrgCode(""); } }); } } System.out.println("交集数据里的所属单位结束总数"+intersection.size()+"交集数据里的所属单位结束" + (System.currentTimeMillis() - startTime) / 1000); - Date creatDate = new Date(); - if (oConvertUtils.isNotEmpty(intersection)) { - intersection.stream().forEach(i -> { - if (oConvertUtils.isNotEmpty(i) && oConvertUtils.isNotEmpty(i.getIdentity()) && IDNumberUtil.checkID(i.getIdentity())) { - Minor minor = new Minor(); - //身份证号 - String idCard = i.getIdentity(); - if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(idCard))) { - minor.setSchool(Minor.SCHOOL_STATUS_NO); - minor.setSchoolName(i.getSchool()); - minor.setStartYear(i.getAdmissionDate()); - minor.setNumber(gaHouseholds.get(idCard).getNumber()); - minor.setHouseholdNum(gaHouseholds.get(idCard).getHouseholdNum()); - } else { - minor.setSchool(Minor.SCHOOL_STATUS_YES); - } - if (oConvertUtils.isNotEmpty(i.getName())) { - minor.setName(i.getName()); - } - if (oConvertUtils.isNotEmpty(i.getAddress())) { - minor.setAddress(i.getAddress()); - } - if (oConvertUtils.isNotEmpty(idCard)) { - minor.setGender(Integer.parseInt(IDNumberUtil.judgeGender(idCard))); - } - minor.setIdentity(idCard); - minor.setSysOrgCode(i.getSysOrgCode()); - minor.setCreateTime(creatDate); - i.setCreateTime(creatDate); - minorMap.put(idCard, minor); - } - }); - } System.out.println("户籍信息里的未成年人的单位" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); long startTime1 = System.currentTimeMillis(); -// schoolService.insertBatch(intersection); - resultSchools.addAll(intersection); + resultSchools.addAll(schools.values()); System.out.println("人口信息he交集总数总数" + minorMap.size()); getSpecialStudent(minorMap, specialStudentVos, mzUnsupporteds, mzLeftBehinds, mzAdoptions, gaPunishVos, mzOrphans,gaHouseholds); } catch (Exception e) { @@ -504,52 +511,68 @@ public class AnalyzeController extends JeecgController mzOrphans, Map gaHouseholds) { try { Map minorMap = new HashMap<>(); + Map schools=new HashMap<>(); long startTime = System.currentTimeMillis(); System.out.println("根据差集数据判断所属单位" + difference.size()); System.out.println("未成年人总数" + difference.size()); Date creatTime = new Date(); - if (oConvertUtils.isNotEmpty(difference) && oConvertUtils.isNotEmpty(departs) && departs.size() > 0) { + if (oConvertUtils.isNotEmpty(difference) && oConvertUtils.isNotEmpty(departs)) { for (SysDepart d : departs) { difference.stream().forEach(m -> { Minor minor = new Minor(); if (oConvertUtils.isNotEmpty(m) && oConvertUtils.isNotEmpty(m.getIdentity()) && IDNumberUtil.checkID(m.getIdentity())) { - if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(m.getSchool())) { - if (d.getCommonCode().contains(m.getSchool())) { - minor.setSysOrgCode(d.getOrgCode()); - m.setSysOrgCode(d.getOrgCode()); + String idCard=m.getIdentity(); + if(oConvertUtils.isNotEmpty(minorMap) && oConvertUtils.isNotEmpty(minorMap.get(idCard))){ + Minor minMap=minorMap.get(idCard); + if(oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(minMap.getSchoolName())){ + if (d.getCommonCode().contains(minMap.getSchoolName())) { + minMap.setSysOrgCode(d.getOrgCode()); + m.setSysOrgCode(d.getOrgCode()); + } + } + if(oConvertUtils.isNotEmpty(schools) && oConvertUtils.isNotEmpty(schools.get(idCard)) ){ + schools.get(idCard).setSysOrgCode(m.getSysOrgCode()); } + }else { + if (oConvertUtils.isNotEmpty(d) && oConvertUtils.isNotEmpty(d.getCommonCode()) && oConvertUtils.isNotEmpty(m.getSchool())) { + if (d.getCommonCode().contains(m.getSchool())) { + minor.setSysOrgCode(d.getOrgCode()); + m.setSysOrgCode(d.getOrgCode()); + } + } + minor.setSchool(Minor.SCHOOL_STATUS_NO); + if (oConvertUtils.isNotEmpty(m.getName())) { + minor.setName(m.getName()); + } + minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(m.getIdentity()))); + if (oConvertUtils.isNotEmpty(m.getAddress())) { + minor.setAddress(m.getAddress()); + } + if (oConvertUtils.isNotEmpty(m.getSchool())) { + minor.setSchoolName(m.getSchool()); + } + if (oConvertUtils.isNotEmpty(m.getAdmissionDate())) { + minor.setStartYear(m.getAdmissionDate()); + } + if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(m.getIdentity()))) { + minor.setNumber(gaHouseholds.get(m.getIdentity()).getNumber()); + minor.setHouseholdNum(gaHouseholds.get(m.getIdentity()).getHouseholdNum()); + } + minor.setIdentity(m.getIdentity()); + minor.setCreateTime(creatTime); + m.setCreateTime(creatTime); + minorMap.put(m.getIdentity(), minor); + schools.put(m.getIdentity(), m); } - minor.setSchool(Minor.SCHOOL_STATUS_NO); - if (oConvertUtils.isNotEmpty(m.getName())) { - minor.setName(m.getName()); - } - minor.setGender(Integer.valueOf(IDNumberUtil.judgeGender(m.getIdentity()))); - if (oConvertUtils.isNotEmpty(m.getAddress())) { - minor.setAddress(m.getAddress()); - } - if (oConvertUtils.isNotEmpty(m.getSchool())) { - minor.setSchoolName(m.getSchool()); - } - if (oConvertUtils.isNotEmpty(m.getAdmissionDate())) { - minor.setStartYear(m.getAdmissionDate()); - } - if (oConvertUtils.isNotEmpty(gaHouseholds) && oConvertUtils.isNotEmpty(gaHouseholds.get(m.getIdentity()))) { - minor.setNumber(gaHouseholds.get(m.getIdentity()).getNumber()); - minor.setHouseholdNum(gaHouseholds.get(m.getIdentity()).getHouseholdNum()); - } - minor.setIdentity(m.getIdentity()); - minor.setCreateTime(creatTime); - m.setCreateTime(creatTime); - minorMap.put(m.getIdentity(), minor); - } + } }); } } System.out.println("根据不在人口基础信息里的学生和单位信息判断所属单位" + (System.currentTimeMillis() - startTime) / 1000 + "秒"); long startTime1 = System.currentTimeMillis(); // schoolService.insertBatch(difference); - resultSchools.addAll(difference); + resultSchools.addAll(schools.values()); System.out.println("有学籍信息但没有人口基本信息的数据" + minorMap.size()); getSpecialStudent(minorMap, specialStudentVos, mzUnsupporteds, mzLeftBehinds, mzAdoptions, gaPunishVos, mzOrphans,gaHouseholds); } catch (Exception e) { @@ -572,11 +595,9 @@ public class AnalyzeController extends JeecgController minors, Map gaHouseholds, Map gaPunishVos) { long startTime = System.currentTimeMillis(); try { - List familys = new ArrayList<>(); - //犯罪人员身份证号-户号关系 - Map idCards = new HashMap<>(); +// List familys = new ArrayList<>(); + //户号-是否犯罪关系 + Map idCards = new HashMap<>(); //户号-家庭成员关系 Map> familyMaps = new HashMap<>(); //人员身份证号-与监护人的关系 Map relations = new HashMap<>(); //户号-与监护人 Map guardians = new HashMap<>(); + Date createTime = new Date(); if (oConvertUtils.isNotEmpty(gaHouseholds)) { - int i=0; + getRandomId idWorker = new getRandomId(0, 0); for (Map.Entry m : gaHouseholds.entrySet()) { + long id = idWorker.nextId(); String mapKey = m.getKey(); Family family = m.getValue(); if (oConvertUtils.isNotEmpty(family)) { - i=i+1; if (oConvertUtils.isNotEmpty(gaPunishVos) && oConvertUtils.isNotEmpty(gaPunishVos.get(mapKey))) { family.setCrime(Family.IS_CRIME); if (oConvertUtils.isNotEmpty(gaPunishVos.get(mapKey).getAjmc())) { @@ -717,6 +755,11 @@ public class AnalyzeController extends JeecgController minors, Map idCards, Map> familyMaps, Map guardians, Map relations) { + public void getFamilyCrime(Map minors, Map idCards, Map> familyMaps, Map guardians, Map relations) { long startTime = System.currentTimeMillis(); try { LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); System.out.println("家庭成员是否犯罪"); List minorList = new ArrayList<>(); - List familys = new ArrayList<>(); + Set familys = new HashSet<>(); + //存放已经被放入minor里面的户号,避免数据重复 + Set houseSet=new HashSet<>(); Date createTime = new Date(); if (oConvertUtils.isNotEmpty(minors)) { for (Map.Entry m : minors.entrySet()) { @@ -772,30 +815,38 @@ public class AnalyzeController extends JeecgController f=new ArrayList<>(); //判断是否是一个家庭的人员 if (oConvertUtils.isNotEmpty(minor.getHouseholdNum())) { String houseNum = minor.getHouseholdNum(); - if (oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum))) { - familys.addAll(familyMaps.get(houseNum)); + if(oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum)) ){ + if(!testIdCards.contains(houseNum) ){ + f.addAll(familyMaps.get(houseNum)); +// resultFamily.addAll(familyMaps.get(houseNum)); + testIdCards.add(houseNum); + } + } + minor.setFamilies(f); + //获取监护人 + if (oConvertUtils.isNotEmpty(houseNum) && oConvertUtils.isNotEmpty(guardians) && oConvertUtils.isNotEmpty(guardians.get(houseNum))) { + minor.setGuardian(guardians.get(houseNum).getName()); + } + //判断家庭成员是否犯罪 + if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(idCards) && oConvertUtils.isNotEmpty(idCards.get(houseNum))) { + if(oConvertUtils.isNotEmpty(minor.getReason()) && !minor.getReason().contains(String.valueOf(Minor.ATTENTION_REASON_CRIME))){ + minor.setReason(minor.getReason()+","+Minor.ATTENTION_REASON_CRIME); + }else { + minor.setReason(String.valueOf(Minor.ATTENTION_REASON_CRIME)); + } } } //获取与监护人关系 if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(relations) && oConvertUtils.isNotEmpty(relations.get(idCard))) { minor.setRelation(relations.get(idCard)); } - //获取监护人 - if (oConvertUtils.isNotEmpty(idCard) && oConvertUtils.isNotEmpty(guardians) && oConvertUtils.isNotEmpty(guardians.get(idCard))) { - minor.setGuardian(guardians.get(idCard).getName()); - } - minorList.add(minor); + resultMinor.add(minor); } } - resultMinor.addAll(minorList); - resultFamily.addAll(familys); } catch (Exception e) { e.printStackTrace(); log.info(String.valueOf(e)); @@ -804,5 +855,4 @@ public class AnalyzeController extends JeecgController queryPageList(Minor minor, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(minor, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); +// IPage pageList = minorService.page(page, queryWrapper); + + IPage pageList = minorService.queryPageList(page,minor.getName()); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param minorPage + * @return + */ + @AutoLog(value = "未成年人-添加") + @ApiOperation(value = "未成年人-添加", notes = "未成年人-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody MinorPage minorPage) { + Minor minor = new Minor(); + BeanUtils.copyProperties(minorPage, minor); + minorService.saveMain(minor, minorPage.getFamilyList()); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param minorPage + * @return + */ + @AutoLog(value = "未成年人-编辑") + @ApiOperation(value = "未成年人-编辑", notes = "未成年人-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody MinorPage minorPage) { + Minor minor = new Minor(); + BeanUtils.copyProperties(minorPage, minor); + Minor minorEntity = minorService.getById(minor.getId()); + if (minorEntity == null) { + return Result.error("未找到对应数据"); + } + minorService.updateMain(minor, minorPage.getFamilyList()); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "未成年人-通过id删除") + @ApiOperation(value = "未成年人-通过id删除", notes = "未成年人-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name = "id", required = true) String id) { + minorService.delMain(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "未成年人-批量删除") + @ApiOperation(value = "未成年人-批量删除", notes = "未成年人-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.minorService.delBatchMain(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "未成年人-通过id查询") + @ApiOperation(value = "未成年人-通过id查询", notes = "未成年人-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + Minor minor = minorService.getById(id); + if (minor == null) { + return Result.error("未找到对应数据"); + } + return Result.OK(minor); + + } + + /** + * 通过householdNum查询 + * + * @param householdNum + * @return + */ + @AutoLog(value = "家庭成员表通过主表householdNum查询") + @ApiOperation(value = "家庭成员表主表householdNum查询", notes = "家庭成员表-通主表householdNum查询") + @GetMapping(value = "/queryFamilyByMainId") + public Result queryFamilyListByMainId(@RequestParam(name = "householdNum", required = true) String householdNum) { + List familyList = familyService.selectByHouseholdNum(householdNum); + return Result.OK(familyList); + } + /** - * 分页列表查询 + * 导出excel * + * @param request * @param minor - * @param pageNo - * @param pageSize - * @param req - * @return */ - @AutoLog(value = "未成年人-分页列表查询") - @ApiOperation(value="未成年人-分页列表查询", notes="未成年人-分页列表查询") - @GetMapping(value = "/list") - public Result queryPageList(Minor minor, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(minor, req.getParameterMap()); - Page page = new Page(pageNo, pageSize); - IPage pageList = minorService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 添加 - * - * @param minorPage - * @return - */ - @AutoLog(value = "未成年人-添加") - @ApiOperation(value="未成年人-添加", notes="未成年人-添加") - @PostMapping(value = "/add") - public Result add(@RequestBody MinorPage minorPage) { - Minor minor = new Minor(); - BeanUtils.copyProperties(minorPage, minor); - minorService.saveMain(minor, minorPage.getFamilyList()); - return Result.OK("添加成功!"); - } - - /** - * 编辑 - * - * @param minorPage - * @return - */ - @AutoLog(value = "未成年人-编辑") - @ApiOperation(value="未成年人-编辑", notes="未成年人-编辑") - @PutMapping(value = "/edit") - public Result edit(@RequestBody MinorPage minorPage) { - Minor minor = new Minor(); - BeanUtils.copyProperties(minorPage, minor); - Minor minorEntity = minorService.getById(minor.getId()); - if(minorEntity==null) { - return Result.error("未找到对应数据"); + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Minor minor) { + // Step.1 组装查询条件查询数据 + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + //Step.2 获取导出数据 + List queryList = minorService.list(queryWrapper); + // 过滤选中数据 + String selections = request.getParameter("selections"); + List minorList = new ArrayList(); + if(oConvertUtils.isEmpty(selections)) { + minorList = queryList; + }else { + List selectionList = Arrays.asList(selections.split(",")); + minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); } - minorService.updateMain(minor, minorPage.getFamilyList()); - return Result.OK("编辑成功!"); - } - - /** - * 通过id删除 - * - * @param id - * @return - */ - @AutoLog(value = "未成年人-通过id删除") - @ApiOperation(value="未成年人-通过id删除", notes="未成年人-通过id删除") - @DeleteMapping(value = "/delete") - public Result delete(@RequestParam(name="id",required=true) String id) { - minorService.delMain(id); - return Result.OK("删除成功!"); - } - - /** - * 批量删除 - * - * @param ids - * @return - */ - @AutoLog(value = "未成年人-批量删除") - @ApiOperation(value="未成年人-批量删除", notes="未成年人-批量删除") - @DeleteMapping(value = "/deleteBatch") - public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.minorService.delBatchMain(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); - } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "未成年人-通过id查询") - @ApiOperation(value="未成年人-通过id查询", notes="未成年人-通过id查询") - @GetMapping(value = "/queryById") - public Result queryById(@RequestParam(name="id",required=true) String id) { - Minor minor = minorService.getById(id); - if(minor==null) { - return Result.error("未找到对应数据"); + // Step.3 组装pageList + List pageList = new ArrayList(); + for (Minor main : minorList) { + MinorPage vo = new MinorPage(); + BeanUtils.copyProperties(main, vo); + List familyList = familyService.selectByHouseholdNum(main.getHouseholdNum()); + vo.setFamilyList(familyList); + pageList.add(vo); } - return Result.OK(minor); + // Step.4 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.FILE_NAME, "未成年人列表"); + mv.addObject(NormalExcelConstants.CLASS, MinorPage.class); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("未成年人数据", "导出人:"+sysUser.getRealname(), "未成年人")); + mv.addObject(NormalExcelConstants.DATA_LIST, pageList); + return mv; } - - /** - * 通过id查询 - * - * @param id - * @return - */ - @AutoLog(value = "家庭成员表通过主表ID查询") - @ApiOperation(value="家庭成员表主表ID查询", notes="家庭成员表-通主表ID查询") - @GetMapping(value = "/queryFamilyByMainId") - public Result queryFamilyListByMainId(@RequestParam(name="id",required=true) String id) { - List familyList = familyService.selectByMainId(id); - return Result.OK(familyList); - } - - /** - * 导出excel - * - * @param request - * @param minor - */ - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, Minor minor) { - // Step.1 组装查询条件查询数据 - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - queryWrapper.last("limit 1"); - //Step.2 获取导出数据 - List queryList = minorService.list(queryWrapper); - // 过滤选中数据 - String selections = request.getParameter("selections"); - List minorList = new ArrayList(); - if(oConvertUtils.isEmpty(selections)) { - minorList = queryList; - }else { - List selectionList = Arrays.asList(selections.split(",")); - minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); - } - // Step.3 组装pageList - List pageList = new ArrayList(); - for (Minor main : minorList) { - MinorPage vo = new MinorPage(); - BeanUtils.copyProperties(main, vo); - List familyList = familyService.selectByMainId(main.getId()); - vo.setFamilyList(familyList); - pageList.add(vo); - } +// /** +// * 导出excel +// * +// * @param request +// * @param minor +// */ +// @RequestMapping(value = "/exportXls") +// public void exportXls(HttpServletRequest request, Minor minor, HttpServletResponse response) throws IOException { +// +// OutputStream outputStream = response.getOutputStream(); +// // Step.1 组装查询条件查询数据 +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(minor, request.getParameterMap()); +// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); +// queryWrapper.last("limit 1"); +// //Step.2 获取导出数据 +// List queryList = minorService.list(queryWrapper); +// // 过滤选中数据 +// String selections = request.getParameter("selections"); +// List minorList = new ArrayList(); +// if (oConvertUtils.isEmpty(selections)) { +// minorList = queryList; +// } else { +// List selectionList = Arrays.asList(selections.split(",")); +// minorList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); +// } +// // Step.3 组装pageList +// List pageList = new ArrayList(); +// List familyList = new ArrayList<>(); +// for (Minor main : minorList) { +// familyList = familyService.selectByHouseholdNum(main.getHouseholdNum()); +// } +// //多个map,对应了多个sheet +// List> listMap = new ArrayList>(); +// Map minorMap = new HashMap(); +// minorMap.put("title", getExportParams("未成年人表"));//表格title +// minorMap.put("entity", Minor.class);//表格对应实体 +// //数据封装方式二:实体类 +// minorMap.put("data", minorList); +// listMap.add(minorMap); +// Map familyMap = new HashMap(); +// familyMap.put("title", getExportParams("家庭成员表"));//表格title +// familyMap.put("entity", Family.class);//表格对应实体 +// //数据封装方式二:实体类 +// familyMap.put("data", familyList); +// listMap.add(familyMap); +// try { +// Workbook wb = ExcelExportUtil.exportExcel(listMap, ExcelType.XSSF); +// response.reset(); +// response.setHeader("Content-disposition", "attachment; filename=details.xls"); +// response.setContentType("application/msexcel"); +// wb.write(outputStream); +// outputStream.close(); +// } catch (IOException e) { +// log.error("模板下载失败" + e.getMessage()); +// response.setStatus(404); +// e.printStackTrace(); +// } finally { +// if (outputStream != null) { +// try { +// outputStream.close(); +// } catch (IOException e) { +// log.error(e.getMessage(), e); +// } +// } +// } +// } - // Step.4 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - mv.addObject(NormalExcelConstants.FILE_NAME, "未成年人列表"); - mv.addObject(NormalExcelConstants.CLASS, MinorPage.class); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("未成年人数据", "导出人:"+sysUser.getRealname(), "未成年人")); - mv.addObject(NormalExcelConstants.DATA_LIST, pageList); - return mv; + //导出参数 + public static ExportParams getExportParams(String name) { + //表格名称,sheet名称,导出版本 + return new ExportParams(name, name, ExcelType.XSSF); } /** - * 通过excel导入数据 - * - * @param request - * @param response - * @return - */ + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; - Map fileMap = multipartRequest.getFileMap(); - for (Map.Entry entity : fileMap.entrySet()) { - MultipartFile file = entity.getValue();// 获取上传文件对象 - ImportParams params = new ImportParams(); - params.setTitleRows(2); - params.setHeadRows(1); - params.setNeedSave(true); - try { - List list = ExcelImportUtil.importExcel(file.getInputStream(), MinorPage.class, params); - for (MinorPage page : list) { - Minor po = new Minor(); - BeanUtils.copyProperties(page, po); - minorService.saveMain(po, page.getFamilyList()); - } - return Result.OK("文件导入成功!数据行数:" + list.size()); - } catch (Exception e) { - log.error(e.getMessage(),e); - return Result.error("文件导入失败:"+e.getMessage()); - } finally { - try { - file.getInputStream().close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return Result.OK("文件导入失败!"); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), MinorPage.class, params); + for (MinorPage page : list) { + Minor po = new Minor(); + BeanUtils.copyProperties(page, po); + minorService.saveMain(po, page.getFamilyList()); + } + return Result.OK("文件导入成功!数据行数:" + list.size()); + } catch (Exception e) { + log.error(e.getMessage(), e); + return Result.error("文件导入失败:" + e.getMessage()); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.OK("文件导入失败!"); } } diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Family.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Family.java index 48f8d30..90d7410 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Family.java +++ b/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 { public static final Integer IS_CRIME=1;//是 public static final Integer IS_NOT_CRIME=0;//否 - @TableId(type = IdType.AUTO) + @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "主键") - private Integer id; + private String id; /**创建人*/ @ApiModelProperty(value = "创建人") private String createBy; diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Minor.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Minor.java index 45ebf7e..e1ef7b0 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/Minor.java +++ b/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; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.Date; +import java.util.List; +import java.util.Set; + import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -79,29 +82,14 @@ public class Minor implements Serializable { @ApiModelProperty(value = "性别") @Dict(dicCode = "sex") private Integer gender; - /**家庭住址*/ - @Excel(name = "家庭住址", width = 15) - @ApiModelProperty(value = "家庭住址") - private String address; /**身份证号*/ @Excel(name = "身份证号", width = 15) @ApiModelProperty(value = "身份证号") private String identity; - - /** - * 监护人 - */ - @Excel(name = "监护人", width = 15) - @ApiModelProperty(value = "监护人") - private String guardian; - - /** - * 监护人关系 - */ - @Excel(name = "监护人关系", width = 15) - @ApiModelProperty(value = "监护人关系") - private String relation; - + /**家庭住址*/ + @Excel(name = "家庭住址", width = 15) + @ApiModelProperty(value = "家庭住址") + private String address; /**是否失学*/ @Excel(name = "是否失学", width = 15,dicCode = "school_status") @ApiModelProperty(value = "是否失学") @@ -116,13 +104,25 @@ public class Minor implements Serializable { @Excel(name = "入学年份", width = 15) @ApiModelProperty(value = "入学年份") private String startYear; + /** + * 监护人 + */ + @Excel(name = "监护人", width = 15) + @ApiModelProperty(value = "监护人") + private String guardian; + + /** + * 监护人关系 + */ + @Excel(name = "监护人关系", width = 15) + @ApiModelProperty(value = "监护人关系") + private String relation; /**重点关注原因*/ @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") @ApiModelProperty(value = "重点关注原因") @Dict(dicCode = "attention_reason") - private Integer reason; - + private String reason; /**特殊原因*/ @Excel(name = "特殊原因", width = 15) @ApiModelProperty(value = "特殊原因") @@ -135,4 +135,10 @@ public class Minor implements Serializable { @Excel(name = "行政区划", width = 15) @ApiModelProperty(value = "行政区划") private String division; + + @TableField(exist = false) + private List families; + + @TableField(exist = false) + private String age; } diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/FamilyMapper.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/FamilyMapper.java index 14fe413..c65de5f 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/FamilyMapper.java +++ b/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; import org.jeecg.modules.system.entity.Family; import java.util.List; +import java.util.Set; /** * @Description: 家庭成员表 @@ -16,7 +17,7 @@ public interface FamilyMapper extends BaseMapper { public boolean deleteByMainId(@Param("mainId") String mainId); - public List selectByMainId(@Param("mainId") String mainId); + public List selectByHouseholdNum(@Param("householdNum") String householdNum); public List getFamilyByMinorId(@Param("minorId") String minorId); diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java index bf39d79..e78c2f4 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/MinorMapper.java @@ -1,8 +1,13 @@ package org.jeecg.modules.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; import org.jeecg.modules.system.entity.Family; import org.jeecg.modules.system.entity.Minor; +import org.jeecg.modules.system.entity.SysUser; +import org.jeecg.modules.system.vo.MinorVo; import java.util.List; @@ -16,4 +21,12 @@ public interface MinorMapper extends BaseMapper { public Integer insertBatch(List list); + /** + * 分页查询未成年人信息 + * @param page + * @return + */ + IPage queryPageList(Page page,@Param("name") String name); + + } diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/FamilyMapper.xml b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/FamilyMapper.xml index 36d1658..64aa620 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/FamilyMapper.xml +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/FamilyMapper.xml @@ -8,23 +8,24 @@ WHERE minor_id = #{mainId} - SELECT * FROM mr_family WHERE - minor_id = #{mainId} - - + household_num = #{householdNum} + - INSERT INTO mr_family (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,crime,reason, other)VALUES + INSERT INTO mr_family (id,create_time,sys_org_code,household_num,number,name,identity,gender,relation,address,crime,reason,other)VALUES (#{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}) + + + + + + + diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml index b6bbbc2..8d22d30 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/MinorMapper.xml @@ -1,6 +1,28 @@ - + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO mr_minor (id, create_time, sys_org_code, household_num, number, name,identity, gender, relation, address,guardian, school,schoolName, startYear,reason,specialReason,remark)VALUES @@ -9,4 +31,15 @@ #{b.school},#{b.schoolName},#{b.startYear},#{b.reason},#{b.specialReason},#{b.remark}) + + + \ No newline at end of file diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IFamilyService.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IFamilyService.java index f206e2f..4be68e9 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IFamilyService.java +++ b/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; import org.jeecg.modules.system.entity.SysDepart; import java.util.List; +import java.util.Set; /** * @Description: 家庭成员表 @@ -15,7 +16,7 @@ import java.util.List; */ public interface IFamilyService extends IService { - public List selectByMainId(String mainId); + public List selectByHouseholdNum(String householdNum); public Integer insertBatch(List list); diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java index d0e9cd7..a159dd1 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/IMinorService.java @@ -1,9 +1,12 @@ package org.jeecg.modules.system.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.system.entity.Family; import org.jeecg.modules.system.entity.Minor; import org.jeecg.modules.system.entity.SysDepart; +import org.jeecg.modules.system.vo.MinorVo; import java.io.Serializable; import java.util.Collection; @@ -41,4 +44,6 @@ public interface IMinorService extends IService { public Integer insertBatch(List list); + + IPage queryPageList(Page page,String name); } diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java index 093a12f..21a27a7 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/FamilyServiceImpl.java +++ b/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; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.system.entity.Family; -import org.jeecg.modules.system.entity.Minor; -import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.mapper.FamilyMapper; import org.jeecg.modules.system.service.IFamilyService; import org.springframework.jdbc.datasource.DataSourceTransactionManager; @@ -17,7 +15,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; @@ -43,8 +40,8 @@ public class FamilyServiceImpl extends ServiceImpl impleme private TransactionDefinition transactionDefinition; @Override - public List selectByMainId(String mainId) { - return familyMapper.selectByMainId(mainId); + public List selectByHouseholdNum(String householdNum){ + return familyMapper.selectByHouseholdNum(householdNum); } private Integer random_number=00000000; @@ -57,49 +54,53 @@ public class FamilyServiceImpl extends ServiceImpl impleme @Override @Transactional public Integer insertBatch(List list) { + System.out.println("源数据条数***************************************"+list.size()); + List families= list.stream().distinct().collect(Collectors.toList());; // if(oConvertUtils.isNotEmpty(list)){ -// for(int i=0;i { +// families.add(h); +// }); // } - updateStudentWithThreads(list); + System.out.println("去重后数据条数***************************************"+families.size()); + updateStudentWithThreads(families); return list.size(); } private void addBatch(List list, CountDownLatch threadLatch){ -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); System.out.println("子线程:" + Thread.currentThread().getName()); try { - list.forEach(s -> { - if(oConvertUtils.isNotEmpty(s)){ - familyMapper.insert(s); - } - }); -// familyMapper.insertBatch(list); -// dataSourceTransactionManager.commit(transactionStatus); +// list.forEach(s -> { +// if(oConvertUtils.isNotEmpty(s)){ +// familyMapper.insert(s); +// } +// }); + if(list.size()>0){ + familyMapper.insertBatch(list); + } + dataSourceTransactionManager.commit(transactionStatus); threadLatch.countDown(); } catch (Throwable e) { e.printStackTrace(); -// dataSourceTransactionManager.rollback(transactionStatus); + dataSourceTransactionManager.rollback(transactionStatus); } } public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 8; + final Integer threadCount = 10; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; - // 创建多线程处理任务 +// // 创建多线程处理任务 ExecutorService studentThreadPool = Executors.newFixedThreadPool(threadCount); CountDownLatch threadLatchs = new CountDownLatch(threadCount); for (int i = 0; i < threadCount; i++) { // 每个线程处理的数据 - List threadDatas = list.stream() + List threadDatas = list.stream() .skip(i * dataPartionLength).limit(dataPartionLength).collect(Collectors.toList()); +// addBatch(threadDatas); studentThreadPool.execute(() -> { addBatch(threadDatas, threadLatchs); }); diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java index 4fb8b3d..001b320 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MinorServiceImpl.java @@ -1,5 +1,7 @@ package org.jeecg.modules.system.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import javassist.bytecode.analysis.Executor; import org.jeecg.common.util.oConvertUtils; @@ -9,6 +11,7 @@ import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.mapper.FamilyMapper; import org.jeecg.modules.system.mapper.MinorMapper; import org.jeecg.modules.system.service.IMinorService; +import org.jeecg.modules.system.vo.MinorVo; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.TransactionDefinition; @@ -131,29 +134,39 @@ public class MinorServiceImpl extends ServiceImpl implements return list.size(); } + @Override + public IPage queryPageList(Page page,String name) { + return minorMapper.queryPageList(page,name); + } + private void addBatch(List list, CountDownLatch threadLatch){ -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); System.out.println("子线程:" + Thread.currentThread().getName()); try { list.forEach(s -> { if(oConvertUtils.isNotEmpty(s)){ minorMapper.insert(s); + if(oConvertUtils.isNotEmpty(s.getFamilies())){ + if(s.getFamilies().size()>0){ + familyMapper.insertBatch(s.getFamilies()); + } + } } }); // minorMapper.insertBatch(list); -// dataSourceTransactionManager.commit(transactionStatus); + dataSourceTransactionManager.commit(transactionStatus); threadLatch.countDown(); } catch (Throwable e) { e.printStackTrace(); -// dataSourceTransactionManager.rollback(transactionStatus); + dataSourceTransactionManager.rollback(transactionStatus); } } public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 8; + final Integer threadCount = 5; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java index 6a90261..62394e0 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/MrSchoolServiceImpl.java +++ b/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 i return list.size(); } -// public static void main(String[] args){ -// System.out.println(System.currentTimeMillis()+"00000000"+1); -// } private void addBatch(List list, CountDownLatch threadLatch){ -// TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); + TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); System.out.println("子线程:" + Thread.currentThread().getName()); try { list.forEach(s -> { @@ -71,18 +68,18 @@ public class MrSchoolServiceImpl extends ServiceImpl i schoolMapper.insert(s); } }); -// dataSourceTransactionManager.commit(transactionStatus); + dataSourceTransactionManager.commit(transactionStatus); threadLatch.countDown(); } catch (Throwable e) { e.printStackTrace(); -// dataSourceTransactionManager.rollback(transactionStatus); + dataSourceTransactionManager.rollback(transactionStatus); } } public void updateStudentWithThreads(List list) { // 线程数量 - final Integer threadCount = 8; + final Integer threadCount = 5; //每个线程处理的数据量 final Integer dataPartionLength = (list.size() + threadCount - 1) / threadCount; diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/getRandomId.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/getRandomId.java new file mode 100644 index 0000000..6e9bba6 --- /dev/null +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/util/getRandomId.java @@ -0,0 +1,264 @@ +package org.jeecg.modules.system.util; + +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.system.entity.Family; +import org.jeecg.modules.system.entity.Minor; + +import java.util.*; + +public class getRandomId { + + // ==============================Fields=========================================== + /** + * 开始时间截 (2018-07-03) + */ + + private final long twepoch = 1530607760000L; + + /** + * 机器id所占的位数 + */ + private final long workerIdBits = 5L; + + /** + * 数据标识id所占的位数 + */ + private final long datacenterIdBits = 5L; + + /** + * 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) + */ + private final long maxWorkerId = -1L ^ (-1L << workerIdBits); + + /** + * 支持的最大数据标识id,结果是31 + */ + private final long maxDatacenterId = -1L ^ (-1L << datacenterIdBits); + + /** + * 序列在id中占的位数 + */ + private final long sequenceBits = 12L; + + /** + * 机器ID向左移12位 + */ + private final long workerIdShift = sequenceBits; + + /** + * 数据标识id向左移17位(12+5) + */ + private final long datacenterIdShift = sequenceBits + workerIdBits; + + /** + * 时间截向左移22位(5+5+12) + */ + private final long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits; + + /** + * 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) + */ + private final long sequenceMask = -1L ^ (-1L << sequenceBits); + + /** + * 工作机器ID(0~31) + */ + private long workerId; + + /** + * 数据中心ID(0~31) + */ + private long datacenterId; + + /** + * 毫秒内序列(0~4095) + */ + private long sequence = 0L; + + /** + * 上次生成ID的时间截 + */ + private long lastTimestamp = -1L; + + //==============================Constructors===================================== + + /** + * 构造函数 + * + * @param workerId 工作ID (0~31) + * @param datacenterId 数据中心ID (0~31) + */ + public getRandomId(long workerId, long datacenterId) { + if (workerId > maxWorkerId || workerId < 0) { + throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId)); + } + if (datacenterId > maxDatacenterId || datacenterId < 0) { + throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId)); + } + this.workerId = workerId; + this.datacenterId = datacenterId; + } + + // ==============================Methods========================================== + + /** + * 获得下一个ID (该方法是线程安全的) + * + * @return SnowflakeId + */ + public synchronized long nextId() { + long timestamp = timeGen(); + + //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常 + if (timestamp < lastTimestamp) { + throw new RuntimeException( + String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); + } + + //如果是同一时间生成的,则进行毫秒内序列 + if (lastTimestamp == timestamp) { + sequence = (sequence + 1) & sequenceMask; + //毫秒内序列溢出 + if (sequence == 0) { + //阻塞到下一个毫秒,获得新的时间戳 + timestamp = tilNextMillis(lastTimestamp); + } + } + //时间戳改变,毫秒内序列重置 + else { + sequence = 0L; + } + + //上次生成ID的时间截 + lastTimestamp = timestamp; + + //移位并通过或运算拼到一起组成64位的ID + return (((timestamp - twepoch) << timestampLeftShift) + | (datacenterId << datacenterIdShift) + | (workerId << workerIdShift) + | sequence); + } + + /** + * 阻塞到下一个毫秒,直到获得新的时间戳 + * + * @param lastTimestamp 上次生成ID的时间截 + * @return 当前时间戳 + */ + protected long tilNextMillis(long lastTimestamp) { + long timestamp = timeGen(); + while (timestamp <= lastTimestamp) { + timestamp = timeGen(); + } + return timestamp; + } + + /** + * 返回以毫秒为单位的当前时间 + * + * @return 当前时间(毫秒) + */ + protected long timeGen() { + return System.currentTimeMillis(); + } + + //==============================Test============================================= + + /** + * 测试 + */ + public static void main(String[] args) { + long startTime = System.currentTimeMillis(); + Set familys = new HashSet<>(); + //存放已经被放入minor里面的户号,避免数据重复 + Set houseSet=new HashSet<>(); + Map minors=getMinors(); + Map> familyMaps=getFamilyMaps(); + if (oConvertUtils.isNotEmpty(minors)) { + for (Map.Entry m : minors.entrySet()) { + String idCard = m.getKey(); + Minor minor = m.getValue(); + Set f=new HashSet<>(); + //判断是否是一个家庭的人员 + if (oConvertUtils.isNotEmpty(minor.getHouseholdNum())) { + String houseNum = minor.getHouseholdNum(); + if(oConvertUtils.isNotEmpty(familyMaps) && oConvertUtils.isNotEmpty(familyMaps.get(houseNum)) ){ + if(!houseSet.contains(houseNum) ){ + familys.addAll(familyMaps.get(houseNum)); + houseSet.add(houseNum); + } + } + minor.setFamilies(f); + } + } + } + long endTime = System.currentTimeMillis(); + + System.out.println("endTime-startTime:" + (endTime - startTime)); + } + public static Map> getFamilyMaps(){ + Map> familyMaps=new HashMap<>(); + List familys=getFamilys(); + for(int i=0;i list = new ArrayList<>(); + list.add(family); + familyMaps.put(family.getHouseholdNum(),list); + } + + } + } + return familyMaps; + + } + + public static List getFamilys(){ + List familys=new ArrayList<>(); + for(int i=0;i<25;i++){ + Family f=new Family(); + if(i<5){ + f.setIdentity("#####################"+i); + f.setHouseholdNum("**************house"+0); + }else if(i<10){ + f.setIdentity("#####################"+i); + f.setHouseholdNum("**************house"+1); + }else if(i<15){ + f.setIdentity("#####################"+i); + f.setHouseholdNum("**************house"+2); + }else if(i<20){ + f.setIdentity("#####################"+i); + f.setHouseholdNum("**************house"+3); + }else if(i<25){ + f.setIdentity("#####################"+i); + f.setHouseholdNum("**************house"+4); + } + familys.add(f); + } + return familys; + + } + + public static Map getMinors(){ + Map minors=new HashMap<>(); + for(int i=0;i<10;i++){ + if(i<5){ + Minor m=new Minor(); + m.setIdentity("**************id"+i); + m.setHouseholdNum("**************house"+i); + minors.put("**************id"+i,m); + }else if(i<10){ + Minor m=new Minor(); + m.setIdentity("**************id"+i); + m.setHouseholdNum("**************house"+(i-5)); + minors.put("**************id"+i,m); + } + } + return minors; + + } + +} diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java index 9453c55..591ca22 100644 --- a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorPage.java @@ -67,6 +67,18 @@ public class MinorPage { @Excel(name = "身份证号", width = 20,needMerge=true) @ApiModelProperty(value = "身份证号") private String identity; + /**是否失学*/ + @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) + @ApiModelProperty(value = "是否失学") + @Dict(dicCode = "school_status") + private Integer school; + /**学校名称*/ + @Excel(name = "学校名称", width = 15,needMerge=true) + @ApiModelProperty(value = "学校名称") + private String schoolName; + @Excel(name = "入学年份", width = 15) + @ApiModelProperty(value = "入学年份") + private String startYear; /**家庭住址*/ @Excel(name = "家庭住址", width = 20,needMerge=true) @ApiModelProperty(value = "家庭住址") @@ -84,18 +96,6 @@ public class MinorPage { @Excel(name = "监护人关系", width = 15,needMerge=true) @ApiModelProperty(value = "监护人关系") private String relation; - /**是否失学*/ - @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) - @ApiModelProperty(value = "是否失学") - @Dict(dicCode = "school_status") - private Integer school; - /**学校名称*/ - @Excel(name = "学校名称", width = 15,needMerge=true) - @ApiModelProperty(value = "学校名称") - private String schoolName; - @Excel(name = "入学年份", width = 15) - @ApiModelProperty(value = "入学年份") - private String startYear; /**重点关注原因*/ @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") @ApiModelProperty(value = "重点关注原因") diff --git a/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorVo.java b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorVo.java new file mode 100644 index 0000000..9aeafd9 --- /dev/null +++ b/juvenile-prosecution-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/vo/MinorVo.java @@ -0,0 +1,104 @@ +package org.jeecg.modules.system.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecg.common.aspect.annotation.Dict; +import org.jeecg.modules.system.entity.Family; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; +import java.util.List; + +/** + * @Description: 未成年人 + * @Author: jeecg-boot + * @Date: 2022-07-13 + * @Version: V1.0 + */ +@Data +@ApiModel(value="mr_minorPage对象", description="未成年人") +public class MinorVo { + + /**主键*/ + @ApiModelProperty(value = "主键") + private String id; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + @Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") + private String sysOrgCode; + /**户号*/ + @Excel(name = "户号", width = 25,needMerge=true) + @ApiModelProperty(value = "户号") + private String householdNum; + /**人员编号*/ + @Excel(name = "人员编号", width = 25,needMerge=true) + @ApiModelProperty(value = "人员编号") + private String number; + /**姓名*/ + @Excel(name = "姓名", width = 15,needMerge=true) + @ApiModelProperty(value = "姓名") + private String name; + /**性别*/ + @Excel(name = "性别", width = 15,dicCode = "sex",needMerge=true) + @ApiModelProperty(value = "性别") + @Dict(dicCode = "sex") + private Integer gender; + /**身份证号*/ + @Excel(name = "身份证号", width = 20,needMerge=true) + @ApiModelProperty(value = "身份证号") + private String identity; + /**是否失学*/ + @Excel(name = "是否失学", width = 10,dicCode = "school_status",needMerge=true) + @ApiModelProperty(value = "是否失学") + @Dict(dicCode = "school_status") + private Integer school; + /**学校名称*/ + @Excel(name = "学校名称", width = 15,needMerge=true) + @ApiModelProperty(value = "学校名称") + private String schoolName; + @Excel(name = "入学年份", width = 15) + @ApiModelProperty(value = "入学年份") + private String startYear; + /**家庭住址*/ + @Excel(name = "家庭住址", width = 20,needMerge=true) + @ApiModelProperty(value = "家庭住址") + private String address; + /** + * 监护人 + */ + @Excel(name = "监护人", width = 15,needMerge=true) + @ApiModelProperty(value = "监护人") + private String guardian; + + /** + * 监护人关系 + */ + @Excel(name = "监护人关系", width = 15,needMerge=true) + @ApiModelProperty(value = "监护人关系") + private String relation; + /**重点关注原因*/ + @Excel(name = "重点关注原因", width = 15,dicCode = "attention_reason") + @ApiModelProperty(value = "重点关注原因") + @Dict(dicCode = "attention_reason") + private Integer reason; + /**特殊原因*/ + @Excel(name = "特殊原因", width = 15) + @ApiModelProperty(value = "特殊原因") + private String specialReason; + /**备注*/ + @Excel(name = "备注", width = 25,needMerge=true) + @ApiModelProperty(value = "备注") + private String remark; + + private String age; + +} diff --git a/juvenile-prosecution-vue/src/utils/util.js b/juvenile-prosecution-vue/src/utils/util.js index acff7bd..41dc65b 100644 --- a/juvenile-prosecution-vue/src/utils/util.js +++ b/juvenile-prosecution-vue/src/utils/util.js @@ -568,7 +568,7 @@ export function removeArrayElement(array, prod, value) { * @constructor */ export function GetAge(identityCard) { - console.log(identityCard) + // console.log(identityCard) var len = (identityCard + "").length; if (len == 0) { return 0; @@ -590,8 +590,8 @@ export function GetAge(identityCard) { var birthDate = new Date(strBirthday); var nowDateTime = new Date(); var age = nowDateTime.getFullYear() - birthDate.getFullYear(); - console.log(nowDateTime.getFullYear()) - console.log(birthDate.getFullYear()) + // console.log(nowDateTime.getFullYear()) + // console.log(birthDate.getFullYear()) //再考虑月、天的因素;.getMonth()获取的是从0开始的,这里进行比较,不需要加1 if (nowDateTime.getMonth() < birthDate.getMonth() || (nowDateTime.getMonth() == birthDate.getMonth() && nowDateTime.getDate() < birthDate.getDate())) { age--; diff --git a/juvenile-prosecution-vue/src/views/business/MinorList.vue b/juvenile-prosecution-vue/src/views/business/MinorList.vue index 3ce1fe8..a984f5f 100644 --- a/juvenile-prosecution-vue/src/views/business/MinorList.vue +++ b/juvenile-prosecution-vue/src/views/business/MinorList.vue @@ -49,7 +49,7 @@ ref="table" size="middle" bordered - rowKey="id" + rowKey="identity" class="j-table-force-nowrap" :scroll="{x:true}" :columns="columns" @@ -71,8 +71,10 @@ - + + {{ info.householdNum }} + {{ info.number }} {{ info.name }} {{ info.gender_dictText }} {{ getAgeByIdentity(info.identity) }} @@ -85,13 +87,16 @@ {{ info.schoolName }} {{ info.guardian }} {{ info.relation }} - {{ info.reason_dictText }} - {{ info.specialReason }} + {{ info.reason_dictText }} + {{ info.specialReason }} {{ info.remark }} - + + + + @@ -108,7 +113,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { GetAge } from '@/utils/util' import MinorModal from './modules/MinorModal' import '@/assets/less/TableExpand.less' -import { getAction } from '@api/manage' +import { getAction,downFile } from '@api/manage' import { FormTypes } from '@/utils/JEditableTableUtil' //引入JS方法 import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil' @@ -131,6 +136,7 @@ export default { title: '序号', dataIndex: '', key: 'rowIndex', + fixed: 'left', width: 60, align: 'center', customRender: function(t, r, index) { @@ -140,6 +146,8 @@ export default { { title: '姓名', align: 'center', + fixed: 'left', + width: 80, dataIndex: 'name' }, { @@ -219,16 +227,6 @@ export default { // 表头 familyColumns: [ { - title: '户号', - align: 'center', - dataIndex: 'householdNum' - }, - { - title: '人员编号', - align: 'center', - dataIndex: 'number' - }, - { title: '姓名', align: 'center', dataIndex: 'name' @@ -280,15 +278,15 @@ export default { /* 分页参数 */ familyPagination: { current: 1, - pageSize: 3, + pageSize: 20, hideOnSinglePage: true, showTotal: (total, range) => { return range[0] + '-' + range[1] + ' 共' + total + '条' }, showQuickJumper: true, - showSizeChanger: true, total: 0 - } + }, + familyLoading:false, } }, created() { @@ -304,16 +302,54 @@ export default { return GetAge(identity) }, handleDetail(record) { - var that = this - let params = { id: record.id } - getAction(this.url.familys, params).then(res => { - that.info = record - that.infoVisible = true - that.familyDatas = res.result || [] - }).finally(() => { - that.infoVisible = true + var that = this; + that.info = record; + that.infoVisible = true; + that.familyDatas=[]; + if(null!==record.householdNum && ''!==record.householdNum && undefined!==record.householdNum){ + let params = { householdNum: record.householdNum } + that.familyLoading=true; + getAction(this.url.familys, params).then(res => { + if (res.success) { + that.familyLoading=false; + that.familyDatas = res.result || [] + } else { + that.familyLoading=false; + } + }) + } + }, + handleImportModel: function(name, type) { + if (!name || typeof name != 'string') { + name = '导出文件' + } + let param = { 'fileName': name, 'type': type } + console.log('导出参数', param) + downFile(this.url.importExcelUrl, param).then((data) => { + console.log(data) + if (!data) { + this.$message.warning('文件下载失败') + return + } + console.log(window.navigator.msSaveBlob) + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data]), name + '.xlsx') + } else { + let url = window.URL.createObjectURL(new Blob([data])) + console.log(url) + let link = document.createElement('a') + console.log(link) + link.style.display = 'none' + link.href = url + link.setAttribute('download', name + '.xlsx') + console.log(link) + document.body.appendChild(link) + link.click() + console.log(link) + document.body.removeChild(link) //下载完成移除元素 + window.URL.revokeObjectURL(url) //释放掉blob对象 + } }) - }, initDictConfig() { }, @@ -332,11 +368,11 @@ export default { - \ No newline at end of file + diff --git a/juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue b/juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue index f63206c..44bb906 100644 --- a/juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue +++ b/juvenile-prosecution-vue/src/views/business/modules/MinorModal.vue @@ -15,6 +15,18 @@ + + + + + + + + + + + + @@ -25,6 +37,11 @@ + + + + + @@ -44,11 +61,6 @@ - - - - - @@ -69,7 +81,7 @@ - + @@ -143,7 +155,6 @@ export default { }, validatorRules: { householdNum:[ { required: true, message: '请输入户号' },], - number:[ { required: true, message: '请输入人员编号' },], name:[ { required: true, message: '请输入姓名' },], gender:[ { required: true, message: '请选择性别' },], identity:[ {required: true,validator:this.validateIdCard}], @@ -305,8 +316,8 @@ export default { this.model = Object.assign({}, record) this.visible = true // 加载子表数据 - if (this.model.id) { - let params = { id: this.model.id } + if (this.model.householdNum) { + let params = { householdNum: this.model.householdNum } this.requestTableData(this.url.familys, params) } }, diff --git a/juvenile-prosecution-vue/src/views/system/UserList.vue b/juvenile-prosecution-vue/src/views/system/UserList.vue index b2eda87..b7104a6 100644 --- a/juvenile-prosecution-vue/src/views/system/UserList.vue +++ b/juvenile-prosecution-vue/src/views/system/UserList.vue @@ -314,14 +314,11 @@ }, methods: { doAnalyze(){ - putAction('/sys/analyze/doAnalyzeData', {}).then((res) => { - console.log(res) - }) + putAction('/sys/analyze/doAnalyzeData', {}) // let self = this; // let apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot"; - // self.$axios.put('/sys/analyze/doAnalyzeData').then(res => { + // self.$axios.put(apiBaseUrl+'/sys/analyze/doAnalyzeData').then(res => { // console.log(res) - // // }) }, getAvatarView: function (avatar) {