package com.taoke.autopay.factory;
|
|
import com.google.gson.Gson;
|
import com.taoke.autopay.entity.WxUserInfo;
|
import com.taoke.autopay.entity.WxUserSettings;
|
import com.taoke.autopay.utils.IPUtil;
|
import com.taoke.autopay.utils.StringUtil;
|
import com.taoke.autopay.vo.WxUserOrderSettingVO;
|
import com.taoke.autopay.vo.WxUserVO;
|
|
/**
|
* @author hxh
|
* @title: WxUserFactory
|
* @description: TODO
|
* @date 2024/6/29 13:24
|
*/
|
public class WxUserFactory {
|
|
public static WxUserVO createVO(WxUserInfo user, WxUserSettings settings) {
|
WxUserVO vo = new WxUserVO();
|
vo.setId(user.getId());
|
vo.setCreateTime(user.getCreateTime());
|
vo.setLoginTime(user.getLoginTime());
|
vo.setNickName(user.getNickName());
|
vo.setPortrait(user.getPortrait());
|
vo.setIp(user.getLatestIP());
|
if(!StringUtil.isNullOrEmpty(user.getLatestIPInfo())){
|
vo.setIpInfo(new Gson().fromJson(user.getLatestIPInfo(), IPUtil.IPInfo.class));
|
}
|
WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay());
|
vo.setOrderSetting(settingVO);
|
return vo;
|
}
|
|
public static WxUserOrderSettingVO createVO(WxUserSettings settings) {
|
|
WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay());
|
settingVO.setId(settings.getId());
|
return settingVO;
|
}
|
|
}
|