|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.matrix.component.redis.RedisUserLoginUtils; | 
|---|
|  |  |  | import com.matrix.component.tools.HttpCurlUtil; | 
|---|
|  |  |  | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.core.tools.LogUtil; | 
|---|
|  |  |  | import com.matrix.core.tools.StringUtils; | 
|---|
|  |  |  | import com.matrix.core.web.BaseAction; | 
|---|
|  |  |  | import com.matrix.system.activity.dao.ActivitySignReceiveRecordDao; | 
|---|
|  |  |  | import com.matrix.system.common.bean.BusParameterSettings; | 
|---|
|  |  |  | import com.matrix.system.common.dao.BusParameterSettingsDao; | 
|---|
|  |  |  | import com.matrix.system.common.interceptor.HostInterceptor; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.matrix.system.fenxiao.entity.ShopSalesmanApply; | 
|---|
|  |  |  | import com.matrix.system.fenxiao.service.ShopSalesmanApplyService; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipInfo; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.MoneyCardUseDao; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.SysVipInfoDao; | 
|---|
|  |  |  | import com.matrix.system.hive.service.SysVipInfoService; | 
|---|
|  |  |  | import com.matrix.system.score.dao.ScoreVipDetailDao; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.api.WeChatApiTools; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.api.dto.XcxUserSaveUserInfoDto; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.dao.ShopCouponRecordDao; | 
|---|
|  |  |  | import net.sf.json.JSONObject; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | WeChatApiTools weChatApiTools; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ScoreVipDetailDao scoreVipDetailDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WeixinServiceUtil weixinServiceUtil; | 
|---|
|  |  |  | private MoneyCardUseDao moneyCardUseDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ShopCouponRecordDao shopCouponRecordDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ActivitySignReceiveRecordDao activitySignReceiveRecordDao; | 
|---|
|  |  |  | @Value("${debug}") | 
|---|
|  |  |  | private String isDebug; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | sysVipInfo.setSessionKey(sessionKey); | 
|---|
|  |  |  | sysVipInfo.setCompanyId(HostInterceptor.getCompanyId()); | 
|---|
|  |  |  | sysVipInfo.setArrivalWay("微商城"); | 
|---|
|  |  |  | sysVipInfo.setVipName("微信用户"); | 
|---|
|  |  |  | sysVipInfo.setVipState(Dictionary.VIP_STATE_HY); | 
|---|
|  |  |  | sysVipInfo.setVipType(Dictionary.VIP_TYPE_NOCARD); | 
|---|
|  |  |  | sysVipInfo.setIsDeal(SysVipInfo.UNDEAL_VIP); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sysVipInfo.setVipNo(openId); | 
|---|
|  |  |  | sysVipInfoService.add(sysVipInfo); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询用户信息 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult findUserInfo() { | 
|---|
|  |  |  | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | String openId = loginUser.getOpenId(); | 
|---|
|  |  |  | SysVipInfo sysVipInfo = sysVipInfoService.findByOpenId(openId); | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | res.setStatus(AjaxResult.STATUS_SUCCESS); | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BeanUtil.copyProperties(xcxUserSaveUserInfoDto,sysVipInfo); | 
|---|
|  |  |  | sysVipInfo.setPhone(xcxUserSaveUserInfoDto.getPhoneNumber()); | 
|---|
|  |  |  | if(StringUtils.isBlank(loginUser.getVipName())){ | 
|---|
|  |  |  | if(StringUtils.isBlank(loginUser.getVipName())||loginUser.getVipName().equals("微信用户")){ | 
|---|
|  |  |  | sysVipInfo.setVipName(xcxUserSaveUserInfoDto.getNickName()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isBlank(loginUser.getSex())){ | 
|---|