| | |
| | | public R addExpert(ComSanshuoExpertDTO comSanshuoExpertDTO) { |
| | | ComSanshuoExpert expert=new ComSanshuoExpert(); |
| | | BeanUtil.copyProperties(comSanshuoExpertDTO,expert); |
| | | //处理id |
| | | if (nonNull(comSanshuoExpertDTO.getUnit())){ |
| | | String id = comSanshuoExpertDTO.getUnit(); |
| | | String[] split = id.split(","); |
| | | comSanshuoExpertDTO.setUnitId(split[split.length]); |
| | | } |
| | | expert.setId(Snowflake.getId()); |
| | | expert.setCreateTime(new Date()); |
| | | if (expert.getLevel()==2){ |
| | | expert.setIndustryCenterId(Long.parseLong(expert.getUnit())); |
| | | expert.setIndustryCenterId(Long.parseLong(comSanshuoExpertDTO.getUnitId())); |
| | | }else if(expert.getLevel()==3){ |
| | | expert.setStreetId(Long.parseLong(expert.getUnit())); |
| | | expert.setStreetId(Long.parseLong(comSanshuoExpertDTO.getUnitId())); |
| | | }else if(expert.getLevel()==4){ |
| | | expert.setCommunityId(Long.parseLong(expert.getUnit())); |
| | | expert.setCommunityId(Long.parseLong(comSanshuoExpertDTO.getUnitId())); |
| | | } |
| | | int insert = comSanshuoExpertDao.insert(expert); |
| | | if (insert>0){ |