package org.springblade.modules.guosen.bussiness.wrapper;

import org.springblade.common.utils.MoneyDesUtil;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.guosen.bussiness.entity.Bussiness;
import org.springblade.modules.guosen.bussiness.vo.BussinessVO;

import java.util.Objects;

/**
 * Created By lidexi in 2021/8/6
 **/
public class BussinessWrapper extends BaseEntityWrapper<Bussiness, BussinessVO> {

	public static BussinessWrapper build(){
		return new BussinessWrapper();
	}
	@Override
	public BussinessVO entityVO(Bussiness bussiness) {
		BussinessVO bussinessVO = Objects.requireNonNull(BeanUtil.copy(bussiness,BussinessVO.class));
		bussinessVO.setUserPassword(null);
		bussinessVO.setRemain(MoneyDesUtil.decrypt(bussiness.getRemain(), MoneyDesUtil.KEY_FOR_UC));
		return bussinessVO;
	}
}
