| | |
| | | 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.entity.credit.UserCreditBalance; |
| | | import com.taoke.autopay.utils.IPUtil; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.vo.WxUserOrderSettingVO; |
| | | import com.taoke.autopay.vo.WxUserVO; |
| | | |
| | |
| | | */ |
| | | public class WxUserFactory { |
| | | |
| | | public static WxUserVO createVO(WxUserInfo user, WxUserSettings settings) { |
| | | public static WxUserVO createVO(WxUserInfo user, WxUserSettings settings, UserCreditBalance balance) { |
| | | WxUserVO vo = new WxUserVO(); |
| | | vo.setId(user.getId()); |
| | | vo.setCreateTime(user.getCreateTime()); |
| | | vo.setLoginTime(user.getLoginTime()); |
| | | vo.setNickName(user.getNickName()); |
| | | vo.setPortrait(user.getPortrait()); |
| | | WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay()); |
| | | vo.setOrderSetting(settingVO); |
| | | vo.setIp(user.getLatestIP()); |
| | | if(!StringUtil.isNullOrEmpty(user.getLatestIPInfo())){ |
| | | vo.setIpInfo(new Gson().fromJson(user.getLatestIPInfo(), IPUtil.IPInfo.class)); |
| | | } |
| | | vo.setStatus(user.getStatus()); |
| | | vo.setCredit(balance==null?0:balance.getCreditBalance()); |
| | | if(settings!=null) { |
| | | WxUserOrderSettingVO settingVO = new WxUserOrderSettingVO(settings.getDyOrderCountPerDay(), settings.getKsOrderCountPerDay(), settings.getTotalOrderCountPerDay()); |
| | | vo.setOrderSetting(settingVO); |
| | | } |
| | | return vo; |
| | | } |
| | | |