| | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-vip</artifactId> |
| | | <version>0.0.1</version> |
| | | <version>0.0.5</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-lijin</artifactId> |
| | | <version>0.0.2</version> |
| | | <version>0.0.3</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-core</artifactId> |
| | | <version>4.5.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>aliyun-java-sdk-dypnsapi</artifactId> |
| | | <version>1.1.3</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | <build> |
| | |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; |
| | |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | |
| | | /** |
| | | * 获取商品详情 |
| | |
| | | GoodsDetailVO goodsDetailVO = new GoodsDetailVO(); |
| | | GoodsDetailVO.GoodsExtraVO extraVO = new GoodsDetailVO.GoodsExtraVO(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = new GoodsMoneyConfigParamsDTO(); |
| | | paramsDTO.setFanLiRate(new BigDecimal("60")); |
| | | paramsDTO.setFanLiRate(goodsLijinMnager.getFanLiRate(uid)); |
| | | // 领券人列表 |
| | | List<ShamUser> listCouponUser = new ArrayList<>(); |
| | | Long goodsIdSuning = null; |
| | | switch (goodsType) { |
| | | case Constant |
| | | .SOURCE_TYPE_TAOBAO: |
| | |
| | | .SOURCE_TYPE_SUNING: |
| | | String[] ids = SuningUtil.getGoodsIdDetail(goodsId); |
| | | SuningGoodsInfo suningGoodsInfo = SuningApiUtil.getGoodsDetail(ids[1], ids[0]); |
| | | goodsIdSuning = Long.parseLong(suningGoodsInfo.getCommodityInfo().getCommodityCode()); |
| | | |
| | | goodsDetailVO.setGoods(GoodsDetailVOLijinFactory.convertSuningGoods(suningGoodsInfo, paramsDTO)); |
| | | extraVO.setDetailUrl("http://apph5.banliapp.com/apppage/goods_img_suning.html?id=" |
| | | + suningGoodsInfo.getCommodityInfo().getCommodityCode() + "&supplierCode=" |
| | |
| | | //是否收藏 |
| | | extraVO.setCollected(false); |
| | | if (uid != null) { |
| | | CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, Long.parseLong(goodsDetailVO.getGoods().getGoodsId()), goodsType); |
| | | CollectionGoodsV2 collectionGoodsV2 = collectionGoodsV2Service.findByUidAndAuctionId(uid, goodsType == Constant.SOURCE_TYPE_SUNING ? goodsIdSuning : Long.parseLong(goodsDetailVO.getGoods().getGoodsId()), goodsType); |
| | | if (collectionGoodsV2 != null) { |
| | | extraVO.setCollected(true); |
| | | } |
| | |
| | | data.put("type", 1); |
| | | data.put("link", link); |
| | | data.put("native", true); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (LiJinException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | |
| | | * @param goodsDetailVO |
| | | */ |
| | | private void loadLijinInfo(Long uid, GoodsDetailVO goodsDetailVO) { |
| | | VIPEnum vipRank = goodsLijinMnager.getVIPRank(uid); |
| | | VIPEnum vipRank = userLijinMnager.getVIPRank(uid); |
| | | GoodsDetailVO.GoodsHongBaoListVO.UserLevelVO userLevelVO = goodsLijinMnager.getUserLevel(vipRank); |
| | | if (goodsDetailVO.getGoods().getPriceList() != null && goodsDetailVO.getGoods().getPriceList().size() > 0) |
| | | goodsDetailVO.getGoods().getPriceList().get(0).setUserLevel(userLevelVO); |
New file |
| | |
| | | package com.yeshi.fanli.controller.client.lijin; |
| | | |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.pojo.DO.VipCenter; |
| | | import com.ks.vip.pojo.DO.VipCenterRecord; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.Enums.OrderTypeEnum; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.ks.vip.service.VipComboService; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.lijin.vo.VIPGradeVO; |
| | | import com.yeshi.fanli.lijin.vo.VipRecordVO; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/lijin/user") |
| | | public class UserControllerLijin { |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private JedisPool jedisPool; |
| | | |
| | | /** |
| | | * 获取用户礼金创建状态 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping("getUserLijinCreatedInfo") |
| | | public void getUserLijinCreatedInfo(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | VIPEnum vipEnum = userLijinMnager.getVIPRank(uid); |
| | | VIPEnum defaultRank = userLijinMnager.getDefaultRank(); |
| | | boolean canOpenVIP = false; |
| | | //淘礼金会员链接 |
| | | String lijinUrl = configService.getValue(ConfigKeyEnum.lijinVIPLink, acceptData.getSystem()); |
| | | TodayLijinCreatedInfo info = userLijinMnager.getTodayCreateInfo(uid); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("leftCount", info.getLeftCount()); |
| | | data.put("leftMoney", info.getLeftMoney()); |
| | | |
| | | JSONObject openInfo = new JSONObject(); |
| | | openInfo.put("vipLink", lijinUrl); |
| | | openInfo.put("btnName", "开通会员"); |
| | | //今日机会已经用完 |
| | | if (info.getLeftCount() <= 0 || info.getCreatedMoney().compareTo(new BigDecimal(1)) < 0) { |
| | | if (vipEnum == defaultRank) { |
| | | //默认等级,开通会员 |
| | | canOpenVIP = true; |
| | | } else { |
| | | //今日机会用完了 |
| | | canOpenVIP = false; |
| | | } |
| | | if (canOpenVIP) |
| | | data.put("openInfo", openInfo); |
| | | |
| | | } else { |
| | | //还可创建 |
| | | } |
| | | //是否可以开通会员 |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取会员等级列表 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping("getVIPPriceList") |
| | | public void getVIPPriceList(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | List<VIPGradeVO> voList = new ArrayList<>(); |
| | | List<VipCombo> vipComboList = userLijinMnager.getVIPPricelist(VIPEnum.platinum); |
| | | for (VipCombo vipCombo : vipComboList) { |
| | | VIPGradeVO vo = new VIPGradeVO(); |
| | | vo.setId(vipCombo.getId() + ""); |
| | | vo.setMoney("¥" + MoneyBigDecimalUtil.getWithNoZera(vipCombo.getDiscountPrice())); |
| | | vo.setName(vipCombo.getName()); |
| | | vo.setOriginMoney("¥" + MoneyBigDecimalUtil.getWithNoZera(vipCombo.getOriginalPrice())); |
| | | vo.setTag(MoneyBigDecimalUtil.getWithNoZera(vipCombo.getDiscount()) + "折"); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | //获取用户信息 |
| | | UserInfo userInfo = userInfoService.selectAvailableByPrimaryKey(uid); |
| | | JSONObject data = new JSONObject(); |
| | | if (userInfo != null) { |
| | | VipCenter vipCenter = userLijinMnager.getUserLevelInfo(uid); |
| | | JSONObject userVO = new JSONObject(); |
| | | userVO.put("nickName", userInfo.getNickName()); |
| | | userVO.put("portrait", userInfo.getPortrait()); |
| | | if (vipCenter != null) |
| | | userVO.put("expireDate", TimeUtil.getGernalTime(vipCenter.getEndTime().getTime(), "yyyy-MM-dd HH:mm")); |
| | | data.put("user", userVO); |
| | | } |
| | | |
| | | |
| | | data.put("count", vipComboList.size()); |
| | | data.put("data", voList); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("getUserLevel") |
| | | public void getUserLevel(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | VIPEnum vipEnum = userLijinMnager.getVIPRank(uid); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("userLevel", vipEnum); |
| | | data.put("lijinVipLink", configService.getValue(ConfigKeyEnum.lijinVIPLink, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否可以创建广告订单 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | |
| | | @RequestMapping("canCreateAdOrder") |
| | | public void canCreateAdOrder(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | boolean canCreatedOrder = userLijinMnager.canCreateADOrder(uid); |
| | | if (!canCreatedOrder) { |
| | | out.print(JsonUtil.loadFalseResult("今日免费领取会员超限,请明日再试")); |
| | | return; |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("type", "csj"); |
| | | data.put("pid", "946119116"); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping("createAdOrder") |
| | | public void createAdOrder(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | String key = "watchad-order-" + uid; |
| | | Jedis jedis = jedisPool.getResource(); |
| | | Long canAdd = jedis.setnx(key, "1"); |
| | | if (canAdd == null) { |
| | | out.print(JsonUtil.loadFalseResult("请稍后再试")); |
| | | return; |
| | | } |
| | | jedis.expire(key, 120); |
| | | try { |
| | | userLijinMnager.createADOrder(uid); |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | } catch (VipOrderException e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | } finally { |
| | | jedis.del(key); |
| | | jedis.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping("getVIPOrderList") |
| | | public void getVIPOrderList(AcceptData acceptData, Long uid, int page, PrintWriter out) { |
| | | List<VipCenterRecord> list = userLijinMnager.getVipRecordList(uid, page, Constant.PAGE_SIZE); |
| | | List<VipRecordVO> voList = new ArrayList<>(); |
| | | |
| | | for (VipCenterRecord record : list) { |
| | | VipRecordVO vo = new VipRecordVO(); |
| | | vo.setCreateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setEndTime(TimeUtil.getGernalTime(record.getEndTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setStartTime(TimeUtil.getGernalTime(record.getStartTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setOrderId(record.getOrderId() + ""); |
| | | String name = ""; |
| | | if (record.getVipOrder() != null) { |
| | | if (record.getVipOrder().getType() == OrderTypeEnum.watchVideo) { |
| | | name = "激励奖励铂金会员"; |
| | | } else if (record.getVipOrder().getType() == OrderTypeEnum.buyNewly) { |
| | | name = "开通铂金会员"; |
| | | } else if (record.getVipOrder().getType() == OrderTypeEnum.buyRenew) { |
| | | name = "续费铂金会员"; |
| | | } |
| | | } |
| | | long timespan = record.getEndTime().getTime() - record.getStartTime().getTime(); |
| | | int hour = (int) (timespan / (1000 * 60 * 60L)); |
| | | |
| | | if (hour > 24 * 93) { |
| | | name += "-年卡"; |
| | | } else if (hour > 24 * 31) { |
| | | name += "-季卡"; |
| | | } else if (hour > 24) { |
| | | name += "-月卡"; |
| | | } else if (hour == 24) { |
| | | name += "-1天"; |
| | | } else { |
| | | name += "-" + hour + "小时"; |
| | | } |
| | | vo.setName(name); |
| | | voList.add(vo); |
| | | } |
| | | long count = userLijinMnager.countVipRecord(uid); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", voList); |
| | | data.put("count", count); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; |
| | | import com.yeshi.fanli.util.SystemInfoUtil; |
| | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | private void doTaoLiJinBuy(AcceptData acceptData, Long uid, Long auctionId, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | |
| | | data.put("link", link); |
| | | if (clientTBPid != null) |
| | | data.put("tbPidInfo", clientTBPid); |
| | | |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | TaoKeLogHelper.convertLinkInfo( |
| | |
| | | data.put("native", true); |
| | | } |
| | | |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseResult(1, "请求失败")); |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | } else { |
| | | price = taoBaoGoodsBriefExtra.getZkPrice() + ""; |
| | | } |
| | | String appName = systemConfigService.get("appName", system); |
| | | String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem()); |
| | | data.put("sharePrice", "¥" + price + "元 送" + appName + "红包¥" |
| | | + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 "); |
| | | data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle()); |
| | |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.account.UserUtil; |
| | | import com.yeshi.fanli.util.wx.MyWXLoginUtil; |
| | | import com.yeshi.fanli.vo.user.QQUserInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "loginNew", method = RequestMethod.POST) |
| | | public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType, |
| | | public void loginNew(AcceptData acceptData, String vcode, String phone, String code, String aliAccessToken, int loginType, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | |
| | | // 2.0以下版本不允许登录 |
| | |
| | | UserInfo userInfo = null; |
| | | // 手机登录 |
| | | if (loginType == 1) { |
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system); |
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system); |
| | | } |
| | | |
| | | // 微信登录 |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "bindPhoneNew") |
| | | public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) { |
| | | public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, String aliAccessToken, PrintWriter out) { |
| | | |
| | | BusinessSystem system = getSystem(acceptData); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | | out.print(JsonUtil.loadFalseResult("验证码不能为空")); |
| | | String mobile = null; |
| | | try { |
| | | mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND); |
| | | } catch (UserAccountException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(phone)) { |
| | | out.print(JsonUtil.loadFalseResult("电话号码不能为空")); |
| | | return; |
| | | } |
| | | |
| | | phone = phone.replaceAll(" ", ""); |
| | | |
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND); |
| | | if (Constant.IS_OUTNET) { |
| | | if (!vcode.equalsIgnoreCase(oldVCode)) { |
| | | out.print(JsonUtil.loadFalseResult(9001, "验证码错误,重新输入")); |
| | | return; |
| | | } |
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND); |
| | | } |
| | | |
| | | try { |
| | | // 绑定用户 |
| | | userAccountService.bindPhoneNew(uid, phone); |
| | | userAccountService.bindPhoneNew(uid, mobile); |
| | | |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid); |
| | | // 判断电话号码是否已经封禁 |
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService |
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone); |
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, mobile); |
| | | if (ic != null && ic.getEffective() != null && ic.getEffective()) { |
| | | out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); |
| | | // 封禁用户 |
| | |
| | | } |
| | | |
| | | try { |
| | | userAccountService.bindWeiXin(acceptData, uid, code); |
| | | userAccountService.bindWeiXin(system, uid, code); |
| | | |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid); |
| | | // 判断taoBaoUid是否已经封禁 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更改微信 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param qqUser |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "bindQQ") |
| | | public void bindQQ(AcceptData acceptData, Long uid, String qqUser, PrintWriter out) { |
| | | BusinessSystem system = getSystem(acceptData); |
| | | |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(qqUser)) { |
| | | out.print(JsonUtil.loadFalseResult("请上传qqUser")); |
| | | return; |
| | | } |
| | | |
| | | String qqUserStr = StringUtil.getFromBase64(qqUser); |
| | | QQUserInfoVO qqUserInfo = new Gson().fromJson(qqUserStr, QQUserInfoVO.class); |
| | | try { |
| | | userAccountService.bindQQ(uid, qqUserInfo); |
| | | |
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("userInfo", UserUtil.filterForClientUser(user)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (UserAccountException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg())); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsBriefs, paramsDTO); |
| | | for (GoodsDetailVO vo : voList) |
| | | for (GoodsDetailVO vo : voList) { |
| | | vo.setCreatetime(null); |
| | | array.add(gson.toJson(vo)); |
| | | |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("nav", null); |
| | | data.put("count", counttotal); |
| | |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | private GoodsMoneyConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { |
| | | UserLevelEnum level = UserLevelEnum.daRen; |
| | |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | } |
| | | data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser; |
| | | import com.yeshi.fanli.vo.user.QQUserInfoVO; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | * 新版登录 V1.5.3 |
| | | * |
| | | * @param acceptData |
| | | * @param loginType 登录方式: 1-手机登录 2-微信登录 3-手机 4-qq |
| | | * @param vcode |
| | | * @param phone |
| | | * @param code |
| | | * @param loginType 登录方式: 1-手机登录 2-微信登录 |
| | | * @param aliAccessToken |
| | | * @param qqUser |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "login", method = RequestMethod.POST) |
| | | public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code, |
| | | public void login(AcceptData acceptData, int loginType, String vcode, String phone, String code, String aliAccessToken, String qqUser, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | |
| | | } |
| | | |
| | | UserInfo userInfo = null; |
| | | // 手机登录 |
| | | if (loginType == 1) { |
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, system); |
| | | } |
| | | |
| | | |
| | | switch (loginType) { |
| | | //电话号码登录 |
| | | case 1: { |
| | | userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system); |
| | | } |
| | | break; |
| | | // 微信登录 |
| | | if (loginType == 2) { |
| | | case 2: { |
| | | //需要绑定电话号码 |
| | | if (SystemInfoUtil.hasFunctions(system.getSystem(), SystemFunction.bindPhone)) |
| | | userInfo = userAccountService.loginWeiXinNew(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system); |
| | |
| | | else |
| | | userInfo = userAccountService.loginWeiXin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, code, system); |
| | | } |
| | | break; |
| | | case 4: { |
| | | QQUserInfoVO qqUserInfo = UserUtil.parseQQUser(qqUser); |
| | | userInfo = userAccountService.loginQQ(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, qqUserInfo, system); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (userInfo == null) { |
| | | out.print(JsonUtil.loadFalseResult("登录失败")); |
| | | } else { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo)); |
| | | if (SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.inviteCode)) { |
| | | data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId())); |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | final UserInfo uuser = userInfo; |
| | |
| | | |
| | | } catch (UserAccountException e) { |
| | | int errorCode = e.getCode(); |
| | | if (errorCode == 101) { // 需要绑定手机号 |
| | | if (errorCode == UserAccountException.CODE_NEED_BIND_PHONE) { // 需要绑定手机号 |
| | | JSONObject data = new JSONObject(); |
| | | data.put("key", e.getMsg()); |
| | | JSONObject object = new JSONObject(); |
| | | object.put("code", errorCode); |
| | | object.put("data", data); |
| | | out.print(object.toString()); |
| | | } else if (errorCode == 102) { // 需要绑定微信号 |
| | | } else if (errorCode == UserAccountException.CODE_NEED_BIND_WX) { // 需要绑定微信号 |
| | | JSONObject data = new JSONObject(); |
| | | data.put("key", e.getMsg()); |
| | | JSONObject object = new JSONObject(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 绑定电话号码 V2.0.1 微信登录 |
| | | * 绑定电话号码 V2.0.1 三方登录 |
| | | * |
| | | * @param acceptData |
| | | * @param vcode |
| | |
| | | */ |
| | | @RequestSerializableByKey(key = "'bindPhoneLogin-'+#phone") |
| | | @RequestMapping(value = "bindPhoneLogin") |
| | | public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key, |
| | | public void bindPhoneLogin(AcceptData acceptData, String vcode, String phone, String key, String aliAccessToken, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | | out.print(JsonUtil.loadFalseResult("验证码不能为空")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(phone)) { |
| | | out.print(JsonUtil.loadFalseResult("电话号码不能为空")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(key)) { |
| | | out.print(JsonUtil.loadFalseResult("key值不能为空")); |
| | | return; |
| | | } |
| | | |
| | | phone = phone.replaceAll(" ", ""); |
| | | |
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND); |
| | | if (Constant.IS_OUTNET) { |
| | | if (!vcode.equalsIgnoreCase(oldVCode)) { |
| | | out.print(JsonUtil.loadFalseResult(9001, "验证码错误,重新输入")); |
| | | String mobile = null; |
| | | try { |
| | | mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND); |
| | | } catch (UserAccountException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | return; |
| | | } |
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND); |
| | | } |
| | | |
| | | try { |
| | | UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, phone, key); |
| | | |
| | | UserInfo userInfo = userAccountService.bindPhoneToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, mobile, key); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | try { |
| | | UserInfo userInfo = userAccountService.bindWXToLogin(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), acceptData, code, system.getAppid(), key); |
| | | JSONObject data = new JSONObject(); |
| | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "20150318020003259", info.getRelationId()); |
| | | "20150318020005224", info.getRelationId()); |
| | | String link = dto.getClick_url(); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "20150318020003259", info.getRelationId()); |
| | | "20150318020005224", info.getRelationId()); |
| | | String link = dto.getClick_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!", |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | } else { |
| | | price = taoBaoGoodsBriefExtra.getZkPrice() + ""; |
| | | } |
| | | String appName = systemConfigService.get("appName", system); |
| | | String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem()); |
| | | data.put("sharePrice", "¥" + price + "元 送" + appName + "红包¥" |
| | | + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 "); |
| | | data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle()); |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.system.SystemConfig; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface SystemConfigMapper extends BaseMapper<SystemConfig>{ |
| | | |
| | | SystemConfig getByKey(@Param("key") String key); |
| | | public SystemConfig selectByKeyAndSystem(@Param("key") String key,@Param("system") SystemEnum system); |
| | | |
| | | |
| | | SystemConfig getByKeyAndSystemId(@Param("key") String key, @Param("systemId") Long systemId); |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | BigDecimal getMyHB(Long id); |
| | | |
| | | // 根据AppId与微信unionID获取用户 |
| | | |
| | | /** |
| | | * 根据系统与微信unionId获取用户 |
| | | * |
| | | * @param system |
| | | * @param unionId |
| | | * @return |
| | | */ |
| | | List<UserInfo> listBySystemAndWXUnionId(@Param("system") SystemEnum system, @Param("unionId") String unionId); |
| | | |
| | | /** |
| | | * 根据系统与淘宝的openid获取用户 |
| | | * |
| | | * @param system |
| | | * @param openId |
| | | * @return |
| | | */ |
| | | List<UserInfo> listBySystemAndTaoBaoOpenId(@Param("system") SystemEnum system, @Param("openId") String openId); |
| | | |
| | | /** |
| | | * 根据系统与电话号码获取用户 |
| | | * |
| | | * @param system |
| | | * @param phone |
| | | * @return |
| | | */ |
| | | List<UserInfo> listBySystemAndPhone(@Param("system") SystemEnum system, @Param("phone") String phone); |
| | | |
| | | // 根据获取电话号码有效用户 |
| | | UserInfo getEffectiveUserInfoByPhone(@Param("phone") String phone, @Param("system") SystemEnum system); |
| | | |
| | | // 根据获WXUnionId有效用户 |
| | | UserInfo getEffectiveUserInfoByWXUnionId(@Param("unionId") String unionId, @Param("system") SystemEnum system); |
| | | |
| | | //根据淘宝openId获取有效用户 |
| | | UserInfo getEffectiveUserInfoByOpenId(@Param("openId") String openId, @Param("system") SystemEnum system); |
| | | |
| | | |
| | | |
| | | //根据微信openid查询 |
| | | UserInfo getEffectiveUserInfoByWXOpenId(@Param("wxOpenId") String wxOpenId, @Param("system") SystemEnum system); |
| | | List<UserInfo> list(@Param("query") DaoQuery query); |
| | | |
| | | Long getMaxUid(); |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<UserInfo> getAutoExtractUserTo1212(@Param("start") int start, @Param("count") int count); |
| | | |
| | | |
| | | public static class DaoQuery extends BaseDaoQuery { |
| | | public String phone; |
| | | public String wxUnionId; |
| | | public String openId; |
| | | public String qqOpenId; |
| | | public SystemEnum system; |
| | | public Integer state; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.user.msg; |
| | | |
| | | import com.ks.lijin.query.BaseDaoQuery; |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOverViews; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class MsgOverViewsDao extends MongodbBaseDao<MsgOverViews> { |
| | | |
| | | |
| | | private Criteria[] getWheres(DaoQuery daoQuery) { |
| | | List<Criteria> whereList = new ArrayList<>(); |
| | | |
| | | if (daoQuery.uid != null) { |
| | | whereList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | | } |
| | | Criteria[] wheres = new Criteria[whereList.size()]; |
| | | whereList.toArray(wheres); |
| | | return wheres; |
| | | } |
| | | |
| | | public List<MsgOverViews> list(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().andOperator(getWheres(daoQuery))); |
| | | query.skip((int) daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | query.with(new Sort(Sort.Direction.DESC, "updateTime")); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = new Query(); |
| | | query.addCriteria(new Criteria().andOperator(getWheres(daoQuery))); |
| | | return count(query); |
| | | } |
| | | |
| | | |
| | | public static class DaoQuery extends BaseDaoQuery { |
| | | public Long uid; |
| | | } |
| | | } |
| | |
| | | */ |
| | | public enum SystemEnum { |
| | | blks("com.yeshi.ec.rebate", "com.xyj.ec.fanli-ios", new String[]{}, new SystemFunction[]{ |
| | | SystemFunction.bindPhone, SystemFunction.threeSale, SystemFunction.cloudOrder, SystemFunction.godenCorn, SystemFunction.redPack,SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.vip |
| | | SystemFunction.bindPhone, SystemFunction.threeSale, SystemFunction.cloudOrder, SystemFunction.godenCorn, SystemFunction.redPack,SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.vip,SystemFunction.inviteCode |
| | | }, 1, "板栗快省","板栗快省"), |
| | | flq("com.fanliunion.android", "com.xyj.ec.flq-ios", new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.fanli}, 11, "返利联盟","淘拼团"), |
| | | yhqjx("com.youhuiquan.android","com.youhuiquanjx.ios",new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.lijinSub}, 12, "优惠券精选","淘拼团"); |
| | | yhqjx("com.youhuiquan.android","com.youhuiquanjx.ios",new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.lijinSub,SystemFunction.bindPhone}, 12, "优惠券精选","淘拼团"); |
| | | private String packageName; |
| | | private String bundleId; |
| | | private int systemId; |
| | |
| | | public enum SystemFunction { |
| | | bindPhone("绑定电话号码"), |
| | | threeSale("三级分销"), |
| | | inviteCode("邀请码"), |
| | | godenCorn("金币"), |
| | | cloudOrder("云发单"), |
| | | redPack("红包"), |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.msg; |
| | | |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.index.Indexed; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 信息概览 |
| | | */ |
| | | @Document(collection = "msgOverViews") |
| | | public class MsgOverViews { |
| | | @Id |
| | | private String id; |
| | | @Indexed |
| | | private Long uid; |
| | | private MsgTypeEnum msgType; |
| | | private Long identityCode;//主键 |
| | | @Indexed |
| | | private Date createTime; |
| | | @Indexed |
| | | private Date updateTime; |
| | | |
| | | |
| | | public MsgOverViews() { |
| | | |
| | | } |
| | | |
| | | |
| | | public MsgOverViews(Long uid, MsgTypeEnum msgType, Long identityCode, Date createTime, Date updateTime) { |
| | | this.uid = uid; |
| | | this.msgType = msgType; |
| | | this.identityCode = identityCode; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public static String createId(MsgTypeEnum msgType, Long identityCode) { |
| | | return identityCode + "-" + msgType; |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public MsgTypeEnum getMsgType() { |
| | | return msgType; |
| | | } |
| | | |
| | | public void setMsgType(MsgTypeEnum msgType) { |
| | | this.msgType = msgType; |
| | | } |
| | | |
| | | public Long getIdentityCode() { |
| | | return identityCode; |
| | | } |
| | | |
| | | public void setIdentityCode(Long identityCode) { |
| | | this.identityCode = identityCode; |
| | | } |
| | | |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.msg; |
| | | |
| | | public enum MsgTypeEnum { |
| | | account("账户消息"), invite("邀请消息"), money("资金消息"), order("订单消息"), system("系统消息"), lijinVip("礼金会员"), other("其他消息"); |
| | | |
| | | private MsgTypeEnum(String name) { |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public final static int TYPE_WX = 1; |
| | | public final static int TYPE_TB = 2; |
| | | public final static int TYPE_PHONE = 3; |
| | | public final static int TYPE_QQ = 4; |
| | | @Column(name = "uabh_id") |
| | | private Long id; |
| | | @Column(name = "uabh_uid") |
| | |
| | | @Column(name = "wxPic") |
| | | private String wxPic; |
| | | |
| | | @Expose |
| | | @Column(name = "qq_open_id") |
| | | private String qqOpenId; |
| | | @Expose |
| | | @Column(name = "qq_nick_name") |
| | | private String qqNickName; |
| | | |
| | | @Column(name = "portrait") |
| | | @Expose |
| | | private String portrait;// 头像 |
| | |
| | | this.erCode = erCode; |
| | | } |
| | | |
| | | |
| | | public String getQqOpenId() { |
| | | return qqOpenId; |
| | | } |
| | | |
| | | public void setQqOpenId(String qqOpenId) { |
| | | this.qqOpenId = qqOpenId; |
| | | } |
| | | |
| | | public String getQqNickName() { |
| | | return qqNickName; |
| | | } |
| | | |
| | | public void setQqNickName(String qqNickName) { |
| | | this.qqNickName = qqNickName; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | final int prime = 31; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public enum ModifyTypeEnum { |
| | | bindWeiXin("微信授权"), bindPhone("绑定手机"), bindTaoBao("淘宝授权"), setWeiXinNum("添加微信号"), |
| | | bindWeiXin("微信授权"), bindPhone("绑定手机"), bindTaoBao("淘宝授权"), bindQQ("绑定QQ"), setWeiXinNum("添加微信号"), |
| | | gender("设置性别"), portrait("修改头像"), nickName("修改昵称"), bindAlipay("绑定支付宝"); |
| | | |
| | | private final String desc; |
New file |
| | |
| | | package com.yeshi.fanli.entity.config; |
| | | |
| | | public enum SystemConfigKeyEnum { |
| | | appName("应用名称"), |
| | | wxAppId("微信开放平台的appId"), |
| | | wxAppSecret("微信开放平台的appSecret"), |
| | | defaultNickNamePrefix("默认昵称前缀"), |
| | | defaultPortrait("默认头像") |
| | | ; |
| | | |
| | | private SystemConfigKeyEnum(String name) { |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | inviteRules("invite_rules", "动态-学院文章热搜词"), |
| | | vipLink("vip_link", "超级会员升级链接"), // 转移至VIPConfig 已废弃 |
| | | helpLinkVipInfo("help_link_vip_info", "超级会员详情页帮助链接"), // 已废弃 |
| | | lijinVIPLink("lijin_vip_link", "礼金会员链接"), |
| | | |
| | | // 文案转链 |
| | | convertDocWebLink("convert_doc_web_link", "文案转链网页"), |
| | | convertDocHelpLink("convert_doc_help_link", "文案转链帮助网页"), |
| | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.yeshi.utils.mybatis.Column; |
| | | import org.yeshi.utils.mybatis.Table; |
| | | |
| | |
| | | @Column(name = "name") |
| | | private String name; |
| | | |
| | | @Column(name = "system") |
| | | private SystemEnum system; |
| | | |
| | | @Column(name = "updatetime") |
| | | private Long updatetime; |
| | | |
| | | private Set<BusinessSystem> systems=new HashSet<BusinessSystem>(); |
| | | |
| | | public SystemConfig() { |
| | | } |
| | |
| | | this.updatetime = updatetime; |
| | | } |
| | | |
| | | public Set<BusinessSystem> getSystems() { |
| | | return systems; |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystems(Set<BusinessSystem> systems) { |
| | | this.systems = systems; |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | //需要绑定手机号 |
| | | public final static int CODE_NEED_BIND_PHONE = 101; |
| | | |
| | | //需要绑定微信 |
| | | public final static int CODE_NEED_BIND_WX = 102; |
| | | |
| | | public UserAccountException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.lijin.dto; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 用户今日创建的礼金信息 |
| | | */ |
| | | public class TodayLijinCreatedInfo { |
| | | |
| | | //创建的数量 |
| | | private int createdCount; |
| | | //创建的金额 |
| | | private BigDecimal createdMoney; |
| | | |
| | | //剩余的数量 |
| | | private int leftCount; |
| | | //剩余的金额 |
| | | private BigDecimal leftMoney; |
| | | |
| | | public int getCreatedCount() { |
| | | return createdCount; |
| | | } |
| | | |
| | | public void setCreatedCount(int createdCount) { |
| | | this.createdCount = createdCount; |
| | | } |
| | | |
| | | public BigDecimal getCreatedMoney() { |
| | | return createdMoney; |
| | | } |
| | | |
| | | public void setCreatedMoney(BigDecimal createdMoney) { |
| | | this.createdMoney = createdMoney; |
| | | } |
| | | |
| | | public int getLeftCount() { |
| | | return leftCount; |
| | | } |
| | | |
| | | public void setLeftCount(int leftCount) { |
| | | this.leftCount = leftCount; |
| | | } |
| | | |
| | | public BigDecimal getLeftMoney() { |
| | | return leftMoney; |
| | | } |
| | | |
| | | public void setLeftMoney(BigDecimal leftMoney) { |
| | | this.leftMoney = leftMoney; |
| | | } |
| | | } |
| | |
| | | import com.yeshi.fanli.lijin.vo.GoodsDetailVO.*; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private LiJinLinkService liJinLinkService; |
| | | |
| | | @Resource |
| | | private UserLijinMnager userLijinMnager; |
| | | |
| | | |
| | | private String getUid(Long uid) { |
| | |
| | | */ |
| | | public BigDecimal getFanLiRate(Long uid) { |
| | | //加载返利信息 |
| | | VIPEnum rank = getVIPRank(uid); |
| | | VIPEnum rank = userLijinMnager.getVIPRank(uid); |
| | | VipGradePotence potence = vipGradePotenceService.getPotenceByVipEnum(rank); |
| | | //获取返利比例 |
| | | BigDecimal fanliRate = potence.getRebatePercent(); |
| | | return fanliRate; |
| | | } |
| | | |
| | | public VIPEnum getVIPRank(Long uid) { |
| | | VIPEnum rank = null; |
| | | if (uid != null) |
| | | rank = vipCenterService.getVIPEnumByUid(getUid(uid)); |
| | | if (rank == null) |
| | | rank = vipGradeService.getDefaultGrade().getIdentity(); |
| | | return rank; |
| | | } |
| | | |
| | | public GoodsHongBaoListVO.UserLevelVO getUserLevel(VIPEnum vipRank) { |
| | | GoodsHongBaoListVO.UserLevelVO userLevelVO = new GoodsHongBaoListVO.UserLevelVO(); |
New file |
| | |
| | | package com.yeshi.fanli.lijin.manager; |
| | | |
| | | import com.ks.lijin.service.LiJinExpendRecordService; |
| | | import com.ks.lijin.service.LiJinLinkService; |
| | | import com.ks.lijin.service.LijinCreateService; |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.pojo.DO.*; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.ks.vip.service.*; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo; |
| | | import com.yeshi.fanli.lijin.vo.UserLijinLevelInfoVO; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class UserLijinMnager { |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private LijinCreateService lijinCreateService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipCenterService vipCenterService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipCenterRecordService vipCenterRecordService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipGradePotenceService vipGradePotenceService; |
| | | |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipGradeService vipGradeService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipComboService vipComboService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private LiJinLinkService liJinLinkService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private LiJinExpendRecordService liJinExpendRecordService; |
| | | |
| | | @Reference(version = "1.0", check = false) |
| | | private VipOrederService vipOrederService; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | |
| | | private String getUid(Long uid) { |
| | | if (uid == null) |
| | | return null; |
| | | return "tejia-" + uid; |
| | | } |
| | | |
| | | public VIPEnum getVIPRank(Long uid) { |
| | | VIPEnum rank = null; |
| | | if (uid != null) |
| | | rank = vipCenterService.getVIPEnumByUid(getUid(uid)); |
| | | if (rank == null) |
| | | rank = vipGradeService.getDefaultGrade().getIdentity(); |
| | | return rank; |
| | | } |
| | | |
| | | public VipCenter getUserLevelInfo(Long uid) { |
| | | VipCenter vipCenter = vipCenterService.getByUid(getUid(uid)); |
| | | if (vipCenter == null) |
| | | return null; |
| | | if (vipCenter.getGradeId().longValue() == vipGradeService.getDefaultGrade().getId()) |
| | | return null; |
| | | return vipCenter; |
| | | } |
| | | |
| | | /** |
| | | * 获取默认等级 |
| | | * |
| | | * @return |
| | | */ |
| | | public VIPEnum getDefaultRank() { |
| | | return vipGradeService.getDefaultGrade().getIdentity(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取会员套餐列表 |
| | | * |
| | | * @param vipEnum |
| | | * @return |
| | | */ |
| | | public List<VipCombo> getVIPPricelist(VIPEnum vipEnum) { |
| | | return vipComboService.listValid(vipEnum); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取今天的创建信息 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public TodayLijinCreatedInfo getTodayCreateInfo(Long uid) { |
| | | VIPEnum rank = getVIPRank(uid); |
| | | TodayLijinCreatedInfo createdInfo = new TodayLijinCreatedInfo(); |
| | | BigDecimal createdMoney = liJinExpendRecordService.countTodayMoneyByExpend(getUid(uid)); |
| | | int createNum = liJinExpendRecordService.countTodayNumByExpend(getUid(uid)); |
| | | createdInfo.setCreatedCount(createNum); |
| | | createdInfo.setCreatedMoney(createdMoney); |
| | | VipGradePotence potence = vipGradePotenceService.getPotenceByVipEnum(rank); |
| | | createdInfo.setLeftCount(potence.getTaolijinMaxNumber() - createNum); |
| | | createdInfo.setLeftMoney(potence.getTaolijinMaxMoney().subtract(createdMoney)); |
| | | |
| | | return createdInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户等级信息 |
| | | * |
| | | * @param uid |
| | | * @param system |
| | | * @return |
| | | */ |
| | | public UserLijinLevelInfoVO getUserLevelInfo(Long uid, SystemEnum system) { |
| | | if (system == SystemEnum.yhqjx) { |
| | | VIPEnum rank = getVIPRank(uid); |
| | | UserLijinLevelInfoVO vo = new UserLijinLevelInfoVO(); |
| | | vo.setUserLevel(getVIPRank(uid).name()); |
| | | vo.setLoadingAdInfo(new UserLijinLevelInfoVO.ADInfo("gdt2", "9041686956722647")); |
| | | if (rank == getDefaultRank()) { |
| | | //当前为默认等级,可以升级 |
| | | vo.setUpgradeRights(new UserLijinLevelInfoVO.UpgradeRights("铂金会员免广告,礼金提高100%", configService.getValue(ConfigKeyEnum.lijinVIPLink, system))); |
| | | } |
| | | return vo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 是否可以创建广告订单 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public boolean canCreateADOrder(Long uid) { |
| | | return vipOrederService.canAddOrderByWatchVideo(getUid(uid)); |
| | | } |
| | | |
| | | /** |
| | | * 创建广告订单 |
| | | * |
| | | * @param uid |
| | | * @throws VipOrderException |
| | | */ |
| | | public void createADOrder(Long uid) throws VipOrderException { |
| | | VipGrade vipGrade = vipGradeService.getByVipEnum(VIPEnum.platinum); |
| | | vipOrederService.addOrderByWatchVideo(getUid(uid), vipGrade.getId(), 24); |
| | | } |
| | | |
| | | public List<VipCenterRecord> getVipRecordList(Long uid, int page, int pageSize) { |
| | | List<VipCenterRecord> list = vipCenterRecordService.list(getUid(uid), page, pageSize); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public long countVipRecord(Long uid) { |
| | | return vipCenterRecordService.count(getUid(uid)); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.lijin.vo; |
| | | |
| | | /** |
| | | * 用户礼金的等级信息 |
| | | */ |
| | | public class UserLijinLevelInfoVO { |
| | | |
| | | //当前的等级 |
| | | private String userLevel; |
| | | //升级权益 |
| | | private UpgradeRights upgradeRights; |
| | | //加载广告信息 |
| | | private ADInfo loadingAdInfo; |
| | | |
| | | |
| | | public String getUserLevel() { |
| | | return userLevel; |
| | | } |
| | | |
| | | public void setUserLevel(String userLevel) { |
| | | this.userLevel = userLevel; |
| | | } |
| | | |
| | | public UpgradeRights getUpgradeRights() { |
| | | return upgradeRights; |
| | | } |
| | | |
| | | public void setUpgradeRights(UpgradeRights upgradeRights) { |
| | | this.upgradeRights = upgradeRights; |
| | | } |
| | | |
| | | public ADInfo getLoadingAdInfo() { |
| | | return loadingAdInfo; |
| | | } |
| | | |
| | | public void setLoadingAdInfo(ADInfo loadingAdInfo) { |
| | | this.loadingAdInfo = loadingAdInfo; |
| | | } |
| | | |
| | | public static class ADInfo { |
| | | //csj gdt2 |
| | | private String type; |
| | | private String pid; |
| | | |
| | | public ADInfo(String type, String pid) { |
| | | this.type = type; |
| | | this.pid = pid; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getPid() { |
| | | return pid; |
| | | } |
| | | |
| | | public void setPid(String pid) { |
| | | this.pid = pid; |
| | | } |
| | | } |
| | | |
| | | public static class UpgradeRights { |
| | | private String desc; |
| | | private String link; |
| | | |
| | | public UpgradeRights(String desc, String link) { |
| | | this.desc = desc; |
| | | this.link = link; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public String getLink() { |
| | | return link; |
| | | } |
| | | |
| | | public void setLink(String link) { |
| | | this.link = link; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.lijin.vo; |
| | | |
| | | public class VIPGradeVO { |
| | | |
| | | private String id; |
| | | private String name; |
| | | private String tag; |
| | | private String money; |
| | | private String originMoney; |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public String getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(String money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getOriginMoney() { |
| | | return originMoney; |
| | | } |
| | | |
| | | public void setOriginMoney(String originMoney) { |
| | | this.originMoney = originMoney; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.lijin.vo; |
| | | |
| | | public class VipRecordVO { |
| | | private String name; |
| | | private String orderId; |
| | | private String startTime; |
| | | private String endTime; |
| | | private String createTime; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getOrderId() { |
| | | return orderId; |
| | | } |
| | | |
| | | public void setOrderId(String orderId) { |
| | | this.orderId = orderId; |
| | | } |
| | | |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.fanli.service.impl.config; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.fanli.dao.mybatis.SystemConfigMapper; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.system.SystemConfig; |
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.SystemConfigMapper; |
| | | import com.yeshi.fanli.entity.system.BusinessSystem; |
| | | import com.yeshi.fanli.entity.system.SystemConfig; |
| | | import com.yeshi.fanli.exception.NotExistObjectException; |
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService; |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class SystemConfigServiceImpl implements SystemConfigService{ |
| | |
| | | private SystemConfigMapper systemConfigMapper; |
| | | |
| | | |
| | | @Cacheable(value={"childSystemCache"}, key="#p0") |
| | | public String get(String sigkey) throws NotExistObjectException { |
| | | SystemConfig systemConfig = systemConfigMapper.getByKey(sigkey); |
| | | if(systemConfig == null ){ |
| | | throw new NotExistObjectException("不存在该参数"); |
| | | } |
| | | return systemConfig.getValue(); |
| | | @Override |
| | | public void save(SystemConfig systemConfig) throws ParamsException { |
| | | |
| | | if (systemConfig == null || systemConfig.getSystem() == null || systemConfig.getKey() == null) { |
| | | throw new ParamsException(1, "参数不完整"); |
| | | } |
| | | |
| | | |
| | | @Cacheable(value={"childSystemCache"}, key="#p0+#system.id") |
| | | public String get(String key, BusinessSystem system) { |
| | | if(system==null || system.getId()==0){ |
| | | return ""; |
| | | SystemConfig old = getConfig(SystemConfigKeyEnum.valueOf(systemConfig.getKey()), systemConfig.getSystem()); |
| | | if (old != null) { |
| | | SystemConfig update = new SystemConfig(); |
| | | update.setId(old.getId()); |
| | | update.setValue(systemConfig.getValue()); |
| | | update.setUpdatetime(System.currentTimeMillis()); |
| | | systemConfigMapper.updateByPrimaryKeySelective(update); |
| | | } else { |
| | | if (systemConfig.getUpdatetime() == null) { |
| | | systemConfig.setUpdatetime(System.currentTimeMillis()); |
| | | } |
| | | SystemConfig systemConfig = systemConfigMapper.getByKeyAndSystemId(key, system.getId()); |
| | | if(systemConfig != null){; |
| | | return systemConfig.getValue(); |
| | | systemConfigMapper.insertSelective(systemConfig); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SystemConfig getConfig(SystemConfigKeyEnum key, SystemEnum system) { |
| | | return systemConfigMapper.selectByKeyAndSystem(key.name(), system); |
| | | } |
| | | |
| | | |
| | | @Cacheable(value = "systemConfig", key = "'getConfig-'+#key+'-'+#system") |
| | | @Override |
| | | public SystemConfig getConfigCache(SystemConfigKeyEnum key, SystemEnum system) { |
| | | return getConfig(key, system); |
| | | } |
| | | |
| | | @Cacheable(value = "systemConfig", key = "'getValue-'+#key+'-'+#system") |
| | | @Override |
| | | public String getValueCache(SystemConfigKeyEnum key, SystemEnum system) { |
| | | SystemConfig config = getConfig(key, system); |
| | | if (config == null) { |
| | | return null; |
| | | } |
| | | return config.getValue(); |
| | | } |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | |
| | | @Resource |
| | | private QualityGoodsService qualityGoodsService; |
| | | |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Cacheable(value = "taoKeMaterialCache", key = "'listByMaterial-'+#materialId +'-'+#pageIndex") |
| | | @Override |
| | |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version,system); |
| | | |
| | | List<TaoBaoGoodsBrief> goodsBriefList = new ArrayList<>(); |
| | | if (fq == 0 && fh == 0 && !ft) { |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief bf : result.getTaoBaoGoodsBriefs()) { |
| | |
| | | } |
| | | } |
| | | |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(bf, paramsDTO); |
| | | re.add(goodsDetailVO); |
| | | goodsBriefList.add(bf); |
| | | } |
| | | } else { |
| | | if (taoBaoGoodsBriefs != null) |
| | |
| | | break; |
| | | } |
| | | } |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO); |
| | | re.add(goodsDetailVO); |
| | | goodsBriefList.add(taoBaoGoodsBrief); |
| | | } |
| | | } |
| | | |
| | | Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | | .excludeFieldsWithoutExposeAnnotation().create(); |
| | | |
| | | List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(system, null, goodsBriefList, paramsDTO); |
| | | for (GoodsDetailVO vo : voList) { |
| | | re.add(vo); |
| | | } |
| | | |
| | | |
| | | data.put("result", gson2.toJson(re)); |
| | | data.put("count", result.getTaoBaoHead().getDocsfound()); |
| | | |
| | | return data; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.msg; |
| | | |
| | | import com.yeshi.fanli.dao.user.msg.MsgOverViewsDao; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOverViews; |
| | | import com.yeshi.fanli.service.inter.msg.MsgOverViewsService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class MsgOverViewsServiceImpl implements MsgOverViewsService { |
| | | |
| | | @Resource |
| | | private MsgOverViewsDao msgOverViewsDao; |
| | | |
| | | @Override |
| | | public void save(MsgOverViews msgOverViews) { |
| | | if (msgOverViews == null) |
| | | return; |
| | | if (msgOverViews.getMsgType() == null || msgOverViews.getUid() == null || msgOverViews.getIdentityCode() == null) |
| | | return; |
| | | msgOverViews.setId(MsgOverViews.createId(msgOverViews.getMsgType(), msgOverViews.getIdentityCode())); |
| | | if (msgOverViews.getCreateTime() == null) { |
| | | msgOverViews.setCreateTime(new Date()); |
| | | } |
| | | |
| | | msgOverViewsDao.save(msgOverViews); |
| | | } |
| | | |
| | | @Override |
| | | public List<MsgOverViews> listByUid(Long uid, int page, int pageSize) { |
| | | MsgOverViewsDao.DaoQuery daoQuery = new MsgOverViewsDao.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | daoQuery.start = (page - 1) * pageSize; |
| | | daoQuery.count = pageSize; |
| | | return msgOverViewsDao.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public long countByUid(Long uid) { |
| | | MsgOverViewsDao.DaoQuery daoQuery = new MsgOverViewsDao.DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | return msgOverViewsDao.count(daoQuery); |
| | | } |
| | | } |
| | |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.config.SMSConfig; |
| | | import com.yeshi.fanli.entity.system.BusinessSystem; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser; |
| | | import com.yeshi.fanli.vo.user.QQUserInfoVO; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | return portrait; |
| | | } |
| | | } |
| | | |
| | | return user.getPortrait(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, BusinessSystem businessSystem) |
| | | throws UserAccountException { |
| | | |
| | | public String getMobile(String vcode, String phone, String aliAccessToken, SystemEnum system, int vcodeType) throws UserAccountException { |
| | | if (!StringUtil.isNullOrEmpty(aliAccessToken)) { |
| | | String mobile = AliyunOneKeyLoginUtil.getMobile(aliAccessToken, ""); |
| | | if (StringUtil.isNullOrEmpty(mobile)) { |
| | | throw new UserAccountException(1, "手机号获取失败"); |
| | | } |
| | | return mobile; |
| | | } else { |
| | | // 空额清理 |
| | | if (phone == null || phone.trim().length() == 0) { |
| | | throw new UserAccountException(1, "请输入手机号码"); |
| | |
| | | phone = phone.replaceAll(" ", ""); |
| | | boolean isDemo=false; |
| | | //查询上线测试的号码与验证码 |
| | | String demoLogin = configService.getValue(ConfigKeyEnum.demoLoginUser, businessSystem.getSystem()); |
| | | String demoLogin = configService.getValue(ConfigKeyEnum.demoLoginUser, system); |
| | | if (!StringUtil.isNullOrEmpty(demoLogin)) { |
| | | String demoPhone = demoLogin.split("#")[0]; |
| | | String demoCode = demoLogin.split("#")[1]; |
| | |
| | | isDemo=true; |
| | | } |
| | | } |
| | | |
| | | // "17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode); |
| | | |
| | | // 苹果应用商店上线测试号码 |
| | | if (isDemo) {//测试号码 |
| | | ; |
| | | } else { |
| | | if (!isDemo) { |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | | throw new UserAccountException(1, "请输入验证码"); |
| | | } |
| | | |
| | | String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN); |
| | | String oldVcode = redisManager.getSMSVCode(phone, vcodeType); |
| | | LogHelper.test("----------------------登录验证码: " + oldVcode); |
| | | if (!Constant.IS_TEST) |
| | | if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) { |
| | | throw new UserAccountException(1, "验证码错误,重新输入"); |
| | | } else {// 验证码输入正确 |
| | | redisManager.clearSMSVCode(phone, SMSHistory.TYPE_LOGIN); |
| | | redisManager.clearSMSVCode(phone, vcodeType); |
| | | } |
| | | } |
| | | return phone; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, String aliAccessToken, BusinessSystem businessSystem) |
| | | throws UserAccountException { |
| | | String mobile = getMobile(vcode, phone, aliAccessToken, businessSystem.getSystem(), SMSHistory.TYPE_LOGIN); |
| | | JSONObject logInfo = new JSONObject(); |
| | | logInfo.put("appId", businessSystem.getAppid()); |
| | | logInfo.put("phone", phone); |
| | | logInfo.put("phone", mobile); |
| | | logInfo.put("loginType", loginType); |
| | | LogHelper.lgoinInfo(logInfo.toString()); |
| | | |
| | | // 判断手机号码是否被封禁 |
| | | ForbiddenUserIdentifyCode identifyCode1 = forbiddenUserIdentifyCodeService |
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, phone); |
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.phone, mobile); |
| | | if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective()) { |
| | | throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC); |
| | | } |
| | | |
| | | // 清空限制 |
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN); |
| | | redisManager.clearSMSFrequencyLimit(mobile, SMSHistory.TYPE_LOGIN); |
| | | // 清理次数 |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, phone); |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.SMSLoginCount, mobile); |
| | | redisManager.removeCommonString(key); |
| | | |
| | | // 采用redis事务防止一个手机号多次注册问题 |
| | | String watchKey = StringUtil.Md5("REGISTER:" + phone); |
| | | String watchKey = StringUtil.Md5("REGISTER:" + mobile); |
| | | Jedis jedis = redisManager.getJedis(); |
| | | try { |
| | | jedis.watch(watchKey); |
| | |
| | | } else { |
| | | |
| | | // 查询是否存在该电话历史用户 |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByPhone(phone, businessSystem.getSystem()); |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByPhone(mobile, businessSystem.getSystem()); |
| | | if (userInfo != null) { |
| | | // 更新账户登录信息 |
| | | updateLonginInfo(userInfo, loginType, ipInfo); |
| | |
| | | userInfo = new UserInfo(); |
| | | userInfo.setAppId(businessSystem.getAppid()); |
| | | userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait()); |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPhone(mobile); |
| | | userInfo.setLoginType(loginType); |
| | | userInfo.setState(UserInfo.STATE_NORMAL); |
| | | userInfo.setSystem(businessSystem.getSystem()); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | userInfoModifyRecordService.addModifyRecord(userInfo.getId(), ModifyTypeEnum.bindPhone, phone); |
| | | userInfoModifyRecordService.addModifyRecord(userInfo.getId(), ModifyTypeEnum.bindPhone, mobile); |
| | | } |
| | | return userInfo; |
| | | } |
| | |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid(), businessSystem.getSystem()); |
| | | if (userInfo == null) { |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, |
| | | StringUtil.Md5("WXLogin:" + weiXinUser.getUnionid())); |
| | | "WXLogin#" + StringUtil.Md5(weiXinUser.getUnionid())); |
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20); |
| | | throw new UserAccountException(101, key); |
| | | throw new UserAccountException(UserAccountException.CODE_NEED_BIND_PHONE, key); |
| | | } |
| | | // 更新账户登录信息 |
| | | updateLonginInfo(userInfo, loginType, ipInfo); |
| | | Long uid = userInfo.getId(); |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 删除邀请分享图 |
| | | spreadUserImgService.deleteImgUrl(uid); |
| | | } |
| | | }); |
| | | return userInfo; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo loginQQ(ProxyIP ipInfo, int loginType, QQUserInfoVO qqUserInfo, BusinessSystem businessSystem) throws UserAccountException { |
| | | // 通过Code换取信息 |
| | | if (qqUserInfo == null) { |
| | | throw new UserAccountException(1, "QQ信息为空"); |
| | | } |
| | | |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByQQOpenId(qqUserInfo.getOpenid(), businessSystem.getSystem()); |
| | | if (userInfo == null) { |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.emptyKey, |
| | | "QQLogin#" + StringUtil.Md5(qqUserInfo.getOpenid())); |
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(qqUserInfo), 60 * 20); |
| | | throw new UserAccountException(UserAccountException.CODE_NEED_BIND_PHONE, key); |
| | | } |
| | | // 更新账户登录信息 |
| | | updateLonginInfo(userInfo, loginType, ipInfo); |
| | |
| | | |
| | | @Transactional(rollbackFor = UserAccountException.class) |
| | | @Override |
| | | public void bindWeiXin(AcceptData acceptData, Long uid, String code) throws UserAccountException { |
| | | WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion()); |
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret()); |
| | | public void bindWeiXin(BusinessSystem system, Long uid, String code) throws UserAccountException { |
| | | WeiXinUser weiXinUser = WXAppLoginUtil.getWeiXinUser(code, system.getWxAppId(), system.getWxAppSecret()); |
| | | if (weiXinUser == null) { |
| | | throw new UserAccountException(2, "微信帐号授权失败"); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void bindQQ(Long uid, QQUserInfoVO qqUser) throws UserAccountException { |
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid); |
| | | if (user == null) { |
| | | throw new UserAccountException(1, "用户不存在"); |
| | | } |
| | | |
| | | if (qqUser == null || StringUtil.isNullOrEmpty(qqUser.getOpenid())) { |
| | | throw new UserAccountException(2, "qq用户信息为空"); |
| | | } |
| | | |
| | | |
| | | String qqOpenIdExist = user.getQqOpenId(); |
| | | |
| | | if (StringUtil.isNullOrEmpty(qqOpenIdExist)) { |
| | | UserInfo newUser = userInfoService.getEffectiveUserInfoByQQOpenId(qqUser.getOpenid(), user.getSystem()); |
| | | if (newUser != null) { |
| | | throw new UserAccountException(4, "该QQ号已被其他帐号绑定"); |
| | | } |
| | | } else if (qqUser.getOpenid().equalsIgnoreCase(qqOpenIdExist)) { |
| | | throw new UserAccountException(3, "QQ帐号一致无需更换"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(user.getPhone())) { |
| | | throw new UserAccountException(5, "该帐号没有绑定手机号码,需绑定手机号码才能完成QQ更换"); |
| | | } |
| | | |
| | | UserInfo updateUserInfo = new UserInfo(uid); |
| | | updateUserInfo.setQqNickName(qqUser.getNickname()); |
| | | updateUserInfo.setQqOpenId(qqUser.getOpenid()); |
| | | |
| | | // 将默认昵称替换成微信昵称 |
| | | String defaultNickName = Constant.systemCommonConfig.getDefaultNickName(); |
| | | if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(qqUser.getNickname())) { |
| | | defaultNickName = defaultNickName + uid; |
| | | if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) { |
| | | updateUserInfo.setNickName(qqUser.getNickname()); |
| | | } |
| | | } |
| | | |
| | | // 将默认头像替换成QQ头像 |
| | | String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait(); |
| | | if (!StringUtil.isNullOrEmpty(qqUser.getFigureurl_2()) && !StringUtil.isNullOrEmpty(defaultPortrait) |
| | | && defaultPortrait.equals(user.getPortrait())) { |
| | | String headimgurl = qqUser.getFigureurl_2(); |
| | | updateUserInfo.setPortrait(headimgurl); |
| | | } |
| | | userInfoService.updateByPrimaryKeySelective(updateUserInfo); |
| | | |
| | | // 加入绑定记录 |
| | | UserAccountBindingHistory history = new UserAccountBindingHistory(); |
| | | history.setContent(qqUser.getOpenid()); |
| | | history.setType(UserAccountBindingHistory.TYPE_QQ); |
| | | history.setUid(uid); |
| | | |
| | | // 之前已经绑定电话号码 |
| | | if (!StringUtil.isNullOrEmpty(user.getQqOpenId())) |
| | | history.setFirst(false); |
| | | else |
| | | history.setFirst(true); |
| | | userAccountBindingHistoryService.addUserAccountBindingHistory(history); |
| | | |
| | | userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_QQ); |
| | | |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindQQ, user.getQqOpenId()); |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo bindPhoneToLogin(ProxyIP ipinfo, AcceptData acceptData, String phone, String key) |
| | | throws UserAccountException { |
| | | |
| | |
| | | if (identifyCode1 != null && identifyCode1.getEffective() != null && identifyCode1.getEffective()) |
| | | throw new UserAccountException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC); |
| | | |
| | | int loginType = 0; |
| | | String loginName = ""; |
| | | if (key.contains("QQLogin#")) { |
| | | //qq登录 |
| | | loginType = 4; |
| | | loginName = "QQ"; |
| | | } else { |
| | | //微信登录 |
| | | loginType = 2; |
| | | loginName = "微信"; |
| | | } |
| | | |
| | | |
| | | String value = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(value)) |
| | | throw new UserAccountException(1, "微信授权失效,请使用微信重新登录"); |
| | | |
| | | WeiXinUser weiXinUser = JsonUtil.getSimpleGson().fromJson(value, WeiXinUser.class); |
| | | if (weiXinUser == null) |
| | | throw new UserAccountException(1, "微信授权失效,请使用微信重新登录"); |
| | | throw new UserAccountException(1, String.format("%s授权失效,请使用%s重新登录", loginName, loginName)); |
| | | |
| | | SystemEnum system = SystemInfoUtil.getSystem(acceptData); |
| | | String thirdPortrait; |
| | | String thirdCode; |
| | | String thirdNickName; |
| | | QQUserInfoVO qqUser = null; |
| | | WeiXinUser weiXinUser = null; |
| | | if (loginType == 4) { |
| | | qqUser = JsonUtil.getSimpleGson().fromJson(value, QQUserInfoVO.class); |
| | | |
| | | if (qqUser == null) |
| | | throw new UserAccountException(1, "QQ授权失效,请使用QQ重新授权登录"); |
| | | |
| | | thirdPortrait = qqUser.getFigureurl_2(); |
| | | thirdCode = qqUser.getOpenid(); |
| | | thirdNickName = qqUser.getNickname(); |
| | | |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByQQOpenId(qqUser.getOpenid(), system); |
| | | // 直接用的QQ登录 |
| | | if (userInfo != null) |
| | | throw new UserAccountException(10, "该QQ号已被占用"); |
| | | |
| | | } else { |
| | | weiXinUser = JsonUtil.getSimpleGson().fromJson(value, WeiXinUser.class); |
| | | if (weiXinUser == null) |
| | | throw new UserAccountException(1, "三方授权失效,请使用三方重新授权登录"); |
| | | |
| | | thirdPortrait = weiXinUser.getHeadimgurl(); |
| | | thirdCode = weiXinUser.getUnionid(); |
| | | thirdNickName = weiXinUser.getNickname(); |
| | | |
| | | UserInfo userInfo = userInfoService.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid(), system); |
| | | // 直接用的微信登录 |
| | | if (userInfo != null) |
| | | throw new UserAccountException(10, "该微信号已被占用"); |
| | | } |
| | | |
| | | String portrait = null; |
| | | if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl())) { |
| | | InputStream asInputStream = HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl()); |
| | | if (!StringUtil.isNullOrEmpty(thirdPortrait)) { |
| | | InputStream asInputStream = HttpUtil.getAsInputStream(thirdPortrait); |
| | | if (asInputStream != null) { |
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, |
| | | String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), |
| | | System.currentTimeMillis() + "")); |
| | | String path = ""; |
| | | if (loginType == 4) { |
| | | path = String.format(FilePathEnum.userQQPortrait.getPath() + "%s_%s.jpg", thirdCode, |
| | | System.currentTimeMillis() + ""); |
| | | } else { |
| | | path = String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", thirdCode, |
| | | System.currentTimeMillis() + ""); |
| | | } |
| | | |
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, path); |
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) |
| | | portrait = result.getUrl(); |
| | | } else { |
| | | portrait = weiXinUser.getHeadimgurl(); |
| | | portrait = thirdPortrait; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 是否需要创建新账户 |
| | | UserInfo phoneUser = userInfoService.getEffectiveUserInfoByPhone(phone, system); |
| | | UserInfo userInfo = null; |
| | | if (phoneUser != null) { |
| | | // 绑定微信 |
| | | if (weiXinUser != null) { |
| | | if (StringUtil.isNullOrEmpty(phoneUser.getWxUnionId())) { |
| | | try { |
| | | bindWeiXin(phoneUser.getId(), weiXinUser); |
| | |
| | | } else { |
| | | throw new UserAccountException(1, "该微信已被绑定"); |
| | | } |
| | | } |
| | | if (qqUser != null) { |
| | | if (StringUtil.isNullOrEmpty(phoneUser.getQqOpenId())) { |
| | | try { |
| | | bindQQ(phoneUser.getId(), qqUser); |
| | | } catch (Exception e) { |
| | | throw new UserAccountException(1, "QQ绑定失败"); |
| | | } |
| | | } else { |
| | | throw new UserAccountException(1, "该QQ已被绑定"); |
| | | } |
| | | } |
| | | |
| | | userInfo = userInfoService.selectAvailableByPrimaryKey(phoneUser.getId()); |
| | | } else { |
| | | // 创建新账户 |
| | |
| | | userInfo.setPhone(phone); |
| | | userInfo.setPortrait(portrait); |
| | | userInfo.setAppId(null); |
| | | if (weiXinUser != null) { |
| | | userInfo.setNickName(weiXinUser.getNickname()); |
| | | userInfo.setWxName(weiXinUser.getNickname()); |
| | | userInfo.setWxOpenId(weiXinUser.getOpenid()); |
| | | userInfo.setWxUnionId(weiXinUser.getUnionid()); |
| | | userInfo.setWxPic(weiXinUser.getHeadimgurl()); |
| | | userInfo.setLastLoginTime(System.currentTimeMillis()); |
| | | userInfo.setLoginType(2); |
| | | } |
| | | |
| | | if (qqUser != null) { |
| | | userInfo.setQqOpenId(qqUser.getOpenid()); |
| | | userInfo.setQqNickName(qqUser.getNickname()); |
| | | userInfo.setLoginType(4); |
| | | } |
| | | userInfo.setLastLoginTime(System.currentTimeMillis()); |
| | | userInfo.setLastLoginIp(ipinfo.getIp()); |
| | | userInfo.setState(UserInfo.STATE_NORMAL); |
| | | userInfo.setSystem(system); |
| | |
| | | } |
| | | |
| | | Long uid = userInfo.getId(); |
| | | final WeiXinUser tempWeiXinUser = weiXinUser; |
| | | final QQUserInfoVO tempQQUser = qqUser; |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | try { |
| | |
| | | userAccountBindingHistoryService.addUserAccountBindingHistory(history); |
| | | |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindPhone, phone); |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, weiXinUser.getUnionid()); |
| | | if (tempWeiXinUser != null) |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, tempWeiXinUser.getUnionid()); |
| | | if (tempQQUser != null) |
| | | userInfoModifyRecordService.addModifyRecord(uid, ModifyTypeEnum.bindQQ, tempQQUser.getOpenid()); |
| | | } |
| | | }); |
| | | // 删除缓存 |
| | |
| | | |
| | | public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, SystemEnum sysetm) { |
| | | List<UserInfo> list = null; |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = sysetm; |
| | | daoQuery.count = 1000; |
| | | if (loginType == 1) { |
| | | list = userInfoMapper.listBySystemAndTaoBaoOpenId(sysetm, openid); |
| | | daoQuery.openId = openid; |
| | | } else { |
| | | list = userInfoMapper.listBySystemAndWXUnionId(sysetm, openid); |
| | | daoQuery.wxUnionId = openid; |
| | | } |
| | | list = userInfoMapper.list(daoQuery); |
| | | |
| | | |
| | | if (list != null) |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | |
| | | @Override |
| | | public List<UserInfo> listBySystemAndWXUnionId(SystemEnum system, String unionId) { |
| | | return userInfoMapper.listBySystemAndWXUnionId(system, unionId); |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = system; |
| | | daoQuery.count = 1000; |
| | | daoQuery.wxUnionId = unionId; |
| | | |
| | | return userInfoMapper.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> listBySystemAndTaoBaoOpenId(SystemEnum system, String openId) { |
| | | return userInfoMapper.listBySystemAndTaoBaoOpenId(system, openId); |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = system; |
| | | daoQuery.count = 1000; |
| | | daoQuery.openId = openId; |
| | | return userInfoMapper.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> listBySystemAndPhone(SystemEnum system, String phone) { |
| | | return userInfoMapper.listBySystemAndPhone(system, phone); |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = system; |
| | | daoQuery.count = 1000; |
| | | daoQuery.phone = phone; |
| | | return userInfoMapper.list(daoQuery); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public UserInfo getEffectiveUserInfoByPhone(String phone, SystemEnum system) { |
| | | return userInfoMapper.getEffectiveUserInfoByPhone(phone, system); |
| | | |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = system; |
| | | daoQuery.count = 1000; |
| | | daoQuery.phone = phone; |
| | | daoQuery.state = UserInfo.STATE_NORMAL; |
| | | List<UserInfo> userInfoList = userInfoMapper.list(daoQuery); |
| | | |
| | | return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo getEffectiveUserInfoByWXUnionId(String unionId, SystemEnum system) { |
| | | return userInfoMapper.getEffectiveUserInfoByWXUnionId(unionId, system); |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = system; |
| | | daoQuery.count = 1000; |
| | | daoQuery.wxUnionId = unionId; |
| | | daoQuery.state = UserInfo.STATE_NORMAL; |
| | | List<UserInfo> userInfoList = userInfoMapper.list(daoQuery); |
| | | |
| | | return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo getEffectiveUserInfoByQQOpenId(String opneId, SystemEnum sysetm) { |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = sysetm; |
| | | daoQuery.count = 1000; |
| | | daoQuery.qqOpenId = opneId; |
| | | daoQuery.state = UserInfo.STATE_NORMAL; |
| | | List<UserInfo> userInfoList = userInfoMapper.list(daoQuery); |
| | | return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo getEffectiveUserInfoByOpenId(String openId, SystemEnum sysetm) { |
| | | return userInfoMapper.getEffectiveUserInfoByOpenId(openId,sysetm); |
| | | UserInfoMapper.DaoQuery daoQuery = new UserInfoMapper.DaoQuery(); |
| | | daoQuery.system = sysetm; |
| | | daoQuery.count = 1000; |
| | | daoQuery.openId = openId; |
| | | daoQuery.state = UserInfo.STATE_NORMAL; |
| | | List<UserInfo> userInfoList = userInfoMapper.list(daoQuery); |
| | | return userInfoList != null && userInfoList.size() > 0 ? userInfoList.get(0) : null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.yeshi.fanli.service.inter.config; |
| | | |
| | | import com.yeshi.fanli.entity.system.BusinessSystem; |
| | | import com.yeshi.fanli.exception.NotExistObjectException; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.system.SystemConfig; |
| | | |
| | | /** |
| | | * 系统配置信息(后台可见,不输出给前端) |
| | | */ |
| | | public interface SystemConfigService { |
| | | |
| | | public String get(String key) throws NotExistObjectException; |
| | | public void save(SystemConfig systemConfig) throws ParamsException; |
| | | |
| | | public String get(String key, BusinessSystem system); |
| | | public SystemConfig getConfig(SystemConfigKeyEnum key, SystemEnum system); |
| | | |
| | | public SystemConfig getConfigCache(SystemConfigKeyEnum key, SystemEnum system); |
| | | |
| | | public String getValueCache(SystemConfigKeyEnum key, SystemEnum system); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.service.inter.msg; |
| | | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOverViews; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface MsgOverViewsService { |
| | | |
| | | /** |
| | | * 保存消息 |
| | | * |
| | | * @param msgOverViews |
| | | */ |
| | | public void save(MsgOverViews msgOverViews); |
| | | |
| | | |
| | | public List<MsgOverViews> listByUid(Long uid, int page, int pageSize); |
| | | |
| | | |
| | | public long countByUid(Long uid); |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.system.BusinessSystem; |
| | | import com.yeshi.fanli.exception.user.UserAccountException; |
| | | import com.yeshi.fanli.vo.taobao.TaoBaoUser; |
| | | import com.yeshi.fanli.vo.user.QQUserInfoVO; |
| | | import org.yeshi.utils.entity.ProxyIP; |
| | | import org.yeshi.utils.entity.wx.WeiXinUser; |
| | | |
| | |
| | | * @author Administrator |
| | | */ |
| | | public interface UserAccountService { |
| | | |
| | | |
| | | public String getMobile(String vcode, String phone, String aliAccessToken, SystemEnum system,int vcodeType) throws UserAccountException; |
| | | /** |
| | | * 用户登录 |
| | | * |
| | |
| | | * @throws UserAccountException |
| | | */ |
| | | @Deprecated |
| | | public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, BusinessSystem businessSystem) |
| | | public UserInfo loginPhone(ProxyIP ipInfo, int loginType, String vcode, String phone, String aliAccessToken, BusinessSystem businessSystem) |
| | | throws UserAccountException; |
| | | |
| | | /** |
| | |
| | | * @param code |
| | | * @throws UserAccountException |
| | | */ |
| | | public void bindWeiXin(AcceptData acceptData, Long uid, String code) throws UserAccountException; |
| | | public void bindWeiXin(BusinessSystem system, Long uid, String code) throws UserAccountException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @throws UserAccountException |
| | | */ |
| | | public void bindWeiXin(Long uid, WeiXinUser wxUser) throws UserAccountException; |
| | | |
| | | |
| | | /** |
| | | * 绑定QQ |
| | | * |
| | | * @param uid |
| | | * @param qqUser |
| | | * @throws UserAccountException |
| | | */ |
| | | public void bindQQ( Long uid, QQUserInfoVO qqUser) throws UserAccountException; |
| | | |
| | | |
| | | /** |
| | |
| | | public UserInfo loginWeiXinNew(ProxyIP ipInfo, int loginType, String wxCode, |
| | | BusinessSystem businessSystem) throws UserAccountException; |
| | | |
| | | |
| | | /** |
| | | * QQ登录 |
| | | * @param ipInfo |
| | | * @param loginType |
| | | * @param qqUserInfo |
| | | * @param businessSystem |
| | | * @return |
| | | * @throws UserAccountException |
| | | */ |
| | | public UserInfo loginQQ(ProxyIP ipInfo, int loginType, QQUserInfoVO qqUserInfo, |
| | | BusinessSystem businessSystem) throws UserAccountException; |
| | | |
| | | /** |
| | | * 未注册之前绑定手机号 |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * 根据QQ获取有效用户 |
| | | * @param opneId |
| | | * @param sysetm |
| | | * @return |
| | | */ |
| | | public UserInfo getEffectiveUserInfoByQQOpenId(String opneId, SystemEnum sysetm); |
| | | |
| | | |
| | | /** |
| | | * 获取有效用户(根据淘宝OpenId) |
| | | * @param openId |
| | | * @param sysetm |
New file |
| | |
| | | package com.yeshi.fanli.util; |
| | | |
| | | import com.aliyuncs.DefaultAcsClient; |
| | | import com.aliyuncs.IAcsClient; |
| | | import com.aliyuncs.dypnsapi.model.v20170525.GetMobileRequest; |
| | | import com.aliyuncs.dypnsapi.model.v20170525.GetMobileResponse; |
| | | import com.aliyuncs.exceptions.ClientException; |
| | | import com.aliyuncs.exceptions.ServerException; |
| | | import com.aliyuncs.profile.DefaultProfile; |
| | | import com.google.gson.Gson; |
| | | |
| | | public class AliyunOneKeyLoginUtil { |
| | | |
| | | private final static String ACCESS_KEY = "LTAI4FwmTxVCuzTaoZtDiV8z"; |
| | | private final static String ACESS_SCRET = "ixWg90QbYFKP6ae5xpAo2P1qwIyll5"; |
| | | |
| | | public static String getMobile(String accessToken, String outId) { |
| | | DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", ACCESS_KEY, ACESS_SCRET); |
| | | IAcsClient client = new DefaultAcsClient(profile); |
| | | |
| | | GetMobileRequest request = new GetMobileRequest(); |
| | | request.setAccessToken(accessToken); |
| | | if (!StringUtil.isNullOrEmpty(outId)) |
| | | request.setOutId(outId); |
| | | |
| | | try { |
| | | GetMobileResponse response = client.getAcsResponse(request); |
| | | System.out.println(new Gson().toJson(response)); |
| | | if (response.getGetMobileResultDTO() != null) { |
| | | String mobile = response.getGetMobileResultDTO().getMobile(); |
| | | return mobile; |
| | | } |
| | | System.out.println(new Gson().toJson(response)); |
| | | } catch (ServerException e) { |
| | | e.printStackTrace(); |
| | | } catch (ClientException e) { |
| | | System.out.println("ErrCode:" + e.getErrCode()); |
| | | System.out.println("ErrMsg:" + e.getErrMsg()); |
| | | System.out.println("RequestId:" + e.getRequestId()); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | userPortrait("/user/img/portrait/", "用户头像"), |
| | | userPreview("/user/img/preview/", "用户预览头像"), |
| | | userWXPortrait("/user/img/portrait_wx/", "用户微信头像"), |
| | | userQQPortrait("/user/img/portrait_qq/", "用户QQ头像"), |
| | | userERcode("/user/img/ercode/", "用户上传微信二维码"), |
| | | userComplaint("/user/img/user_complaint/", "用户吐槽图片"), |
| | | activityUserPortrait("/user/img/dynamic/portrait/", "动态用户头像"), |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.fanli.vo.user.QQUserInfoVO; |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | |
| | | return orderId.substring(0, orderId.length() - 6) + "******"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解析QQ用户信息 |
| | | * |
| | | * @param qqUserBase64 |
| | | * @return |
| | | */ |
| | | public static QQUserInfoVO parseQQUser(String qqUserBase64) { |
| | | if (StringUtil.isNullOrEmpty(qqUserBase64)) |
| | | return null; |
| | | String qqUserStr = StringUtil.getFromBase64(qqUserBase64); |
| | | if (StringUtil.isNullOrEmpty(qqUserStr)) |
| | | return null; |
| | | QQUserInfoVO qqUserInfo = new Gson().fromJson(qqUserStr, QQUserInfoVO.class); |
| | | return qqUserInfo; |
| | | } |
| | | } |
| | |
| | | public final static int TYPE_WX = 1;// 微信 |
| | | public final static int TYPE_TB = 2;// 淘宝 |
| | | public final static int TYPE_PHONE = 3;// 电话 |
| | | public final static int TYPE_QQ = 4;// 电话 |
| | | |
| | | public final static int WAY_BIND = 1;// 绑定 |
| | | public final static int WAY_CHANGE = 2;// 更换 |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.sun.istack.NotNull; |
| | | import com.sun.istack.internal.NotNull; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static VIPConvertResultDTO convertLinkByUrl(String url, String tag) { |
| | | JSONObject taskParams = new JSONObject(); |
| | | JSONArray urlArray = new JSONArray(); |
| | | urlArray.add(url); |
| | | taskParams.put("urlList", urlArray); |
| | | if (tag != null) { |
| | | taskParams.put("chanTag", tag); |
| | | } |
| | | taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID()); |
| | | String result = baseRequest("com.vip.adp.api.open.service.UnionUrlService", "genByVIPUrl", |
| | | JSONObject.fromObject(taskParams)); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("returnCode") == 0) { |
| | | String re = resultJSON.optJSONObject("result").optJSONArray("urlInfoList").optJSONObject(0).toString(); |
| | | return new Gson().fromJson(re, VIPConvertResultDTO.class); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据商品ID获取商品详情 |
| | | * |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | |
| | | convertLink("6919237495414585303","437032"); |
| | | |
| | | convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.user; |
| | | |
| | | public class QQUserInfoVO { |
| | | |
| | | private String openid; |
| | | private String nickname; |
| | | private String gender; |
| | | private int gender_type; |
| | | private String province; |
| | | private String city; |
| | | private String year; |
| | | private String figureurl; |
| | | private String figureurl_1; |
| | | private String figureurl_2; |
| | | |
| | | |
| | | public String getOpenid() { |
| | | return openid; |
| | | } |
| | | |
| | | public void setOpenid(String openid) { |
| | | this.openid = openid; |
| | | } |
| | | |
| | | public String getNickname() { |
| | | return nickname; |
| | | } |
| | | |
| | | public void setNickname(String nickname) { |
| | | this.nickname = nickname; |
| | | } |
| | | |
| | | public String getGender() { |
| | | return gender; |
| | | } |
| | | |
| | | public void setGender(String gender) { |
| | | this.gender = gender; |
| | | } |
| | | |
| | | public int getGender_type() { |
| | | return gender_type; |
| | | } |
| | | |
| | | public void setGender_type(int gender_type) { |
| | | this.gender_type = gender_type; |
| | | } |
| | | |
| | | public String getProvince() { |
| | | return province; |
| | | } |
| | | |
| | | public void setProvince(String province) { |
| | | this.province = province; |
| | | } |
| | | |
| | | public String getCity() { |
| | | return city; |
| | | } |
| | | |
| | | public void setCity(String city) { |
| | | this.city = city; |
| | | } |
| | | |
| | | public String getYear() { |
| | | return year; |
| | | } |
| | | |
| | | public void setYear(String year) { |
| | | this.year = year; |
| | | } |
| | | |
| | | public String getFigureurl() { |
| | | return figureurl; |
| | | } |
| | | |
| | | public void setFigureurl(String figureurl) { |
| | | this.figureurl = figureurl; |
| | | } |
| | | |
| | | public String getFigureurl_1() { |
| | | return figureurl_1; |
| | | } |
| | | |
| | | public void setFigureurl_1(String figureurl_1) { |
| | | this.figureurl_1 = figureurl_1; |
| | | } |
| | | |
| | | public String getFigureurl_2() { |
| | | return figureurl_2; |
| | | } |
| | | |
| | | public void setFigureurl_2(String figureurl_2) { |
| | | this.figureurl_2 = figureurl_2; |
| | | } |
| | | } |
| | |
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" /> |
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" /> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" /> |
| | | <result column="qq_open_id" property="qqOpenId" jdbcType="VARCHAR"/> |
| | | <result column="qq_nick_name" property="qqNickName" jdbcType="VARCHAR"/> |
| | | <result column="tbName" property="tbName" jdbcType="VARCHAR" /> |
| | | <result column="tbPic" property="tbPic" jdbcType="VARCHAR" /> |
| | | <result column="wxName" property="wxName" jdbcType="VARCHAR" /> |
| | |
| | | <result column="login_type" property="loginType" jdbcType="INTEGER" /> |
| | | <result column="wx_open_id" property="wxOpenId" jdbcType="VARCHAR" /> |
| | | <result column="wx_union_id" property="wxUnionId" jdbcType="VARCHAR" /> |
| | | <result column="qq_open_id" property="qqOpenId" jdbcType="VARCHAR"/> |
| | | <result column="qq_nick_name" property="qqNickName" jdbcType="VARCHAR"/> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR" /> |
| | | <result column="uiet_taobao_nick_name" property="tbName" |
| | | jdbcType="VARCHAR" /> |
| | |
| | | <result column="showValue" property="showValue" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc |
| | | <sql id="Base_Column_List">id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,qq_open_id,qq_nick_name |
| | | </sql> |
| | | <!-- 不能查询缓存 --> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user |
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,platform) |
| | | (id,identifycode,login_type,wx_open_id,wx_union_id,nick_name,tbName,tbPic,wxName,wxPic,portrait,createtime,last_logintime,loginip,type,appid,my_hongBao,pay_password,system,rank,phone,state,state_desc,platform,qq_open_id,qq_nick_name) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{platform,jdbcType=VARCHAR}) |
| | | (#{id,jdbcType=BIGINT},#{openid,jdbcType=VARCHAR},#{loginType,jdbcType=INTEGER},#{wxOpenId,jdbcType=VARCHAR},#{wxUnionId,jdbcType=VARCHAR},#{nickName,jdbcType=VARCHAR},#{tbName,jdbcType=VARCHAR},#{tbPic,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPic,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createtime,jdbcType=BIGINT},#{lastLoginTime,jdbcType=BIGINT},#{lastLoginIp,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{appId,jdbcType=VARCHAR},#{myHongBao,jdbcType=DECIMAL},#{payPassword,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR},#{rank,jdbcType=INTEGER},#{phone,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{stateDesc,jdbcType=VARCHAR},#{platform,jdbcType=VARCHAR},#{qqOpenId,jdbcType=VARCHAR},#{qqNickName,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="state != null">state,</if> |
| | | <if test="stateDesc != null">state_desc,</if> |
| | | <if test="platform != null">platform,</if> |
| | | <if test="qqOpenId != null">qq_open_id,</if> |
| | | <if test="qqNickName != null">qq_nick_name,</if> |
| | | |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="rank != null">#{rank,jdbcType=INTEGER},</if> |
| | | <if test="phone != null">#{phone,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR}</if> |
| | | <if test="platform != null">#{platform,jdbcType=VARCHAR}</if> |
| | | <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if> |
| | | <if test="platform != null">#{platform,jdbcType=VARCHAR},</if> |
| | | <if test="qqOpenId != null">#{qqOpenId,jdbcType=VARCHAR},</if> |
| | | <if test="qqNickName != null">#{qqNickName,jdbcType=VARCHAR},</if> |
| | | |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo">update |
| | |
| | | #{payPassword,jdbcType=VARCHAR},system = |
| | | #{system,jdbcType=VARCHAR},rank = #{rank,jdbcType=INTEGER} ,phone |
| | | =#{phone,jdbcType=VARCHAR} ,state =#{state,jdbcType=INTEGER} |
| | | ,state_desc =#{stateDesc,jdbcType=VARCHAR} where id = |
| | | ,state_desc =#{stateDesc,jdbcType=VARCHAR} |
| | | ,qq_open_id =#{qqOpenId,jdbcType=VARCHAR} |
| | | ,qq_nick_name =#{qqNickName,jdbcType=VARCHAR} |
| | | |
| | | where id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | |
| | | <if test="wxOpenId != null">wx_open_id=#{wxOpenId,jdbcType=VARCHAR},</if> |
| | | <if test="wxUnionId != null">wx_union_id=#{wxUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">nick_name=#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="qqNickName != null">qq_nick_name=#{qqNickName,jdbcType=VARCHAR},</if> |
| | | <if test="qqOpenId != null">qq_open_id=#{qqOpenId,jdbcType=VARCHAR},</if> |
| | | <if test="tbName != null">tbName=#{tbName,jdbcType=VARCHAR},</if> |
| | | <if test="tbPic != null">tbPic=#{tbPic,jdbcType=VARCHAR},</if> |
| | | <if test="wxName != null">wxName=#{wxName,jdbcType=VARCHAR},</if> |
| | |
| | | `yeshi_ec_hongbao` hb WHERE hb.`uid` = #{id}; |
| | | </select> |
| | | |
| | | <!-- 根据系统与微信unionID获取用户 --> |
| | | <select id="listBySystemAndWXUnionId" resultMap="BaseResultMap"> |
| | | |
| | | <sql id="listWhereSQL"> |
| | | |
| | | <if test="query.phone!=null">and phone=#{query.phone}</if> |
| | | <if test="query.wxUnionId!=null">and wx_union_id=#{query.wxUnionId}</if> |
| | | <if test="query.openId!=null">and identifycode=#{query.openId}</if> |
| | | <if test="query.qqOpenId!=null">and qq_open_id=#{query.qqOpenId}</if> |
| | | <if test="query.system!=null">and system=#{query.system}</if> |
| | | <if test="query.state!=null">and state=#{query.state}</if> |
| | | </sql> |
| | | |
| | | <!-- 查询列表 --> |
| | | <select id="list" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where system=#{system} and wx_union_id=#{unionId} |
| | | </select> |
| | | <!-- 根据系统与淘宝OpenId获取用户 --> |
| | | <select id="listBySystemAndTaoBaoOpenId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where system=#{system} and identifycode=#{openId} |
| | | </select> |
| | | <!-- 根据系统与电话号码获取用户 --> |
| | | <select id="listBySystemAndPhone" resultMap="BaseResultMap" |
| | | useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user where system=#{system} and phone=#{phone} |
| | | from yeshi_ec_user where 1=1 |
| | | <include refid="listWhereSQL"></include> |
| | | limit #{query.start},#{query.count} |
| | | </select> |
| | | |
| | | |
| | | <select id="getEffectiveUserInfoByPhone" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user |
| | | where phone=#{phone} AND system=#{system} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getEffectiveUserInfoByWXUnionId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user |
| | | where wx_union_id=#{unionId} AND system=#{system} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getEffectiveUserInfoByOpenId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user |
| | | where identifycode=#{openId} AND system=#{system} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | |
| | | <select id="getEffectiveUserInfoByWXOpenId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user |
| | | where wx_open_id=#{wxOpenId} AND system=#{system} AND state = 0 |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getMaxUid" resultType="java.lang.Long">select max(id) from |
| | | yeshi_ec_user |
| | |
| | | SELECT u.`id` FROM `yeshi_ec_user` u |
| | | WHERE u.`id` IN |
| | | <foreach item="item" collection="list" open="(" separator="," |
| | | close=")">#{item}</foreach> |
| | | close=")">#{item} |
| | | </foreach> |
| | | AND <![CDATA[ (DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`last_logintime`/1000)) |
| | | OR (u.`last_logintime` IS NULL |
| | | AND DATE_SUB(CURDATE(), INTERVAL ${daysNum} DAY) > DATE(FROM_UNIXTIME(u.`createTime`/1000)))) ]]> |
| | |
| | | </if> |
| | | ORDER BY u.`createtime` |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWeekHasOrder" resultMap="ChartMap"> |