| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.vos.community.acid.ComAcidStaticVO; |
| | | import com.panzhihua.common.model.vos.community.acid.ComActAcidRecordVO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActAcidDangerMemberDao; |
| | | 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.service.ComActAcidRecordService; |
| | |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import static com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNull; |
| | | |
| | | /** |
| | | * (ComActAcidRecord)表服务实现类 |
| | |
| | | |
| | | @Resource |
| | | private RabbitTemplate rabbitTemplate; |
| | | @Resource |
| | | private ComActAcidDangerMemberDao comActAcidDangerMemberDao; |
| | | |
| | | @Override |
| | | public R pageList(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | | return R.ok(this.baseMapper.pageList(new Page<>(comActAcidRecordDTO.getPage(), comActAcidRecordDTO.getSize()),comActAcidRecordDTO)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R insertRecord(ComActAcidRecordVO comActAcidRecordVO) { |
| | | if(StringUtils.isEmpty(comActAcidRecordVO.getLocalCity())){ |
| | | rabbitTemplate.convertAndSend("huacheng.acid.exchange", "huacheng.acid.key", comActAcidRecordVO, message -> { |
| | |
| | | ComActAcidRecord comActAcidRecord=new ComActAcidRecord(); |
| | | BeanUtils.copyProperties(comActAcidRecordVO,comActAcidRecord); |
| | | comActAcidRecord.setCreateTime(new Date()); |
| | | return R.ok(this.save(comActAcidRecord)); |
| | | int result = this.baseMapper.insert(comActAcidRecord); |
| | | if (result > 0) { |
| | | String colorMark = comActAcidRecordVO.getColorMark(); |
| | | String travelCard = comActAcidRecordVO.getTravelCard(); |
| | | String dangerArea = comActAcidRecordVO.getDangerArea(); |
| | | String outsideCity = comActAcidRecordVO.getOutsideCity(); |
| | | String acidTest = comActAcidRecordVO.getAcidTest(); |
| | | if (StringUtils.inStringIgnoreCase(colorMark, "红码", "黄码") || travelCard.equals("是") |
| | | || dangerArea.equals("是") || outsideCity.equals("是") || acidTest.equals("阳性")) { |
| | | ComActAcidDangerMember dangerMember = comActAcidDangerMemberDao.selectOne(new LambdaQueryWrapper<ComActAcidDangerMember>() |
| | | .eq(ComActAcidDangerMember::getIdCard, comActAcidRecordVO.getIdCard())); |
| | | if (isNull(dangerMember)) { |
| | | dangerMember = new ComActAcidDangerMember(); |
| | | dangerMember.setName(comActAcidRecordVO.getName()); |
| | | dangerMember.setPhone(comActAcidRecordVO.getPhone()); |
| | | dangerMember.setRecordId(comActAcidRecord.getId()); |
| | | dangerMember.setSource(1); |
| | | dangerMember.setStatus(6); |
| | | dangerMember.setType(1); |
| | | dangerMember.setCreateTime(new Date()); |
| | | comActAcidDangerMemberDao.insert(dangerMember); |
| | | } else { |
| | | dangerMember.setName(comActAcidRecordVO.getName()); |
| | | dangerMember.setPhone(comActAcidRecordVO.getPhone()); |
| | | dangerMember.setRecordId(comActAcidRecord.getId()); |
| | | dangerMember.setSource(1); |
| | | dangerMember.setStatus(6); |
| | | dangerMember.setType(1); |
| | | dangerMember.setUpdateTime(new Date()); |
| | | comActAcidDangerMemberDao.updateById(dangerMember); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | return R.fail("操作失败,请重新尝试"); |
| | | } |
| | | |
| | | @Override |