| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.community.acid.ComActAcidRecordDTO; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.acid.*; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActAcidDangerMemberDao; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.entity.ComActAcidDangerMember; |
| | | import com.panzhihua.service_community.entity.ComActAcidRecord; |
| | | import com.panzhihua.service_community.dao.ComActAcidRecordDao; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.service.ComActAcidRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | |
| | | private RabbitTemplate rabbitTemplate; |
| | | @Resource |
| | | private ComActAcidDangerMemberDao comActAcidDangerMemberDao; |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private ComActDAO comActDAO; |
| | | |
| | | @Override |
| | | public R pageList(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | |
| | | |
| | | @Override |
| | | public R export(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | | List<ComActAcidRecordExcelVO> comActAcidRecordExcelVOS=this.baseMapper.export(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(StringUtils.isEmpty(comActAcidRecordVO.getLocalCity())){ |
| | | rabbitTemplate.convertAndSend("huacheng.acid.exchange", "huacheng.acid.key", comActAcidRecordVO, message -> { |
| | | message.getMessageProperties().setHeader("x-delay", 24*60*60*1000); |
| | | message.getMessageProperties().setHeader("x-delay", 2*60*60*1000); |
| | | return message; |
| | | }); |
| | | } |
| | | else { |
| | | rabbitTemplate.convertAndSend("huacheng.acid.direct.exchange", "huacheng.acid.direct.key", comActAcidRecordVO); |
| | | } |
| | | ComActAcidRecord comActAcidRecord=new ComActAcidRecord(); |
| | | BeanUtils.copyProperties(comActAcidRecordVO,comActAcidRecord); |
| | |
| | | ComActAcidDangerMemberVO dangerMemberVO = new ComActAcidDangerMemberVO(); |
| | | BeanUtils.copyProperties(dangerMember, dangerMemberVO); |
| | | rabbitTemplate.convertAndSend("huacheng.acid.danger.exchange", "huacheng.acid.danger.key", dangerMemberVO, message -> { |
| | | message.getMessageProperties().setHeader("x-delay", 5*60*1000); |
| | | message.getMessageProperties().setHeader("x-delay", 1*60*1000); |
| | | return message; |
| | | }); |
| | | } |
| | |
| | | } |
| | | return R.ok(comAcidStaticVOS); |
| | | } |
| | | |
| | | @Override |
| | | public R updateLocalCity(ComActAcidRecordVO comActAcidRecordVO) { |
| | | ComActAcidRecord comActAcidRecord=new ComActAcidRecord(); |
| | | BeanUtils.copyProperties(comActAcidRecordVO,comActAcidRecord); |
| | | if(StringUtils.isNotEmpty(comActAcidRecord.getLocalCity())){ |
| | | ComActAcidDangerMember comActAcidDangerMember= comActAcidDangerMemberDao.selectOne(new QueryWrapper<ComActAcidDangerMember>().lambda().eq(ComActAcidDangerMember::getRecordId,comActAcidRecordVO.getId())); |
| | | if(comActAcidDangerMember!=null){ |
| | | if(comActAcidDangerMember.getType()==2){ |
| | | this.comActAcidDangerMemberDao.deleteById(comActAcidDangerMember.getId()); |
| | | } |
| | | else { |
| | | comActAcidDangerMember.setRelationName(comActAcidRecord.getLocalCity()); |
| | | this.comActAcidDangerMemberDao.updateById(comActAcidDangerMember); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(this.baseMapper.updateById(comActAcidRecord)); |
| | | } |
| | | } |