package cn.pluss.platform.converter;

import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantStore;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.entity.UserInfo;
import java.text.SimpleDateFormat;
import javax.annotation.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-01-29T10:16:06+0800",
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_362 (Amazon.com Inc.)"
)
public class UserAppConverterImpl implements UserAppConverter {

    @Override
    public void copyProperties(MerchantStore merchantStore, UserApp userApp) {
        if ( merchantStore == null ) {
            return;
        }

        if ( merchantStore.getId() != null ) {
            userApp.setStoreId2( String.valueOf( merchantStore.getId() ) );
        }
        if ( merchantStore.getCreateDt() != null ) {
            userApp.setCreateDt( merchantStore.getCreateDt() );
        }
        if ( merchantStore.getMerchantCode() != null ) {
            userApp.setMerchantCode( merchantStore.getMerchantCode() );
        }
        if ( merchantStore.getMerchantName() != null ) {
            userApp.setMerchantName( merchantStore.getMerchantName() );
        }
        if ( merchantStore.getStoreName() != null ) {
            userApp.setStoreName( merchantStore.getStoreName() );
        }
        if ( merchantStore.getStoreId() != null ) {
            userApp.setStoreId( merchantStore.getStoreId() );
        }
        if ( merchantStore.getProductDesc() != null ) {
            userApp.setProductDesc( merchantStore.getProductDesc() );
        }
        if ( merchantStore.getPayEcdemicSwitch() != null ) {
            userApp.setPayEcdemicSwitch( merchantStore.getPayEcdemicSwitch() );
        }
        if ( merchantStore.getIsMarket() != null ) {
            userApp.setIsMarket( merchantStore.getIsMarket() );
        }
        if ( merchantStore.getMerchantType() != null ) {
            userApp.setMerchantType( merchantStore.getMerchantType() );
        }
        if ( merchantStore.getAlias() != null ) {
            userApp.setAlias( merchantStore.getAlias() );
        }
        if ( merchantStore.getMcsStatus() != null ) {
            userApp.setMcsStatus( merchantStore.getMcsStatus() );
        }
    }

    @Override
    public void copyProperties(MerchantBaseInfo merchantBaseInfo, UserApp userApp) {
        if ( merchantBaseInfo == null ) {
            return;
        }

        if ( merchantBaseInfo.getAlias() != null ) {
            userApp.setMerchantName( merchantBaseInfo.getAlias() );
        }
        if ( merchantBaseInfo.getId() != null ) {
            userApp.setMercId( merchantBaseInfo.getId() );
        }
        if ( merchantBaseInfo.getLoginName() != null ) {
            userApp.setLoginName( merchantBaseInfo.getLoginName() );
        }
        if ( merchantBaseInfo.getUserId() != null ) {
            userApp.setUserId( Long.parseLong( merchantBaseInfo.getUserId() ) );
        }
        if ( merchantBaseInfo.getUserName() != null ) {
            userApp.setUserName( merchantBaseInfo.getUserName() );
        }
        if ( merchantBaseInfo.getLogo() != null ) {
            userApp.setLogo( merchantBaseInfo.getLogo() );
        }
        if ( merchantBaseInfo.getCreateDt() != null ) {
            userApp.setCreateDt( merchantBaseInfo.getCreateDt() );
        }
        if ( merchantBaseInfo.getUpdateDt() != null ) {
            userApp.setUpdateDt( merchantBaseInfo.getUpdateDt() );
        }
        if ( merchantBaseInfo.getMerchantCode() != null ) {
            userApp.setMerchantCode( merchantBaseInfo.getMerchantCode() );
        }
        if ( merchantBaseInfo.getContactName() != null ) {
            userApp.setContactName( merchantBaseInfo.getContactName() );
        }
        if ( merchantBaseInfo.getProductDesc() != null ) {
            userApp.setProductDesc( merchantBaseInfo.getProductDesc() );
        }
        if ( merchantBaseInfo.getBussAuthNum() != null ) {
            userApp.setBussAuthNum( merchantBaseInfo.getBussAuthNum() );
        }
        if ( merchantBaseInfo.getIsVoice() != null ) {
            userApp.setIsVoice( merchantBaseInfo.getIsVoice() );
        }
        if ( merchantBaseInfo.getIsUnionPay() != null ) {
            userApp.setIsUnionPay( merchantBaseInfo.getIsUnionPay() );
        }
        if ( merchantBaseInfo.getPassword() != null ) {
            userApp.setPassword( merchantBaseInfo.getPassword() );
        }
        if ( merchantBaseInfo.getMerchantType() != null ) {
            userApp.setMerchantType( merchantBaseInfo.getMerchantType() );
        }
        if ( merchantBaseInfo.getAlias() != null ) {
            userApp.setAlias( merchantBaseInfo.getAlias() );
        }
        if ( merchantBaseInfo.getMerchantAuditStatus() != null ) {
            userApp.setMerchantAuditStatus( merchantBaseInfo.getMerchantAuditStatus() );
        }
    }

    @Override
    public UserApp toUserApp(UserInfo userInfo) {
        if ( userInfo == null ) {
            return null;
        }

        UserApp userApp = new UserApp();

        userApp.setCreateDt( userInfo.getCreateTime() );
        userApp.setUserId( userInfo.getId() );
        userApp.setLoginName( userInfo.getLoginName() );
        userApp.setStatus( userInfo.getStatus() );
        if ( userInfo.getParentId() != null ) {
            userApp.setParentId( userInfo.getParentId().longValue() );
        }
        userApp.setPhone( userInfo.getPhone() );
        userApp.setMerchantCode( userInfo.getMerchantCode() );
        userApp.setStoreId( userInfo.getStoreId() );
        userApp.setPassword( userInfo.getPassword() );
        if ( userInfo.getUpdateTime() != null ) {
            userApp.setUpdateTime( new SimpleDateFormat().format( userInfo.getUpdateTime() ) );
        }
        userApp.setPayPassword( userInfo.getPayPassword() );
        userApp.setFaceCert( userInfo.getFaceCert() );
        userApp.setFaceCompare( userInfo.getFaceCompare() );

        return userApp;
    }
}
