admin
2018-12-18 735883f04e0be2a5c0235b5fb5fd388192ab8330
邀请有奖代码恢复
用户登录BUG修复
4个文件已修改
140 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/InviteGetMoneyController.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/WeiXinUserParam.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/wx/WXLoginUtil.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/InviteGetMoneyController.java
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
@@ -12,6 +13,7 @@
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.admin.InviteGetMoney;
import com.yeshi.fanli.entity.system.System;
import com.yeshi.fanli.entity.system.SystemClientParams;
import com.yeshi.fanli.exception.NotExistObjectException;
@@ -21,7 +23,10 @@
import com.yeshi.fanli.service.inter.user.QrCodeService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserRankingsService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
@@ -54,6 +59,79 @@
    @Resource
    private UserRankingsService userRankingsService;
    @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
    public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
            throws NotExistObjectException {
        // 查询商品总数
        Integer totalCount = 0;
        int totalPage = totalCount % Constant.PAGE_SIZE == 0 ? totalCount / Constant.PAGE_SIZE
                : totalCount / Constant.PAGE_SIZE + 1;
        PageEntity pageEntity = new PageEntity(pageIndex, Constant.PAGE_SIZE, totalCount, totalPage);
        /*
         * // 分页查询邀请提成榜 List<InviteGetMoney> inviteGetMoneyList =
         * inviteGetMoneyService.inviteGetMoneyList(pageIndex - 1, "");
         *
         * // 名字*处理 for (InviteGetMoney inviteGetMoney : inviteGetMoneyList) {
         *
         * String name = inviteGetMoney.getName(); if (name != null) { if
         * (name.length() > 2) { name = Utils.getStarString(name, 1,
         * name.length() - 1); } else { name = name.substring(0, 1) + "**" +
         * name.substring(name.length() - 1); } } inviteGetMoney.setName(name);
         * inviteGetMoney.setRankIcon(UserUtil.getRankIcon(3)); }
         */
        List<InviteGetMoney> inviteGetMoneyList = userRankingsService.getRank(0, 5);
        JSONObject data = new JSONObject();
        data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
        data.put("everyDayTaskList", new JSONArray());
        data.put("inviteGetMoneyList", JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList));
        if (uid.equals("0") || uid == null) {
            data.put("myTeam", "---");
            data.put("moneyToday", "---");
            data.put("moneyMonth", "---");
            data.put("moneyLastMonth", "---");
        } else {
            // 我的队员
            int myFirstTeamCount = inviteGetMoneyService.myFirstTeamCount(uid);
            int mySecondTeamCount = inviteGetMoneyService.mySecondTeamCount(uid);
            int myTeamCount = myFirstTeamCount + mySecondTeamCount;
            data.put("myTeam", myTeamCount);
            // 今日 本月预估收益
            BigDecimal moneyToday = inviteGetMoneyService.getMoneyToday(uid + "");
            if (moneyToday == null) {
                moneyToday = new BigDecimal(0);
            }
            BigDecimal moneyMonth = inviteGetMoneyService.getMoneyMonth(uid + "");
            if (moneyMonth == null) {
                moneyMonth = new BigDecimal(0);
            }
            BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
            data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN));
            data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
            data.put("moneyLastMonth", moneyLastMonth);
        }
        // 活动规则
        String key = "activityRules"; // key值
        com.yeshi.fanli.entity.system.System system = new System();
        system.setCreatetime(java.lang.System.currentTimeMillis());
        system.setPlatform(1);
        system.setId(4L);
        SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
        // 转换换行符 给前端
        String valueN = values.getValue();
        String valueBr = valueN.replace("\n", "<br><br>");
        data.put("activityRules", valueBr);
        data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
                Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
        out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
    }
    /**
     * 
     * 方法说明: 分享好友邀请图片
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/WeiXinUserParam.java
@@ -1,42 +1,60 @@
package com.yeshi.fanli.entity.bus.user;
public class WeiXinUserParam {
    private String accessToken;
    private String refreshToken;
    private String openId;
    private String unionId;
    private String scope;
    private Integer expires;
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public String getRefreshToken() {
        return refreshToken;
    }
    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getScope() {
        return scope;
    }
    public void setScope(String scope) {
        this.scope = scope;
    }
    public Integer getExpires() {
        return expires;
    }
    public void setExpires(Integer expires) {
        this.expires = expires;
    }
    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -103,15 +103,16 @@
    @Override
    public LoginResult login(HttpServletRequest request, Boolean first, String appId, String code, String phone,
            UserInfo tbUserInfo, boolean wxinstall, int loginType) throws UserAccountException {
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", appId);
        logInfo.put("code", code);
        logInfo.put("phone", phone);
        logInfo.put("tbUserInfo", tbUserInfo);
        if (tbUserInfo != null)
            logInfo.put("tbUserInfo", tbUserInfo.getId());
        logInfo.put("loginType", loginType);
        LogHelper.lgoinInfo(logInfo.toString());
        HttpSession session = request.getSession();
        if (first != null && first == true)
            session.removeAttribute("LAST_LOGIN_USER");
@@ -319,7 +320,8 @@
        logInfo.put("appId", appId);
        logInfo.put("code", code);
        logInfo.put("phone", phone);
        logInfo.put("tbUserInfo", tbUserInfo);
        if (tbUserInfo != null)
            logInfo.put("tbUserInfo", tbUserInfo.getId());
        logInfo.put("loginType", loginType);
        LogHelper.lgoinInfo(logInfo.toString());
fanli/src/main/java/com/yeshi/fanli/util/wx/WXLoginUtil.java
@@ -79,7 +79,12 @@
        if (param == null) {
            return null;
        }
        return getWeiXinUser(param);
        WeiXinUser weiXinUser = getWeiXinUser(param);
        if (weiXinUser != null && StringUtil.isNullOrEmpty(weiXinUser.getUnionid())
                && !StringUtil.isNullOrEmpty(param.getUnionId())) {
            weiXinUser.setUnionid(param.getUnionId());
        }
        return weiXinUser;
    }
    /**
@@ -99,14 +104,17 @@
                if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
                    user.setHeadimgurl(result.getUrl());
                    // COS删除其余头像
//                    String prefix = String.format("/portrait/wx/%s_", user.getUnionid());
//                    ObjectListing list = COSManager.getInstance().getObjectList(prefix, null, 30);
//                    if (list != null && list.getObjectSummaries() != null)
//                        for (COSObjectSummary object : list.getObjectSummaries()) {
//                            if (!result.getUrl().contains(object.getKey())) {
//                                COSManager.getInstance().deleteFile(object.getKey());
//                            }
//                        }
                    // String prefix = String.format("/portrait/wx/%s_",
                    // user.getUnionid());
                    // ObjectListing list =
                    // COSManager.getInstance().getObjectList(prefix, null, 30);
                    // if (list != null && list.getObjectSummaries() != null)
                    // for (COSObjectSummary object : list.getObjectSummaries())
                    // {
                    // if (!result.getUrl().contains(object.getKey())) {
                    // COSManager.getInstance().deleteFile(object.getKey());
                    // }
                    // }
                }
            }
        }
@@ -138,12 +146,14 @@
        String refreshToken = jsonObject.optString("refresh_token");
        String scope = jsonObject.optString("scope");
        int expires = jsonObject.optInt("expires_in");
        String unionId = jsonObject.optString("unionid");
        weiXinUserParam.setRefreshToken(refreshToken);
        weiXinUserParam.setOpenId(openId);
        weiXinUserParam.setExpires(expires);
        weiXinUserParam.setAccessToken(accessToken);
        weiXinUserParam.setScope(scope);
        weiXinUserParam.setUnionId(unionId);
        return weiXinUserParam;
    }