| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.system.export.OldsterImport; |
| | | import com.ruoyi.system.model.TNotice; |
| | | import com.ruoyi.system.model.TOldster; |
| | | import com.ruoyi.system.query.BannerListQuery; |
| | | import com.ruoyi.system.query.OldsterListQuery; |
| | |
| | | oldsterService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看老人户籍信息详情 |
| | | */ |
| | | @ApiOperation(value = "查看老人户籍信息详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TOldster> getDetailById(@RequestParam String id) { |
| | | return R.ok(oldsterService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除老人户籍信息 |
| | | */ |
| | |
| | | } |
| | | } |
| | | } |
| | | @Log(title = "老人户籍信息导入", businessType = BusinessType.INSERT) |
| | | @Log(title = "老人户籍信息-老人户籍信息导入", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "老人户籍信息导入") |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
| | | @PostMapping("/import") |
| | | public R<String> importLocation(@RequestPart("file") MultipartFile file) { |
| | | public R<String> importInfo(@RequestPart("file") MultipartFile file) { |
| | | List<TOldster> oldsters = new ArrayList<>(); |
| | | ImportParams params = new ImportParams(); |
| | | params.setHeadRows(1); //表头行数 |
| | |
| | | for (OldsterImport oldsterImport : assetHouseInspectionImports) { |
| | | if (!StringUtils.hasLength(oldsterImport.getOldsterName())){ |
| | | result.append("第"+i+"行:[", "老人姓名"+"]不能为空"); |
| | | continue; |
| | | } |
| | | if (oldsterImport.getOldsterAge()!=null){ |
| | | if (oldsterImport.getOldsterAge()==null){ |
| | | result.append("第"+i+"行:[", "老人年龄"+"]不能为空"); |
| | | continue; |
| | | } |
| | | if (oldsterImport.getOldsterSex()!=null){ |
| | | if (!StringUtils.hasLength(oldsterImport.getOldsterSexStr())){ |
| | | result.append("第"+i+"行:[", "老人性别"+"]不能为空"); |
| | | continue; |
| | | } |
| | | if (!StringUtils.hasLength(oldsterImport.getContactPhone())){ |
| | | result.append("第"+i+"行:[", "联系方式"+"]不能为空"); |
| | | continue; |
| | | } |
| | | if (oldsterImport.getOldsterType()!=null){ |
| | | if (!StringUtils.hasLength(oldsterImport.getOldsterTypeStr())){ |
| | | result.append("第"+i+"行:[", "人员类型"+"]不能为空"); |
| | | continue; |
| | | } |
| | | if (!StringUtils.hasLength(oldsterImport.getAddress())){ |
| | | result.append("第"+i+"行:[", "居住地址"+"]不能为空"); |
| | | continue; |
| | | } |
| | | TOldster tOldster = new TOldster(); |
| | | BeanUtils.copyProperties(oldsterImport, tOldster); |
| | | if(StringUtils.hasLength(oldsterImport.getBirthDateStr())){ |
| | | try{ |
| | | LocalDate localDate = DateUtils.stringToLocalDate(oldsterImport.getBirthDateStr()); |
| | | tOldster.setBirthDate(localDate); |
| | | }catch (Exception e){ |
| | | result.append("第"+i+"行:[", "出生日期"+"]格式错误"); |
| | | continue; |
| | | } |
| | | } |
| | | switch (oldsterImport.getOldsterSexStr()){ |
| | | case "男": |
| | | tOldster.setOldsterSex(1); |
| | | break; |
| | | case "女": |
| | | tOldster.setOldsterSex(2); |
| | | break; |
| | | } |
| | | switch (oldsterImport.getOldsterTypeStr()){ |
| | | case "独居老人": |
| | | tOldster.setOldsterType(1); |
| | | break; |
| | | case "高龄老人": |
| | | tOldster.setOldsterType(2); |
| | | break; |
| | | case "散居特困供养老人": |
| | | tOldster.setOldsterType(3); |
| | | break; |
| | | case "失能老人": |
| | | tOldster.setOldsterType(4); |
| | | break; |
| | | } |
| | | oldsters.add(tOldster); |
| | | i++; |
| | | } |