| | |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.entity.ComActAcidDangerMember; |
| | | import com.panzhihua.service_community.entity.ComActAcidRecord; |
| | | import com.panzhihua.service_community.entity.ComActAcidUpdateRecord; |
| | | import com.panzhihua.service_community.entity.*; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.model.dos.ComStreetDO; |
| | | import com.panzhihua.service_community.service.ComActAcidRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.amqp.rabbit.core.RabbitTemplate; |
| | |
| | | private ComActAcidUpdateRecordDao comActAcidUpdateRecordDao; |
| | | @Resource |
| | | private ComAreaTownCommunityDao comAreaTownCommunityDao; |
| | | @Resource |
| | | private ComCunDao comCunDao; |
| | | @Resource |
| | | private ComStreetDAO comStreetDAO; |
| | | @Resource |
| | | private SysUserDao sysUserDao; |
| | | |
| | | @Override |
| | | public R pageList(ComActAcidRecordDTO comActAcidRecordDTO) { |
| | |
| | | } |
| | | return R.ok(comActAcidRecordVO); |
| | | } |
| | | |
| | | @Override |
| | | public R test() { |
| | | List<ComCun> comCuns=comCunDao.selectList(new QueryWrapper<ComCun>()); |
| | | comCuns.forEach(comCun->{ |
| | | ComActDO comActDO= comActDAO.selectOne(new QueryWrapper<ComActDO>().lambda().eq(ComActDO::getName,comCun.getCommunity())); |
| | | if(comActDO==null){ |
| | | ComStreetDO comStreetDO = comStreetDAO.selectOne(new QueryWrapper<ComStreetDO>().lambda().eq(ComStreetDO::getName,comCun.getTown())); |
| | | if(comStreetDO==null){ |
| | | comStreetDO=new ComStreetDO(); |
| | | comStreetDO.setName(comCun.getTown()); |
| | | areaCheck(comCun,comStreetDO); |
| | | comStreetDO.setAccount(comCun.getAccount()); |
| | | comStreetDAO.insert(comStreetDO); |
| | | } |
| | | comActDO=new ComActDO(); |
| | | comActDO.setStreetId(comStreetDO.getStreetId()); |
| | | comActDO.setAreaCode(comStreetDO.getAreaCode().toString()); |
| | | comActDO.setName(comCun.getCommunity()); |
| | | comActDO.setContacts(comCun.getName()); |
| | | comActDO.setContactsPhone(comCun.getPhone()); |
| | | comActDAO.insert(comActDO); |
| | | } |
| | | ComAreaTownCommunity community=comAreaTownCommunityDao.selectOne(new QueryWrapper<ComAreaTownCommunity>().lambda().eq(ComAreaTownCommunity::getArea,comCun.getArea()).eq(ComAreaTownCommunity::getTown,comCun.getTown()).eq(ComAreaTownCommunity::getCommunity,comCun.getCommunity())); |
| | | if(community==null){ |
| | | community=new ComAreaTownCommunity(); |
| | | community.setArea(comCun.getArea()); |
| | | community.setTown(comCun.getTown()); |
| | | community.setCommunity(comCun.getCommunity()); |
| | | comAreaTownCommunityDao.insert(community); |
| | | }else { |
| | | community.setCommunityId(comActDO.getCommunityId()); |
| | | comAreaTownCommunityDao.updateById(community); |
| | | } |
| | | SysUser sysUser=sysUserDao.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getAccount,comCun.getAccount())); |
| | | if(sysUser!=null){ |
| | | System.out.println(comCun.getAccount()+","+comCun.getCommunity()); |
| | | } |
| | | else { |
| | | sysUser=new SysUser(); |
| | | sysUser.setAccount(comCun.getAccount()); |
| | | sysUser.setPassword("$2a$10$F/2lE2NMhKNHJfi5.FLmfu7jIr7ImRWgCTTeO6m3IRNR2V4sv8YR."); |
| | | sysUser.setName(comCun.getCommunity()); |
| | | sysUser.setType(9); |
| | | sysUserDao.insert(sysUser); |
| | | } |
| | | }); |
| | | return null; |
| | | } |
| | | |
| | | public static void areaCheck(ComCun area,ComStreetDO comStreetDO){ |
| | | switch (area.getArea()){ |
| | | case "西区": comStreetDO.setAreaCode(510423); break; |
| | | case "东区": comStreetDO.setAreaCode(510402); break; |
| | | case "仁和区": comStreetDO.setAreaCode(510411); break; |
| | | case "米易县": comStreetDO.setAreaCode(510421); break; |
| | | case "盐边县": comStreetDO.setAreaCode(510422); break; |
| | | } |
| | | } |
| | | } |