|  |  |  | 
|---|
|  |  |  | package com.matrix.system.shopXcx.api.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.bean.BeanUtil; | 
|---|
|  |  |  | import cn.hutool.core.util.ObjectUtil; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.matrix.system.common.constance.AppConstance; | 
|---|
|  |  |  | import com.matrix.system.common.init.UserCacheManager; | 
|---|
|  |  |  | import com.matrix.component.tools.HttpCurlUtil; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/findUserInfo") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult findUserInfo() { | 
|---|
|  |  |  | AjaxResult res = new AjaxResult(); | 
|---|
|  |  |  | SysVipInfo loginUser = userCacheManager.getLoginUser(); | 
|---|
|  |  |  | SysVipInfo sysVipInfo = sysVipInfoService.findById(loginUser.getId()); | 
|---|
|  |  |  | sysVipInfo.setPointAll(scoreVipDetailDao.selectUserTotalScore(loginUser.getId())); | 
|---|
|  |  |  | sysVipInfo.setBalance(moneyCardUseDao.selectVipCardTotalMoney(loginUser.getId())); | 
|---|
|  |  |  | AjaxResult res = new AjaxResult(); | 
|---|
|  |  |  | res.putInMap("couponCount", shopCouponRecordDao.countUnuseCouponRecord(loginUser.getId())); | 
|---|
|  |  |  | res.putInMap("prizeCount", activitySignReceiveRecordDao.getSignAwardReceiveCount(loginUser.getId(), loginUser.getCompanyId())); | 
|---|
|  |  |  | res.putInMap("userInfo", sysVipInfo); | 
|---|
|  |  |  | //查询会员等级 | 
|---|
|  |  |  | if (sysVipInfo.getSalesmanGrade() != null) { | 
|---|
|  |  |  | ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade()); | 
|---|
|  |  |  | res.putInMap("vipLevel", shopSalesmanGrade.getName()); | 
|---|
|  |  |  | } else if (sysVipInfo.getVipLevel() != null) { | 
|---|
|  |  |  | res.putInMap("vipLevel", sysVipInfo.getVipLevel().getLevelName()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | res.putInMap("vipLevel", "初级会员"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (sysVipInfo != null) { | 
|---|
|  |  |  | if (SysVipInfo.VALID_FLAG_Y == sysVipInfo.getValidFlag()) { | 
|---|
|  |  |  | sysVipInfo.setBalance(moneyCardUseDao.selectVipCardTotalMoney(loginUser.getId())); | 
|---|
|  |  |  | sysVipInfo.setPointAll(scoreVipDetailDao.selectUserTotalScore(loginUser.getId())); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | sysVipInfo.setBalance(0D); | 
|---|
|  |  |  | sysVipInfo.setPointAll(0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | res.putInMap("couponCount", shopCouponRecordDao.countUnuseCouponRecord(loginUser.getId())); | 
|---|
|  |  |  | res.putInMap("prizeCount", activitySignReceiveRecordDao.getSignAwardReceiveCount(loginUser.getId(), loginUser.getCompanyId())); | 
|---|
|  |  |  | res.putInMap("userInfo", sysVipInfo); | 
|---|
|  |  |  | //查询会员等级 | 
|---|
|  |  |  | if (sysVipInfo.getSalesmanGrade() != null) { | 
|---|
|  |  |  | ShopSalesmanGrade shopSalesmanGrade = shopSalesmanGradeDao.selectById(sysVipInfo.getSalesmanGrade()); | 
|---|
|  |  |  | res.putInMap("vipLevel", shopSalesmanGrade.getName()); | 
|---|
|  |  |  | } else if (sysVipInfo.getVipLevel() != null) { | 
|---|
|  |  |  | res.putInMap("vipLevel", sysVipInfo.getVipLevel().getLevelName()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | res.putInMap("vipLevel", "初级会员"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | res.setStatus(AjaxResult.STATUS_SUCCESS); | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | 
|---|
|  |  |  | if ((loginUser.getIsSales() == null || loginUser.getIsSales() == 2) | 
|---|
|  |  |  | && StringUtils.isNotBlank(sysVipInfo.getNickName())) {//目前还不是分销员 | 
|---|
|  |  |  | BusParameterSettings fxSwith = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_SWITCH, HostInterceptor.getCompanyId()); | 
|---|
|  |  |  | if (fxSwith!=null && fxSwith.getParamValue().equals("1")) {//开启分销 | 
|---|
|  |  |  | if (fxSwith!=null && "1".equals(fxSwith.getParamValue())) {//开启分销 | 
|---|
|  |  |  | BusParameterSettings applyWay = busParameterSettingsDao.selectCompanyParamByCode(FenxiaoSettingConstant.FX_APPLY_WAY, loginUser.getCompanyId()); | 
|---|
|  |  |  | if (applyWay.getParamValue().equals(FenxiaoSettingConstant.FX_APPLY_WAY_AUTO)) {//自动成为分销员 | 
|---|
|  |  |  | QueryWrapper<ShopSalesmanApply> queryWrapper = new QueryWrapper<>(); | 
|---|