| | |
| | | package com.taoke.autopay.service.impl; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.taoke.autopay.dao.WxUserInfoMapper; |
| | | import com.taoke.autopay.entity.SystemConfigKeyEnum; |
| | | import com.taoke.autopay.entity.WxUserInfo; |
| | |
| | | import com.taoke.autopay.service.SystemConfigService; |
| | | import com.taoke.autopay.service.WxUserService; |
| | | import com.taoke.autopay.service.WxUserSettingService; |
| | | import com.taoke.autopay.service.credit.UserCreditBalanceService; |
| | | import com.taoke.autopay.utils.IPUtil; |
| | | import com.taoke.autopay.utils.StringUtil; |
| | | import com.taoke.autopay.utils.WxApiUtil; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private UserCreditBalanceService userCreditBalanceService; |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | user.setLoginTime(new Date()); |
| | | user.setCreateTime(new Date()); |
| | | wxUserInfoMapper.insertSelective(user); |
| | | userCreditBalanceService.initializeCreditBalance(user.getId()); |
| | | return user; |
| | | } else { |
| | | WxUserInfo update = new WxUserInfo(); |
| | |
| | | update.setLoginTime(new Date()); |
| | | update.setUpdateTime(new Date()); |
| | | wxUserInfoMapper.updateByPrimaryKeySelective(update); |
| | | userCreditBalanceService.initializeCreditBalance(update.getId()); |
| | | return list.get(0); |
| | | } |
| | | } |
| | |
| | | public long count(WxUserInfoMapper.DaoQuery query) { |
| | | return wxUserInfoMapper.count(query); |
| | | } |
| | | |
| | | @Override |
| | | public void setLatestInfoInfo(Long uid, String ip, IPUtil.IPInfo ipInfo) { |
| | | WxUserInfo wxUserInfo=new WxUserInfo(); |
| | | wxUserInfo.setId(uid); |
| | | wxUserInfo.setLatestIP(ip); |
| | | wxUserInfo.setLatestIPInfo(ipInfo!=null?new Gson().toJson(ipInfo):null); |
| | | wxUserInfo.setUpdateTime(new Date()); |
| | | wxUserInfoMapper.updateByPrimaryKeySelective(wxUserInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void update(WxUserInfo wxUserInfo) { |
| | | wxUserInfoMapper.updateByPrimaryKeySelective(wxUserInfo); |
| | | } |
| | | } |