| | |
| | | |
| | | import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty; |
| | | import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNull; |
| | | import static org.apache.commons.lang3.StringUtils.isBlank; |
| | | |
| | | /** |
| | | * (ComActAcidRecord)表服务实现类 |
| | |
| | | @Override |
| | | public R export(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | | List<ComActAcidRecordExcelReturn> comActAcidRecordExcelVOS=this.baseMapper.export(comActAcidRecordDTO); |
| | | comActAcidRecordExcelVOS.forEach(comActAcidRecordExcelVO -> { |
| | | if(StringUtils.isNotEmpty(comActAcidRecordExcelVO.getTouristCity())&&comActAcidRecordExcelVO.getTouristCity().contains("[")){ |
| | | JSONArray jsonArray = JSON.parseArray(comActAcidRecordExcelVO.getTouristCity()); |
| | | if(jsonArray.isEmpty()){ |
| | | comActAcidRecordExcelVO.setTouristCity(""); |
| | | } |
| | | else { |
| | | StringBuilder touristCity= new StringBuilder(); |
| | | for(int i=0;i<jsonArray.size();i++){ |
| | | JSONObject jsonObject=jsonArray.getJSONObject(i); |
| | | String name=jsonObject.getString("name"); |
| | | if(StringUtils.isNotEmpty(name)){ |
| | | touristCity.append(name).append(";"); |
| | | } |
| | | } |
| | | comActAcidRecordExcelVO.setTouristCity(touristCity.toString()); |
| | | } |
| | | } |
| | | }); |
| | | return R.ok(comActAcidRecordExcelVOS); |
| | | } |
| | | |
| | | @Override |
| | | public R exportNew(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | | List<ComActAcidRecordExcelReturn> comActAcidRecordExcelVOS=this.baseMapper.exportNew(comActAcidRecordDTO); |
| | | comActAcidRecordExcelVOS.forEach(comActAcidRecordExcelVO -> { |
| | | if(StringUtils.isNotEmpty(comActAcidRecordExcelVO.getTouristCity())&&comActAcidRecordExcelVO.getTouristCity().contains("[")){ |
| | | JSONArray jsonArray = JSON.parseArray(comActAcidRecordExcelVO.getTouristCity()); |
| | |
| | | relationName = localCity; |
| | | } else { |
| | | String realAddress = comActAcidRecordVO.getRealAddress(); |
| | | if (realAddress.contains("攀枝花")) { |
| | | if (realAddress.contains("区")) { |
| | | relationName = realAddress.substring(realAddress.indexOf("市") + 1, realAddress.indexOf("区") + 1); |
| | | } else { |
| | | relationName = realAddress.substring(realAddress.indexOf("市") + 1, realAddress.indexOf("县") + 1); |
| | | if(isNotEmpty(realAddress)){ |
| | | if (realAddress.contains("攀枝花")) { |
| | | if (realAddress.contains("区")) { |
| | | relationName = realAddress.substring(realAddress.indexOf("市") + 1, realAddress.indexOf("区") + 1); |
| | | } else { |
| | | relationName = realAddress.substring(realAddress.indexOf("市") + 1, realAddress.indexOf("县") + 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ComActAcidDangerMember dangerMember = comActAcidDangerMemberDao.selectOne(new LambdaQueryWrapper<ComActAcidDangerMember>() |
| | | .eq(ComActAcidDangerMember::getIdCard, comActAcidRecordVO.getIdCard()).eq(ComActAcidDangerMember::getRelationName, relationName)); |
| | | .eq(ComActAcidDangerMember::getIdCard, comActAcidRecordVO.getIdCard()).eq(ComActAcidDangerMember::getRecordId, recordId)); |
| | | if (isNull(dangerMember)) { |
| | | dangerMember = new ComActAcidDangerMember(); |
| | | dangerMember.setName(comActAcidRecordVO.getName()); |
| | |
| | | dangerMember.setRecordId(recordId); |
| | | dangerMember.setIdCard(comActAcidRecordVO.getIdCard()); |
| | | dangerMember.setSource(1); |
| | | dangerMember.setStatus(6); |
| | | dangerMember.setType(type); |
| | | dangerMember.setRelationName(relationName); |
| | | dangerMember.setUpdateTime(new Date()); |
| | |
| | | public R updateLocalCity(ComActAcidRecordVO comActAcidRecordVO) { |
| | | ComActAcidRecord comActAcidRecord = new ComActAcidRecord(); |
| | | BeanUtils.copyProperties(comActAcidRecordVO, comActAcidRecord); |
| | | String idCard = comActAcidRecordVO.getIdCard(); |
| | | if (isBlank(idCard)) { |
| | | //只修改地址,其他信息需要查询 |
| | | ComActAcidRecord comActAcidRecord1 = this.baseMapper.selectById(comActAcidRecordVO.getId()); |
| | | if (isNull(comActAcidRecord1)) { |
| | | return R.fail("填报纪录不存在"); |
| | | } |
| | | String localCity = comActAcidRecordVO.getLocalCity(); |
| | | String localAddress = comActAcidRecordVO.getLocalAddress(); |
| | | BeanUtils.copyProperties(comActAcidRecord1, comActAcidRecordVO); |
| | | comActAcidRecordVO.setLocalCity(localCity); |
| | | comActAcidRecordVO.setLocalAddress(localAddress); |
| | | } |
| | | ComActAcidDangerMember comActAcidDangerMember = |
| | | comActAcidDangerMemberDao.selectOne(new QueryWrapper<ComActAcidDangerMember>().lambda() |
| | | .eq(ComActAcidDangerMember::getRecordId, comActAcidRecordVO.getId())); |
| | | .eq(ComActAcidDangerMember::getRecordId, comActAcidRecordVO.getId()).orderByDesc(ComActAcidDangerMember::getCreateTime).last("limit 1")); |
| | | String colorMark = comActAcidRecordVO.getColorMark(); |
| | | String travelCard = comActAcidRecordVO.getTravelCard(); |
| | | String dangerArea = comActAcidRecordVO.getDangerArea(); |
| | |
| | | } |
| | | return R.ok(this.baseMapper.updateById(comActAcidRecord)); |
| | | } |
| | | |
| | | @Override |
| | | public R delete(Long id) { |
| | | ComActAcidRecord comActAcidRecord=new ComActAcidRecord(); |
| | | comActAcidRecord.setId(id); |
| | | comActAcidRecord.setIsDel(1); |
| | | this.baseMapper.updateById(comActAcidRecord); |
| | | List<ComActAcidDangerMember> comActAcidDangerMembers=this.comActAcidDangerMemberDao.selectList(new QueryWrapper<ComActAcidDangerMember>().lambda().eq(ComActAcidDangerMember::getRecordId,id)); |
| | | comActAcidDangerMembers.forEach(comActAcidDangerMember -> { |
| | | comActAcidDangerMember.setIsDel(1); |
| | | this.comActAcidDangerMemberDao.updateById(comActAcidDangerMember); |
| | | }); |
| | | return R.ok(); |
| | | } |
| | | } |