当前位置 : 主页 > 编程语言 > java >

Dozer对象复制工具,即使两个不一样的对象,使用注解的方式,可以把对象映射

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt import org.dozer.DozerBeanMapper;import org.dozer.Mapper; //新增操作的时候操作税务接口 Mapper mapper = new DozerBeanMapper();Nonresident nonresident = mapper.map(baseLeaserVO, Nonresident.class);nonresident.setJNW
gistfile1.txt
import org.dozer.DozerBeanMapper;
import org.dozer.Mapper;

        //新增操作的时候操作税务接口
        Mapper mapper = new DozerBeanMapper();
		Nonresident nonresident = mapper.map(baseLeaserVO, Nonresident.class);
		nonresident.setJNWJGSFGL(nonresident.getJNWJGSFGL().equals("是") ? "1":"0");
		// 财务联系人
		nonresident.setCWFZR(baseLeaserVO.getBaseContact().getFinaceAdmin());
		nonresident.setCONTACT(baseLeaserVO.getBaseContact().getContactName());
		nonresident.setPHONENO(baseLeaserVO.getBaseContact().getTelephone());
		nonresident.setFAXNO(baseLeaserVO.getBaseContact().getFax());
        // 获取国家代码
        BaseCountry baseCountry = baseCountryService.queryCountryByName(nonresident.getNACODE());
        nonresident.setNACODE(baseCountry.getCountryNo());
        // 收款人信息
		List
 
   payeeList = baseLeaserVO.getPayeeList();
		List
  
    paymentList = new ArrayList<>(); if(CollectionUtils.isNotEmpty(payeeList)){ payeeList.forEach(action->{ BasePayeeVO findOneByPayeeById = basePayeeService.findOneByPayeeById(action.getPayeeId()); List
   
     infos = findOneByPayeeById.getInfos(); Iterator
    
      iterator = infos.iterator(); while(iterator.hasNext()){ BaseBankAccount next = iterator.next(); Payment payment = mapper.map(next, Payment.class); paymentList.add(payment); } }); }
    
   
  
 
网友评论