admin
2021-06-01 4f5a5b0a00c01491f009074351089f086f950d3e
系统配置改为数据库
52个文件已修改
7752 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java 401 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java 437 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java 312 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/push/PushContentDetailDTO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/SystemEnum.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/Special.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemCommonConfig.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemConfigKeyEnum.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/push/PushQueueRecord.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/ConfigCategory.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/config/WXGZServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java 1086 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java 383 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java 552 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SpreadUserImgServiceImpl.java 793 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 844 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java 261 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInviteRecordServiceImpl.java 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/wx/WXMPUserLoginServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/config/WXGZService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/BasePushService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/HWPushService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/IOSPushService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/VIVOPushService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/Constant.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/HWPushUtil.java 698 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java 452 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/OPPOPushUtil.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/VIVOPushUtil.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java 493 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/wx/MyWXLoginUtil.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/mapping/SystemConfigMapper.xml 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/mapping/homemodule/SpecialMapper.xml 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/mapping/push/PushQueueRecordMapper.xml 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java
@@ -11,6 +11,7 @@
import javax.servlet.http.HttpSession;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.util.wx.MyWXLoginUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@@ -54,262 +55,236 @@
/**
 * 客户端网页接口与微信网页接口
 *
 * @author Administrator
 *
 * @author Administrator
 */
@Controller
@RequestMapping("/client")
public class ClientJspController {
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private GoodsSecondClassService goodsSecondClassService;
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private ConfigService configService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private SystemClientParamsService systemClientParamsService;
    @Resource
    private ShamUserService shamUserService;
    @Resource
    private ShareGoodsService shareGoodsService;
    @Resource
    private TaoBaoCouponService taoBaoCouponService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInviteRecordService userInviteRecordService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private CustomerNameService customerNameService;
    @Resource
    private SystemClientParamsService systemClientParamsService;
    @Resource
    private CustomerContentService customerContentService;
    @Resource
    private ShareGoodsService shareGoodsService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    private static final String DOWNURL2 = "http://121.42.200.138/apk/fanliquan20180124.apk";
    @Resource
    private UserInviteRecordService userInviteRecordService;
    @RequestMapping(value = "/new/{uid}")
    public String threeShareRepNew(@PathVariable String uid, String code, String state, String packages,
                                   String platform, String ios, HttpSession httpSession, HttpServletRequest request) {
    @Resource
    private RedisManager redisManager;
        BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages, SystemEnum.blks);
        String wxState = (String) httpSession.getAttribute("wxState");
        // 通过配置参数获取
        String down = DOWNURL2;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
        SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
                "download_app_url");
        if (params != null)
            down = params.getValue();
    @Resource
    private CustomerNameService customerNameService;
        if (state != null && !state.equals(wxState)) {// 不是微信返回的!
            // request.setAttribute("error", "1");
            return "redirect:" + down;
        }
    @Resource
    private CustomerContentService customerContentService;
        // 保存邀请记录
        userInviteRecordService.saveInviteRecord(code, uid);
    private static final String DOWNURL = "http://sj.qq.com/myapp/detail.htm?apkName="
            + Constant.systemCommonConfig.getAndroidPackageName();
        return "redirect:" + down;
    }
    private static final String DOWNURL2 = "http://121.42.200.138/apk/fanliquan20180124.apk";
    // 新版分享
    @RequestMapping("threeShareNew")
    public String threeShareNew(HttpServletRequest request, HttpSession session, HttpServletResponse response,
                                long uid) {
        UserInfo userInfo = userInfoService.getUserById(uid);
        if (userInfo == null) {
            return "share/error";
        }
    @RequestMapping(value = "/new/{uid}")
    public String threeShareRepNew(@PathVariable String uid, String code, String state, String packages,
            String platform, String ios, HttpSession httpSession, HttpServletRequest request) {
        try {
            String header = request.getHeader("User-Agent");// MicroMessenger:微信浏览器
            String ios = "ios=1";
            if (header.contains("iPhone")) {
                ios = "ios=2";
            }
            String redirect_uri = "http://" + Constant.wxGZConfig.getLoginHost() + "/"
                    + Constant.systemCommonConfig.getProjectName() + "/client/new/" + uid + "?packages="
                    + systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames, userInfo.getSystem()) + "&platform=ANDROID&" + ios;
            redirect_uri = URLEncoder.encode(redirect_uri, "utf-8");
        BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages, SystemEnum.blks);
        String wxState = (String) httpSession.getAttribute("wxState");
        // 通过配置参数获取
        String down = DOWNURL2;
            long currentTimeMillis = java.lang.System.currentTimeMillis();
            String md5 = StringUtil.Md5(currentTimeMillis + "");
            session.setAttribute("wxState", md5);
            String baseUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + systemConfigService.getValueCache(SystemConfigKeyEnum.wxGZAppId, userInfo.getSystem())
                    + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_userinfo&state=" + md5
                    + "#wechat_redirect";
            response.sendRedirect(baseUrl);
        } catch (Exception e) {
            e.printStackTrace();
        }
        SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
                "download_app_url");
        if (params != null)
            down = params.getValue();
        return "share2/yaoqing";
    }
        if (state!=null&&!state.equals(wxState)) {// 不是微信返回的!
            // request.setAttribute("error", "1");
            return "redirect:" + down;
        }
    @RequestMapping("getShareGoodsInfo")
    public void getShareGoodsInfo(HttpServletRequest request, long uid, long id, String sign, PrintWriter out) {
        // 保存邀请记录
        userInviteRecordService.saveInviteRecord(code, uid);
        if (!StringUtil.Md5("" + uid + id + Constant.WEBPAGE_SIGN_KEY).equalsIgnoreCase(sign)) {
            out.print(JsonUtil.loadFalseResult(-1, "签名错误"));
            return;
        }
        return "redirect:" + down;
    }
        // 添加分享
        try {
            long startTime = java.lang.System.currentTimeMillis();
            UserShareGoodsHistory userShareGoodsHistory = shareGoodsService.addShareGoodsHistory(uid, id);
            LogHelper.test("生成分享图的总耗时为:" + (java.lang.System.currentTimeMillis() - startTime));
    // 新版分享
    @RequestMapping("threeShareNew")
    public String threeShareNew(HttpServletRequest request, HttpSession session, HttpServletResponse response,
            long uid) {
        UserInfo userInfo = userInfoService.getUserById(uid);
        if (userInfo == null) {
            return "share/error";
        }
            JSONObject data = new JSONObject();
            JSONObject shareData = new JSONObject();
            JSONArray imgArr = new JSONArray();
            String pictures = userShareGoodsHistory.getPictures();
            JSONArray pictureArray = JSONArray.fromObject(pictures);
            for (int i = 0; i < pictureArray.size(); i++) {
                imgArr.add(pictureArray.optString(i));
            }
        try {
            String header = request.getHeader("User-Agent");// MicroMessenger:微信浏览器
            String ios = "ios=1";
            if (header.contains("iPhone")) {
                ios = "ios=2";
            }
            String redirect_uri = "http://" + Constant.wxGZConfig.getLoginHost() + "/"
                    + Constant.systemCommonConfig.getProjectName() + "/client/new/" + uid + "?packages="
                    + Constant.systemCommonConfig.getAndroidPackageName() + "&platform=ANDROID&" + ios;
            redirect_uri = URLEncoder.encode(redirect_uri, "utf-8");
            TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(userShareGoodsHistory.getGoodsId());
            long currentTimeMillis = java.lang.System.currentTimeMillis();
            String md5 = StringUtil.Md5(currentTimeMillis + "");
            session.setAttribute("wxState", md5);
            String baseUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + MyWXLoginUtil.WEXIN_APPID
                    + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_userinfo&state=" + md5
                    + "#wechat_redirect";
            response.sendRedirect(baseUrl);
        } catch (Exception e) {
            e.printStackTrace();
        }
            shareData.put("type", "2");
            shareData.put("title", goods.getTitle());
            shareData.put("description", goods.getTitle());
            shareData.put("imgs", imgArr);
            try {
                data.put("wx", StringUtil.getBase64String(shareData.toString()));
                data.put("wxcircle", StringUtil.getBase64String(shareData.toString()));
                data.put("tkcode", StringUtil.getBase64String(userShareGoodsHistory.getTkCode()));
                data.put("qq", StringUtil.getBase64String(shareData.toString()));
                data.put("qqzone", StringUtil.getBase64String(shareData.toString()));
                data.put("sina", StringUtil.getBase64String(shareData.toString()));
                data.put("tishi", StringUtil.getBase64String("分享中..."));
                data.put("shareGoods", JsonUtil.getSimpleGson().toJson(userShareGoodsHistory));
                JSONObject goodsJSON = new JSONObject();
                goodsJSON.put("title", goods.getTitle());
                goodsJSON.put("zkPrice", goods.getZkPrice());
                // 有券
                if (!StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
        return "share2/yaoqing";
    }
                    goodsJSON.put("finalPrice", TaoBaoUtil.getCouponPrice(goods));
                }
                data.put("goods", goodsJSON);
    @RequestMapping("getShareGoodsInfo")
    public void getShareGoodsInfo(HttpServletRequest request, long uid, long id, String sign, PrintWriter out) {
                String link = String.format("http://%s/%s/client/html/sharegoods/share_detail.html?uid=%s&goodsId=%s",
                        Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName(),
                        AESUtil.encrypt(uid + ""), id + "");
                try {
                    String shortLink = HttpUtil.getShortLink(link);
                    data.put("link", shortLink);
                } catch (Exception e) {
                    data.put("link", link);
                }
                out.print(JsonUtil.loadTrueResult(data));
            } catch (Exception e) {
                JSONObject rdata = new JSONObject();
                rdata.put("uid", uid);
                rdata.put("id", id);
                LogHelper.errorDetailInfo(e, rdata.toString(), request.getRequestURI());
                out.print(JsonUtil.loadFalseResult(1001, "未知错误"));
            }
        if (!StringUtil.Md5("" + uid + id + Constant.WEBPAGE_SIGN_KEY).equalsIgnoreCase(sign)) {
            out.print(JsonUtil.loadFalseResult(-1, "签名错误"));
            return;
        }
        } catch (ShareGoodsException e1) {
            JSONObject data = new JSONObject();
            data.put("uid", uid);
            data.put("id", id);
            LogHelper.errorDetailInfo(e1, data.toString(), request.getRequestURI());
            out.print(JsonUtil.loadFalseResult(e1.getCode(), e1.getMsg()));
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        // 添加分享
        try {
            long startTime = java.lang.System.currentTimeMillis();
            UserShareGoodsHistory userShareGoodsHistory = shareGoodsService.addShareGoodsHistory(uid, id);
            LogHelper.test("生成分享图的总耗时为:" + (java.lang.System.currentTimeMillis() - startTime));
    }
            JSONObject data = new JSONObject();
            JSONObject shareData = new JSONObject();
            JSONArray imgArr = new JSONArray();
            String pictures = userShareGoodsHistory.getPictures();
            JSONArray pictureArray = JSONArray.fromObject(pictures);
            for (int i = 0; i < pictureArray.size(); i++) {
                imgArr.add(pictureArray.optString(i));
            }
    // 获取帮助中心列表
            TaoBaoGoodsBrief goods = redisManager.getTaoBaoGoodsBrief(userShareGoodsHistory.getGoodsId());
    @RequestMapping("getHelpList")
    public void getHelpList(PrintWriter out) {
        List<CustomerName> totalList = new ArrayList<>();
        int page = 0;
        List<CustomerName> customerNameList = customerNameService.customerNameList(page, "", 1);
        if (customerNameList != null && customerNameList.size() > 0)
            totalList.addAll(customerNameList);
            shareData.put("type", "2");
            shareData.put("title", goods.getTitle());
            shareData.put("description", goods.getTitle());
            shareData.put("imgs", imgArr);
            try {
                data.put("wx", StringUtil.getBase64String(shareData.toString()));
                data.put("wxcircle", StringUtil.getBase64String(shareData.toString()));
                data.put("tkcode", StringUtil.getBase64String(userShareGoodsHistory.getTkCode()));
                data.put("qq", StringUtil.getBase64String(shareData.toString()));
                data.put("qqzone", StringUtil.getBase64String(shareData.toString()));
                data.put("sina", StringUtil.getBase64String(shareData.toString()));
                data.put("tishi", StringUtil.getBase64String("分享中..."));
                data.put("shareGoods", JsonUtil.getSimpleGson().toJson(userShareGoodsHistory));
                JSONObject goodsJSON = new JSONObject();
                goodsJSON.put("title", goods.getTitle());
                goodsJSON.put("zkPrice", goods.getZkPrice());
                // 有券
                if (!StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
        while (customerNameList != null && customerNameList.size() == Constant.PAGE_SIZE) {
            page++;
            customerNameList = customerNameService.customerNameList(page, "", 1);
            if (customerNameList != null && customerNameList.size() > 0)
                totalList.addAll(customerNameList);
        }
                    goodsJSON.put("finalPrice", TaoBaoUtil.getCouponPrice(goods));
                }
                data.put("goods", goodsJSON);
        // 获取每个下面的详情
        for (CustomerName cn : totalList) {
            List<CustomerContent> contentList = customerContentService.getSecondProblemList(0, "", cn.getId());
            cn.setCustomerContentList(contentList);
        }
        out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(totalList)));
    }
                String link = String.format("http://%s/%s/client/html/sharegoods/share_detail.html?uid=%s&goodsId=%s",
                        Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName(),
                        AESUtil.encrypt(uid + ""), id + "");
                try {
                    String shortLink = HttpUtil.getShortLink(link);
                    data.put("link", shortLink);
                } catch (Exception e) {
                    data.put("link", link);
                }
                out.print(JsonUtil.loadTrueResult(data));
            } catch (Exception e) {
                JSONObject rdata = new JSONObject();
                rdata.put("uid", uid);
                rdata.put("id", id);
                LogHelper.errorDetailInfo(e, rdata.toString(), request.getRequestURI());
                out.print(JsonUtil.loadFalseResult(1001, "未知错误"));
            }
    @RequestMapping("getHelpDetail")
    public void getHelpDetail(long id, PrintWriter out) {
        List<CustomerName> totalList = new ArrayList<>();
        CustomerContent customerContent = customerContentService.getCustomerContent(id);
        out.print(JsonUtil.loadTrueResult(customerContent.getContent().replace("\n", "<br>")));
    }
        } catch (ShareGoodsException e1) {
            JSONObject data = new JSONObject();
            data.put("uid", uid);
            data.put("id", id);
            LogHelper.errorDetailInfo(e1, data.toString(), request.getRequestURI());
            out.print(JsonUtil.loadFalseResult(e1.getCode(), e1.getMsg()));
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
    }
    // 获取帮助中心列表
    @RequestMapping("getHelpList")
    public void getHelpList(PrintWriter out) {
        List<CustomerName> totalList = new ArrayList<>();
        int page = 0;
        List<CustomerName> customerNameList = customerNameService.customerNameList(page, "", 1);
        if (customerNameList != null && customerNameList.size() > 0)
            totalList.addAll(customerNameList);
        while (customerNameList != null && customerNameList.size() == Constant.PAGE_SIZE) {
            page++;
            customerNameList = customerNameService.customerNameList(page, "", 1);
            if (customerNameList != null && customerNameList.size() > 0)
                totalList.addAll(customerNameList);
        }
        // 获取每个下面的详情
        for (CustomerName cn : totalList) {
            List<CustomerContent> contentList = customerContentService.getSecondProblemList(0, "", cn.getId());
            cn.setCustomerContentList(contentList);
        }
        out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(totalList)));
    }
    @RequestMapping("getHelpDetail")
    public void getHelpDetail(long id, PrintWriter out) {
        List<CustomerName> totalList = new ArrayList<>();
        CustomerContent customerContent = customerContentService.getCustomerContent(id);
        out.print(JsonUtil.loadTrueResult(customerContent.getContent().replace("\n", "<br>")));
    }
    /**
     * 获取邀请有奖的规则
     *
     * @param callback
     * @param out
     */
    @RequestMapping("getinviteactivityrules")
    public void getInviteActivityRules(String callback, PrintWriter out) {
        String key = "activityRules"; // key值
        com.yeshi.fanli.entity.system.BusinessSystem system = new BusinessSystem();
        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>");
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(valueBr)));
        } else {
            out.print(JsonUtil.loadTrueResult(valueBr));
        }
    }
    /**
     * 获取邀请有奖的规则
     *
     * @param callback
     * @param out
     */
    @RequestMapping("getinviteactivityrules")
    public void getInviteActivityRules(String callback, PrintWriter out) {
        String key = "activityRules"; // key值
        com.yeshi.fanli.entity.system.BusinessSystem system = new BusinessSystem();
        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>");
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(valueBr)));
        } else {
            out.print(JsonUtil.loadTrueResult(valueBr));
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java
@@ -332,25 +332,26 @@
    public void pushOppo(String registerId, PrintWriter out) {
        List<String> registerIds = new ArrayList<>();
        registerIds.add(registerId);
        String androidBaseActivity="";
        try {
            OPPOPushUtil.pushUrl(registerIds, "测试网页推送", "测试网页推送内容", "http://www.baidu.com");
            OPPOPushUtil.pushUrl(registerIds, "测试网页推送", "测试网页推送内容", "http://www.baidu.com",androidBaseActivity);
        } catch (PushException e) {
            e.printStackTrace();
        }
        try {
            OPPOPushUtil.pushGoods(registerIds, "测试商品网页推送", "测试商品推送内容", 1, 577628549116L);
            OPPOPushUtil.pushGoods(registerIds, "测试商品网页推送", "测试商品推送内容", 1, 577628549116L,androidBaseActivity);
        } catch (PushException e) {
            e.printStackTrace();
        }
        try {
            OPPOPushUtil.pushUserSignInNotification(registerIds, "测试签到推送", "测试签到推送");
            OPPOPushUtil.pushUserSignInNotification(registerIds, "测试签到推送", "测试签到推送",androidBaseActivity);
        } catch (PushException e) {
            e.printStackTrace();
        }
        try {
            OPPOPushUtil.pushWelfareCenter(registerIds, "测试福利中心推送", "测试福利中心推送");
            OPPOPushUtil.pushWelfareCenter(registerIds, "测试福利中心推送", "测试福利中心推送",androidBaseActivity);
        } catch (PushException e) {
            e.printStackTrace();
        }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -274,6 +274,7 @@
    @Resource
    private PIDManager pidManager;
    @RequestMapping(value = "getHonestList")
    public void getHonestList(AcceptData acceptData, PrintWriter out) {
        List<Honest> honestList = null;
@@ -286,7 +287,7 @@
            honestList = new ArrayList<>();
            JumpDetail detail = new JumpDetail();
            detail.setActivity(String.format("%s.ui.invite.ShareBrowserActivity",
                    Constant.systemCommonConfig.getAndroidBaseactivityName()));
                    systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,acceptData.getSystem())));
            detail.setName("网页");
            detail.setController("ShonpingShareViewController");
@@ -373,7 +374,7 @@
            honestList = new ArrayList<>();
            JumpDetail detail = new JumpDetail();
            detail.setActivity(
                    String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
                    String.format("%s.ui.BrowserActivity",   systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,acceptData.getSystem())));
            detail.setName("网页");
            // GoodsDetailController
            detail.setController("BrowserController");
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SMSController.java
@@ -255,4 +255,23 @@
        }
    }
    /**
     * 设备是否允许一键登录
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "allowOneKeyLogin", method = RequestMethod.POST)
    public void allowOneKeyLogin(AcceptData acceptData, PrintWriter out) {
        String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount, StringUtil.Md5(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
        //每天只能用10次
        String value = redisManager.getCommonString(key);
        if (!StringUtil.isNullOrEmpty(value) && Integer.parseInt(value) >= 10) {
            out.print(JsonUtil.loadFalseResult("一键登录每日只能用10次"));
            return;
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java
@@ -108,6 +108,14 @@
            list.add(ssp);
        }
        SystemClientParams ssp = new SystemClientParams();
        ssp.setKey(ConfigKeyEnum.homePageBgColors.getKey());
        ssp.setValue(configService.getValue(ConfigKeyEnum.homePageBgColors,acceptData.getSystem()));
        list.add(ssp);
        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        JSONObject data = new JSONObject();
        data.put("count", list.size());
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -35,6 +35,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.TimeUtil;
import org.yeshi.utils.encrypt.DESUtil;
import org.yeshi.utils.entity.ProxyIP;
import org.yeshi.utils.entity.wx.WeiXinUser;
@@ -1090,6 +1091,14 @@
            return;
        }
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            long now = System.currentTimeMillis();
            String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount,StringUtil.Md5(  StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
            redisManager.increase(key);
            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
            redisManager.expire(key, expire);
        }
        try {
            BusinessSystem system = getSystem(acceptData);
            if (system == null) {
@@ -1170,6 +1179,15 @@
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
        }
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            long now = System.currentTimeMillis();
            String key =  RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount,StringUtil.Md5(  StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));
            redisManager.increase(key);
            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
            redisManager.expire(key, expire);
        }
        String mobile = null;
        try {
            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/CommonContentControllerV2.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -47,256 +48,266 @@
/**
 * 通用模板
 *
 * @author Administrator
 *
 * @author Administrator
 */
@Controller
@RequestMapping("api/v2/commoncontent")
public class CommonContentControllerV2 {
    @Resource
    private SwiperPictureService swiperPictureService;
    @Resource
    private SwiperPictureService swiperPictureService;
    @Resource
    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
    @Resource
    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
    @Resource
    private CommonTemplateContentService commonTemplateContentService;
    @Resource
    private CommonTemplateContentService commonTemplateContentService;
    @Resource
    private JDCommonTemplateContentService jdCommonTemplateContentService;
    @Resource
    private JDCommonTemplateContentService jdCommonTemplateContentService;
    @Resource
    private PDDCommonTemplateContentService pddCommonTemplateContentService;
    @Resource
    private PDDCommonTemplateContentService pddCommonTemplateContentService;
    /**
     * 通用模板导航
     *
     * @param acceptData
     * @param key
     * @param out
     */
    @RequestMapping(value = "getNavList", method = RequestMethod.POST)
    public void getNavList(AcceptData acceptData, String key, Integer type, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
            return;
        }
    @Resource
    private GoodsLijinMnager goodsLijinMnager;
        List<CommonContentNav> list = null;
        if (type == null || type == Constant.SOURCE_TYPE_TAOBAO) {
            list = commonTemplateContentService.getNavList(CommonContentTypeEnum.valueOf(key),acceptData.getSystem());
        } else if (type == Constant.SOURCE_TYPE_JD) {
            // 暂无分类
        } else if (type == Constant.SOURCE_TYPE_PDD) {
            list = pddCommonTemplateContentService.getNavList(PDDCommonContentTypeEnum.valueOf(key));
        }
    /**
     * 通用模板导航
     *
     * @param acceptData
     * @param key
     * @param out
     */
    @RequestMapping(value = "getNavList", method = RequestMethod.POST)
    public void getNavList(AcceptData acceptData, String key, Integer type, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
            return;
        }
        if (list == null) {
            list = new ArrayList<CommonContentNav>();
        }
        List<CommonContentNav> list = null;
        if (type == null || type == Constant.SOURCE_TYPE_TAOBAO) {
            list = commonTemplateContentService.getNavList(CommonContentTypeEnum.valueOf(key), acceptData.getSystem());
        } else if (type == Constant.SOURCE_TYPE_JD) {
            // 暂无分类
        } else if (type == Constant.SOURCE_TYPE_PDD) {
            list = pddCommonTemplateContentService.getNavList(PDDCommonContentTypeEnum.valueOf(key));
        }
        out.print(JsonUtil.loadTrueResult(new Gson().toJson(list)));
    }
        if (list == null) {
            list = new ArrayList<CommonContentNav>();
        }
    /**
     * 获取内容
     *
     * @param acceptData
     * @param key
     * @param page-页码
     * @param navId-导航ID
     * @param out
     */
    @RequestMapping(value = "getNavGoodsList", method = RequestMethod.POST)
    public void getNavContent(AcceptData acceptData, String key, Integer type, Integer page, String cid,
            PrintWriter out) {
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
            return;
        }
        out.print(JsonUtil.loadTrueResult(new Gson().toJson(list)));
    }
        if (page == null || page < 1) {
            out.print(JsonUtil.loadFalseResult(1, "请传入正确的page"));
            return;
        }
    /**
     * 获取内容
     *
     * @param acceptData
     * @param uid
     * @param key
     * @param type
     * @param page
     * @param cid
     * @param out
     */
    @RequestMapping(value = "getNavGoodsList", method = RequestMethod.POST)
    public void getNavContent(AcceptData acceptData, Long uid, String key, Integer type, Integer page, String cid,
                              PrintWriter out) {
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
            return;
        }
        if (type == null || type == Constant.SOURCE_TYPE_TAOBAO) {
            getListTB(acceptData, key, page, cid, out);
            return;
        }
        if (page == null || page < 1) {
            out.print(JsonUtil.loadFalseResult(1, "请传入正确的page"));
            return;
        }
        if (type == Constant.SOURCE_TYPE_JD) {
            getListJD(acceptData, key, page, cid, out);
            return;
        }
        if (type == null || type == Constant.SOURCE_TYPE_TAOBAO) {
            getListTB(acceptData, uid, key, page, cid, out);
            return;
        }
        if (type == Constant.SOURCE_TYPE_PDD) {
            getListPDD(acceptData, key, page, cid, out);
            return;
        }
        out.print(JsonUtil.loadFalseResult("goodsType参数不正确"));
    }
        if (type == Constant.SOURCE_TYPE_JD) {
            getListJD(acceptData, uid, key, page, cid, out);
            return;
        }
    private void getListTB(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) {
        CommonContentResult result = null;
        CommonContentTypeEnum type = CommonContentTypeEnum.valueOf(key);
        if (type == CommonContentTypeEnum.guessLikeDevice) {
            // 猜你喜欢
            String idfa = acceptData.getIdfa();
            String imei = acceptData.getImei();
            result = guessLikeDeviceTB(idfa, imei, acceptData.getUtdid(), page);
        } else {
            // 大淘客页码只能为10,50,100,200
            result = commonTemplateContentService.getContentList(type, cid, page, 10,acceptData.getSystem());
        }
        if (type == Constant.SOURCE_TYPE_PDD) {
            getListPDD(acceptData, uid, key, page, cid, out);
            return;
        }
        out.print(JsonUtil.loadFalseResult("goodsType参数不正确"));
    }
        JSONObject root = new JSONObject();
        if (page == 1) {
            // 保留暂时不开启,待后续开启
            List<SwiperPicture> bannerList = new ArrayList<>();
            root.put("bannerList", new Gson().toJson(bannerList));
        }
    private void getListTB(AcceptData acceptData, Long uid, String key, Integer page, String cid, PrintWriter out) {
        CommonContentResult result = null;
        CommonContentTypeEnum type = CommonContentTypeEnum.valueOf(key);
        if (type == CommonContentTypeEnum.guessLikeDevice) {
            // 猜你喜欢
            String idfa = acceptData.getIdfa();
            String imei = acceptData.getImei();
            result = guessLikeDeviceTB(idfa, imei, acceptData.getUtdid(), page);
        } else {
            // 大淘客页码只能为10,50,100,200
            result = commonTemplateContentService.getContentList(type, cid, page, 10, acceptData.getSystem());
        }
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
        List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
        if (result != null)
            goodsList = result.getGoodsList();
        JSONObject root = new JSONObject();
        if (page == 1) {
            // 保留暂时不开启,待后续开启
            List<SwiperPicture> bannerList = new ArrayList<>();
            root.put("bannerList", new Gson().toJson(bannerList));
        }
        GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion(),acceptData.getSystem());
        for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
            GoodsDetailVO vo = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
            if (type == CommonContentTypeEnum.mianDan)// 免单商品
            {
                vo.getMoneyInfo().setFanliMoney("¥" + TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief));
                vo.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief));
                vo.getMoneyInfo().setMaxMoney(null);
            }
            array.add(gson.toJson(vo));
        }
        JSONArray array = new JSONArray();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
        List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
        if (result != null)
            goodsList = result.getGoodsList();
        root.put("list", array);
        root.put("count", result != null ? result.getCount() : 0);
        out.print(JsonUtil.loadTrueResult(root));
    }
        GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion(), acceptData.getSystem());
    /**
     * 京东通用专题模板
     *
     * @param acceptData
     * @param key
     * @param page
     * @param cid
     * @param out
     */
    public void getListJD(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) {
        JSONObject data = new JSONObject();
        if (page == 1) {
            List<SwiperPicture> bannerList = new ArrayList<>();
            data.put("bannerList", new Gson().toJson(bannerList));
        }
        List<GoodsDetailVO> goodsDetailVOList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
        int p = 0;
        for (GoodsDetailVO vo : goodsDetailVOList) {
            if (type == CommonContentTypeEnum.mianDan)// 免单商品
            {
                vo.getMoneyInfo().setFanliMoney("¥" + TaoBaoUtil.getCouponPrice(goodsList.get(p)));
                vo.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getCouponPrice(goodsList.get(p)));
                vo.getMoneyInfo().setMaxMoney(null);
            }
            array.add(gson.toJson(vo));
            p++;
        }
        JDSearchResult result = jdCommonTemplateContentService.getContentList(JDCommonContentTypeEnum.valueOf(key), cid,
                page, Constant.PAGE_SIZE);
        JSONArray array = new JSONArray();
        root.put("list", array);
        root.put("count", result != null ? result.getCount() : 0);
        out.print(JsonUtil.loadTrueResult(root));
    }
        long count = 0;
        if (result != null) {
            PageEntity pageEntity = result.getPageEntity();
            if (pageEntity != null) {
                count = pageEntity.getTotalCount();
            }
    /**
     * 京东通用专题模板
     *
     * @param acceptData
     * @param key
     * @param page
     * @param cid
     * @param out
     */
    public void getListJD(AcceptData acceptData, Long uid, String key, Integer page, String cid, PrintWriter out) {
        JSONObject data = new JSONObject();
        if (page == 1) {
            List<SwiperPicture> bannerList = new ArrayList<>();
            data.put("bannerList", new Gson().toJson(bannerList));
        }
            List<JDGoods> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(),acceptData.getSystem());
        JDSearchResult result = jdCommonTemplateContentService.getContentList(JDCommonContentTypeEnum.valueOf(key), cid,
                page, Constant.PAGE_SIZE);
        JSONArray array = new JSONArray();
                for (JDGoods goods : goodsList) {
                    array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO)));
                }
            }
        }
        long count = 0;
        if (result != null) {
            PageEntity pageEntity = result.getPageEntity();
            if (pageEntity != null) {
                count = pageEntity.getTotalCount();
            }
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
            List<JDGoods> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
    /**
     * 拼多多通用专题模板
     *
     * @param acceptData
     * @param key
     * @param page
     * @param cid
     * @param out
     */
    public void getListPDD(AcceptData acceptData, String key, Integer page, String cid, PrintWriter out) {
        JSONObject data = new JSONObject();
        if (page == 1) {
            // 2、顶部轮播图
            List<BannerVO> bannerList = null;
            if (Constant.IS_TEST) {
                bannerList = swiperPictureService.getByBannerCardAndVersion("index_top", acceptData.getPlatform(),
                        Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
            }
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
                for (GoodsDetailVO goods : voList) {
                    array.add(gson.toJson(goods));
                }
            }
        }
            if (bannerList == null) {
                bannerList = new ArrayList<BannerVO>();
            }
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
            data.put("bannerList", new Gson().toJson(bannerList));
        }
    /**
     * 拼多多通用专题模板
     *
     * @param acceptData
     * @param key
     * @param page
     * @param cid
     * @param out
     */
    public void getListPDD(AcceptData acceptData, Long uid, String key, Integer page, String cid, PrintWriter out) {
        JSONObject data = new JSONObject();
        if (page == 1) {
            // 2、顶部轮播图
            List<BannerVO> bannerList = null;
            if (Constant.IS_TEST) {
                bannerList = swiperPictureService.getByBannerCardAndVersion("index_top", acceptData.getPlatform(),
                        Integer.parseInt(acceptData.getVersion()), acceptData.getSystem());
            }
        PDDGoodsResult result = pddCommonTemplateContentService.getContentList(PDDCommonContentTypeEnum.valueOf(key),
                cid, page, Constant.PAGE_SIZE);
        JSONArray array = new JSONArray();
        long count = 0;
        if (result != null) {
            count = result.getTotalCount();
            if (bannerList == null) {
                bannerList = new ArrayList<BannerVO>();
            }
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(),acceptData.getSystem());
            data.put("bannerList", new Gson().toJson(bannerList));
        }
                for (PDDGoodsDetail goods : goodsList) {
                    array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO)));
                }
            }
        }
        PDDGoodsResult result = pddCommonTemplateContentService.getContentList(PDDCommonContentTypeEnum.valueOf(key),
                cid, page, Constant.PAGE_SIZE);
        JSONArray array = new JSONArray();
        long count = 0;
        if (result != null) {
            count = result.getTotalCount();
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion(), acceptData.getSystem());
    /**
     * 猜你喜欢-淘宝设备推荐
     *
     * @param acceptData
     * @param page
     * @return
     */
    @Cacheable(value = "commonContentCache", key = "#idfa+'-'+#imei+'-'+#page")
    private CommonContentResult guessLikeDeviceTB(String idfa, String imei, String utdid, Integer page) {
        TaoBaoSearchResult searchResult = TaoKeApiUtil.guessDeviceLike(page, Constant.PAGE_SIZE, imei, idfa, utdid);
        if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
                && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
            CommonContentResult result = new CommonContentResult();
            result.setCount(searchResult.getPageEntity().getTotalCount());
            result.setGoodsList(searchResult.getTaoBaoGoodsBriefs());
            return result;
        }
        return null;
    }
                List<GoodsDetailVO> voList = goodsLijinMnager.loadOtherMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
                for (GoodsDetailVO goods : voList) {
                    array.add(gson.toJson(goods));
                }
            }
        }
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 猜你喜欢-淘宝设备推荐
     *
     * @param idfa
     * @param imei
     * @param utdid
     * @param page
     * @return
     */
    private CommonContentResult guessLikeDeviceTB(String idfa, String imei, String utdid, Integer page) {
        TaoBaoSearchResult searchResult = TaoKeApiUtil.guessDeviceLike(page, Constant.PAGE_SIZE, imei, idfa, utdid);
        if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
                && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
            CommonContentResult result = new CommonContentResult();
            result.setCount(searchResult.getPageEntity().getTotalCount());
            result.setGoodsList(searchResult.getTaoBaoGoodsBriefs());
            return result;
        }
        return null;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -209,6 +209,13 @@
            switch (loginType) {
                //电话号码登录
                case 1: {
                    if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
                        long now = System.currentTimeMillis();
                        String key =  RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount,StringUtil.Md5(  StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));;
                        redisManager.increase(key);
                        int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
                        redisManager.expire(key, expire);
                    }
                    userInfo = userAccountService.loginPhone(new ProxyIP(request.getRemoteHost(), request.getRemotePort()), loginType, vcode, phone, aliAccessToken, system);
                }
                break;
@@ -363,6 +370,14 @@
            return;
        }
        if (!StringUtil.isNullOrEmpty(aliAccessToken)) {
            long now = System.currentTimeMillis();
            String redisKey =  RedisKeyEnum.getRedisKey(RedisKeyEnum.oneKeyLoginCount,StringUtil.Md5(  StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()));;
            redisManager.increase(redisKey);
            int expire = (int) ((TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyyMMdd"), "yyyyMMdd") - now) / 1000);
            redisManager.expire(redisKey, expire);
        }
        String mobile = null;
        try {
            mobile = userAccountService.getMobile(vcode, phone, aliAccessToken, acceptData.getSystem(), SMSHistory.TYPE_BIND);
fanli/src/main/java/com/yeshi/fanli/controller/h5/H5RecommendController.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
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;
@@ -126,7 +127,7 @@
    public void getRecommendBanner(AcceptData acceptData, String callback, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystem("WEB",
                Constant.systemCommonConfig.getH5PackageName(), acceptData.getSystem());
              systemConfigService.getValueCache(SystemConfigKeyEnum.h5PackageName,acceptData.getSystem()), acceptData.getSystem());
        JSONObject json = new JSONObject();
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, H5ControllerUtil.NOSYSTEM));
fanli/src/main/java/com/yeshi/fanli/controller/web/WebRecommendController.java
@@ -43,183 +43,181 @@
@RequestMapping("api/web/v1/webRecommend")
public class WebRecommendController {
    @Resource
    private WebControllerUtil webControllerUtil;
    @Resource
    private WebControllerUtil webControllerUtil;
    @Resource
    private SuperRecommendBannerService superRecommendBannerService;
    @Resource
    private SuperRecommendBannerService superRecommendBannerService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private RedisManager redisManager;
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private CollectionGoodsV2Service collectionGoodsV2Service;
    @Resource
    private CollectionGoodsV2Service collectionGoodsV2Service;
    @Resource
    private ConfigService configService;
    @Resource
    private ConfigService configService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
    /**
     *
     * 方法说明: 推荐轮播商品信息
     *
     * @author mawurui createTime 2018年5月11日 上午11:13:47
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getRecommenBanner", method = RequestMethod.GET)
    public void getRecommendBanner(AcceptData acceptData, String callback, PrintWriter out) {
    /**
     * 方法说明: 推荐轮播商品信息
     *
     * @param acceptData
     * @param out
     * @author mawurui createTime 2018年5月11日 上午11:13:47
     */
    @RequestMapping(value = "getRecommenBanner", method = RequestMethod.GET)
    public void getRecommendBanner(AcceptData acceptData, String callback, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystem("WEB",
                Constant.systemCommonConfig.getH5PackageName(),acceptData.getSystem());
        JSONObject json = new JSONObject();
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM));
            return;
        }
        List<SuperRecommendBanner> superRecommendBanners = superRecommendBannerService
                .getSuperRecommendBannersBySystem(system);
        List<RecommendBanner> list = null;
        for (SuperRecommendBanner superRecommendBanner : superRecommendBanners) {
            if (list == null) {
                list = new ArrayList<RecommendBanner>();
            }
            RecommendBanner recommendBanner = superRecommendBanner.getRecommendBanner();
            // 淘特价暂时修改
            if (system.getId() == 7) {
                recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity()
                        .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial"));
            }
        BusinessSystem system = businessSystemService.getBusinessSystem("WEB",
                systemConfigService.getValueCache(SystemConfigKeyEnum.h5PackageName, acceptData.getSystem()), acceptData.getSystem());
        JSONObject json = new JSONObject();
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM));
            return;
        }
        List<SuperRecommendBanner> superRecommendBanners = superRecommendBannerService
                .getSuperRecommendBannersBySystem(system);
        List<RecommendBanner> list = null;
        for (SuperRecommendBanner superRecommendBanner : superRecommendBanners) {
            if (list == null) {
                list = new ArrayList<RecommendBanner>();
            }
            RecommendBanner recommendBanner = superRecommendBanner.getRecommendBanner();
            // 淘特价暂时修改
            if (system.getId() == 7) {
                recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity()
                        .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial"));
            }
            list.add(recommendBanner);
        }
            list.add(recommendBanner);
        }
        if (list == null) {
            json.put("code", "1");
            json.put("msg", WebControllerUtil.NODATA);
            out.print(json);
            java.lang.System.out.println("json-" + json);
            return;
        }
        json.put("code", 0);
        JSONObject data = new JSONObject();
        data.put("count", list.size());
        Gson gson = new Gson();
        data.put("data", gson.toJson(list));
        json.put("data", data);
        // jsonp方式返回
        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json)));
        return;
    }
        if (list == null) {
            json.put("code", "1");
            json.put("msg", WebControllerUtil.NODATA);
            out.print(json);
            java.lang.System.out.println("json-" + json);
            return;
        }
        json.put("code", 0);
        JSONObject data = new JSONObject();
        data.put("count", list.size());
        Gson gson = new Gson();
        data.put("data", gson.toJson(list));
        json.put("data", data);
        // jsonp方式返回
        out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json)));
        return;
    }
    /**
     *
     * 方法说明: 获取商品详情
     *
     * @author mawurui createTime 2018年5月11日 上午11:37:02
     * @param acceptData
     * @param id
     * @param uid
     * @param out
     */
    /**
     * 方法说明: 获取商品详情
     *
     * @param acceptData
     * @param id
     * @param uid
     * @param out
     * @author mawurui createTime 2018年5月11日 上午11:37:02
     */
    @RequestMapping(value = "getGoodsDetail", method = RequestMethod.GET)
    public void getGoodsDetail(final AcceptData acceptData, final String id, final String uid, Integer goodsType,
            String callback, PrintWriter out) {
        long begin = java.lang.System.currentTimeMillis();
        if (StringUtil.isNullOrEmpty(id)) {
            out.print(JsonUtil.loadFalseResult(1, "请上传id"));
            return;
        }
        BusinessSystem system = webControllerUtil.getSystem(acceptData);
    @RequestMapping(value = "getGoodsDetail", method = RequestMethod.GET)
    public void getGoodsDetail(final AcceptData acceptData, final String id, final String uid, Integer goodsType,
                               String callback, PrintWriter out) {
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM));
            return;
        }
        TaoBaoGoodsBrief tb = null;
        try {
            tb = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
        } catch (NumberFormatException e1) {
            e1.printStackTrace();
        } catch (TaobaoGoodsDownException e1) {
            e1.printStackTrace();
        }
        long begin = java.lang.System.currentTimeMillis();
        if (StringUtil.isNullOrEmpty(id)) {
            out.print(JsonUtil.loadFalseResult(1, "请上传id"));
            return;
        }
        BusinessSystem system = webControllerUtil.getSystem(acceptData);
        if (tb != null) {
            tb.setAuctionUrl(null);
            tb.setId(null);
            Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
            JSONObject data = new JSONObject();
        if (system == null) {
            out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM));
            return;
        }
        TaoBaoGoodsBrief tb = null;
        try {
            tb = redisManager.getTaoBaoGoodsBrief(Long.parseLong(id));
        } catch (NumberFormatException e1) {
            e1.printStackTrace();
        } catch (TaobaoGoodsDownException e1) {
            e1.printStackTrace();
        }
            // 获取默认PID信息
            int type = 0;
            if ("android".equalsIgnoreCase(acceptData.getPlatform()))
                type = 1;
            else
                type = 2;
            List<TaoBaoUnionConfig> config = taoBaoUnionConfigService.getConfigByTypeCache(type);
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(tb, config.get(0),acceptData.getSystem());
            if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null)
                taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(tb.getCouponLink());
        if (tb != null) {
            tb.setAuctionUrl(null);
            tb.setId(null);
            Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
            JSONObject data = new JSONObject();
            if (uid != null && !"".equals(uid.trim())) {
                CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(Long.parseLong(uid),
                        Long.parseLong(id), goodsType);
                data.put("collection", collectionGoods != null ? true : false);
            }
            taoBaoGoodsBriefExtra.setAuctionUrl(null);
            data.put("taobao", gson.toJson(taoBaoGoodsBriefExtra));
            String info = configService.getValue(ConfigKeyEnum.detailPrompt.getKey(), acceptData.getSystem());
            data.put("info", info);
            String onlyInfo = configService.getValue(ConfigKeyEnum.onlyInfo.getKey(), acceptData.getSystem());
            data.put("only", onlyInfo);
            int showType = taoBaoGoodsBriefExtra.getShowType();
            String price = "";
            if (showType == 1 || showType == 3) {
                price = taoBaoGoodsBriefExtra.getQuanPrice() + "";
            } else {
                price = taoBaoGoodsBriefExtra.getZkPrice() + "";
            }
            String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem());
            data.put("sharePrice", "¥" + price + "元      送" + appName + "红包¥"
                    + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 ");
            data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
            data.put("shareContent", "¥" + price + "元");
            data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl());
            String html = configService.getValue(ConfigKeyEnum.downAPP.getKey(), acceptData.getSystem());
            data.put("downAPP", html);
            String shareSinaContent = configService.getValue("shareSinaContent", acceptData.getSystem());
            data.put("shareSina",
                    "¥" + price + "元      送" + appName + "红包¥"
                            + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元    "
                            + taoBaoGoodsBriefExtra.getTitle() + shareSinaContent);
            // 获取默认PID信息
            int type = 0;
            if ("android".equalsIgnoreCase(acceptData.getPlatform()))
                type = 1;
            else
                type = 2;
            List<TaoBaoUnionConfig> config = taoBaoUnionConfigService.getConfigByTypeCache(type);
            TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(tb, config.get(0), acceptData.getSystem());
            if (!StringUtil.isNullOrEmpty(tb.getCouponLink()) && taoBaoGoodsBriefExtra.getTaoBaoQuanInfo() != null)
                taoBaoGoodsBriefExtra.getTaoBaoQuanInfo().setCouponLink(tb.getCouponLink());
            data.put("sharemoney", "分享奖金 ¥" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb,acceptData.getSystem()) + "元");
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
            if (uid != null && !"".equals(uid.trim())) {
                CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(Long.parseLong(uid),
                        Long.parseLong(id), goodsType);
                data.put("collection", collectionGoods != null ? true : false);
            }
            taoBaoGoodsBriefExtra.setAuctionUrl(null);
            data.put("taobao", gson.toJson(taoBaoGoodsBriefExtra));
            String info = configService.getValue(ConfigKeyEnum.detailPrompt.getKey(), acceptData.getSystem());
            data.put("info", info);
            String onlyInfo = configService.getValue(ConfigKeyEnum.onlyInfo.getKey(), acceptData.getSystem());
            data.put("only", onlyInfo);
            int showType = taoBaoGoodsBriefExtra.getShowType();
            String price = "";
            if (showType == 1 || showType == 3) {
                price = taoBaoGoodsBriefExtra.getQuanPrice() + "";
            } else {
                price = taoBaoGoodsBriefExtra.getZkPrice() + "";
            }
            String appName = systemConfigService.getValueCache(SystemConfigKeyEnum.appName, acceptData.getSystem());
            data.put("sharePrice", "¥" + price + "元      送" + appName + "红包¥"
                    + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元 ");
            data.put("shareTitle", taoBaoGoodsBriefExtra.getTitle());
            data.put("shareContent", "¥" + price + "元");
            data.put("shareImg", taoBaoGoodsBriefExtra.getPictUrl());
            String html = configService.getValue(ConfigKeyEnum.downAPP.getKey(), acceptData.getSystem());
            data.put("downAPP", html);
            String shareSinaContent = configService.getValue("shareSinaContent", acceptData.getSystem());
            data.put("shareSina",
                    "¥" + price + "元      送" + appName + "红包¥"
                            + taoBaoGoodsBriefExtra.getTaoBaoHongBaoInfo().getHongbao() + "元    "
                            + taoBaoGoodsBriefExtra.getTitle() + shareSinaContent);
            final TaoBaoGoodsBrief tbb = tb;
            data.put("sharemoney", "分享奖金 ¥" + taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb, acceptData.getSystem()) + "元");
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
        } else {
            out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
        }
        long end = java.lang.System.currentTimeMillis();
        java.lang.System.out.println("耗时:" + (end - begin));
        return;
    }
            final TaoBaoGoodsBrief tbb = tb;
        } else {
            out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
        }
        long end = java.lang.System.currentTimeMillis();
        java.lang.System.out.println("耗时:" + (end - begin));
        return;
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/push/PushContentDetailDTO.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.dto.push;
import com.yeshi.fanli.entity.SystemEnum;
//推送内容
public class PushContentDetailDTO {
    private PushTypeEnum type;
@@ -66,4 +68,5 @@
    public void setContent(PushBaseContent content) {
        this.content = content;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/SystemEnum.java
@@ -11,7 +11,7 @@
            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.fanli,SystemFunction.lijinSub,SystemFunction.bindPhone}, 12, "优惠券精选","淘拼团");
    yhqjx("com.youhuiquan.android","com.youhuiquanjx.ios",new String[]{}, new SystemFunction[]{SystemFunction.faQuan,SystemFunction.fanli,SystemFunction.lijinSub,SystemFunction.bindPhone}, 12, "优惠券精选","特价App");
    private String packageName;
    private String bundleId;
    private int systemId;
fanli/src/main/java/com/yeshi/fanli/entity/bus/homemodule/Special.java
@@ -63,6 +63,11 @@
    @Column(name = "b_sub_picture")
    private String subPicture;
    //背景颜色
    @Expose
    @Column(name = "b_bg_color")
    private String bgColor;
    // 跳转详情
    @Expose
    @Column(name = "b_jumpid")
@@ -455,4 +460,12 @@
        this.timeTask = timeTask;
    }
    public String getBgColor() {
        return bgColor;
    }
    public void setBgColor(String bgColor) {
        this.bgColor = bgColor;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemCommonConfig.java
@@ -13,42 +13,13 @@
    // 项目域名
    @Map("project_host")
    private String projectHost;
    @Map("default_nick_name")
    private String defaultNickName;
    @Map("default_portrait")
    private String defaultPortrait;
    // 公众平台appid
    @Map("wxgz_appid")
    private String wxGZAppId;
    // 公众平台Appsecret
    @Map("wxgz_appsecret")
    private String wxGZAppSecret;
    // 开放平台appId
    @Map("wx_open_appid")
    private String wxOpenAppId;
    // 开放平台appSecret
    @Map("wx_open_appsecret")
    private String wxOpenAppSecret;
    // 默认的提成订单图片
    @Map("default_order_picture")
    private String defaultOrderPicture;
    @Map("android_package_name")
    private String androidPackageName;
    @Map("ios_bundle_id")
    private String iosBundleId;
    @Map("h5_package_name")
    private String h5PackageName;
    @Map("sign_key")
    private String signKey;
    @Map("android_baseactivity_name")
    private String androidBaseactivityName;
    @Map("share_goods_page_path")
    private String shareGoodsPagePath;
@@ -65,8 +36,6 @@
    @Map("base_user_rank_icon_url")
    private String baseUserRankIconUrl;
    @Map("ios_push_certificate_pwd")
    private String iosPushCertificatePwd;
    @Map("extract_notify_url")
    private String extractNotifyUrl;
@@ -77,14 +46,6 @@
    public void setExtractNotifyUrl(String extractNotifyUrl) {
        this.extractNotifyUrl = extractNotifyUrl;
    }
    public String getIosPushCertificatePwd() {
        return iosPushCertificatePwd;
    }
    public void setIosPushCertificatePwd(String iosPushCertificatePwd) {
        this.iosPushCertificatePwd = iosPushCertificatePwd;
    }
    public String getBaseUserRankIconUrl() {
@@ -111,13 +72,6 @@
        this.shareGoodsPagePath = shareGoodsPagePath;
    }
    public String getAndroidBaseactivityName() {
        return androidBaseactivityName;
    }
    public void setAndroidBaseactivityName(String androidBaseactivityName) {
        this.androidBaseactivityName = androidBaseactivityName;
    }
    public String getSignKey() {
        return signKey;
@@ -135,68 +89,12 @@
        this.projectChineseName = projectChineseName;
    }
    public String getH5PackageName() {
        return h5PackageName;
    }
    public void setH5PackageName(String h5PackageName) {
        this.h5PackageName = h5PackageName;
    }
    public String getAndroidPackageName() {
        return androidPackageName;
    }
    public void setAndroidPackageName(String androidPackageName) {
        this.androidPackageName = androidPackageName;
    }
    public String getIosBundleId() {
        return iosBundleId;
    }
    public void setIosBundleId(String iosBundleId) {
        this.iosBundleId = iosBundleId;
    }
    public String getDefaultOrderPicture() {
        return defaultOrderPicture;
    }
    public void setDefaultOrderPicture(String defaultOrderPicture) {
        this.defaultOrderPicture = defaultOrderPicture;
    }
    public String getWxGZAppId() {
        return wxGZAppId;
    }
    public void setWxGZAppId(String wxGZAppId) {
        this.wxGZAppId = wxGZAppId;
    }
    public String getWxGZAppSecret() {
        return wxGZAppSecret;
    }
    public void setWxGZAppSecret(String wxGZAppSecret) {
        this.wxGZAppSecret = wxGZAppSecret;
    }
    public String getWxOpenAppId() {
        return wxOpenAppId;
    }
    public void setWxOpenAppId(String wxOpenAppId) {
        this.wxOpenAppId = wxOpenAppId;
    }
    public String getWxOpenAppSecret() {
        return wxOpenAppSecret;
    }
    public void setWxOpenAppSecret(String wxOpenAppSecret) {
        this.wxOpenAppSecret = wxOpenAppSecret;
    }
    public String getProjectName() {
@@ -213,22 +111,6 @@
    public void setProjectHost(String projectHost) {
        this.projectHost = projectHost;
    }
    public String getDefaultNickName() {
        return defaultNickName;
    }
    public void setDefaultNickName(String defaultNickName) {
        this.defaultNickName = defaultNickName;
    }
    public String getDefaultPortrait() {
        return defaultPortrait;
    }
    public void setDefaultPortrait(String defaultPortrait) {
        this.defaultPortrait = defaultPortrait;
    }
    public String getShareGoodsPagePathJD() {
fanli/src/main/java/com/yeshi/fanli/entity/config/SystemConfigKeyEnum.java
@@ -3,13 +3,25 @@
public enum SystemConfigKeyEnum {
    appName("应用名称"),
    wxAppId("微信开放平台的appId"),
    androidPackageNames("Android包名"),
    androidBaseActivityName("Android activity的基础路径"),
    h5PackageName("网页的packageName"),
    iosPushCertPwd("ios推送密码"),
    iosBundleIds("IOS的BundleId"),
    wxAppSecret("微信开放平台的appSecret"),
    wxGZAppId("微信公众平台的appId"),
    wxGZAppSecret("微信公众平台的appSecret"),
    defaultNickNamePrefix("默认昵称前缀"),
    defaultPortrait("默认头像")
    ;
    defaultPortrait("默认头像");
    private String name;
    public String getName() {
        return name;
    }
    private SystemConfigKeyEnum(String name) {
        this.name = name;
    }
fanli/src/main/java/com/yeshi/fanli/entity/push/PushQueueRecord.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.entity.push;
import com.yeshi.fanli.entity.SystemEnum;
import java.util.Date;
@@ -47,6 +49,10 @@
    /* 结束时间 */
    @org.yeshi.utils.mybatis.Column(name = "qe_endtime")
    private Date endtime;
    @org.yeshi.utils.mybatis.Column(name = "qe_system")
    private SystemEnum system;
    
    public Long getId() {
@@ -136,5 +142,12 @@
    public void setVersions(String versions) {
        this.versions = versions;
    }
    public SystemEnum getSystem() {
        return system;
    }
    public void setSystem(SystemEnum system) {
        this.system = system;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/system/ConfigCategory.java
@@ -32,7 +32,8 @@
        guanXuan("官宣任务"), 
        specialHelper("小助手"), 
        article("学院相关"), 
        extract("提现相关");
        extract("提现相关"),
        homeUI("首页UI");
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemConfig.java
@@ -42,6 +42,13 @@
        this.id = id;
    }
    public SystemConfig(String key, String value, String name, SystemEnum system) {
        this.key = key;
        this.value = value;
        this.name = name;
        this.system = system;
    }
    public Long getId() {
        return id;
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/config/WXGZServiceImpl.java
@@ -12,9 +12,9 @@
@Service
public class WXGZServiceImpl implements WXGZService {
    @Override
    public void initMenu() {
        String appId = Constant.systemCommonConfig.getWxGZAppId();
        String appSecret = Constant.systemCommonConfig.getWxGZAppSecret();
    public void initMenu(String wxGZAppId,String wxGZAppsecret) {
        String appId = wxGZAppId;
        String appSecret = wxGZAppsecret;
        String accessToken = WXUtil.getAcessToken(appId, appSecret);
        JSONObject root = new JSONObject();
        JSONArray items = new JSONArray();
fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java
@@ -7,12 +7,14 @@
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.entity.push.DeviceTokenHW;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.log.LogManager;
import com.yeshi.fanli.log.PushLogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.HWPushService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
@@ -37,7 +39,10 @@
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) {
    @Resource
    private SystemConfigService systemConfigService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList,SystemEnum system) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 46, system);
@@ -159,7 +164,7 @@
            for (int p = 1; p <= page; p++) {
                List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenList(p, 100, newVersionList, minUpdateTime);
                hwDeviceList = filterDeviceToken(hwDeviceList, hour);
                LogHelper.pushHW(String.format("全推:设备数%s",hwDeviceList.size()));
                LogHelper.pushHW(String.format("全推:设备数%s", hwDeviceList.size()));
                List<String> tokenList = new ArrayList<>();
                for (DeviceTokenHW token : hwDeviceList)
                    tokenList.add(token.getDeviceToken());
@@ -167,25 +172,25 @@
                    if (dto.getType() == PushTypeEnum.goodsdetail) {// 商品详情
                        if (dto.getGoodsId() == null)
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId());
                        HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId(),getAndroidBaseActivity( dto.getContent().getSystem()));
                    } else if (dto.getType() == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(dto.getWebUrl()))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl());
                        HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl(),getAndroidBaseActivity(dto.getContent().getSystem()));
                    } else if (dto.getType() == PushTypeEnum.ZNX) {// 站内信
                        HWPushUtil.pushZNX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                    } else if (dto.getType() == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(dto.getUrl()))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl());
                        HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl(),getAndroidBaseActivity(dto.getContent().getSystem()));
                    } else if (dto.getType() == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(dto.getWebUrl()))
                            throw new PushException(2, "参数不完整");
                        HWPushUtil.pushBaiChuanUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl());
                    } else if (dto.getType() == PushTypeEnum.welfare) {// 福利中心
                        HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                        HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem()));
                    } else if (dto.getType() == PushTypeEnum.signin) {// 签到
                        HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                        HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem()));
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
@@ -203,7 +208,7 @@
                    tokenList.add(token.getDeviceToken());
            }
            LogHelper.pushHW(String.format("单推:设备数%s 用户:%s",hwDeviceList.size(),dto.getUid()+""));
            LogHelper.pushHW(String.format("单推:设备数%s 用户:%s", hwDeviceList.size(), dto.getUid() + ""));
            if (tokenList.size() == 0)
                return;
@@ -212,25 +217,25 @@
                if (dto.getType() == PushTypeEnum.goodsdetail) {// 商品详情
                    if (dto.getGoodsId() == null)
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId());
                    HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId(),getAndroidBaseActivity(dto.getContent().getSystem()));
                } else if (dto.getType() == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(dto.getWebUrl()))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl());
                    HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl(),getAndroidBaseActivity(dto.getContent().getSystem()));
                } else if (dto.getType() == PushTypeEnum.ZNX) {// 站内信
                    HWPushUtil.pushZNX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                } else if (dto.getType() == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(dto.getUrl()))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl());
                    HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl(),getAndroidBaseActivity(dto.getContent().getSystem()));
                } else if (dto.getType() == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(dto.getWebUrl()))
                        throw new PushException(2, "参数不完整");
                    HWPushUtil.pushBaiChuanUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl());
                } else if (dto.getType() == PushTypeEnum.welfare) {// 福利中心
                    HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                    HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem()));
                } else if (dto.getType() == PushTypeEnum.signin) {// 签到
                    HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent());
                    HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem()));
                }
            } catch (Exception e) {
                PushLogHelper.hwError(e);
@@ -238,4 +243,10 @@
        }
    }
    private String getAndroidBaseActivity(SystemEnum system) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/IOSPushServiceImpl.java
@@ -8,6 +8,9 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -35,649 +38,654 @@
@Service
public class IOSPushServiceImpl implements IOSPushService {
    @Resource
    private DeviceTokenIOSMapper deviceTokenIOSMapper;
    @Resource
    private DeviceTokenIOSMapper deviceTokenIOSMapper;
    @Resource
    private PushQueueRecordMapper pushQueueRecordMapper;
    @Resource
    private PushQueueRecordMapper pushQueueRecordMapper;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versionCodes)
            throws PushException {
    @Resource
    private SystemConfigService systemConfigService;
        String url = "https://item.taobao.com/item.htm?id=" + auctionId;
        JSONObject json = new JSONObject();
        json.put("id", auctionId);
        json.put("type", "goodsdetail");
        json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.recommend.GoodsBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versionCodes, SystemEnum system)
            throws PushException {
        PushRecord pushRecord = new PushRecord();
        pushRecord.setState(1);
        pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 都成功
        pushRecord.setUrl(url);
        pushRecord.setTitle(title);
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
        String url = "https://item.taobao.com/item.htm?id=" + auctionId;
        JSONObject json = new JSONObject();
        json.put("id", auctionId);
        json.put("type", "goodsdetail");
        json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
                systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
        if (uid == null || uid == 0) {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        info.setPackageName(systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames,system));
        info.setActivty(String.format("%s.ui.recommend.GoodsBrowserActivity",
                systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            addPushIOSQueue(info, url, PushTypeEnum.goodsdetail.getCode(), versionCodes);
        PushRecord pushRecord = new PushRecord();
        pushRecord.setState(1);
        pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 都成功
        pushRecord.setUrl(url);
        pushRecord.setTitle(title);
        pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
            /*
             * // 查询IOS所有设备号 // TODO 需要全推 List<String> deviceTokenList =
             * getDeviceTokenList(1, 20000); // IOS 全推 ThreadUtil.run(new
             * Runnable() {
             *
             * @Override public void run() { try {
             * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
             * PushController.GOODS); } catch (Exception e) {
             * PushLogHelper.iosError(e);
             *
             * } } });
             */
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
            }
        if (uid == null || uid == 0) {
            // IOS 单推
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            addPushIOSQueue(info, url, PushTypeEnum.goodsdetail.getCode(), versionCodes,system);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            /*
             * // 查询IOS所有设备号 // TODO 需要全推 List<String> deviceTokenList =
             * getDeviceTokenList(1, 20000); // IOS 全推 ThreadUtil.run(new
             * Runnable() {
             *
             * @Override public void run() { try {
             * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
             * PushController.GOODS); } catch (Exception e) {
             * PushLogHelper.iosError(e);
             *
             * } } });
             */
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
            }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.goodsdetail.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
            // IOS 单推
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
        }
    }
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, String versionCodes) throws PushException {
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", "url");
        json.put("webUrl", url);
        json.put("miPushUrl",
                String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.goodsdetail.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(
                String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
        }
    }
        PushRecord pushRecord = new PushRecord();
        // IOS 全推
        if (uid == null || uid == 0) {
            // TODO 需要全推
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, String versionCodes, SystemEnum system) throws PushException {
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", "url");
        json.put("webUrl", url);
        json.put("miPushUrl",
                String.format("%s.ui.BrowserActivity",systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            addPushIOSQueue(info, url, PushTypeEnum.url.getCode(), versionCodes);
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames,system));
        info.setActivty(
                String.format("%s.ui.BrowserActivity", systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
             * ThreadUtil.run(new Runnable() {
             *
             * @Override public void run() { try {
             *
             * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
             * PushController.URL);
             *
             * } catch (Exception e) { PushLogHelper.iosError(e); } } });
             */
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
            }
        PushRecord pushRecord = new PushRecord();
        // IOS 全推
        if (uid == null || uid == 0) {
            // TODO 需要全推
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.url.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
            addPushIOSQueue(info, url, PushTypeEnum.url.getCode(), versionCodes,system);
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versionCodes) throws PushException {
        MessageInfo info = new MessageInfo();
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
             * ThreadUtil.run(new Runnable() {
             *
             * @Override public void run() { try {
             *
             * IOSPushUtil.allPushIOS(deviceTokenList, info, url,
             * PushController.URL);
             *
             * } catch (Exception e) { PushLogHelper.iosError(e); } } });
             */
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
            }
        JSONObject contentJson = new JSONObject();
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.url.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
        /* 无uid , 广播 数据插入系统表 */
        if (systemZNX != null) {
            info.setTitle(systemZNX.getTitle());
            info.setContent(systemZNX.getContent());
            contentJson.put("title", systemZNX.getTitle());
            contentJson.put("content", systemZNX.getContent());
            info.setDescription(systemZNX.getContent());
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versionCodes, SystemEnum system) throws PushException {
        MessageInfo info = new MessageInfo();
        info.setPackageName(systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames,system));
            // 小米开始全推
            long id = systemZNX.getId();
            contentJson.put("id", id);
        JSONObject contentJson = new JSONObject();
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                    Constant.systemCommonConfig.getAndroidBaseactivityName()));
        /* 无uid , 广播 数据插入系统表 */
        if (systemZNX != null) {
            info.setTitle(systemZNX.getTitle());
            info.setContent(systemZNX.getContent());
            contentJson.put("title", systemZNX.getTitle());
            contentJson.put("content", systemZNX.getContent());
            info.setDescription(systemZNX.getContent());
            PushRecord pushRecord = new PushRecord();
            // 小米开始全推
            long id = systemZNX.getId();
            contentJson.put("id", id);
            // TODO 需要全推
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                    systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            addPushIOSQueue(info, id + "", PushTypeEnum.ZNX.getCode(), versionCodes);
            PushRecord pushRecord = new PushRecord();
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
             *
             * ThreadUtil.run(new Runnable() {
             *
             * @Override public void run() { try {
             * IOSPushUtil.allPushIOS(deviceTokenList, info, id + "",
             * PushController.ZNX); } catch (Exception e) {
             * PushLogHelper.iosError(e); }
             *
             * } });
             */
        } else if (msg != null) {
            // TODO 需要全推
            if (uId != null) {
                if (!validateNotDisturbSingle(uId)) {
                    return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
                }
            }
            addPushIOSQueue(info, id + "", PushTypeEnum.ZNX.getCode(), versionCodes,system);
            // 插入推送记录
            PushRecord pushRecord = new PushRecord();
            info.setTitle(msg.getTitle());
            info.setContent(msg.getContent());
            contentJson.put("title", msg.getTitle());
            contentJson.put("content", msg.getContent());
            info.setDescription(msg.getContent());
            /*
             * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
             *
             * ThreadUtil.run(new Runnable() {
             *
             * @Override public void run() { try {
             * IOSPushUtil.allPushIOS(deviceTokenList, info, id + "",
             * PushController.ZNX); } catch (Exception e) {
             * PushLogHelper.iosError(e); }
             *
             * } });
             */
        } else if (msg != null) {
            info.setAlias(uId + "");
            info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
            info.setActivty(
                    String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
            if (uId != null) {
                if (!validateNotDisturbSingle(uId)) {
                    return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
                }
            }
            contentJson.put("id", msg.getId() + "");
            // 插入推送记录
            PushRecord pushRecord = new PushRecord();
            info.setTitle(msg.getTitle());
            info.setContent(msg.getContent());
            contentJson.put("title", msg.getTitle());
            contentJson.put("content", msg.getContent());
            info.setDescription(msg.getContent());
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                    Constant.systemCommonConfig.getAndroidBaseactivityName()));
            info.setAlias(uId + "");
            info.setPackageName(systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames,system));
            info.setActivty(
                    String.format("%s.ui.BrowserActivity",systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(msg.getUserInfo().getId(), versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            contentJson.put("id", msg.getId() + "");
            // IOS 单推
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushTypeEnum.ZNX.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
            JSONObject json = new JSONObject();
            json.put("type", "ZNX");
            json.put("content", contentJson);
            json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                    systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName,system)));
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(msg.getUserInfo().getId(), versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            // IOS 单推
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "0", PushTypeEnum.ZNX.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    @Transactional
    @Override
    public void addDeviceToken(Long uid, int version, String deviceToken, String device) {
        // 如果device为空就返回
        if (StringUtil.isNullOrEmpty(device) || StringUtil.isNullOrEmpty(deviceToken))
            return;
    @Transactional
    @Override
    public void addDeviceToken(Long uid, int version, String deviceToken, String device) {
        // 如果device为空就返回
        if (StringUtil.isNullOrEmpty(device) || StringUtil.isNullOrEmpty(deviceToken))
            return;
        // 判断device是否存在
        DeviceTokenIOS deviceTokenIos = deviceTokenIOSMapper.selectByDeviceForUpdate(device);
        if (deviceTokenIos == null) {
            deviceTokenIos = new DeviceTokenIOS();
            deviceTokenIos.setCreateTime(new Date());
            deviceTokenIos.setUpdateTime(new Date());
            deviceTokenIos.setDevice(device);
            deviceTokenIos.setDeviceToken(deviceToken);
            deviceTokenIos.setDeviceTokenMd5(StringUtil.Md5(deviceToken));
            deviceTokenIos.setUid(uid);
            deviceTokenIos.setVersion(version);
            deviceTokenIOSMapper.insertSelective(deviceTokenIos);
        } else {// 更新devicetoken
            DeviceTokenIOS updateDeviceTokenIOS = new DeviceTokenIOS();
            updateDeviceTokenIOS.setId(deviceTokenIos.getId());
            updateDeviceTokenIOS.setDeviceToken(deviceToken);
            updateDeviceTokenIOS.setDeviceTokenMd5(StringUtil.Md5(deviceToken));
            updateDeviceTokenIOS.setUid(uid);
            updateDeviceTokenIOS.setUpdateTime(new Date());
            deviceTokenIOSMapper.updateByPrimaryKeySelective(updateDeviceTokenIOS);
        }
        // 判断device是否存在
        DeviceTokenIOS deviceTokenIos = deviceTokenIOSMapper.selectByDeviceForUpdate(device);
        if (deviceTokenIos == null) {
            deviceTokenIos = new DeviceTokenIOS();
            deviceTokenIos.setCreateTime(new Date());
            deviceTokenIos.setUpdateTime(new Date());
            deviceTokenIos.setDevice(device);
            deviceTokenIos.setDeviceToken(deviceToken);
            deviceTokenIos.setDeviceTokenMd5(StringUtil.Md5(deviceToken));
            deviceTokenIos.setUid(uid);
            deviceTokenIos.setVersion(version);
            deviceTokenIOSMapper.insertSelective(deviceTokenIos);
        } else {// 更新devicetoken
            DeviceTokenIOS updateDeviceTokenIOS = new DeviceTokenIOS();
            updateDeviceTokenIOS.setId(deviceTokenIos.getId());
            updateDeviceTokenIOS.setDeviceToken(deviceToken);
            updateDeviceTokenIOS.setDeviceTokenMd5(StringUtil.Md5(deviceToken));
            updateDeviceTokenIOS.setUid(uid);
            updateDeviceTokenIOS.setUpdateTime(new Date());
            deviceTokenIOSMapper.updateByPrimaryKeySelective(updateDeviceTokenIOS);
        }
    }
    }
    @Override
    public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, String versionCodes) throws PushException {
        return deviceTokenIOSMapper.selectByUid(uid, convertVersionType(versionCodes));
    }
    @Override
    public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, String versionCodes) throws PushException {
        return deviceTokenIOSMapper.selectByUid(uid, convertVersionType(versionCodes));
    }
    @Override
    public List<String> getDeviceTokenList(int page, int size) {
        List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList((long) ((page - 1) * size), size, null);
        List<String> tokenList = new ArrayList<>();
        for (DeviceTokenIOS ios : list)
            if (!StringUtil.isNullOrEmpty(ios.getDeviceToken()))
                tokenList.add(ios.getDeviceToken());
        return tokenList;
    }
    @Override
    public List<String> getDeviceTokenList(int page, int size) {
        List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList((long) ((page - 1) * size), size, null);
        List<String> tokenList = new ArrayList<>();
        for (DeviceTokenIOS ios : list)
            if (!StringUtil.isNullOrEmpty(ios.getDeviceToken()))
                tokenList.add(ios.getDeviceToken());
        return tokenList;
    }
    @Override
    public long getDeviceTokenCount() {
        return deviceTokenIOSMapper.selectCount();
    }
    @Override
    public long getDeviceTokenCount() {
        return deviceTokenIOSMapper.selectCount();
    }
    @Override
    public void updateDeviceToken(DeviceTokenIOS deviceTokenIos) {
        if (deviceTokenIos != null) {
            deviceTokenIos.setUpdateTime(new Date());
            deviceTokenIOSMapper.updateByPrimaryKey(deviceTokenIos);
        }
    }
    @Override
    public void updateDeviceToken(DeviceTokenIOS deviceTokenIos) {
        if (deviceTokenIos != null) {
            deviceTokenIos.setUpdateTime(new Date());
            deviceTokenIOSMapper.updateByPrimaryKey(deviceTokenIos);
        }
    }
    @Override
    public DeviceTokenIOS getDeviceTokenByDeviceToken(String deviceToken) {
        return deviceTokenIOSMapper.selectByDeviceToken(deviceToken);
    }
    @Override
    public DeviceTokenIOS getDeviceTokenByDeviceToken(String deviceToken) {
        return deviceTokenIOSMapper.selectByDeviceToken(deviceToken);
    }
    /**
     * 保存推送内容只队列中
     *
     * @param json
     */
    @Transactional(rollbackFor=Exception.class)
    public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes) throws PushException {
    /**
     * 保存推送内容只队列中
     *
     * @param json
     */
    @Transactional(rollbackFor = Exception.class)
    public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes,SystemEnum system) throws PushException {
        if (Constant.IS_TEST)
            return;
        if (Constant.IS_TEST)
            return;
        try {
        try {
            JSONObject json = IOSPushUtil.getJSONObject(info, url, type);
            JSONObject json = IOSPushUtil.getJSONObject(info, url, type);
            // 总条目
            long tokenCount = getDeviceTokenCount();
            // 总条目
            long tokenCount = getDeviceTokenCount();
            // 一个队列 1000 条
            long totalCount = 1000;
            // 一个队列 1000 条
            long totalCount = 1000;
            // 每次执行条目
            int pushNum = 50;
            // 每次执行条目
            int pushNum = 50;
            for (long i = 0; i < tokenCount + totalCount;) {
            for (long i = 0; i < tokenCount + totalCount; ) {
                PushQueueRecord pushQueueRecord = new PushQueueRecord();
                // 初始状态
                pushQueueRecord.setState(0);
                // 发送内容
                pushQueueRecord.setJsonContent(json.toString());
                // 创建时间
                pushQueueRecord.setCreatetime(new Date());
                // 每次推送数量
                pushQueueRecord.setPushNum(pushNum);
                // 推送端 IOS
                pushQueueRecord.setType(1);
                // 版本号
                pushQueueRecord.setVersions(versionCodes);
                PushQueueRecord pushQueueRecord = new PushQueueRecord();
                pushQueueRecord.setSystem(system);
                // 初始状态
                pushQueueRecord.setState(0);
                // 发送内容
                pushQueueRecord.setJsonContent(json.toString());
                // 创建时间
                pushQueueRecord.setCreatetime(new Date());
                // 每次推送数量
                pushQueueRecord.setPushNum(pushNum);
                // 推送端 IOS
                pushQueueRecord.setType(1);
                // 版本号
                pushQueueRecord.setVersions(versionCodes);
                if (tokenCount - i < totalCount) {
                    // 起始游标
                    pushQueueRecord.setStartCursor(i);
                    // 结束游标
                    pushQueueRecord.setEndCursor(tokenCount);
                if (tokenCount - i < totalCount) {
                    // 起始游标
                    pushQueueRecord.setStartCursor(i);
                    // 结束游标
                    pushQueueRecord.setEndCursor(tokenCount);
                    // 存入数据库
                    pushQueueRecordMapper.insert(pushQueueRecord);
                    // 存入数据库
                    pushQueueRecordMapper.insert(pushQueueRecord);
                    // 加入队列
                    CMQManager.getInstance().addIOSPushMsg(pushQueueRecord);
                    // 加入队列
                    CMQManager.getInstance().addIOSPushMsg(pushQueueRecord);
                    break;
                    break;
                } else {
                } else {
                    // 起始游标
                    pushQueueRecord.setStartCursor(i);
                    // 起始游标
                    pushQueueRecord.setStartCursor(i);
                    long endCursor = (i + totalCount) - 1;
                    long endCursor = (i + totalCount) - 1;
                    // 结束游标
                    pushQueueRecord.setEndCursor(endCursor);
                    // 结束游标
                    pushQueueRecord.setEndCursor(endCursor);
                    // 存入数据库
                    pushQueueRecordMapper.insert(pushQueueRecord);
                    // 加入队列
                    CMQManager.getInstance().addIOSPushMsg(pushQueueRecord);
                }
                    // 存入数据库
                    pushQueueRecordMapper.insert(pushQueueRecord);
                    // 加入队列
                    CMQManager.getInstance().addIOSPushMsg(pushQueueRecord);
                }
                i += totalCount;
            }
                i += totalCount;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    }
    /**
     * 队列执行推送操作
     */
    @Override
    public void readyPushIOS(PushQueueRecord pushQueueRecord) throws Exception {
    /**
     * 队列执行推送操作
     */
    @Override
    public void readyPushIOS(PushQueueRecord pushQueueRecord) throws Exception {
        // 起始位置
        Long startCursor = pushQueueRecord.getStartCursor();
        // 结束位置
        Long endCursor = pushQueueRecord.getEndCursor();
        // 起始位置
        Long startCursor = pushQueueRecord.getStartCursor();
        // 结束位置
        Long endCursor = pushQueueRecord.getEndCursor();
        if (startCursor == null && endCursor == null) {
            return;
        }
        if (startCursor == null && endCursor == null) {
            return;
        }
        // 推送的版本号
        String versions = pushQueueRecord.getVersions();
        List<Integer> listCode = convertVersionType(versions);
        // 推送的版本号
        String versions = pushQueueRecord.getVersions();
        List<Integer> listCode = convertVersionType(versions);
        int total = (int) (endCursor - startCursor);
        int total = (int) (endCursor - startCursor);
        // 每次推送总条数
        int moveNum = pushQueueRecord.getPushNum();
        // 每次推送总条数
        int moveNum = pushQueueRecord.getPushNum();
        int count = total / moveNum;
        int count = total / moveNum;
        if (total % moveNum > 0) {
            count += 1;
        }
        if (total % moveNum > 0) {
            count += 1;
        }
        long recordCursor = startCursor;
        long recordCursor = startCursor;
        for (int i = 0; i < count; i++) {
        for (int i = 0; i < count; i++) {
            // 不足50个数据
            if (moveNum > total) {
                moveNum = (int) (endCursor - startCursor);
                List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(startCursor, moveNum, listCode);
                recordCursor = endCursor;
            // 不足50个数据
            if (moveNum > total) {
                moveNum = (int) (endCursor - startCursor);
                List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(startCursor, moveNum, listCode);
                recordCursor = endCursor;
                if (list != null) {
                    executePushIOS(list, pushQueueRecord, recordCursor);
                    PushLogHelper.iosInfo("推送游标:" + startCursor + "," + moveNum);
                }
                if (list != null) {
                    executePushIOS(list, pushQueueRecord, recordCursor,pushQueueRecord.getSystem());
                    PushLogHelper.iosInfo("推送游标:" + startCursor + "," + moveNum);
                }
            } else {
            } else {
                if (recordCursor + moveNum > endCursor) {
                    // System.out.println("recordCursorend:" +recordCursor);
                    moveNum = (int) (endCursor - recordCursor);
                    // System.out.println(moveNum);
                    List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, endCursor);
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                    recordCursor = endCursor;
                if (recordCursor + moveNum > endCursor) {
                    // System.out.println("recordCursorend:" +recordCursor);
                    moveNum = (int) (endCursor - recordCursor);
                    // System.out.println(moveNum);
                    List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, endCursor,pushQueueRecord.getSystem());
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                    recordCursor = endCursor;
                } else {
                    List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
                    recordCursor = recordCursor + 50;
                } else {
                    List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
                    recordCursor = recordCursor + 50;
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, recordCursor - 1);
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                }
            }
        }
    }
                    if (list != null) {
                        executePushIOS(list, pushQueueRecord, recordCursor - 1,pushQueueRecord.getSystem());
                        PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
                    }
                }
            }
        }
    }
    public void executePushIOS(List<DeviceTokenIOS> list, PushQueueRecord pushQueueRecord, long recordCursor) {
    public void executePushIOS(List<DeviceTokenIOS> list, PushQueueRecord pushQueueRecord, long recordCursor,SystemEnum system) {
        String jsonContent = pushQueueRecord.getJsonContent();
        JSONObject json = JSONObject.fromObject(jsonContent);
        String jsonContent = pushQueueRecord.getJsonContent();
        JSONObject json = JSONObject.fromObject(jsonContent);
        List<String> tokenList = new ArrayList<>();
        List<String> tokenList = new ArrayList<>();
        boolean ispush = false;
        List<Long> listNotPushId = null;
        boolean ispush = false;
        List<Long> listNotPushId = null;
        Calendar now = Calendar.getInstance();
        int hour = now.get(Calendar.HOUR_OF_DAY);
        Calendar now = Calendar.getInstance();
        int hour = now.get(Calendar.HOUR_OF_DAY);
//        if (hour >= 8 && hour < 20) {
//            ispush = true; // 可推送
//        } else {
//            listNotPushId = validateNotDisturb();
//        }
        ispush=true;//TODO 处理消息免打扰
        for (DeviceTokenIOS ios : list) {
        ispush = true;//TODO 处理消息免打扰
            if (!StringUtil.isNullOrEmpty(ios.getDeviceToken())) {
                if (!ispush && listNotPushId != null && listNotPushId.size() > 0) {
                    Long uid = ios.getUid();
                    if (uid != null && listNotPushId.contains(uid)) {
                        continue; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
                    }
                }
                tokenList.add(ios.getDeviceToken());
            }
        }
        for (DeviceTokenIOS ios : list) {
        if (tokenList.size() > 0) {
            // 执行推送
            try {
                IOSPushUtil.executePushIOS(tokenList, json);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        pushQueueRecord.setState(1);
        pushQueueRecord.setEndtime(new Date());
        pushQueueRecord.setRecordCursor(recordCursor);
            if (!StringUtil.isNullOrEmpty(ios.getDeviceToken())) {
                if (!ispush && listNotPushId != null && listNotPushId.size() > 0) {
                    Long uid = ios.getUid();
                    if (uid != null && listNotPushId.contains(uid)) {
                        continue; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
                    }
                }
                tokenList.add(ios.getDeviceToken());
            }
        }
        // 更新数据库
        pushQueueRecordMapper.updateByPrimaryKeySelective(pushQueueRecord);
    }
        if (tokenList.size() > 0) {
            // 执行推送
            try {
                IOSPushUtil.executePushIOS(tokenList, json,systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        pushQueueRecord.setState(1);
        pushQueueRecord.setEndtime(new Date());
        pushQueueRecord.setRecordCursor(recordCursor);
    @Override
    public void unBindUidAndDevice(String device) {
        if (StringUtil.isNullOrEmpty(device))
            return;
        DeviceTokenIOS deviceTokenIOS = deviceTokenIOSMapper.selectByDevice(device);
        if (device != null) {
            deviceTokenIOS.setUpdateTime(new Date());
            deviceTokenIOS.setUid(null);
            deviceTokenIOSMapper.updateByPrimaryKey(deviceTokenIOS);
        }
    }
        // 更新数据库
        pushQueueRecordMapper.updateByPrimaryKeySelective(pushQueueRecord);
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, String versionCodes)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, weexUrl, PushTypeEnum.weex.getCode(), versionCodes);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, weexUrl, PushTypeEnum.weex.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    @Override
    public void unBindUidAndDevice(String device) {
        if (StringUtil.isNullOrEmpty(device))
            return;
        DeviceTokenIOS deviceTokenIOS = deviceTokenIOSMapper.selectByDevice(device);
        if (device != null) {
            deviceTokenIOS.setUpdateTime(new Date());
            deviceTokenIOS.setUid(null);
            deviceTokenIOSMapper.updateByPrimaryKey(deviceTokenIOS);
        }
    }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versionCodes)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, url, PushTypeEnum.baichuan.getCode(), versionCodes);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.baichuan.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, String versionCodes, SystemEnum system)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, weexUrl, PushTypeEnum.weex.getCode(), versionCodes,system);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, weexUrl, PushTypeEnum.weex.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    /**
     * 通知免打扰(20:00-8:00)
     */
    public List<Long> validateNotDisturb() {
        return userCustomSettingsService.getCancelNoticeUsers();
    }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versionCodes, SystemEnum system)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, url, PushTypeEnum.baichuan.getCode(), versionCodes,system);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, url, PushTypeEnum.baichuan.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
    /**
     * 通知免打扰(20:00-8:00)
     */
    public boolean validateNotDisturbSingle(Long uid) {
        Calendar now = Calendar.getInstance();
        int hour = now.get(Calendar.HOUR_OF_DAY);
        boolean ispush;
        if (hour >= 8 && hour < 20) {
            ispush = true; // 可推送
        } else {
            // 自定义设置 通知免打扰(20:00-24:00 / 00:00 -08:00)
            ispush = userCustomSettingsService.validateCancelNoticeByUid(uid);
        }
    /**
     * 通知免打扰(20:00-8:00)
     */
    public List<Long> validateNotDisturb() {
        return userCustomSettingsService.getCancelNoticeUsers();
    }
        return ispush;
    }
    /**
     * 通知免打扰(20:00-8:00)
     */
    public boolean validateNotDisturbSingle(Long uid) {
        Calendar now = Calendar.getInstance();
        int hour = now.get(Calendar.HOUR_OF_DAY);
        boolean ispush;
        if (hour >= 8 && hour < 20) {
            ispush = true; // 可推送
        } else {
            // 自定义设置 通知免打扰(20:00-24:00 / 00:00 -08:00)
            ispush = userCustomSettingsService.validateCancelNoticeByUid(uid);
        }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, String versionCodes) throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushTypeEnum.welfare.getCode(), versionCodes);
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return;
            }
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.welfare.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
        return ispush;
    }
    private List<Integer> convertVersionType(String versionCodes) {
        List<Integer> listVersionCode = null;
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, String versionCodes, SystemEnum system) throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushTypeEnum.welfare.getCode(), versionCodes,system);
        } else {
            if (!validateNotDisturbSingle(uid)) {
                return;
            }
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.welfare.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
        if (versionCodes != null && versionCodes.trim().length() > 0) {
            List<String> listVersion = Arrays.asList(versionCodes.split(","));
            if (listVersion != null && listVersion.size() > 0) {
    private List<Integer> convertVersionType(String versionCodes) {
        List<Integer> listVersionCode = null;
                listVersionCode = new ArrayList<Integer>();
                // 转换成功整型
                for (String version : listVersion) {
                    if (version != null && version.trim().length() > 0) {
                        listVersionCode.add(Integer.parseInt(version));
                    }
                }
            }
        }
        return listVersionCode;
    }
        if (versionCodes != null && versionCodes.trim().length() > 0) {
            List<String> listVersion = Arrays.asList(versionCodes.split(","));
            if (listVersion != null && listVersion.size() > 0) {
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushTypeEnum.signin.getCode(), versions);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versions);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.signin.getCode());
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
                listVersionCode = new ArrayList<Integer>();
                // 转换成功整型
                for (String version : listVersion) {
                    if (version != null && version.trim().length() > 0) {
                        listVersionCode.add(Integer.parseInt(version));
                    }
                }
            }
        }
        return listVersionCode;
    }
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions, SystemEnum system)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // IOS 全推
        if (uid == null || uid == 0) {
            addPushIOSQueue(info, "", PushTypeEnum.signin.getCode(), versions,system);
        } else {
            List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versions);
            List<String> deviceTokenList = new ArrayList<>();
            if (deviceTokenIosList != null)
                for (DeviceTokenIOS ios : deviceTokenIosList) {
                    deviceTokenList.add(ios.getDeviceToken());
                }
            try {
                IOSPushUtil.allPushIOS(deviceTokenList, info, "", PushTypeEnum.signin.getCode(),systemConfigService.getValueCache(SystemConfigKeyEnum.iosPushCertPwd,system));
            } catch (Exception e) {
                PushLogHelper.iosError(e);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
@@ -6,6 +6,8 @@
import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.Constant;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -27,212 +29,217 @@
@Service
public class OPPOPushServiceImpl implements OPPOPushService {
    @Resource
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList,SystemEnum system) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51,system);
            if (appInfoList != null)
                for (AppVersionInfo version : appInfoList) {
                    versionList.add(version.getVersionCode());
                }
    @Resource
    private SystemConfigService systemConfigService;
        } else {// 按版本推送
            for (Integer versionCode : versionCodeList) {
                if (versionCode.intValue() >= 51) {// 2.0.1开始支持
                    versionList.add(versionCode);
                }
            }
        }
        return versionList;
    }
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51, system);
            if (appInfoList != null)
                for (AppVersionInfo version : appInfoList) {
                    versionList.add(version.getVersionCode());
                }
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.goodsdetail, uid, null, null, auctionId, baseContent);
    }
        } else {// 按版本推送
            for (Integer versionCode : versionCodeList) {
                if (versionCode.intValue() >= 51) {// 2.0.1开始支持
                    versionList.add(versionCode);
                }
            }
        }
        return versionList;
    }
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url,  PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.url, uid, null, url, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.goodsdetail, uid, null, null, auctionId, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uid,  PushBaseContent baseContent) throws PushException {
        push(PushTypeEnum.ZNX, uid,  null, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.url, uid, null, url, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid,String weexUrl, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.weex, uid,  weexUrl, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uid, PushBaseContent baseContent) throws PushException {
        push(PushTypeEnum.ZNX, uid, null, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid,String url, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.baichuan, uid, null, url, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String weexUrl, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.weex, uid, weexUrl, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.welfare, uid, null, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String url, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.baichuan, uid, null, url, null, baseContent);
    }
    @Override
    public void pushUserSignInNotification(Long uid, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.signin, uid,  null, null, null, baseContent);
    }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.welfare, uid, null, null, null, baseContent);
    }
    private List<DeviceTokenOPPO> filterDeviceToken(List<DeviceTokenOPPO> deviceList, int hour) {
    @Override
    public void pushUserSignInNotification(Long uid, PushBaseContent baseContent)
            throws PushException {
        push(PushTypeEnum.signin, uid, null, null, null, baseContent);
    }
        // TODO 消息免打扰关闭
        if (1 > 0)
            return deviceList;
    private List<DeviceTokenOPPO> filterDeviceToken(List<DeviceTokenOPPO> deviceList, int hour) {
        // 处理消息免打扰
        if (hour >= 20 || hour < 8) {
            Set<Long> uidSets = new HashSet<>();
            for (DeviceTokenOPPO dt : deviceList)
                if (dt.getUid() != null)
                    uidSets.add(dt.getUid());
            List<Long> uidList = new ArrayList<>();
            uidList.addAll(uidSets);
            List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
                    UserSettingTypeEnum.cancelNotice.name(), UserCustomSettings.STATE_VALID);
            uidSets.clear();
            if (settingList != null) {
                for (UserCustomSettings seeting : settingList)
                    uidSets.add(seeting.getUserInfo().getId());
            }
            if (uidSets.size() > 0)
                for (int i = 0; i < deviceList.size(); i++) {
                    if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
                        deviceList.remove(i--);
                    }
                }
        }
        return deviceList;
    }
        // TODO 消息免打扰关闭
        if (1 > 0)
            return deviceList;
    /**
     * 推送
     *
     * @param type
     * @param uid
     * @param content
     * @param url
     * @param webUrl
     */
    private void push(PushTypeEnum type, Long uid, String url, String webUrl,
                      Long goodsId,PushBaseContent content) throws PushException {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(content.getVersionCodeList(),content.getSystem());
        // 1.6.5后开始推送
        for (int i = 0; i < newVersionList.size(); i++) {
            if (newVersionList.get(i) < 47)
                newVersionList.remove(i--);
        }
        // 处理消息免打扰
        if (hour >= 20 || hour < 8) {
            Set<Long> uidSets = new HashSet<>();
            for (DeviceTokenOPPO dt : deviceList)
                if (dt.getUid() != null)
                    uidSets.add(dt.getUid());
            List<Long> uidList = new ArrayList<>();
            uidList.addAll(uidSets);
            List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
                    UserSettingTypeEnum.cancelNotice.name(), UserCustomSettings.STATE_VALID);
            uidSets.clear();
            if (settingList != null) {
                for (UserCustomSettings seeting : settingList)
                    uidSets.add(seeting.getUserInfo().getId());
            }
            if (uidSets.size() > 0)
                for (int i = 0; i < deviceList.size(); i++) {
                    if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
                        deviceList.remove(i--);
                    }
                }
        }
        return deviceList;
    }
        if (uid == null || uid == 0) {
            Date minUpdatetime=new Date(System.currentTimeMillis()- Constant.PUSH_MIN_TIME);
            int pageSize = 200;
            long deviceCount = deviceTokenOPPOService.countDeviceToken(newVersionList,minUpdatetime);
            int page = (int) (deviceCount % pageSize == 0 ? deviceCount / pageSize : deviceCount / pageSize + 1);
            for (int p = 1; p <= page; p++) {
                List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listDeviceToken(p, pageSize, newVersionList,minUpdatetime);
                deviceList = filterDeviceToken(deviceList, hour);
    /**
     * 推送
     *
     * @param type
     * @param uid
     * @param content
     * @param url
     * @param webUrl
     */
    private void push(PushTypeEnum type, Long uid, String url, String webUrl,
                      Long goodsId, PushBaseContent content) throws PushException {
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(content.getVersionCodeList(), content.getSystem());
        // 1.6.5后开始推送
        for (int i = 0; i < newVersionList.size(); i++) {
            if (newVersionList.get(i) < 47)
                newVersionList.remove(i--);
        }
                List<String> tokenList = new ArrayList<>();
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
                try {
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId);
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        OPPOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushWEEX(tokenList,content.getTitle(), content.getContent(), url);
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushBaiChuanUrl(tokenList,content.getTitle(), content.getContent(), webUrl);
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        OPPOPushUtil.pushWelfareCenter(tokenList,content.getTitle(), content.getContent());
                    } else if (type == PushTypeEnum.signin) {// 签到
                        OPPOPushUtil.pushUserSignInNotification(tokenList, content.getTitle(), content.getContent());
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
                }
        String androidBaseActivity = systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, content.getSystem());
            }
        } else {
            // 华为单推
            List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listByUid(uid, newVersionList);
            List<String> tokenList = new ArrayList<>();
            if (deviceList != null) {
                deviceList = filterDeviceToken(deviceList, hour);
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
            }
            if (tokenList.size() == 0)
                return;
        if (uid == null || uid == 0) {
            Date minUpdatetime = new Date(System.currentTimeMillis() - Constant.PUSH_MIN_TIME);
            int pageSize = 200;
            long deviceCount = deviceTokenOPPOService.countDeviceToken(newVersionList, minUpdatetime);
            int page = (int) (deviceCount % pageSize == 0 ? deviceCount / pageSize : deviceCount / pageSize + 1);
            for (int p = 1; p <= page; p++) {
                List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listDeviceToken(p, pageSize, newVersionList, minUpdatetime);
                deviceList = filterDeviceToken(deviceList, hour);
            try {
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId);
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    OPPOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url);
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    OPPOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent());
                } else if (type == PushTypeEnum.signin) {// 签到
                    OPPOPushUtil.pushUserSignInNotification(tokenList, content.getTitle(), content.getContent());
                }
            } catch (Exception e) {
                PushLogHelper.oppoError(e);
            }
                List<String> tokenList = new ArrayList<>();
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
                try {
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId,androidBaseActivity);
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl,androidBaseActivity);
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        OPPOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url,androidBaseActivity);
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        OPPOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
                    } else if (type == PushTypeEnum.signin) {// 签到
                        OPPOPushUtil.pushUserSignInNotification(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
                }
        }
    }
            }
        } else {
            // 华为单推
            List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listByUid(uid, newVersionList);
            List<String> tokenList = new ArrayList<>();
            if (deviceList != null) {
                deviceList = filterDeviceToken(deviceList, hour);
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
            }
            if (tokenList.size() == 0)
                return;
            try {
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId,androidBaseActivity);
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl,androidBaseActivity);
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    OPPOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url,androidBaseActivity);
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    OPPOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
                } else if (type == PushTypeEnum.signin) {// 签到
                    OPPOPushUtil.pushUserSignInNotification(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
                }
            } catch (Exception e) {
                PushLogHelper.oppoError(e);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -12,6 +12,7 @@
import com.yeshi.fanli.entity.xinge.PushRecord;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.service.inter.push.*;
import com.yeshi.fanli.service.inter.user.SystemZnxService;
import com.yeshi.fanli.util.Constant;
@@ -24,22 +25,13 @@
@Service
public class PushServiceImpl implements PushService {
    static String IOSBundleId = "";
    static String PROJECT_NAME = "";
    static {
        IOSBundleId = Constant.systemCommonConfig.getIosBundleId();
        PROJECT_NAME = Constant.systemCommonConfig.getProjectChineseName();
    }
    @Resource
    private PushRecordService pushRecordService;
    @Resource
    private SystemZnxService systemZnxService;
    @Resource
    private DeviceTokenHWService deviceTokenHWService;
    @Resource
    private IOSPushService iosPushService;
@@ -65,6 +57,10 @@
    @Resource
    private AppVersionService appVersionService;
    @Resource
    private SystemConfigService systemConfigService;
    @Override
    public void pushGoods(Long uid, String title, String content, String url, List<String> listIOS,
                          List<String> listAndroid, SystemEnum system) throws PushException {
@@ -82,7 +78,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes);
                iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes,  system);
            }
        }
@@ -91,7 +87,7 @@
            // 限制推送版本号:0
            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions);
                xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions,  system);
            }
            // 华为推送
            if (listAndroid == null || listAndroid.size() > 0) {
@@ -146,7 +142,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushUrl(uid, url, title, content, codes);
                iosPushService.pushUrl(uid, url, title, content, codes,system);
            }
        }
@@ -155,7 +151,7 @@
            // 限制推送版本号:0
            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushUrl(uid, url, title, content, versions);
                xmPushService.pushUrl(uid, url, title, content, versions,system);
            }
            // 华为推送
@@ -229,7 +225,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushZNX(uId, accountMessage, systemZnx, codes);
                iosPushService.pushZNX(uId, accountMessage, systemZnx, codes,system);
            }
        }
@@ -238,7 +234,7 @@
            // 限制推送版本号:0
            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushZNX(uId, accountMessage, systemZnx, versions);
                xmPushService.pushZNX(uId, accountMessage, systemZnx, versions,system);
            }
            // 华为推送
@@ -292,7 +288,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushWEEX(uid, title, content, weexUrl, codes);
                iosPushService.pushWEEX(uid, title, content, weexUrl, codes,system);
            }
        }
@@ -301,7 +297,7 @@
            // 限制推送版本号:31
            String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushWEEX(uid, title, content, weexUrl, versions);
                xmPushService.pushWEEX(uid, title, content, weexUrl, versions,system);
            }
        }
@@ -356,7 +352,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushBaiChuanUrl(uid, title, content, url, codes);
                iosPushService.pushBaiChuanUrl(uid, title, content, url, codes,system);
            }
        }
@@ -365,7 +361,7 @@
            // 限制推送版本号:31
            String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushBaiChuanUrl(uid, title, content, url, versions);
                xmPushService.pushBaiChuanUrl(uid, title, content, url, versions,system);
            }
        }
@@ -419,7 +415,7 @@
            // 限制推送版本号:0
            String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushWelfareCenter(uid, title, content, codes);
                iosPushService.pushWelfareCenter(uid, title, content, codes,system);
            }
        }
@@ -428,7 +424,7 @@
            // 限制推送版本号:36
            String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushWelfareCenter(uid, title, content, versions);
                xmPushService.pushWelfareCenter(uid, title, content, versions,system);
            }
        }
@@ -558,7 +554,7 @@
            // 限制推送版本号:1.6.5以后
            String codes = getEffectiveVersionCodes(60, AppVersionInfo.PLATFORM_IOS, listIOS, system);
            if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
                iosPushService.pushUserSignInNotification(uid, title, content, codes);
                iosPushService.pushUserSignInNotification(uid, title, content, codes,system);
            }
        }
@@ -567,7 +563,7 @@
            // 限制推送版本号:1.6.5以后
            String versions = getEffectiveVersions(47, AppVersionInfo.PLATFORM_ANDROID, listAndroid, system);
            if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
                xmPushService.pushUserSignInNotification(uid, title, content, versions);
                xmPushService.pushUserSignInNotification(uid, title, content, versions,system);
            }
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/push/VIVOPushServiceImpl.java
@@ -6,6 +6,8 @@
import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.Constant;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -36,7 +38,10 @@
    @Resource
    private UserCustomSettingsService userCustomSettingsService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) {
    @Resource
    private SystemConfigService systemConfigService;
    private List<Integer> getVersionCodeList(List<Integer> versionCodeList,SystemEnum system) {
        List<Integer> versionList = new ArrayList<>();
        if (versionCodeList == null) {// 全推
            List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51,system);
@@ -143,6 +148,8 @@
     */
    private void push(PushTypeEnum type, Long uid, String url, String webUrl,
            Long goodsId, PushBaseContent content) throws PushException {
        String androidBaseActivity=getAndroidBaseActivity(content.getSystem());
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        List<Integer> newVersionList = getVersionCodeList(content.getVersionCodeList(),content.getSystem());
        // 2.0.1后开始推送
@@ -167,25 +174,25 @@
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushGoods(tokenList, content.getTitle(),content.getContent(), 1, goodsId);
                        VIVOPushUtil.pushGoods(tokenList, content.getTitle(),content.getContent(), 1, goodsId,androidBaseActivity);
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
                        VIVOPushUtil.pushUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl,androidBaseActivity);
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        VIVOPushUtil.pushZNX(tokenList,  content.getTitle(),content.getContent());
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushWEEX(tokenList,  content.getTitle(),content.getContent(),  url);
                        VIVOPushUtil.pushWEEX(tokenList,  content.getTitle(),content.getContent(),  url,androidBaseActivity);
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        VIVOPushUtil.pushBaiChuanUrl(tokenList,  content.getTitle(),content.getContent(),  webUrl);
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        VIVOPushUtil.pushWelfareCenter(tokenList,  content.getTitle(),content.getContent());
                        VIVOPushUtil.pushWelfareCenter(tokenList,  content.getTitle(),content.getContent(),androidBaseActivity);
                    } else if (type == PushTypeEnum.signin) {// 签到
                        VIVOPushUtil.pushUserSignInNotification(tokenList,  content.getTitle(),content.getContent());
                        VIVOPushUtil.pushUserSignInNotification(tokenList,  content.getTitle(),content.getContent(),androidBaseActivity);
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
@@ -208,25 +215,25 @@
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId);
                    VIVOPushUtil.pushGoods(tokenList, content.getTitle(), content.getContent(), 1, goodsId,androidBaseActivity);
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                    VIVOPushUtil.pushUrl(tokenList, content.getTitle(), content.getContent(), webUrl,androidBaseActivity);
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    VIVOPushUtil.pushZNX(tokenList, content.getTitle(), content.getContent());
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url);
                    VIVOPushUtil.pushWEEX(tokenList, content.getTitle(), content.getContent(), url,androidBaseActivity);
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    VIVOPushUtil.pushBaiChuanUrl(tokenList, content.getTitle(), content.getContent(), webUrl);
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    VIVOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent());
                    VIVOPushUtil.pushWelfareCenter(tokenList, content.getTitle(), content.getContent(),androidBaseActivity);
                } else if (type == PushTypeEnum.signin) {// 签到
                    VIVOPushUtil.pushUserSignInNotification(tokenList,content.getTitle(), content.getContent());
                    VIVOPushUtil.pushUserSignInNotification(tokenList,content.getTitle(), content.getContent(),androidBaseActivity);
                }
            } catch (Exception e) {
                PushLogHelper.vivoError(e);
@@ -234,4 +241,10 @@
        }
    }
    private String getAndroidBaseActivity(SystemEnum system) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/XMPushServiceImpl.java
@@ -5,6 +5,9 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -26,319 +29,330 @@
@Service
public class XMPushServiceImpl implements XMPushService {
    @Resource
    private DeviceTokenXMService deviceTokenXMService;
    @Resource
    private DeviceTokenXMService deviceTokenXMService;
    private List<String> getRegIds(Long uid) {
        List<DeviceTokenXM> list = deviceTokenXMService.listByUid(uid);
    @Resource
    private SystemConfigService systemConfigService;
        List<String> regIds = new ArrayList<>();
        if (list != null)
            for (DeviceTokenXM token : list)
                regIds.add(token.getRegisterId());
        return regIds;
    }
    private List<String> getRegIds(Long uid) {
        List<DeviceTokenXM> list = deviceTokenXMService.listByUid(uid);
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versions)
            throws PushException {
        List<String> regIds = new ArrayList<>();
        if (list != null)
            for (DeviceTokenXM token : list)
                regIds.add(token.getRegisterId());
        return regIds;
    }
        String gid = auctionId + "";
        JSONObject json = new JSONObject();
        // json.put("url", "http://item.taobao.com/item.htm?id=" + gid);// IOS使用
        json.put("id", gid);
        json.put("type", PushTypeEnum.goodsdetail.name());
        json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
    @Async("pushExecutor")
    @Override
    public void pushGoods(Long uid, Long auctionId, String title, String content, String versions, SystemEnum system)
            throws PushException {
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        String gid = auctionId + "";
        JSONObject json = new JSONObject();
        // json.put("url", "http://item.taobao.com/item.htm?id=" + gid);// IOS使用
        json.put("id", gid);
        json.put("type", PushTypeEnum.goodsdetail.name());
        json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
                getAndroidPackageName(system)));
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.recommend.GoodsBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        if (uid == null || uid == 0) {
            // 小米 全推
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            // 小米 单推
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        info.setPackageName(getAndroidBaseactivityName(system));
        info.setActivty(String.format("%s.ui.recommend.GoodsBrowserActivity",
                getAndroidPackageName(system)));
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException {
        PushRecord pushRecord = new PushRecord();
        if (uid == null || uid == 0) {
            // 小米 全推
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            // 小米 单推
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", PushTypeEnum.url.name());
        json.put("webUrl", url);
        json.put("miPushUrl", String.format("%s.ui.invite.ShareBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
    @Async("pushExecutor")
    @Override
    public void pushUrl(Long uid, String url, String title, String content, String versions, SystemEnum system) throws PushException {
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", PushTypeEnum.url.name());
        json.put("webUrl", url);
        json.put("miPushUrl", String.format("%s.ui.invite.ShareBrowserActivity",
                getAndroidPackageName(system)));
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.invite.ShareBrowserActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(getAndroidBaseactivityName(system));
        info.setActivty(String.format("%s.ui.invite.ShareBrowserActivity",
                getAndroidPackageName(system)));
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        PushRecord pushRecord = new PushRecord();
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException {
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        MessageInfo info = new MessageInfo();
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
    @Async("pushExecutor")
    @Override
    public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions, SystemEnum system) throws PushException {
        JSONObject contentJson = new JSONObject();
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
        MessageInfo info = new MessageInfo();
        info.setPackageName(getAndroidBaseactivityName(system));
        /* 无uid , 广播 数据插入系统表 */
        if (systemZNX != null) {
            info.setTitle(systemZNX.getTitle());
            info.setContent(systemZNX.getContent());
            contentJson.put("title", systemZNX.getTitle());
            contentJson.put("content", systemZNX.getContent());
            info.setDescription(systemZNX.getContent());
            // 小米开始全推
            long id = systemZNX.getId();
            contentJson.put("id", id);
        JSONObject contentJson = new JSONObject();
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
            JSONObject json = new JSONObject();
            json.put("type", PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl",
                    String.format("%s.ui.main.MainActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
        /* 无uid , 广播 数据插入系统表 */
        if (systemZNX != null) {
            info.setTitle(systemZNX.getTitle());
            info.setContent(systemZNX.getContent());
            contentJson.put("title", systemZNX.getTitle());
            contentJson.put("content", systemZNX.getContent());
            info.setDescription(systemZNX.getContent());
            // 小米开始全推
            long id = systemZNX.getId();
            contentJson.put("id", id);
            // 版本推送
            if (versions != null && versions.trim().length() > 0) {
                json.put("app_version", versions);
            }
            JSONObject json = new JSONObject();
            json.put("type", PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl",
                    String.format("%s.ui.main.MainActivity", getAndroidPackageName(system)));
            PushRecord pushRecord = new PushRecord();
            // 版本推送
            if (versions != null && versions.trim().length() > 0) {
                json.put("app_version", versions);
            }
            // 小米 全推
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e1) {
                PushLogHelper.xmError(e1);
            }
        } else if (msg != null) {
            info.setTitle(msg.getTitle());
            info.setContent(msg.getContent());
            contentJson.put("title", msg.getTitle());
            contentJson.put("content", msg.getContent());
            info.setDescription(msg.getContent());
            PushRecord pushRecord = new PushRecord();
            // 插入推送记录
            PushRecord pushRecord = new PushRecord();
            info.setAlias(uId + "");
            info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
            info.setActivty(
                    String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
            contentJson.put("id", msg.getId() + "");
            // 小米 全推
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e1) {
                PushLogHelper.xmError(e1);
            }
        } else if (msg != null) {
            info.setTitle(msg.getTitle());
            info.setContent(msg.getContent());
            contentJson.put("title", msg.getTitle());
            contentJson.put("content", msg.getContent());
            info.setDescription(msg.getContent());
            JSONObject json = new JSONObject();
            json.put("type", PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl",
                    String.format("%s.ui.main.MainActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
            // 插入推送记录
            PushRecord pushRecord = new PushRecord();
            info.setAlias(uId + "");
            info.setPackageName(getAndroidBaseactivityName(system));
            info.setActivty(
                    String.format("%s.ui.BrowserActivity", getAndroidPackageName(system)));
            contentJson.put("id", msg.getId() + "");
            // 版本推送
            if (versions != null && versions.trim().length() > 0) {
                json.put("app_version", versions);
            }
            JSONObject json = new JSONObject();
            json.put("type", PushTypeEnum.ZNX.name());
            json.put("content", contentJson);
            json.put("miPushUrl",
                    String.format("%s.ui.main.MainActivity", getAndroidPackageName(system)));
            // 小米 单推
            try {
                PushUtils.singlePushXiaoMi(info, json, getRegIds(uId), pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        }
    }
            // 版本推送
            if (versions != null && versions.trim().length() > 0) {
                json.put("app_version", versions);
            }
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, String versions) throws PushException {
            // 小米 单推
            try {
                PushUtils.singlePushXiaoMi(info, json, getRegIds(uId), pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        }
    }
        JSONObject json = new JSONObject();
        json.put("url", weexUrl);
        json.put("type", PushTypeEnum.weex.name());
    @Async("pushExecutor")
    @Override
    public void pushWEEX(Long uid, String title, String content, String weexUrl, String versions, SystemEnum system) throws PushException {
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        JSONObject json = new JSONObject();
        json.put("url", weexUrl);
        json.put("type", PushTypeEnum.weex.name());
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.mine.weex.WeexApplicationActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(getAndroidBaseactivityName(system));
        info.setActivty(String.format("%s.ui.mine.weex.WeexApplicationActivity",
                getAndroidPackageName(system)));
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        PushRecord pushRecord = new PushRecord();
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions)
            throws PushException {
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", PushTypeEnum.baichuan.name());
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
    @Async("pushExecutor")
    @Override
    public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions, SystemEnum system)
            throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        JSONObject json = new JSONObject();
        json.put("url", url);
        json.put("type", PushTypeEnum.baichuan.name());
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(getAndroidBaseactivityName(system));
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        PushRecord pushRecord = new PushRecord();
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException {
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        JSONObject json = new JSONObject();
        json.put("type", PushTypeEnum.welfare.name());
        json.put("miPushUrl", String.format("%s.ui.mine.WelfareCenterActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
    @Async("pushExecutor")
    @Override
    public void pushWelfareCenter(Long uid, String title, String content, String versions, SystemEnum system) throws PushException {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.mine.WelfareCenterActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        JSONObject json = new JSONObject();
        json.put("type", PushTypeEnum.welfare.name());
        json.put("miPushUrl", String.format("%s.ui.mine.WelfareCenterActivity",
                getAndroidPackageName(system)));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(getAndroidBaseactivityName(system));
        info.setActivty(String.format("%s.ui.mine.WelfareCenterActivity",
                getAndroidPackageName(system)));
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        PushRecord pushRecord = new PushRecord();
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions)
            throws PushException {
        JSONObject json = new JSONObject();
        json.put("type", PushTypeEnum.signin.name());
        json.put("miPushUrl", String.format("%s.ui.goldtask.GoldTaskActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        info.setActivty(String.format("%s.ui.goldtask.GoldTaskActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
    @Override
    public void pushUserSignInNotification(Long uid, String title, String content, String versions, SystemEnum system)
            throws PushException {
        JSONObject json = new JSONObject();
        json.put("type", PushTypeEnum.signin.name());
        json.put("miPushUrl", String.format("%s.ui.goldtask.GoldTaskActivity",
                getAndroidPackageName(system)));
        // 版本推送
        if (versions != null && versions.trim().length() > 0) {
            json.put("app_version", versions);
        }
        PushRecord pushRecord = new PushRecord();
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        info.setDescription(content);
        // 小米推送网页
        info.setPackageName(getAndroidBaseactivityName(system));
        info.setActivty(String.format("%s.ui.goldtask.GoldTaskActivity",
                getAndroidPackageName(system)));
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
        PushRecord pushRecord = new PushRecord();
        // 小米 全推
        if (uid == null || uid == 0) {
            try {
                PushUtils.allPushXiaoMi(info, json, pushRecord);
            } catch (Exception e) {
                PushLogHelper.xmError(e);
            }
        } else {
            info.setAlias(uid + "");
            PushUtils.singlePushXiaoMi(info, json, getRegIds(uid), pushRecord);
        }
    }
    private String getAndroidBaseactivityName(SystemEnum system) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system);
    }
    private String getAndroidPackageName(SystemEnum system) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.androidPackageNames, system);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java
@@ -10,6 +10,7 @@
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.SystemPIDInfo;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.service.manger.PIDManager;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
@@ -69,9 +70,6 @@
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Resource
    private DeviceActiveService deviceActiveService;
    @Resource
@@ -91,6 +89,7 @@
    @Resource
    private PIDManager pidManager;
    @Override
@@ -246,7 +245,7 @@
        winDetailVO.setTips(configTaoLiJinService.getValueByKey("new_user_win_tips"));
        winDetailVO.setParams(json.toString());
        winDetailVO.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
        winDetailVO.setLogo(Constant.systemCommonConfig.getDefaultPortrait());
        winDetailVO.setLogo(userInfoService.getDefaultPortrait(userInfo.getSystem()));
        winDetailVO.setLogoLight(userInfo.getPortrait());
        return winDetailVO;
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/SpreadUserImgServiceImpl.java
@@ -13,6 +13,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import org.springframework.stereotype.Service;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.ListUtil;
@@ -36,439 +37,445 @@
@Service
public class SpreadUserImgServiceImpl implements SpreadUserImgService {
    @Resource
    private SpreadUserImgMapper spreadUserImgMapper;
    @Resource
    private SpreadUserImgMapper spreadUserImgMapper;
    @Resource
    private SpreadImgMapper spreadImgMapper;
    @Resource
    private SpreadImgMapper spreadImgMapper;
    @Resource
    private QrCodeService qrCodeService;
    @Resource
    private QrCodeService qrCodeService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private SpreadImgService spreadImgService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Override
    public void addUserInviteImg(Long uid, String imgUrl) {
        SpreadUserImg spreadUserImg = new SpreadUserImg();
        spreadUserImg.setUid(uid);
        spreadUserImg.setUrl(imgUrl); // 服务器上的url地址
        spreadUserImg.setType(0);
        spreadUserImg.setCreatetime(new Date());
        spreadUserImgMapper.insertSelective(spreadUserImg);
    }
    @Resource
    private SpreadImgService spreadImgService;
    @Override
    public List<String> getImgUrlList(Long uid) {
        return spreadUserImgMapper.getImgUrlList(uid);
    }
    @Resource
    private SystemConfigService systemConfigService;
    @Override
    public int imgUrlCount(Long uid) {
        return spreadUserImgMapper.imgUrlCount(uid);
    }
    @Override
    public void addUserInviteImg(Long uid, String imgUrl) {
        SpreadUserImg spreadUserImg = new SpreadUserImg();
        spreadUserImg.setUid(uid);
        spreadUserImg.setUrl(imgUrl); // 服务器上的url地址
        spreadUserImg.setType(0);
        spreadUserImg.setCreatetime(new Date());
        spreadUserImgMapper.insertSelective(spreadUserImg);
    }
    @Override
    public void deleteImgUrl(Long uid) {
        // 先删除远程文件
        List<String> urlList = getImgUrlList(uid);
        spreadUserImgMapper.deleteImgUrl(uid);
        if (urlList != null)
            for (String img : urlList) {
                COSManager.getInstance().deleteFile(img);
            }
    }
    @Override
    public List<String> getImgUrlList(Long uid) {
        return spreadUserImgMapper.getImgUrlList(uid);
    }
    // 获取图片的MD5值
    private String getSpreadUserImgMD5(String url) {
        // https://ec-1255749512.file.myqcloud.com/ercode/ercode_578435_16a56f70b2b74aae9277f0e87a242f47.jpg
        String imgName = url.split("_")[url.split("_").length - 1];
        return imgName.replace(".jpg", "").replace(".png", "");
    }
    @Override
    public int imgUrlCount(Long uid) {
        return spreadUserImgMapper.imgUrlCount(uid);
    }
    // 获取图片的MD5值
    private String getSpreadImgMD5(String url) {
        // https://ec-1255749512.file.myqcloud.com/16a56f70b2b74aae9277f0e87a242f47.png
        String imgName = url.split("/")[url.split("/").length - 1];
        return imgName.substring(0, imgName.indexOf("."));
    }
    @Override
    public void deleteImgUrl(Long uid) {
        // 先删除远程文件
        List<String> urlList = getImgUrlList(uid);
        spreadUserImgMapper.deleteImgUrl(uid);
        if (urlList != null)
            for (String img : urlList) {
                COSManager.getInstance().deleteFile(img);
            }
    }
    @Override
    public List<String> getUserSpreadImg(Long uid, HttpServletRequest request) {
        List<String> imgList = new ArrayList<>();
    // 获取图片的MD5值
    private String getSpreadUserImgMD5(String url) {
        // https://ec-1255749512.file.myqcloud.com/ercode/ercode_578435_16a56f70b2b74aae9277f0e87a242f47.jpg
        String imgName = url.split("_")[url.split("_").length - 1];
        return imgName.replace(".jpg", "").replace(".png", "");
    }
        // 查询当前用户的推广图
        List<SpreadUserImg> spreadUserImgList = spreadUserImgMapper.listByUid(uid);
        // 查询系统的推广图
        List<SpreadImg> spreadImgList = spreadImgMapper.listAll();
    // 获取图片的MD5值
    private String getSpreadImgMD5(String url) {
        // https://ec-1255749512.file.myqcloud.com/16a56f70b2b74aae9277f0e87a242f47.png
        String imgName = url.split("/")[url.split("/").length - 1];
        return imgName.substring(0, imgName.indexOf("."));
    }
        for (SpreadUserImg img : spreadUserImgList) {
            img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        }
    @Override
    public List<String> getUserSpreadImg(Long uid, HttpServletRequest request) {
        List<String> imgList = new ArrayList<>();
        for (SpreadImg img : spreadImgList) {
            img.setMd5(getSpreadImgMD5(img.getUrl()));
        }
        // 查询当前用户的推广图
        List<SpreadUserImg> spreadUserImgList = spreadUserImgMapper.listByUid(uid);
        // 查询系统的推广图
        List<SpreadImg> spreadImgList = spreadImgMapper.listAll();
        Comparator<SpreadImg> cmSpreadImg = new Comparator<SpreadImg>() {
        for (SpreadUserImg img : spreadUserImgList) {
            img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        }
            @Override
            public int compare(SpreadImg o1, SpreadImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        for (SpreadImg img : spreadImgList) {
            img.setMd5(getSpreadImgMD5(img.getUrl()));
        }
        Comparator<SpreadUserImg> cmUserSpreadImg = new Comparator<SpreadUserImg>() {
        Comparator<SpreadImg> cmSpreadImg = new Comparator<SpreadImg>() {
            @Override
            public int compare(SpreadUserImg o1, SpreadUserImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        Collections.sort(spreadUserImgList, cmUserSpreadImg);
        Collections.sort(spreadImgList, cmSpreadImg);
            @Override
            public int compare(SpreadImg o1, SpreadImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        boolean equal = true;
        if (spreadUserImgList.size() == spreadImgList.size())
            for (int i = 0; i < spreadUserImgList.size(); i++) {
                if (!spreadUserImgList.get(i).getMd5().equalsIgnoreCase(spreadImgList.get(i).getMd5())) {
                    equal = false;
                    break;
                }
            }
        else
            equal = false;
        Comparator<SpreadUserImg> cmUserSpreadImg = new Comparator<SpreadUserImg>() {
        // 没有更改
        if (equal) {
            for (SpreadUserImg userImg : spreadUserImgList)
                imgList.add(userImg.getUrl());
            return imgList;
        }
            @Override
            public int compare(SpreadUserImg o1, SpreadUserImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        Collections.sort(spreadUserImgList, cmUserSpreadImg);
        Collections.sort(spreadImgList, cmSpreadImg);
        // 有过更改
        boolean equal = true;
        if (spreadUserImgList.size() == spreadImgList.size())
            for (int i = 0; i < spreadUserImgList.size(); i++) {
                if (!spreadUserImgList.get(i).getMd5().equalsIgnoreCase(spreadImgList.get(i).getMd5())) {
                    equal = false;
                    break;
                }
            }
        else
            equal = false;
        List<String> spreadUserMD5List = new ArrayList<>();
        for (SpreadUserImg userImg : spreadUserImgList)
            spreadUserMD5List.add(userImg.getMd5());
        List<String> spreadMD5List = new ArrayList<>();
        for (SpreadImg img : spreadImgList)
            spreadMD5List.add(img.getMd5());
        // 删除多余的
        // 没有更改
        if (equal) {
            for (SpreadUserImg userImg : spreadUserImgList)
                imgList.add(userImg.getUrl());
            return imgList;
        }
        // 获取交集
        List<String> ilist = ListUtil.getIntersection(spreadUserMD5List, spreadMD5List);
        // 有过更改
        // 获取多余的集合
        List<String> extraList = ListUtil.getDifference(spreadUserMD5List, ilist);
        List<String> spreadUserMD5List = new ArrayList<>();
        for (SpreadUserImg userImg : spreadUserImgList)
            spreadUserMD5List.add(userImg.getMd5());
        List<String> spreadMD5List = new ArrayList<>();
        for (SpreadImg img : spreadImgList)
            spreadMD5List.add(img.getMd5());
        // 删除多余的
        for (String md5 : extraList) {
            for (SpreadUserImg img : spreadUserImgList)
                if (img.getMd5().equalsIgnoreCase(md5)) {
                    spreadUserImgMapper.deleteByPrimaryKey(img.getId());
                    break;
                }
        }
        // 获取交集
        List<String> ilist = ListUtil.getIntersection(spreadUserMD5List, spreadMD5List);
        List<String> dlist = ListUtil.getDifference(spreadMD5List, ilist);
        // 获取多余的集合
        List<String> extraList = ListUtil.getDifference(spreadUserMD5List, ilist);
        UserInfo user = null;
        if (dlist != null && dlist.size() > 0)
            user = userInfoService.selectByPKey(uid);
        for (String md5 : extraList) {
            for (SpreadUserImg img : spreadUserImgList)
                if (img.getMd5().equalsIgnoreCase(md5)) {
                    spreadUserImgMapper.deleteByPrimaryKey(img.getId());
                    break;
                }
        }
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
        // 缓存路径
        String rootPath = request.getSession().getServletContext().getRealPath("/").replace("\\", "/");
        String projectName = request.getContextPath();
        String path = rootPath.replace(projectName, "/temp");
        File f = new File(path);
        if (!f.exists())
            f.mkdirs();
        // 添加原来没有的
        for (String md5 : dlist) {
            for (SpreadImg img : spreadImgList)
                if (img.getMd5().equalsIgnoreCase(md5)) {
                    // 画图
                    try {
                        String portrait = user.getPortrait();
                        if (StringUtil.isNullOrEmpty(portrait)) {
                            portrait = Constant.systemCommonConfig.getDefaultPortrait();
                        }
                        // 背景图片缓存
                        int index = img.getUrl().lastIndexOf("/");
                        String fileName = img.getUrl().substring(index + 1);
        List<String> dlist = ListUtil.getDifference(spreadMD5List, ilist);
                        InputStream inputStream = null;
                        String cachePath = path  +  fileName;
                        File file = new File(cachePath);
                        if (file.exists()) {
                            inputStream = new FileInputStream(file);
                        } else {
                            // 网络下载
                            InputStream input = HttpUtil.getAsInputStream(img.getUrl());
                            // 缓存本地
                            FileUtil.saveAsFile(input, cachePath);
                            // 获取流
                            inputStream = new FileInputStream(file);
                        }
                        String imgUrl = qrCodeService.drawInviteQrCodeNew(inputStream, fileName, uid, portrait, null, null, null, inviteCode);
                        if (!StringUtil.isNullOrEmpty(imgUrl)) {
                            if (imgUrl != null) {
                                addUserInviteImg(uid, imgUrl);
                            }
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    } // 背景图
                    break;
                }
        }
        UserInfo user = null;
        if (dlist != null && dlist.size() > 0)
            user = userInfoService.selectByPKey(uid);
        // 重新查询
        spreadUserImgList = spreadUserImgMapper.listByUid(uid);
        imgList.clear();
        if (spreadUserImgList != null)
            for (SpreadUserImg img : spreadUserImgList)
                imgList.add(img.getUrl());
        return imgList;
    }
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
    @Override
    public List<String> getUserSpreadImgToPage(Long uid, int page, int count, HttpServletRequest request) {
        // 查询系统的推广图
        List<SpreadImg> spreadImgList = spreadImgService.listAll();
        //用户的已生成推广图
        List<SpreadUserImg> spreadUserImgList = spreadUserImgMapper.listByUid(uid);
        // 缓存路径
        String rootPath = request.getSession().getServletContext().getRealPath("/").replace("\\", "/");
        String projectName = request.getContextPath();
        String path = rootPath.replace(projectName, "/temp");
        File f = new File(path);
        if (!f.exists())
            f.mkdirs();
        for (SpreadUserImg img : spreadUserImgList) {
            img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        }
        String defaultPortrait = userInfoService.getDefaultPortrait(uid);
        for (SpreadImg img : spreadImgList) {
            img.setMd5(getSpreadImgMD5(img.getUrl()));
        }
        Comparator<SpreadImg> cmSpreadImg = new Comparator<SpreadImg>() {
            @Override
            public int compare(SpreadImg o1, SpreadImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        // 添加原来没有的
        for (String md5 : dlist) {
            for (SpreadImg img : spreadImgList)
                if (img.getMd5().equalsIgnoreCase(md5)) {
                    // 画图
                    try {
                        String portrait = user.getPortrait();
                        if (StringUtil.isNullOrEmpty(portrait)) {
                            portrait = defaultPortrait;
                        }
        Comparator<SpreadUserImg> cmUserSpreadImg = new Comparator<SpreadUserImg>() {
            @Override
            public int compare(SpreadUserImg o1, SpreadUserImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        Collections.sort(spreadUserImgList, cmUserSpreadImg);
        Collections.sort(spreadImgList, cmSpreadImg);
                        // 背景图片缓存
                        int index = img.getUrl().lastIndexOf("/");
                        String fileName = img.getUrl().substring(index + 1);
        boolean equal = true;
        if (spreadUserImgList.size() != spreadImgList.size()) {
            equal = false;
        } else {
            for (int i = 0; i < spreadUserImgList.size(); i++) {
                if (!spreadUserImgList.get(i).getMd5().equalsIgnoreCase(spreadImgList.get(i).getMd5())) {
                    equal = false;
                    break;
                }
            }
        }
                        InputStream inputStream = null;
                        String cachePath = path + fileName;
                        File file = new File(cachePath);
                        if (file.exists()) {
                            inputStream = new FileInputStream(file);
                        } else {
                            // 网络下载
                            InputStream input = HttpUtil.getAsInputStream(img.getUrl());
                            // 缓存本地
                            FileUtil.saveAsFile(input, cachePath);
                            // 获取流
                            inputStream = new FileInputStream(file);
                        }
        // 分页处理
        int start = 0;
        if (page > 1)
            start = 3;
        List<String> imgList = new ArrayList<>();
        if (equal) {
            for (; start < spreadUserImgList.size() && start < count; start++) {
                imgList.add(spreadUserImgList.get(start).getUrl());
            }
            return imgList;
        }
        String path = null;
        if (page == 1) {
            // 删除多余历史数据
            for (int j = 0; j < spreadUserImgList.size(); j++) {
                boolean needRemove = true;
                SpreadUserImg userImg = spreadUserImgList.get(j);
                String imgMD5User = getSpreadUserImgMD5(userImg.getUrl());
                for (int i = 0; i < spreadImgList.size(); i++) {
                    String imgMD5 = getSpreadImgMD5(spreadImgList.get(i).getUrl());
                    if (imgMD5.equalsIgnoreCase(imgMD5User)) {
                        needRemove = false;
                        break;
                    }
                }
                if (needRemove) {
                    spreadUserImgMapper.deleteByPrimaryKey(userImg.getId());
                    spreadUserImgList.remove(j);
                    j--;
                }
            }
            // 缓存路径
            String rootPath = request.getSession().getServletContext().getRealPath("/").replace("\\", "/");
            String projectName = request.getContextPath();
            path = rootPath.replace(projectName, "/temp");
            File f = new File(path);
            if (!f.exists())
                f.mkdirs();
        }
        // 用户头像
        UserInfo user = userInfoService.selectByPKey(uid);
        String portrait = user.getPortrait();
        if (StringUtil.isNullOrEmpty(portrait)) {
            portrait = Constant.systemCommonConfig.getDefaultPortrait();
        }
        // 邀请码
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
        for (; start < spreadImgList.size() && start < count; start++) {
            String url =  null;
            SpreadImg spreadImg = spreadImgList.get(start);
            String imgMD5 = getSpreadImgMD5(spreadImg.getUrl());
            for (int j = 0; j < spreadUserImgList.size(); j++) {
                String imgMD5User = getSpreadUserImgMD5(spreadUserImgList.get(j).getUrl());
                if (imgMD5.equalsIgnoreCase(imgMD5User)) {
                    url = spreadUserImgList.get(j).getUrl();
                    break;
                }
            }
            if (!StringUtil.isNullOrEmpty(url)) {
                imgList.add(url);
            } else {
                url = getInviteImgUrl(uid, portrait, inviteCode, imgMD5, spreadImg.getUrl(), path);
                if (!StringUtil.isNullOrEmpty(url)) {
                    addUserInviteImg(uid, url);
                    imgList.add(url);
                }
            }
        }
        return imgList;
    }
    /**
     * 邀请图画图
     * @param uid
     * @param portrait
     * @param inviteCode
     * @param urlMd5
     * @param url
     * @param path
     * @return
     */
    private String getInviteImgUrl (Long uid, String portrait, String inviteCode, String urlMd5, String url, String path) {
        try {
            InputStream inputStream = null;
            String cachePath = path  +  urlMd5;
            File file = new File(cachePath);
            if (file.exists()) {
                inputStream = new FileInputStream(file);
            } else {
                // 网络下载
                InputStream input = HttpUtil.getAsInputStream(url);
                // 缓存本地
                FileUtil.saveAsFile(input, cachePath);
                // 获取流
                inputStream = new FileInputStream(file);
            }
            return qrCodeService.drawInviteQrCodeNew(inputStream, urlMd5, uid, portrait, null, null, null, inviteCode);
        } catch (Exception e) {
             LogHelper.errorDetailInfo(e);
        }
        return null;
    }
                        String imgUrl = qrCodeService.drawInviteQrCodeNew(inputStream, fileName, uid, portrait, null, null, null, inviteCode);
                        if (!StringUtil.isNullOrEmpty(imgUrl)) {
                            if (imgUrl != null) {
                                addUserInviteImg(uid, imgUrl);
                            }
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    } // 背景图
                    break;
                }
        }
    @Override
    public String getUserSpreadImg(Long uid, String bgImg) {
        // 查询是否存在
        // String md5 = getSpreadImgMD5(bgImg);
        // List<SpreadUserImg> spreadUserImgList = spreadUserImgDao.list("from
        // SpreadUserImg su where su.uid=" + uid);
        // for (SpreadUserImg img : spreadUserImgList) {
        // img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        // if (md5.equalsIgnoreCase(getSpreadUserImgMD5(img.getUrl())))
        // return img.getUrl();// 原来存在
        // }
        // 重新查询
        spreadUserImgList = spreadUserImgMapper.listByUid(uid);
        imgList.clear();
        if (spreadUserImgList != null)
            for (SpreadUserImg img : spreadUserImgList)
                imgList.add(img.getUrl());
        return imgList;
    }
        // 生成
        UserInfo user = userInfoService.selectByPKey(uid);
        try {
            String imgUrl = qrCodeService.drawInviteQrCode(bgImg, uid, user.getPortrait(), null);
            return imgUrl;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public String getUserSpreadImg(Long uid, String bgImg, int erCodePostionX, int erCodePostionY, int erCodeSize) {
        UserInfo user = userInfoService.selectByPKey(uid);
        try {
            String imgUrl = qrCodeService.drawInviteQrCode(bgImg, uid, user.getPortrait(), erCodePostionX,
                    erCodePostionY, erCodeSize, null);
            return imgUrl;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public List<String> getUserSpreadImgToPage(Long uid, int page, int count, HttpServletRequest request) {
        // 查询系统的推广图
        List<SpreadImg> spreadImgList = spreadImgService.listAll();
        //用户的已生成推广图
        List<SpreadUserImg> spreadUserImgList = spreadUserImgMapper.listByUid(uid);
    @Override
    public int countUserSpreadImg(Long uid) {
        return (int) (spreadUserImgMapper.imgUrlCount(uid));
    }
        for (SpreadUserImg img : spreadUserImgList) {
            img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        }
    @Override
    public String drawInviteQrCodeNew(String bgImg, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws Exception {
        InputStream asInputStream = HttpUtil.getAsInputStream(bgImg);
        int index = bgImg.lastIndexOf("/");
        String newUrl = bgImg.substring(index + 1);
        String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
        return qrCodeService.drawInviteQrCodeNew(asInputStream, urlMd5, uid, portrait, pX, pY, size, inviteCode);
    }
    @Override
    public String getInviteImgToGreet(String bgImg, Long uid,  String portrait, String inviteCode, String content, Date date) throws Exception {
        return qrCodeService.drawInviteToGreet(bgImg, uid,portrait, inviteCode, content, date);
    }
    private static String getProjectRootPath(){
        String rootPath=Thread.currentThread().getContextClassLoader().getResource("").getPath();
        rootPath = rootPath.substring(1,rootPath.indexOf("WEB-INF"));
        return rootPath;
    }
        for (SpreadImg img : spreadImgList) {
            img.setMd5(getSpreadImgMD5(img.getUrl()));
        }
        Comparator<SpreadImg> cmSpreadImg = new Comparator<SpreadImg>() {
            @Override
            public int compare(SpreadImg o1, SpreadImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        Comparator<SpreadUserImg> cmUserSpreadImg = new Comparator<SpreadUserImg>() {
            @Override
            public int compare(SpreadUserImg o1, SpreadUserImg o2) {
                return o1.getMd5().compareTo(o2.getMd5());
            }
        };
        Collections.sort(spreadUserImgList, cmUserSpreadImg);
        Collections.sort(spreadImgList, cmSpreadImg);
        boolean equal = true;
        if (spreadUserImgList.size() != spreadImgList.size()) {
            equal = false;
        } else {
            for (int i = 0; i < spreadUserImgList.size(); i++) {
                if (!spreadUserImgList.get(i).getMd5().equalsIgnoreCase(spreadImgList.get(i).getMd5())) {
                    equal = false;
                    break;
                }
            }
        }
        // 分页处理
        int start = 0;
        if (page > 1)
            start = 3;
        List<String> imgList = new ArrayList<>();
        if (equal) {
            for (; start < spreadUserImgList.size() && start < count; start++) {
                imgList.add(spreadUserImgList.get(start).getUrl());
            }
            return imgList;
        }
        String path = null;
        if (page == 1) {
            // 删除多余历史数据
            for (int j = 0; j < spreadUserImgList.size(); j++) {
                boolean needRemove = true;
                SpreadUserImg userImg = spreadUserImgList.get(j);
                String imgMD5User = getSpreadUserImgMD5(userImg.getUrl());
                for (int i = 0; i < spreadImgList.size(); i++) {
                    String imgMD5 = getSpreadImgMD5(spreadImgList.get(i).getUrl());
                    if (imgMD5.equalsIgnoreCase(imgMD5User)) {
                        needRemove = false;
                        break;
                    }
                }
                if (needRemove) {
                    spreadUserImgMapper.deleteByPrimaryKey(userImg.getId());
                    spreadUserImgList.remove(j);
                    j--;
                }
            }
            // 缓存路径
            String rootPath = request.getSession().getServletContext().getRealPath("/").replace("\\", "/");
            String projectName = request.getContextPath();
            path = rootPath.replace(projectName, "/temp");
            File f = new File(path);
            if (!f.exists())
                f.mkdirs();
        }
        // 用户头像
        UserInfo user = userInfoService.selectByPKey(uid);
        String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
        String portrait = user.getPortrait();
        if (StringUtil.isNullOrEmpty(portrait)) {
            portrait = defaultPortrait;
        }
        // 邀请码
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
        for (; start < spreadImgList.size() && start < count; start++) {
            String url = null;
            SpreadImg spreadImg = spreadImgList.get(start);
            String imgMD5 = getSpreadImgMD5(spreadImg.getUrl());
            for (int j = 0; j < spreadUserImgList.size(); j++) {
                String imgMD5User = getSpreadUserImgMD5(spreadUserImgList.get(j).getUrl());
                if (imgMD5.equalsIgnoreCase(imgMD5User)) {
                    url = spreadUserImgList.get(j).getUrl();
                    break;
                }
            }
            if (!StringUtil.isNullOrEmpty(url)) {
                imgList.add(url);
            } else {
                url = getInviteImgUrl(uid, portrait, inviteCode, imgMD5, spreadImg.getUrl(), path);
                if (!StringUtil.isNullOrEmpty(url)) {
                    addUserInviteImg(uid, url);
                    imgList.add(url);
                }
            }
        }
        return imgList;
    }
    /**
     * 邀请图画图
     *
     * @param uid
     * @param portrait
     * @param inviteCode
     * @param urlMd5
     * @param url
     * @param path
     * @return
     */
    private String getInviteImgUrl(Long uid, String portrait, String inviteCode, String urlMd5, String url, String path) {
        try {
            InputStream inputStream = null;
            String cachePath = path + urlMd5;
            File file = new File(cachePath);
            if (file.exists()) {
                inputStream = new FileInputStream(file);
            } else {
                // 网络下载
                InputStream input = HttpUtil.getAsInputStream(url);
                // 缓存本地
                FileUtil.saveAsFile(input, cachePath);
                // 获取流
                inputStream = new FileInputStream(file);
            }
            return qrCodeService.drawInviteQrCodeNew(inputStream, urlMd5, uid, portrait, null, null, null, inviteCode);
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        return null;
    }
    @Override
    public String getUserSpreadImg(Long uid, String bgImg) {
        // 查询是否存在
        // String md5 = getSpreadImgMD5(bgImg);
        // List<SpreadUserImg> spreadUserImgList = spreadUserImgDao.list("from
        // SpreadUserImg su where su.uid=" + uid);
        // for (SpreadUserImg img : spreadUserImgList) {
        // img.setMd5(getSpreadUserImgMD5(img.getUrl()));
        // if (md5.equalsIgnoreCase(getSpreadUserImgMD5(img.getUrl())))
        // return img.getUrl();// 原来存在
        // }
        // 生成
        UserInfo user = userInfoService.selectByPKey(uid);
        try {
            String imgUrl = qrCodeService.drawInviteQrCode(bgImg, uid, user.getPortrait(), null);
            return imgUrl;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public String getUserSpreadImg(Long uid, String bgImg, int erCodePostionX, int erCodePostionY, int erCodeSize) {
        UserInfo user = userInfoService.selectByPKey(uid);
        try {
            String imgUrl = qrCodeService.drawInviteQrCode(bgImg, uid, user.getPortrait(), erCodePostionX,
                    erCodePostionY, erCodeSize, null);
            return imgUrl;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    @Override
    public int countUserSpreadImg(Long uid) {
        return (int) (spreadUserImgMapper.imgUrlCount(uid));
    }
    @Override
    public String drawInviteQrCodeNew(String bgImg, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws Exception {
        InputStream asInputStream = HttpUtil.getAsInputStream(bgImg);
        int index = bgImg.lastIndexOf("/");
        String newUrl = bgImg.substring(index + 1);
        String urlMd5 = newUrl.substring(0, newUrl.lastIndexOf("."));
        return qrCodeService.drawInviteQrCodeNew(asInputStream, urlMd5, uid, portrait, pX, pY, size, inviteCode);
    }
    @Override
    public String getInviteImgToGreet(String bgImg, Long uid, String portrait, String inviteCode, String content, Date date) throws Exception {
        return qrCodeService.drawInviteToGreet(bgImg, uid, portrait, inviteCode, content, date);
    }
    private static String getProjectRootPath() {
        String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
        rootPath = rootPath.substring(1, rootPath.indexOf("WEB-INF"));
        return rootPath;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -6,6 +6,9 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
@@ -48,501 +51,500 @@
@Service
public class TokenRecordServiceImpl implements TokenRecordService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private TokenRecordMapper tokenRecordMapper;
    @Resource
    private TokenRecordMapper tokenRecordMapper;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    @Lazy
    private UserSystemCouponService userSystemCouponService;
    @Resource
    @Lazy
    private UserSystemCouponService userSystemCouponService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserSystemCouponRecordService userSystemCouponRecordService;
    @Resource
    private UserSystemCouponRecordService userSystemCouponRecordService;
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Lazy
    @Resource
    private IntegralGetService integralGetService;
    @Lazy
    @Resource
    private IntegralGetService integralGetService;
    @Resource
    private SystemCouponService systemCouponService;
    @Resource
    private SystemCouponService systemCouponService;
    @Resource
    private UserInviteMsgNotificationService userInviteMsgNotificationService;
    @Resource
    private RedPackGiveRecordService redPackGiveRecordService;
    @Resource
    private RedPackGiveRecordService redPackGiveRecordService;
    @Resource
    private SystemConfigService systemConfigService;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Override
    public void insertSelective(TokenRecord record) {
        record.setCreateTime(new Date());
        record.setUpdateTime(new Date());
        tokenRecordMapper.insertSelective(record);
    }
    @Override
    public void insertSelective(TokenRecord record) {
        record.setCreateTime(new Date());
        record.setUpdateTime(new Date());
        tokenRecordMapper.insertSelective(record);
    }
    @Override
    public void updateByPrimaryKeySelective(TokenRecord record) {
        tokenRecordMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public void updateByPrimaryKeySelective(TokenRecord record) {
        tokenRecordMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public TokenRecord getNearByTypeAndIdentify(String type, String identify) {
        return tokenRecordMapper.getNearByTypeAndIdentify(type, identify);
    }
    @Override
    public TokenRecord getNearByTypeAndIdentify(String type, String identify) {
        return tokenRecordMapper.getNearByTypeAndIdentify(type, identify);
    }
    @Override
    public TokenRecord getByTypeAndIdentify(String type, String identify) {
        return tokenRecordMapper.getByTypeAndIdentify(type, identify);
    }
    @Override
    public TokenRecord getByTypeAndIdentify(String type, String identify) {
        return tokenRecordMapper.getByTypeAndIdentify(type, identify);
    }
    @Override
    public TokenVO discernToken(String token, Long uid, String platform, String version) throws TokenRecordException {
        // 解析口令
        String parseToken = TokenUtil.parseToken(token);
        if (StringUtil.isNullOrEmpty(parseToken))
            throw new TokenRecordException(1, "未发现口令");
    @Override
    public TokenVO discernToken(String token, Long uid, String platform, String version) throws TokenRecordException {
        // 解析口令
        String parseToken = TokenUtil.parseToken(token);
        if (StringUtil.isNullOrEmpty(parseToken))
            throw new TokenRecordException(1, "未发现口令");
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(parseToken);
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令不存在");
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(parseToken);
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令不存在");
        Long uidToken = rokenRecord.getUid();
        if (uid != null && uidToken != null && uid.longValue() == uidToken.longValue())
            throw new TokenRecordException(1, "不能自己赠送给自己");
        Long uidToken = rokenRecord.getUid();
        if (uid != null && uidToken != null && uid.longValue() == uidToken.longValue())
            throw new TokenRecordException(1, "不能自己赠送给自己");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        Integer stateTtoken = rokenRecord.getState();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime() || (stateTtoken != null && stateTtoken == 1)
                || StringUtil.isNullOrEmpty(rokenRecord.getIdentify()))
            throw new TokenRecordException(1, "口令已失效");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        Integer stateTtoken = rokenRecord.getState();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime() || (stateTtoken != null && stateTtoken == 1)
                || StringUtil.isNullOrEmpty(rokenRecord.getIdentify()))
            throw new TokenRecordException(1, "口令已失效");
        Integer num = 0;
        Integer type = 0;
        String money = null;
        boolean state = false;
        List<String> tips = new ArrayList<String>();
        String identify = rokenRecord.getIdentify();
        Integer num = 0;
        Integer type = 0;
        String money = null;
        boolean state = false;
        List<String> tips = new ArrayList<String>();
        String identify = rokenRecord.getIdentify();
        TokenTypeEnum tokenType = rokenRecord.getType();
        if (tokenType == TokenTypeEnum.freeCoupon) {
            type = 10;
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
        TokenTypeEnum tokenType = rokenRecord.getType();
        if (tokenType == TokenTypeEnum.freeCoupon) {
            type = 10;
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            Date endTime = giveRecord.getEndTime();
            // 用户券信息
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
                throw new TokenRecordException(1, "券不存在或非赠送状态");
            Date endTime = giveRecord.getEndTime();
            // 用户券信息
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
                throw new TokenRecordException(1, "券不存在或非赠送状态");
            if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这张免单券已失效了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
                tips.add("哎呀,这张免单券已被领取了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[免单券]需要登录后领取");
            if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这张免单券已失效了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
                tips.add("哎呀,这张免单券已被领取了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[免单券]需要登录后领取");
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("获赠的免单券,需要激活后才能使用,详情参见免单券激活规则;");
                    tips.add("成功领取后,请到“我的-福利中心”查看。");
                } else {
                    tips.add("获赠的免单券,需要激活后才能使用,详情参见免单券激活规则;");
                    tips.add("成功领取后,请到“我的-福利中心”查看。");
                }
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
        } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
            type = 11;
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("获赠的免单券,需要激活后才能使用,详情参见免单券激活规则;");
                    tips.add("成功领取后,请到“我的-福利中心”查看。");
                } else {
                    tips.add("获赠的免单券,需要激活后才能使用,详情参见免单券激活规则;");
                    tips.add("成功领取后,请到“我的-福利中心”查看。");
                }
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
        } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
            type = 11;
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            Date endTime = giveRecord.getEndTime();
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
                throw new TokenRecordException(1, "券不存在或非赠送状态");
            Date endTime = giveRecord.getEndTime();
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive())
                throw new TokenRecordException(1, "券不存在或非赠送状态");
            if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这张返利奖励券已失效了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
                tips.add("哎呀,这张返利奖励券已被领取了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[返利奖励券]需要登录后领取");
            if (userCoupon.getState() == UserSystemCoupon.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这张返利奖励券已失效了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_END_USE) {
                tips.add("哎呀,这张返利奖励券已被领取了!");
            } else if (userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[返利奖励券]需要登录后领取");
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                } else {
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                }
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
        } else if (tokenType == TokenTypeEnum.redPack) {
            if (!VersionUtil.greaterThan_2_0_5(platform, version))
                throw new TokenRecordException(1, "请升级到最新版");
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                } else {
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                }
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
        } else if (tokenType == TokenTypeEnum.redPack) {
            if (!VersionUtil.greaterThan_2_0_5(platform, version))
                throw new TokenRecordException(1, "请升级到最新版");
            type = 13;
            RedPackGiveRecord giveRecord = redPackGiveRecordService.selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "口令已失效");
            type = 13;
            RedPackGiveRecord giveRecord = redPackGiveRecordService.selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "口令已失效");
            Date endTime = giveRecord.getEndTime();
            // 赠送面额
            money = giveRecord.getAmount().setScale(2).toString();
            Date endTime = giveRecord.getEndTime();
            // 赠送面额
            money = giveRecord.getAmount().setScale(2).toString();
            if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这个红包已失效了!");
            } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_RECEIVE) {
                tips.add("哎呀,这个红包已被领取了!");
            } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_INIT) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[红包]需要登录后领取");
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("红包可提现,可购买折扣商品;");
                    tips.add("成功领取后,请到“我的-红包”中查看。");
                } else {
                    tips.add("红包可提现,可购买折扣商品;");
                    tips.add("成功领取后,请到“我的-红包”中查看。");
                }
            }
        } else if (tokenType == TokenTypeEnum.taoLiJin) {
            throw new TokenRecordException(1, "推广红包相关功能已下线!");
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
            if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_OVERDUE
                    || (endTime != null && endTime.getTime() < now.getTime())) {
                tips.add("哎呀,这个红包已失效了!");
            } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_RECEIVE) {
                tips.add("哎呀,这个红包已被领取了!");
            } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_INIT) {
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[红包]需要登录后领取");
                state = true;
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送人的直接粉丝;");
                    tips.add("红包可提现,可购买折扣商品;");
                    tips.add("成功领取后,请到“我的-红包”中查看。");
                } else {
                    tips.add("红包可提现,可购买折扣商品;");
                    tips.add("成功领取后,请到“我的-红包”中查看。");
                }
            }
        } else if (tokenType == TokenTypeEnum.taoLiJin) {
            throw new TokenRecordException(1, "推广红包相关功能已下线!");
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
        String nickName = null;
        String portrait = null;
        Long inviteId = rokenRecord.getUid();
        if (inviteId != null) {
            UserInfo inviteUser = userInfoService.selectByPKey(inviteId);
            if (inviteUser != null) {
                nickName = inviteUser.getNickName();
                portrait = inviteUser.getPortrait();
            }
        }
        String nickName = null;
        String portrait = null;
        Long inviteId = rokenRecord.getUid();
        if (inviteId != null) {
            UserInfo inviteUser = userInfoService.selectByPKey(inviteId);
            if (inviteUser != null) {
                nickName = inviteUser.getNickName();
                portrait = inviteUser.getPortrait();
            }
        }
        SystemEnum system = userInfoService.getUserSystem(rokenRecord.getUid());
        if (StringUtil.isNullOrEmpty(nickName))
            nickName = Constant.systemCommonConfig.getDefaultNickName() + inviteId;
        if (StringUtil.isNullOrEmpty(nickName))
            nickName = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultNickNamePrefix, system) + inviteId;
        if (StringUtil.isNullOrEmpty(portrait))
            portrait = Constant.systemCommonConfig.getDefaultPortrait();
        if (StringUtil.isNullOrEmpty(portrait))
            portrait = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultPortrait, system);
        if (nickName.length() > 6) {
            nickName = nickName.substring(0, 6) + "...";
        }
        if (nickName.length() > 6) {
            nickName = nickName.substring(0, 6) + "...";
        }
        TokenVO tokenVO = new TokenVO();
        tokenVO.setAmount(num);
        tokenVO.setMoney(money);
        tokenVO.setToken(parseToken);
        tokenVO.setNickName(nickName + "赠送");
        tokenVO.setPortrait(portrait);
        tokenVO.setTips(tips);
        tokenVO.setState(state);
        tokenVO.setType(type);
        return tokenVO;
    }
        TokenVO tokenVO = new TokenVO();
        tokenVO.setAmount(num);
        tokenVO.setMoney(money);
        tokenVO.setToken(parseToken);
        tokenVO.setNickName(nickName + "赠送");
        tokenVO.setPortrait(portrait);
        tokenVO.setTips(tips);
        tokenVO.setState(state);
        tokenVO.setType(type);
        return tokenVO;
    }
    @Override
    public String receiveToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
        if (uid == null || uid <= 0)
            throw new TokenRecordException(1, "用户未登录");
    @Override
    public String receiveToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
        if (uid == null || uid <= 0)
            throw new TokenRecordException(1, "用户未登录");
        if (StringUtil.isNullOrEmpty(token))
            throw new TokenRecordException(1, "口令不能为空");
        if (StringUtil.isNullOrEmpty(token))
            throw new TokenRecordException(1, "口令不能为空");
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令已失效");
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令已失效");
        Long uidToken = rokenRecord.getUid();
        if (uidToken != null && uid.longValue() == uidToken.longValue())
            throw new TokenRecordException(1, "不能自己赠送给自己");
        Long uidToken = rokenRecord.getUid();
        if (uidToken != null && uid.longValue() == uidToken.longValue())
            throw new TokenRecordException(1, "不能自己赠送给自己");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime())
            throw new TokenRecordException(1, "口令已失效");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime())
            throw new TokenRecordException(1, "口令已失效");
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken != null && stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken != null && stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        String identify = rokenRecord.getIdentify();
        if (StringUtil.isNullOrEmpty(identify))
            throw new TokenRecordException(1, "口令标识不存在");
        String identify = rokenRecord.getIdentify();
        if (StringUtil.isNullOrEmpty(identify))
            throw new TokenRecordException(1, "口令标识不存在");
        Long giveUid = rokenRecord.getUid();
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null)
            throw new TokenRecordException(1, "用户信息缺失");
        Long giveUid = rokenRecord.getUid();
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null)
            throw new TokenRecordException(1, "用户信息缺失");
        String msg = "领取成功";
        TokenTypeEnum tokenType = rokenRecord.getType();
        if (tokenType == TokenTypeEnum.freeCoupon) {
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
        String msg = "领取成功";
        TokenTypeEnum tokenType = rokenRecord.getType();
        if (tokenType == TokenTypeEnum.freeCoupon) {
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            Date endTime = giveRecord.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime())
                throw new TokenRecordException(1, "赠送记录已过期");
            Date endTime = giveRecord.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime())
                throw new TokenRecordException(1, "赠送记录已过期");
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive()
                    || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
                throw new TokenRecordException(1, "该券不存在或非赠送");
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive()
                    || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
                throw new TokenRecordException(1, "该券不存在或非赠送");
            UserSystemCoupon userSystemCoupon = null;
            try {
                userSystemCoupon = userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCoupon,
                        UserSystemCoupon.SOURCE_GIVE, 1, true);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
            }
            UserSystemCoupon userSystemCoupon = null;
            try {
                userSystemCoupon = userSystemCouponService.freeCouponWin(uid, CouponTypeEnum.freeCoupon,
                        UserSystemCoupon.SOURCE_GIVE, 1, true);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
            }
            // 更新状态
            Date date = new Date();
            userCoupon.setId(userCoupon.getId());
            userCoupon.setState(UserSystemCoupon.STATE_END_USE);
            userCoupon.setUseTime(date);
            userCoupon.setUpdateTime(date);
            userSystemCouponService.updateByPrimaryKeySelective(userCoupon);
            // 更新状态
            Date date = new Date();
            userCoupon.setId(userCoupon.getId());
            userCoupon.setState(UserSystemCoupon.STATE_END_USE);
            userCoupon.setUseTime(date);
            userCoupon.setUpdateTime(date);
            userSystemCouponService.updateByPrimaryKeySelective(userCoupon);
            // 更新使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (useRecord != null) {
                UserSystemCouponRecord updateuseRecord = new UserSystemCouponRecord();
                updateuseRecord.setId(useRecord.getId());
                updateuseRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
                updateuseRecord.setUpdateTime(new Date());
                userSystemCouponRecordService.updateByPrimaryKeySelective(updateuseRecord);
            }
            // 更新使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (useRecord != null) {
                UserSystemCouponRecord updateuseRecord = new UserSystemCouponRecord();
                updateuseRecord.setId(useRecord.getId());
                updateuseRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
                updateuseRecord.setUpdateTime(new Date());
                userSystemCouponRecordService.updateByPrimaryKeySelective(updateuseRecord);
            }
            // 更新赠送记录
            UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
            updateGiveRecord.setId(giveRecord.getId());
            updateGiveRecord.setReceiveUid(uid);
            updateGiveRecord.setReceiveTime(new Date());
            updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
            if (userSystemCoupon != null) {
                updateGiveRecord.setReceiveId(userSystemCoupon.getId());
            }
            userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
            // 更新赠送记录
            UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
            updateGiveRecord.setId(giveRecord.getId());
            updateGiveRecord.setReceiveUid(uid);
            updateGiveRecord.setReceiveTime(new Date());
            updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
            if (userSystemCoupon != null) {
                updateGiveRecord.setReceiveId(userSystemCoupon.getId());
            }
            userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
            integralGetService.addGiveFreeCoupon(giveUid);
            integralGetService.addGiveFreeCoupon(giveUid);
            msg = "领取成功[免单券]成功,请到[我的-福利中心]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            msg = "领取成功[免单券]成功,请到[我的-福利中心]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
            // 赠送记录
            UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null)
                throw new TokenRecordException(1, "赠送记录不存在");
            Date endTime = giveRecord.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime())
                throw new TokenRecordException(1, "赠送记录已过期");
            Date endTime = giveRecord.getEndTime();
            if (endTime != null && endTime.getTime() < now.getTime())
                throw new TokenRecordException(1, "赠送记录已过期");
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive()
                    || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
                throw new TokenRecordException(1, "该券不存在或非赠送");
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(giveRecord.getCouponId());
            if (userCoupon == null || userCoupon.getGive() == null || !userCoupon.getGive()
                    || userCoupon.getState() != UserSystemCoupon.STATE_IN_USE)
                throw new TokenRecordException(1, "该券不存在或非赠送");
            SystemCoupon systemCoupon = userCoupon.getSystemCoupon();
            if (systemCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
            SystemCoupon systemCoupon = userCoupon.getSystemCoupon();
            if (systemCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
            systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
            if (systemCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
            systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
            if (systemCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
            UserSystemCoupon userSystemCoupon = null;
            try {
                userSystemCoupon = userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_GIVE, 1, true,
                        systemCoupon.getPercent());
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
            }
            UserSystemCoupon userSystemCoupon = null;
            try {
                userSystemCoupon = userSystemCouponService.rewardCouponWin(uid, UserSystemCoupon.SOURCE_GIVE, 1, true,
                        systemCoupon.getPercent());
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new TokenRecordException(1, "领取失败");
            }
            // 更新状态
            Date date = new Date();
            userCoupon.setId(userCoupon.getId());
            userCoupon.setState(UserSystemCoupon.STATE_END_USE);
            userCoupon.setUseTime(date);
            userCoupon.setUpdateTime(date);
            userSystemCouponService.updateByPrimaryKeySelective(userCoupon);
            // 更新状态
            Date date = new Date();
            userCoupon.setId(userCoupon.getId());
            userCoupon.setState(UserSystemCoupon.STATE_END_USE);
            userCoupon.setUseTime(date);
            userCoupon.setUpdateTime(date);
            userSystemCouponService.updateByPrimaryKeySelective(userCoupon);
            // 更新使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (useRecord != null) {
                UserSystemCouponRecord updateuseRecord = new UserSystemCouponRecord();
                updateuseRecord.setId(useRecord.getId());
                updateuseRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
                updateuseRecord.setUpdateTime(new Date());
                userSystemCouponRecordService.updateByPrimaryKeySelective(updateuseRecord);
            }
            // 更新使用记录
            UserSystemCouponRecord useRecord = userSystemCouponRecordService.getNearByUserCouponId(userCoupon.getId());
            if (useRecord != null) {
                UserSystemCouponRecord updateuseRecord = new UserSystemCouponRecord();
                updateuseRecord.setId(useRecord.getId());
                updateuseRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
                updateuseRecord.setUpdateTime(new Date());
                userSystemCouponRecordService.updateByPrimaryKeySelective(updateuseRecord);
            }
            // 更新赠送记录
            UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
            updateGiveRecord.setId(giveRecord.getId());
            updateGiveRecord.setReceiveUid(uid);
            updateGiveRecord.setReceiveTime(new Date());
            updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
            if (userSystemCoupon != null) {
                updateGiveRecord.setReceiveId(userSystemCoupon.getId());
            }
            userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
            // 更新赠送记录
            UserSystemCouponGiveRecord updateGiveRecord = new UserSystemCouponGiveRecord();
            updateGiveRecord.setId(giveRecord.getId());
            updateGiveRecord.setReceiveUid(uid);
            updateGiveRecord.setReceiveTime(new Date());
            updateGiveRecord.setState(UserSystemCouponGiveRecord.STATE_RECEIVE);
            if (userSystemCoupon != null) {
                updateGiveRecord.setReceiveId(userSystemCoupon.getId());
            }
            userSystemCouponGiveRecordService.updateByPrimaryKeySelective(updateGiveRecord);
            integralGetService.addGiveRebateCoupon(giveUid);
            integralGetService.addGiveRebateCoupon(giveUid);
            msg = "领取成功[返利奖励券]成功,请到[我的-福利中心]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
            msg = "领取成功[返利奖励券]成功,请到[我的-福利中心]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.redPack) {
            if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
                throw new TokenRecordException(1, "请升级到最新版");
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.redPack) {
            if (!VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion()))
                throw new TokenRecordException(1, "请升级到最新版");
            msg = "领取红包成功,请到[我的-红包]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.taoLiJin) {
            throw new TokenRecordException(1, "推广红包相关功能已下线!");
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
            msg = "领取红包成功,请到[我的-红包]中查看";
            // 消息 + 队员
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    addInviteTeam(uid, giveUid, userInfoExtra);
                }
            });
        } else if (tokenType == TokenTypeEnum.taoLiJin) {
            throw new TokenRecordException(1, "推广红包相关功能已下线!");
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
        return msg;
    }
        return msg;
    }
    /**
     * 未激活邀请码: 上下级关系确立
     *
     * @param uid
     * @param giveUid
     * @param userInfoExtra
     * @return
     */
    public boolean addInviteTeam(Long uid, Long giveUid, UserInfoExtra userInfoExtra) {
        boolean invite = false;
        if (StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
            UserInfoExtra userInfoExtraGive = userInfoExtraService.getUserInfoExtra(giveUid);
            if (userInfoExtraGive != null) {
                String inviteCode = userInfoExtraGive.getInviteCode();
                if (!StringUtil.isNullOrEmpty(inviteCode)) {
                    try {
                        userInfoExtraService.activateInviteCode(uid, inviteCode);
                        invite = true;
                    } catch (UserInfoExtraException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return invite;
    }
    /**
     * 未激活邀请码: 上下级关系确立
     *
     * @param uid
     * @param giveUid
     * @param userInfoExtra
     * @return
     */
    public boolean addInviteTeam(Long uid, Long giveUid, UserInfoExtra userInfoExtra) {
        boolean invite = false;
        if (StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
            UserInfoExtra userInfoExtraGive = userInfoExtraService.getUserInfoExtra(giveUid);
            if (userInfoExtraGive != null) {
                String inviteCode = userInfoExtraGive.getInviteCode();
                if (!StringUtil.isNullOrEmpty(inviteCode)) {
                    try {
                        userInfoExtraService.activateInviteCode(uid, inviteCode);
                        invite = true;
                    } catch (UserInfoExtraException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return invite;
    }
    @Override
    public List<TokenRecord> overdueList(int count) {
        return tokenRecordMapper.overdueList(count);
    }
    @Override
    public List<TokenRecord> overdueList(int count) {
        return tokenRecordMapper.overdueList(count);
    }
    @Override
    public void overdue(List<TokenRecord> list) {
        if (list == null || list.size() == 0)
            return;
        Date date = new Date();
        for (TokenRecord tokenRecord : list) {
            tokenRecord.setState(1);
            tokenRecord.setUpdateTime(date);
            tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
        }
    }
    @Override
    public void overdue(List<TokenRecord> list) {
        if (list == null || list.size() == 0)
            return;
        Date date = new Date();
        for (TokenRecord tokenRecord : list) {
            tokenRecord.setState(1);
            tokenRecord.setUpdateTime(date);
            tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
        }
    }
    @Override
    public void invalidByRedPack(Long id) {
        if (id == null)
            return;
    @Override
    public void invalidByRedPack(Long id) {
        if (id == null)
            return;
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.redPack.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.redPack.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
    @Override
    public void invalidByCoupon(Long id) {
        if (id == null)
            return;
    @Override
    public void invalidByCoupon(Long id) {
        if (id == null)
            return;
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.freeCoupon.name());
        list.add(TokenTypeEnum.rebatePercentCoupon.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
        List<String> list = new ArrayList<String>();
        list.add(TokenTypeEnum.freeCoupon.name());
        list.add(TokenTypeEnum.rebatePercentCoupon.name());
        tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -12,6 +12,7 @@
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.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.*;
import com.yeshi.fanli.vo.taobao.TaoBaoUser;
import com.yeshi.fanli.vo.user.QQUserInfoVO;
@@ -106,6 +107,10 @@
    @Resource
    private UserInfoModifyRecordService userInfoModifyRecordService;
    @Resource
    private SystemConfigService systemConfigService;
    @Transactional(rollbackFor = Exception.class)
    @Override
    public LoginResult login(HttpServletRequest request, AcceptData acceptData, Boolean first, String appId,
@@ -125,6 +130,9 @@
        if (first != null && first == true) {
            session.removeAttribute("LAST_LOGIN_USER");
        }
        String defaultPortrait = userInfoService.getDefaultPortrait(acceptData.getSystem());
        // 会话中上次登录的用户
        if (wxinstall) {// 安装了微信的状态
            UserInfo lastUser = (UserInfo) session.getAttribute("LAST_LOGIN_USER");
@@ -330,8 +338,8 @@
                    if (userInfo == null) {// 原先的账号不存在
                        userInfo = new UserInfo();
                        userInfo.setAppId(appId);
                        userInfo.setNickName(Constant.systemCommonConfig.getDefaultNickName());
                        userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                        userInfo.setNickName(null);
                        userInfo.setPortrait(defaultPortrait);
                        userInfo.setPhone(phone);
                        userInfo.setLoginType(loginType);
                        userInfo.setSystem(SystemInfoUtil.getSystem(acceptData));
@@ -374,6 +382,8 @@
            logInfo.put("tbUserInfo", tbUserInfo.getId());
        logInfo.put("loginType", loginType);
        LogHelper.lgoinInfo(logInfo.toString());
        String defaultPortrait = userInfoService.getDefaultPortrait(acceptData.getSystem());
        UserInfo userInfo = null;
        WeiXinUser weiXinUser = null;
@@ -442,8 +452,8 @@
                    break;
                case 3:// 手机号码
                    // 默认头像与昵称
                    userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                    userInfo.setNickName(Constant.systemCommonConfig.getDefaultNickName());
                    userInfo.setPortrait(defaultPortrait);
                    userInfo.setNickName(null);
                    userInfo.setPhone(phone);
                    break;
            }
@@ -576,13 +586,16 @@
    public void addUser(UserInfo user) {
        user.setCreatetime(System.currentTimeMillis());
        user.setRank(0);
        if (StringUtil.isNullOrEmpty(user.getPortrait()))
            user.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
        if (StringUtil.isNullOrEmpty(user.getPortrait())) {
            String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
            user.setPortrait(defaultPortrait);
        }
        userInfoService.createUser(user, user.getSystem());
        // 昵称为空时 默认昵称
        if (StringUtil.isNullOrEmpty(user.getNickName())) {
            UserInfo updateUserInfo = new UserInfo(user.getId());
            updateUserInfo.setNickName(Constant.systemCommonConfig.getDefaultNickName() + user.getId());
            String defaultNickName = userInfoService.getDefaultNickName(user.getSystem(), user.getId());
            updateUserInfo.setNickName(defaultNickName);
            userInfoService.updateByPrimaryKeySelective(updateUserInfo);
        }
@@ -696,8 +709,8 @@
        update.setTbPic("");
        // 判断是否有微信绑定
        if (StringUtil.isNullOrEmpty(user.getWxUnionId())) {
            update.setNickName(Constant.systemCommonConfig.getDefaultNickName() + user.getId());
            update.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
            update.setNickName(userInfoService.getDefaultNickName(user.getSystem(), user.getId()));
            update.setPortrait(userInfoService.getDefaultPortrait(user.getSystem()));
        }
        userInfoService.updateByPrimaryKeySelective(update);
@@ -731,16 +744,15 @@
        updateUserInfo.setWxUnionId(weiXinUser.getUnionid());
        // 将默认昵称替换成微信昵称
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
        if (!StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
            String defaultNickName = userInfoService.getDefaultNickName(user.getSystem(), uid);
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
                updateUserInfo.setNickName(weiXinUser.getNickname());
            }
        }
        // 将默认头像替换成微信头像
        String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
        String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
        if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                && defaultPortrait.equals(user.getPortrait())) {
            updateUserInfo.setPortrait(weiXinUser.getHeadimgurl());
@@ -803,6 +815,8 @@
    @Override
    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, "手机号获取失败");
@@ -891,7 +905,7 @@
                } else {
                    userInfo = new UserInfo();
                    userInfo.setAppId(businessSystem.getAppid());
                    userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                    userInfo.setPortrait(null);
                    userInfo.setPhone(mobile);
                    userInfo.setLoginType(loginType);
                    userInfo.setState(UserInfo.STATE_NORMAL);
@@ -1100,7 +1114,7 @@
                    }
                    if (StringUtil.isNullOrEmpty(portrait))
                        portrait = Constant.systemCommonConfig.getDefaultPortrait();
                        portrait = userInfoService.getDefaultPortrait(businessSystem.getSystem());
                    // 创建新账户
                    userInfo = new UserInfo();
@@ -1320,7 +1334,7 @@
        updateUserInfo.setWxUnionId(weiXinUser.getUnionid());
        // 将默认昵称替换成微信昵称
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        String defaultNickName = userInfoService.getDefaultNickName(user.getSystem(), user.getId());
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
@@ -1329,7 +1343,7 @@
        }
        // 将默认头像替换成微信头像
        String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
        String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
        if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                && defaultPortrait.equals(user.getPortrait())) {
            String headimgurl = weiXinUser.getHeadimgurl();
@@ -1400,7 +1414,7 @@
        updateUserInfo.setQqOpenId(qqUser.getOpenid());
        // 将默认昵称替换成微信昵称
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        String defaultNickName = userInfoService.getDefaultNickName(user.getSystem(), user.getId());
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(qqUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
@@ -1409,7 +1423,7 @@
        }
        // 将默认头像替换成QQ头像
        String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
        String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
        if (!StringUtil.isNullOrEmpty(qqUser.getFigureurl_2()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                && defaultPortrait.equals(user.getPortrait())) {
            String headimgurl = qqUser.getFigureurl_2();
@@ -1519,9 +1533,9 @@
            }
        }
        if (StringUtil.isNullOrEmpty(portrait))
            portrait = Constant.systemCommonConfig.getDefaultPortrait();
        if (StringUtil.isNullOrEmpty(portrait)) {
            portrait = userInfoService.getDefaultPortrait(system);
        }
        // 是否需要创建新账户
        UserInfo phoneUser = userInfoService.getEffectiveUserInfoByPhone(phone, system);
        UserInfo userInfo = null;
@@ -1683,9 +1697,9 @@
                        }
                    }
                    if (StringUtil.isNullOrEmpty(portrait))
                        portrait = Constant.systemCommonConfig.getDefaultPortrait();
                    if (StringUtil.isNullOrEmpty(portrait)) {
                        portrait = userInfoService.getDefaultPortrait(system);
                    }
                    // 创建新账户
                    userInfo = new UserInfo();
                    userInfo.setPhone(phone);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -17,7 +17,9 @@
import com.yeshi.fanli.dao.user.UserGoodsChannelConfigDao;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.entity.goods.UserGoodsChannelConfig;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.*;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -92,12 +94,6 @@
    private UserInfoService userInfoService;
    @Resource
    private UserAccountService userAccountService;
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    @Resource
    private UserInviteRecordService userInviteRecordService;
    @Resource
@@ -109,6 +105,9 @@
    @Resource
    private RocketMQManager rocketMQManager;
    @Resource
    private SystemConfigService systemConfigService;
    @Override
    public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
@@ -410,17 +409,17 @@
            updateUserInfo.setWxPic(weiXinUser.getHeadimgurl());
            // 将默认昵称替换成微信昵称
            String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
            String defaultNickName = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultNickNamePrefix, invitee.getSystem());
            if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
                defaultNickName = defaultNickName + uid;
                if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName())
                        || invitee.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName()))) {
                        || invitee.getNickName().startsWith(defaultNickName))) {
                    updateUserInfo.setNickName(weiXinUser.getNickname());
                }
            }
            // 将默认头像替换成微信头像
            String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
            String defaultPortrait = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultPortrait, invitee.getSystem());
            if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                    && defaultPortrait.equals(invitee.getPortrait())) {
                String headimgurl = weiXinUser.getHeadimgurl();
@@ -494,17 +493,17 @@
            updateUserInfo.setWxPic(weiXinUser.getHeadimgurl());
            // 将默认昵称替换成微信昵称
            String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
            String defaultNickName = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultNickNamePrefix, invitee.getSystem());
            if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
                defaultNickName = defaultNickName + uid;
                if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName())
                        || invitee.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName()))) {
                        || invitee.getNickName().startsWith(defaultNickName))) {
                    updateUserInfo.setNickName(weiXinUser.getNickname());
                }
            }
            // 将默认头像替换成微信头像
            String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
            String defaultPortrait = systemConfigService.getValueCache(SystemConfigKeyEnum.defaultPortrait, invitee.getSystem());
            if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                    && defaultPortrait.equals(invitee.getPortrait())) {
                String headimgurl = weiXinUser.getHeadimgurl();
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java
@@ -38,155 +38,158 @@
@Service
public class UserInfoModifyRecordServiceImpl implements UserInfoModifyRecordService {
    @Resource
    private UserInfoModifyRecordMapper userInfoModifyRecordMapper;
    @Resource
    private UserInfoModifyRecordMapper userInfoModifyRecordMapper;
    @Resource
    private IntegralGetService integralGetService;
    @Resource
    private IntegralGetService integralGetService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private BindingAccountService bindingAccountService;
    @Resource
    private BindingAccountService bindingAccountService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
    @Resource
    private RocketMQManager rocketMQManager;
    @Resource
    private RocketMQManager rocketMQManager;
    @Async()
    @Transactional
    @Override
    public void addModifyRecord(Long uid, ModifyTypeEnum type, String value) {
        try {
            if (uid == null || StringUtil.isNullOrEmpty(value))
                return;
    @Async()
    @Transactional
    @Override
    public void addModifyRecord(Long uid, ModifyTypeEnum type, String value) {
        try {
            if (uid == null || StringUtil.isNullOrEmpty(value))
                return;
            long count = countByUid(uid, type.name());
            if (count == 0) {
                if (type == ModifyTypeEnum.bindPhone) {
                    integralGetService.addBindPhone(uid);
                } else if (type == ModifyTypeEnum.bindAlipay) {
                    integralGetService.addBindAlipay(uid);
                } else if (type == ModifyTypeEnum.bindTaoBao) {
                    integralGetService.addBindTaoBao(uid);
                } else if (type == ModifyTypeEnum.bindWeiXin) {
                    integralGetService.addBindWeiXin(uid);
                } else if (type == ModifyTypeEnum.gender) {
                    integralGetService.addSetGender(uid);
                } else if (type == ModifyTypeEnum.nickName) {
                    integralGetService.addSetNickname(uid);
                } else if (type == ModifyTypeEnum.portrait) {
                    integralGetService.addSetPortrait(uid);
                } else if (type == ModifyTypeEnum.setWeiXinNum) {
                    integralGetService.addSetWeiXinNum(uid);
                }
            }
            long count = countByUid(uid, type.name());
            if (count == 0) {
                if (type == ModifyTypeEnum.bindPhone) {
                    integralGetService.addBindPhone(uid);
                } else if (type == ModifyTypeEnum.bindAlipay) {
                    integralGetService.addBindAlipay(uid);
                } else if (type == ModifyTypeEnum.bindTaoBao) {
                    integralGetService.addBindTaoBao(uid);
                } else if (type == ModifyTypeEnum.bindWeiXin) {
                    integralGetService.addBindWeiXin(uid);
                } else if (type == ModifyTypeEnum.gender) {
                    integralGetService.addSetGender(uid);
                } else if (type == ModifyTypeEnum.nickName) {
                    integralGetService.addSetNickname(uid);
                } else if (type == ModifyTypeEnum.portrait) {
                    integralGetService.addSetPortrait(uid);
                } else if (type == ModifyTypeEnum.setWeiXinNum) {
                    integralGetService.addSetWeiXinNum(uid);
                }
            }
            UserInfoModifyRecord oldRecord = userInfoModifyRecordMapper.selectLatestByUidAndType(uid, type.name());
            if (oldRecord == null || !oldRecord.getValue().equalsIgnoreCase(value)) {// 不能修改重复的数据
                UserInfoModifyRecord record = new UserInfoModifyRecord();
                record.setUid(uid);
                record.setType(type);
                record.setValue(value);
                record.setCreateTime(new Date());
                userInfoModifyRecordMapper.insertSelective(record);
            UserInfoModifyRecord oldRecord = userInfoModifyRecordMapper.selectLatestByUidAndType(uid, type.name());
            if (oldRecord == null || !oldRecord.getValue().equalsIgnoreCase(value)) {// 不能修改重复的数据
                UserInfoModifyRecord record = new UserInfoModifyRecord();
                record.setUid(uid);
                record.setType(type);
                record.setValue(value);
                record.setCreateTime(new Date());
                userInfoModifyRecordMapper.insertSelective(record);
                if (oldRecord == null) {// 新建
                    // 发送账号修改消息
                    UserAccountBindingMQMsg mqMsg = null;
                    if (type == ModifyTypeEnum.bindPhone) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_PHONE, value, new Date());
                    } else if (type == ModifyTypeEnum.bindTaoBao) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_TAOBAO, value,
                                new Date());
                    } else if (type == ModifyTypeEnum.bindWeiXin) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_WX, value, new Date());
                    } else if (type == ModifyTypeEnum.bindAlipay) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_ALIPAY, value,
                                new Date());
                    }
                    Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
                            UserTopicTagEnum.userAccountBinding, mqMsg);
                    if (!Constant.IS_TEST)
                        rocketMQManager.sendNormalMsg(message, null);
                } else {// 修改
                    UserInfoUpdateMQMsg mqMsg = null;
                if (oldRecord == null) {// 新建
                    // 发送账号修改消息
                    UserAccountBindingMQMsg mqMsg = null;
                    if (type == ModifyTypeEnum.bindPhone) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_PHONE, value, new Date());
                    } else if (type == ModifyTypeEnum.bindTaoBao) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_TAOBAO, value,
                                new Date());
                    } else if (type == ModifyTypeEnum.bindWeiXin) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_WX, value, new Date());
                    } else if (type == ModifyTypeEnum.bindAlipay) {
                        mqMsg = new UserAccountBindingMQMsg(uid, UserAccountBindingMQMsg.TYPE_ALIPAY, value,
                                new Date());
                    }
                    Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
                            UserTopicTagEnum.userAccountBinding, mqMsg);
                    if (!Constant.IS_TEST)
                        rocketMQManager.sendNormalMsg(message, null);
                } else {// 修改
                    UserInfoUpdateMQMsg mqMsg = null;
                    if (type == ModifyTypeEnum.portrait) {
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.portrait, value, new Date());
                    } else if (type == ModifyTypeEnum.nickName)
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.nickName, value, new Date());
                    else if (type == ModifyTypeEnum.setWeiXinNum)
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.wxId, value, new Date());
                    if (type == ModifyTypeEnum.portrait) {
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.portrait, value, new Date());
                    } else if (type == ModifyTypeEnum.nickName)
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.nickName, value, new Date());
                    else if (type == ModifyTypeEnum.setWeiXinNum)
                        mqMsg = new UserInfoUpdateMQMsg(uid, UserInfoUpdateTypeEnum.wxId, value, new Date());
                    if (mqMsg != null) {
                        Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
                                UserTopicTagEnum.userInfoUpdate, mqMsg);
                        rocketMQManager.sendNormalMsg(message, null);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            LogHelper.errorDetailInfo(e);
        }
    }
                    if (mqMsg != null) {
                        Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER,
                                UserTopicTagEnum.userInfoUpdate, mqMsg);
                        rocketMQManager.sendNormalMsg(message, null);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            LogHelper.errorDetailInfo(e);
        }
    }
    @Override
    public long countByUid(Long uid, String type) {
        return userInfoModifyRecordMapper.countByUid(uid, type);
    }
    @Override
    public long countByUid(Long uid, String type) {
        return userInfoModifyRecordMapper.countByUid(uid, type);
    }
    @Override
    public void syncBeforeInfo(Long uid) {
        // 获取用户基本信息
        UserInfo user = userInfoService.selectByPKey(uid);
        if (user == null || user.getState() != UserInfo.STATE_NORMAL) {// 用户不正常
            return;
        }
        if (!StringUtil.isNullOrEmpty(user.getPhone())) {
            addModifyRecord(uid, ModifyTypeEnum.bindPhone, user.getPhone());
        }
    @Override
    public void syncBeforeInfo(Long uid) {
        // 获取用户基本信息
        UserInfo user = userInfoService.selectByPKey(uid);
        if (user == null || user.getState() != UserInfo.STATE_NORMAL) {// 用户不正常
            return;
        }
        if (!StringUtil.isNullOrEmpty(user.getPhone())) {
            addModifyRecord(uid, ModifyTypeEnum.bindPhone, user.getPhone());
        }
        BindingAccount account = bindingAccountService.getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (account != null) {
            addModifyRecord(uid, ModifyTypeEnum.bindAlipay, account.getAccount());
        }
        BindingAccount account = bindingAccountService.getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (account != null) {
            addModifyRecord(uid, ModifyTypeEnum.bindAlipay, account.getAccount());
        }
        if (!StringUtil.isNullOrEmpty(user.getWxUnionId())) {
            addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, user.getWxUnionId());
        }
        if (!StringUtil.isNullOrEmpty(user.getWxUnionId())) {
            addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, user.getWxUnionId());
        }
        if (user.getNickName() != null && !user.getNickName().startsWith("返利券")
                && !user.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName())) {
            addModifyRecord(uid, ModifyTypeEnum.nickName, user.getNickName() + "");
        }
        String defaultNickName = userInfoService.getDefaultNickName(user.getSystem(), uid);
        if (!Constant.systemCommonConfig.getDefaultPortrait().equalsIgnoreCase(user.getPortrait())) {
            addModifyRecord(uid, ModifyTypeEnum.portrait, user.getPortrait());
        }
        if (user.getNickName() != null && !user.getNickName().startsWith("返利券")
                && !user.getNickName().startsWith(defaultNickName)) {
            addModifyRecord(uid, ModifyTypeEnum.nickName, user.getNickName() + "");
        }
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra != null) {
            if (userInfoExtra.getSex() != null)
                addModifyRecord(uid, ModifyTypeEnum.gender, userInfoExtra.getSex() + "");
        String defaultPortrait = userInfoService.getDefaultPortrait(user.getSystem());
        if (!defaultPortrait.equalsIgnoreCase(user.getPortrait())) {
            addModifyRecord(uid, ModifyTypeEnum.portrait, user.getPortrait());
        }
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
                addModifyRecord(uid, ModifyTypeEnum.setWeiXinNum, userInfoExtra.getWeiXin());
        }
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra != null) {
            if (userInfoExtra.getSex() != null)
                addModifyRecord(uid, ModifyTypeEnum.gender, userInfoExtra.getSex() + "");
        UserExtraTaoBaoInfo taoBaoExtra = userExtraTaoBaoInfoService.getByUid(uid);
        if (taoBaoExtra != null && !StringUtil.isNullOrEmpty(taoBaoExtra.getRelationId())
                && !StringUtil.isNullOrEmpty(taoBaoExtra.getSpecialId()) && taoBaoExtra.getRelationValid()
                && taoBaoExtra.getSpecialValid()) {
            addModifyRecord(uid, ModifyTypeEnum.bindTaoBao, taoBaoExtra.getTaoBaoUid());
        }
            if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
                addModifyRecord(uid, ModifyTypeEnum.setWeiXinNum, userInfoExtra.getWeiXin());
        }
    }
        UserExtraTaoBaoInfo taoBaoExtra = userExtraTaoBaoInfoService.getByUid(uid);
        if (taoBaoExtra != null && !StringUtil.isNullOrEmpty(taoBaoExtra.getRelationId())
                && !StringUtil.isNullOrEmpty(taoBaoExtra.getSpecialId()) && taoBaoExtra.getRelationValid()
                && taoBaoExtra.getSpecialValid()) {
            addModifyRecord(uid, ModifyTypeEnum.bindTaoBao, taoBaoExtra.getTaoBaoUid());
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java
@@ -11,6 +11,8 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.*;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.task.TaskExecutor;
@@ -100,6 +102,9 @@
    @Resource
    private RedisManager redisManager;
    @Resource
    private SystemConfigService systemConfigService;
    public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, SystemEnum sysetm) {
@@ -781,4 +786,27 @@
    }
    @Override
    public String getDefaultNickName(SystemEnum system, Long uid) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.defaultNickNamePrefix, system) + uid;
    }
    @Override
    public String getDefaultNickName(Long uid) {
        SystemEnum system = getUserSystem(uid);
        return getDefaultNickName(system, uid);
    }
    @Override
    public String getDefaultPortrait(SystemEnum system) {
        return systemConfigService.getValueCache(SystemConfigKeyEnum.defaultPortrait, system);
    }
    @Override
    public String getDefaultPortrait(Long uid) {
        SystemEnum system = getUserSystem(uid);
        return getDefaultPortrait(system);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInviteRecordServiceImpl.java
@@ -4,6 +4,8 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.config.SystemConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.wx.MyWXLoginUtil;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -19,64 +21,70 @@
@Service
public class UserInviteRecordServiceImpl implements UserInviteRecordService {
    @Resource
    private UserInviteRecordMapper userInviteRecordMapper;
    @Resource
    private UserInfoService  userInfoService;
    @Async("pushExecutor")
    @Override
    public void saveInviteRecord(String code, String uid) {
        // 用户code 未获取到
        if (code == null || uid == null || uid.trim().length() == 0) {
            return;
        }
        // 没得这个人
        Long invitId = Long.parseLong(uid);
        UserInfo inviter = userInfoService.getUserById(invitId);
        if (inviter == null) {
            return;
        }
    @Resource
    private UserInviteRecordMapper userInviteRecordMapper;
        // 获取微信信息
        WeiXinUser weiXinUser = MyWXLoginUtil.getWeiXinWYUser(code);
        if (weiXinUser == null) {
            return;
        }
        String wxUnionId = weiXinUser.getUnionid();
        if (wxUnionId == null || wxUnionId.trim().length() == 0) {
            return;
        }
        // 是否是邀请者自己识别
        if (wxUnionId.equals(inviter.getWxUnionId())) {
            return;
        }
        UserInviteRecord record  = userInviteRecordMapper.getByInviterIdAndUnionid(invitId, wxUnionId);
        if (record != null) {
            UserInviteRecord userInviteRecord = new UserInviteRecord();
            userInviteRecord.setId(record.getId());
            userInviteRecord.setUpdateTime(new Date());
            userInviteRecordMapper.updateByPrimaryKey(record);
        } else {
            UserInviteRecord userInviteRecord = new UserInviteRecord();
            userInviteRecord.setInviterId(invitId);
            userInviteRecord.setWxUnionid(wxUnionId);
            userInviteRecord.setCreateTime(new Date());
            userInviteRecord.setUpdateTime(new Date());
            userInviteRecordMapper.insertSelective(userInviteRecord);
        }
    }
    @Resource
    private UserInfoService userInfoService;
    @Override
    public Long getNewestInviterId(String wxUnionId) {
        return userInviteRecordMapper.getNewestInviterId(wxUnionId);
    }
    @Resource
    private SystemConfigService systemConfigService;
    @Async("pushExecutor")
    @Override
    public void saveInviteRecord(String code, String uid) {
        // 用户code 未获取到
        if (code == null || uid == null || uid.trim().length() == 0) {
            return;
        }
        // 没得这个人
        Long invitId = Long.parseLong(uid);
        UserInfo inviter = userInfoService.getUserById(invitId);
        if (inviter == null) {
            return;
        }
        // 获取微信信息
        String wxGZAppId = systemConfigService.getValueCache(SystemConfigKeyEnum.wxGZAppId, inviter.getSystem());
        String wxGZSecretId = systemConfigService.getValueCache(SystemConfigKeyEnum.wxGZAppSecret, inviter.getSystem());
        WeiXinUser weiXinUser = MyWXLoginUtil.getWeiXinWYUser(code, wxGZAppId, wxGZSecretId);
        if (weiXinUser == null) {
            return;
        }
        String wxUnionId = weiXinUser.getUnionid();
        if (wxUnionId == null || wxUnionId.trim().length() == 0) {
            return;
        }
        // 是否是邀请者自己识别
        if (wxUnionId.equals(inviter.getWxUnionId())) {
            return;
        }
        UserInviteRecord record = userInviteRecordMapper.getByInviterIdAndUnionid(invitId, wxUnionId);
        if (record != null) {
            UserInviteRecord userInviteRecord = new UserInviteRecord();
            userInviteRecord.setId(record.getId());
            userInviteRecord.setUpdateTime(new Date());
            userInviteRecordMapper.updateByPrimaryKey(record);
        } else {
            UserInviteRecord userInviteRecord = new UserInviteRecord();
            userInviteRecord.setInviterId(invitId);
            userInviteRecord.setWxUnionid(wxUnionId);
            userInviteRecord.setCreateTime(new Date());
            userInviteRecord.setUpdateTime(new Date());
            userInviteRecordMapper.insertSelective(userInviteRecord);
        }
    }
    @Override
    public Long getNewestInviterId(String wxUnionId) {
        return userInviteRecordMapper.getNewestInviterId(wxUnionId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/wx/WXMPUserLoginServiceImpl.java
@@ -3,6 +3,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.util.SystemInfoUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -41,6 +42,9 @@
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    @Resource
    private SystemConfigService systemConfigService;
    @Transactional(rollbackFor = Exception.class)
    @Override
    public WXMPLoginResult wxmpLogin(WXMPLoginData loginData) throws UserAccountException {
@@ -69,8 +73,8 @@
                } else {
                    UserInfo userInfo = new UserInfo();
                    userInfo.setAppId(loginData.getAppId());
                    userInfo.setNickName(Constant.systemCommonConfig.getDefaultNickName());
                    userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                    userInfo.setNickName(null);
                    userInfo.setPortrait(userInfoService.getDefaultPortrait(system));
                    userInfo.setPhone(loginData.getPhone());
                    if (!StringUtil.isNullOrEmpty(loginData.getLastUser().getNickName()))
@@ -112,8 +116,8 @@
                } else {// 新用户
                    userInfo = new UserInfo();
                    userInfo.setAppId(loginData.getAppId());
                    userInfo.setNickName(Constant.systemCommonConfig.getDefaultNickName());
                    userInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
                    userInfo.setNickName(null);
                    userInfo.setPortrait(null);
                    userInfo.setPhone(loginData.getPhone());
                    userInfo.setPlatform("wxmp");
fanli/src/main/java/com/yeshi/fanli/service/inter/config/WXGZService.java
@@ -5,6 +5,6 @@
    /**
     * 初始化自定义菜单
     */
    public void initMenu();
    public void initMenu(String wxGZAppId,String wxGZAppsecret);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/BasePushService.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.inter.push;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.exception.push.PushException;
@@ -14,7 +15,7 @@
     * @param content
     * @throws PushException
     */
    void pushGoods(Long uid, Long auctionId, String title, String content, String versions) throws PushException;
    void pushGoods(Long uid, Long auctionId, String title, String content, String versions, SystemEnum system) throws PushException;
    /**
     * 推送链接
@@ -25,7 +26,7 @@
     * @param content
     * @throws PushException
     */
    void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException;
    void pushUrl(Long uid, String url, String title, String content, String versions, SystemEnum system) throws PushException;
    /**
     * 推送站内信
@@ -35,7 +36,7 @@
     * @param content
     * @throws PushException
     */
    void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException;
    void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions, SystemEnum system) throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送weex页面
@@ -46,7 +47,7 @@
     * @param weexUrl
     * @throws PushException
     */
    void pushWEEX(Long uid, String title, String content, String weexUrl, String versions) throws PushException;
    void pushWEEX(Long uid, String title, String content, String weexUrl, String versions, SystemEnum system) throws PushException;
    /**
     * 适用版本 1.4.8及以后 推送百川网页
@@ -57,7 +58,7 @@
     * @param url
     * @throws PushException
     */
    void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions) throws PushException;
    void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions, SystemEnum system) throws PushException;
    /**
     * 推送福利中心(版本号:1.5.1后)
@@ -67,7 +68,7 @@
     * @param content
     * @throws PushException
     */
    void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException;
    void pushWelfareCenter(Long uid, String title, String content, String versions, SystemEnum system) throws PushException;
    /**
     * 推送用户签到
@@ -78,5 +79,5 @@
     * @param versions
     * @throws PushException
     */
    void pushUserSignInNotification(Long uid, String title, String content, String versions) throws PushException;
    void pushUserSignInNotification(Long uid, String title, String content, String versions, SystemEnum system) throws PushException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/HWPushService.java
@@ -2,6 +2,7 @@
import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.dto.push.PushContentDetailDTO;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.exception.push.PushException;
import java.util.List;
fanli/src/main/java/com/yeshi/fanli/service/inter/push/IOSPushService.java
@@ -2,6 +2,7 @@
import java.util.List;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.entity.push.DeviceTokenIOS;
import com.yeshi.fanli.entity.push.PushQueueRecord;
import com.yeshi.fanli.exception.push.PushException;
@@ -21,7 +22,7 @@
     * @param deviceToken
     * @param device
     */
    public void addDeviceToken(Long uid, int version, String deviceToken,  String device);
    public void addDeviceToken(Long uid, int version, String deviceToken, String device);
    /**
     * 更新设备的deviceToken
@@ -75,7 +76,7 @@
     * @param pushQueueRecord
     * @throws Exception
     */
    public void executePushIOS(List<DeviceTokenIOS> list, PushQueueRecord pushQueueRecord, long recordCursor)
    public void executePushIOS(List<DeviceTokenIOS> list, PushQueueRecord pushQueueRecord, long recordCursor,SystemEnum system)
            throws Exception;
    /**
fanli/src/main/java/com/yeshi/fanli/service/inter/push/VIVOPushService.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.yeshi.fanli.dto.push.PushBaseContent;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.exception.push.PushException;
/**
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserInfoService.java
@@ -22,7 +22,6 @@
     * @return 用户,如果不存在返回null
     */
    /**
     *
     * @param loginType
     * @param openid
     * @param sysetm
@@ -86,10 +85,10 @@
     */
    public List<UserInfoVO> query(long start, int count, Integer userState, String key, Integer keyType,
                                  String userRank, Integer days, String startTime, String endTime, Integer orderField, Integer orderMode,
                                  Integer userType, String level, Integer activeCode,SystemEnum system);
                                  Integer userType, String level, Integer activeCode, SystemEnum system);
    public long queryCount(Integer userState, String key, Integer keyType, String userRank, Integer days,
                           String startTime, String endTime, Integer userType, String level, Integer activeCode,SystemEnum system);
                           String startTime, String endTime, Integer userType, String level, Integer activeCode, SystemEnum system);
    public double querySumMoney(String key, Integer userType, Integer days, String startTime, String endTime);
@@ -162,6 +161,7 @@
    /**
     * 根据QQ获取有效用户
     *
     * @param opneId
     * @param sysetm
     * @return
@@ -171,6 +171,7 @@
    /**
     * 获取有效用户(根据淘宝OpenId)
     *
     * @param openId
     * @param sysetm
     * @return
@@ -251,20 +252,44 @@
    public long countInfo(Integer userState, String key, Integer keyType, String userRank, Integer days, String startTime,
                          String endTime, Integer userType, String level, Integer activeCode,SystemEnum system);
                          String endTime, Integer userType, String level, Integer activeCode, SystemEnum system);
    public List<UserInfoVO> queryInfo(long start, int count, Integer userState, String key, Integer keyType, String userRank,
                                      Integer days, String startTime, String endTime, Integer userType, String level, Integer activeCode,SystemEnum system);
                                      Integer days, String startTime, String endTime, Integer userType, String level, Integer activeCode, SystemEnum system);
    List<UserInfo> listBySystemAndWXUnionId(SystemEnum system, String unionId);
    List<UserInfo> listBySystemAndTaoBaoOpenId(SystemEnum system, String openId);
    List<UserInfo> listBySystemAndPhone(SystemEnum system, String phone);
    /**
     * 根据用户ID获取所在系统
     *
     * @param uid
     * @return
     */
    public SystemEnum getUserSystem(Long uid);
    /**
     * 获取默认昵称
     * @param system
     * @param uid
     * @return
     */
    public String getDefaultNickName(SystemEnum system, Long uid);
    public String getDefaultNickName(Long uid);
    /**
     * 获取默认头像
     * @param system
     * @return
     */
    public String getDefaultPortrait(SystemEnum system);
    public String getDefaultPortrait(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -43,23 +43,8 @@
    public final static String ADMINH5_AESKEY = "WW782Ss@0*px/,2v";
    public final static String RANDKEY = "user_randkey";
    public final static String RANDPWDKEY = "user_pwd_randkey";
    public final static String MAIL_SENDER_ACCOUNT = "he15901227708@163.com";// 发送账号
    public final static String MAIL_SENDER_PWD = "hexiaohui1011";// 发送密码
    public final static String TAOBAO_APP_ID = "23595652";
    public final static String TAOBAO_APP_SECRET = "a4b2098670284a929a3f5930644ac26d";
    public final static String TAOBAO_BASEURL = "http://gw.api.taobao.com/router/rest";
    public final static long TAOBAO_AdzoneId = 70076496L;
    public final static int HB_NOTIME = 1;
    public final static int HB_GET = 2;
    public final static int HB_GOT = 3;
    public final static int HB_DISABLE = 4;
    public final static String HB_STATEEXCEPTION = "红包状态异常";
    public final static String HB_NOEXIST = "红包不存在";
    public static final int MR_COUNT = 2;
    public final static String BA_EXIST = "该类型账户已存在";
    public final static String BA_SUCCESS = "创建成功";
@@ -71,7 +56,6 @@
    public final static int WEIXIN = 2;
    public static final String NOTYPE = "不存在该类型";
    public static final String NOACCOUNT = "不存在该类型账户";
    public static final String HB_TIMEEXCEPTION = "红包解锁时间未到,还不能打开红包";
    public static final String DEL = "delete";
    public static final int EXTRACT_DEFUALT = 0;
    public static final int EXTRACT_PASS = 1;
@@ -79,20 +63,12 @@
    public static final String SESSION_ADMIN = "ADMIN";// 管理员用户的session key
    public static final String SESSION_EXTRACT_CODE = "ADMIN_EXTRACT_CODE"; // 提现码
    public static final String SESSION_EXTRACT_VERIFY_RESULT = "SESSION_EXTRACT_VERIFY_RESULT"; // 提现码验证结果
    public static final int NOWHOTSIZE = 10;
    public static final int DAYMS = 86400000;
    public static final int DEFAULT_DAYMS = 1296000000;
    public static final int HOURMS = 3600000;
    public static String Extract_Activty;
    public static String HB_Activity;
    public static final String MYLIKE = "mylike";
    public static final String MYDYNAMIC = "mydynamic";
    public static final String TAOBAO_AUTH_APPKEY = "24980167";
    public static final String TAOBAO_AUTH_APPSECRET = "e0a2e05deabf5ce039b52e5b492d5382";
    public static final String TAOBAO_RELATION_PID_DEFAULT = "mm_124933865_56750082_87140050199";
    public static final String TAOBAO_SPECIAL_PID_DEFAULT = "mm_124933865_56750082_89555600043";
    public static final long PUSH_MIN_TIME=1000*60*60L*24*30*2;
@@ -338,10 +314,6 @@
            System.out.println("IS_TEST:" + IS_TEST);
        }
        Extract_Activty = String.format("%s.ui.mine.MyRedPacketsActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName());
        HB_Activity = String.format("%s.ui.main.MainActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName());
    }
    public static String getSourceName(int sourceType) {
fanli/src/main/java/com/yeshi/fanli/util/RedisKeyEnum.java
@@ -8,6 +8,7 @@
    SMSLoginCount("sendMSNLoginCount", "登录发送短信次数统计"),
    SMSBindCount("sendMSNBindCount", "绑定手机号发送短信次数统计"),
    SMSBindRemove("sendMSNRemoveCount", "注销手机号发送短信次数统计"),
    oneKeyLoginCount("oneKeyLoginCount-", "一键登录次数"),
    wxmpUserLogin("wxmp-user-login-", "小程序登录"),
    frequencyLimit("frequency-", "频率限制"),
    inviteShortLink("invite-shortlink-", "短连接"),
fanli/src/main/java/com/yeshi/fanli/util/push/HWPushUtil.java
@@ -31,412 +31,402 @@
@Component
public class HWPushUtil {
    private static HWPushUtil hWPushUtil;
    private static HWPushUtil hWPushUtil;
    @Autowired
    private BusinessSystemService businessSystemService;
    @Autowired
    private BusinessSystemService businessSystemService;
    @PostConstruct
    public void init() {
        hWPushUtil = this;
        hWPushUtil.businessSystemService = this.businessSystemService;
    }
    @PostConstruct
    public void init() {
        hWPushUtil = this;
        hWPushUtil.businessSystemService = this.businessSystemService;
    }
    private static String appSecret = "";
    private static String appId = "";// 用户在华为开发者联盟申请的appId和appSecret(会员中心->我的产品,点击产品对应的Push服务,点击“移动应用详情”获取)
    private static String tokenUrl = "https://login.cloud.huawei.com/oauth2/v2/token"; // 获取认证Token的URL
    private static String apiUrl = "https://api.push.hicloud.com/pushsend.do"; // 应用级消息下发API
    private static String accessToken;// 下发通知消息的认证Token
    private static long tokenExpiredTime; // accessToken的过期时间
    private static String appSecret = "";
    private static String appId = "";// 用户在华为开发者联盟申请的appId和appSecret(会员中心->我的产品,点击产品对应的Push服务,点击“移动应用详情”获取)
    private static String tokenUrl = "https://login.cloud.huawei.com/oauth2/v2/token"; // 获取认证Token的URL
    private static String apiUrl = "https://api.push.hicloud.com/pushsend.do"; // 应用级消息下发API
    private static String accessToken;// 下发通知消息的认证Token
    private static long tokenExpiredTime; // accessToken的过期时间
    static {
        Properties ps = org.yeshi.utils.PropertiesUtil
                .getProperties(TaoBaoUtil.class.getClassLoader().getResourceAsStream("push_hw.properties"));
        HWPushConfig config = (HWPushConfig) MapUtil.parseMap(HWPushConfig.class, ps);
        appId = config.getAppId();
        appSecret = config.getAppSecret();
    }
    static {
        Properties ps = org.yeshi.utils.PropertiesUtil
                .getProperties(TaoBaoUtil.class.getClassLoader().getResourceAsStream("push_hw.properties"));
        HWPushConfig config = (HWPushConfig) MapUtil.parseMap(HWPushConfig.class, ps);
        appId = config.getAppId();
        appSecret = config.getAppSecret();
    }
    private static String getIntent(String type, String activity, String url, String webUrl, Long id) {
        net.sf.json.JSONObject data = new net.sf.json.JSONObject();
        if (type != null)
            data.put("type", type);
        if (activity != null)
            data.put("activity", activity);
        if (url != null)
            data.put("url", url);
        if (webUrl != null)
            data.put("webUrl", webUrl);
        if (id != null)
            data.put("id", id);
    private static String getIntent(String type, String activity, String url, String webUrl, Long id) {
        net.sf.json.JSONObject data = new net.sf.json.JSONObject();
        if (type != null)
            data.put("type", type);
        if (activity != null)
            data.put("activity", activity);
        if (url != null)
            data.put("url", url);
        if (webUrl != null)
            data.put("webUrl", webUrl);
        if (id != null)
            data.put("id", id);
        try {
            return String.format(
                    "intent://flq/hmpush?data=%s#Intent;scheme=banliapp;launchFlags=0x4000000;end",
                    URLDecoder.decode(data.toString(), "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
        try {
            return String.format(
                    "intent://flq/hmpush?data=%s#Intent;scheme=banliapp;launchFlags=0x4000000;end",
                    URLDecoder.decode(data.toString(), "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 推送商品
     *
     * @param deviceTokens
     *            -最大值1000
     * @param title
     * @param content
     * @param goodsType
     * @param goodsId
     * @throws PushException
     */
    public static void pushGoods(List<String> deviceTokens, String title, String content, int goodsType, Long goodsId)
            throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过100个");
    /**
     * 推送商品
     *
     * @param deviceTokens -最大值1000
     * @param title
     * @param content
     * @param goodsType
     * @param goodsId
     * @throws PushException
     */
    public static void pushGoods(List<String> deviceTokens, String title, String content, int goodsType, Long goodsId, String androidBaseActivityName)
            throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过100个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName()
                + ".ui.recommend.GoodsBrowserActivity";
        String intent = getIntent("goodsdetail", activity, null, null, goodsId);
        String activity = androidBaseActivityName
                + ".ui.recommend.GoodsBrowserActivity";
        String intent = getIntent("goodsdetail", activity, null, null, goodsId);
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 网页推送
     *
     * @param deviceTokens
     *            最大值1000
     * @param title
     * @param content
     * @param url
     *            -网页链接
     * @throws PushException
     */
    public static void pushUrl(List<String> deviceTokens, String title, String content, String url)
            throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过1000个");
    /**
     * 网页推送
     *
     * @param deviceTokens 最大值1000
     * @param title
     * @param content
     * @param url          -网页链接
     * @throws PushException
     */
    public static void pushUrl(List<String> deviceTokens, String title, String content, String url, String androidBaseActivityName)
            throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过1000个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.invite.ShareBrowserActivity";
        String intent = getIntent("url", activity, null, url, null);
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        String activity = androidBaseActivityName + ".ui.invite.ShareBrowserActivity";
        String intent = getIntent("url", activity, null, url, null);
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 站内信推送
     *
     * @param deviceTokens
     *            最大值1000
     * @param title
     * @param content
     * @param url
     *            -网页链接
     * @throws PushException
     */
    public static void pushZNX(List<String> deviceTokens, String title, String content) throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过100个");
        String intent = getIntent("ZNX", null, null, null, null);
        if (intent == null)
            return;
    /**
     * 站内信推送
     *
     * @param deviceTokens 最大值1000
     * @param title
     * @param content
     * @param url          -网页链接
     * @throws PushException
     */
    public static void pushZNX(List<String> deviceTokens, String title, String content) throws PushException {
        if (deviceTokens != null && deviceTokens.size() > 100)
            throw new PushException(1, "设备数不能超过100个");
        String intent = getIntent("ZNX", null, null, null, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void pushWEEX(List<String> deviceTokens, String title, String content, String weexUrl)
            throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.weex.WeexApplicationActivity";
        String intent = getIntent("weex", activity, weexUrl, weexUrl, null);
        if (intent == null)
            return;
    public static void pushWEEX(List<String> deviceTokens, String title, String content, String weexUrl, String androidBaseActivityName)
            throws PushException {
        String activity = androidBaseActivityName + ".ui.mine.weex.WeexApplicationActivity";
        String intent = getIntent("weex", activity, weexUrl, weexUrl, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void pushBaiChuanUrl(List<String> deviceTokens, String title, String content, String url)
            throws PushException {
        String intent = getIntent("baichuan", null, url, null, null);
        if (intent == null)
            return;
    public static void pushBaiChuanUrl(List<String> deviceTokens, String title, String content, String url)
            throws PushException {
        String intent = getIntent("baichuan", null, url, null, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void pushWelfareCenter(List<String> deviceTokens, String title, String content) throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.WelfareCenterActivity";
        String intent = getIntent("welfare", activity, null, null, null);
        if (intent == null)
            return;
    public static void pushWelfareCenter(List<String> deviceTokens, String title, String content, String androidBaseActivityName) throws PushException {
        String activity = androidBaseActivityName + ".ui.mine.WelfareCenterActivity";
        String intent = getIntent("welfare", activity, null, null, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void pushUserSignInNotification(List<String> deviceTokens, String title, String content) throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.goldtask.GoldTaskActivity";
        String intent = getIntent("signin", activity, null, null, null);
        if (intent == null)
            return;
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void pushUserSignInNotification(List<String> deviceTokens, String title, String content, String androidBaseActivityName) throws PushException {
        String activity = androidBaseActivityName + ".ui.goldtask.GoldTaskActivity";
        String intent = getIntent("signin", activity, null, null, null);
        if (intent == null)
            return;
    /**
     * 推送设备消息
     *
     * @param deviceTokens
     *            -最大1000条
     * @param title
     *            -标题
     * @param content
     *            -内容
     * @param intent
     *            如:intent:#Intent;component=com.yeshi.ec.rebate/.myapplication.
     *            ui.invite.ShareBrowserActivity;S.url="+URLEncoder.encode("http
     *            ://www.baidu.com")+";end
     * @return
     * @throws IOException
     */
    private static String sendPushHWMessageForIntent(List<String> deviceTokens, String title, String content,
            String intent) throws IOException {
        if (tokenExpiredTime <= System.currentTimeMillis()) {
            refreshToken();
        }
        try {
            String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent);
            net.sf.json.JSONObject data = net.sf.json.JSONObject.fromObject(result);
            if (!"success".equalsIgnoreCase(data.optString("msg")))
                throw new PushException(2, result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
        /* PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败 */
        /* PushToken不支持手动编写,需使用客户端的onToken方法获取 */
        JSONArray deviceTokenList = new JSONArray();// 目标设备Token
        for (String deviceToken : deviceTokens) {
            deviceTokenList.add(deviceToken);
        }
    /**
     * 推送设备消息
     *
     * @param deviceTokens -最大1000条
     * @param title        -标题
     * @param content      -内容
     * @param intent       如:intent:#Intent;component=com.yeshi.ec.rebate/.myapplication.
     *                     ui.invite.ShareBrowserActivity;S.url="+URLEncoder.encode("http
     *                     ://www.baidu.com")+";end
     * @return
     * @throws IOException
     */
    private static String sendPushHWMessageForIntent(List<String> deviceTokens, String title, String content,
                                                     String intent) throws IOException {
        if (tokenExpiredTime <= System.currentTimeMillis()) {
            refreshToken();
        }
        // 仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
        JSONObject body = new JSONObject();
        body.put("title", title);// 消息标题
        body.put("content", content);// 消息内容体
        /* PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败 */
        /* PushToken不支持手动编写,需使用客户端的onToken方法获取 */
        JSONArray deviceTokenList = new JSONArray();// 目标设备Token
        for (String deviceToken : deviceTokens) {
            deviceTokenList.add(deviceToken);
        }
        // 定义需要打开的appPkgName
        JSONObject param = new JSONObject();
        // param.put("url", "http://www.baidu.com");
        // 仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
        JSONObject body = new JSONObject();
        body.put("title", title);// 消息标题
        body.put("content", content);// 消息内容体
        param.put("intent", intent);
        // param.put("appPkgName", "com.yeshi.ec.rebate");
        // 定义需要打开的appPkgName
        JSONObject param = new JSONObject();
        // param.put("url", "http://www.baidu.com");
        JSONObject action = new JSONObject();
        action.put("type", 1);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
                                // 打开APP:默认值,打开App的首页)
        action.put("param", param);// 消息点击动作参数
        param.put("intent", intent);
        // param.put("appPkgName", "com.yeshi.ec.rebate");
        JSONObject msg = new JSONObject();
        msg.put("type", 3);// 3: 通知栏消息,异步透传消息请根据接口文档设置
        msg.put("action", action);// 消息点击动作
        msg.put("body", body);// 通知栏消息body内容
        JSONObject action = new JSONObject();
        action.put("type", 1);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
        // 打开APP:默认值,打开App的首页)
        action.put("param", param);// 消息点击动作参数
        // 扩展信息,含BI消息统计,特定展示风格,消息折叠。
        JSONObject ext = new JSONObject();
        JSONObject msg = new JSONObject();
        msg.put("type", 3);// 3: 通知栏消息,异步透传消息请根据接口文档设置
        msg.put("action", action);// 消息点击动作
        msg.put("body", body);// 通知栏消息body内容
        // ext.put("icon",
        // "http://pic.qiantucdn.com/58pic/12/38/18/13758PIC4GV.jpg");//
        // 自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
        // 扩展信息,含BI消息统计,特定展示风格,消息折叠。
        JSONObject ext = new JSONObject();
        // 华为PUSH消息总结构体
        JSONObject hps = new JSONObject();
        hps.put("msg", msg);
        hps.put("ext", ext);
        // ext.put("icon",
        // "http://pic.qiantucdn.com/58pic/12/38/18/13758PIC4GV.jpg");//
        // 自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
        JSONObject payload = new JSONObject();
        payload.put("hps", hps);
        // 华为PUSH消息总结构体
        JSONObject hps = new JSONObject();
        hps.put("msg", msg);
        hps.put("ext", ext);
        System.out.println(payload.toJSONString());
        JSONObject payload = new JSONObject();
        payload.put("hps", hps);
        String postBody = MessageFormat.format(
                "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
                URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
                URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000), "UTF-8"),
                URLEncoder.encode(deviceTokenList.toString(), "UTF-8"), URLEncoder.encode(payload.toString(), "UTF-8"));
        System.out.println(payload.toJSONString());
        String postUrl = apiUrl + "?nsp_ctx="
                + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
        String result = httpPost(postUrl, postBody, 5000, 5000);
        String postBody = MessageFormat.format(
                "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
                URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
                URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000), "UTF-8"),
                URLEncoder.encode(deviceTokenList.toString(), "UTF-8"), URLEncoder.encode(payload.toString(), "UTF-8"));
        return result;
    }
        String postUrl = apiUrl + "?nsp_ctx="
                + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
        String result = httpPost(postUrl, postBody, 5000, 5000);
    /**
     * 推送打开APP的消息
     *
     * @param deviceTokens
     * @param title
     * @param content
     * @return
     * @throws IOException
     */
    private static String sendPushHWMessageForOpenApp(List<String> deviceTokens, String title, String content)
            throws IOException {
        if (tokenExpiredTime <= System.currentTimeMillis()) {
            refreshToken();
        }
        return result;
    }
        /* PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败 */
        /* PushToken不支持手动编写,需使用客户端的onToken方法获取 */
        JSONArray deviceTokenList = new JSONArray();// 目标设备Token
        for (String deviceToken : deviceTokens) {
            deviceTokenList.add(deviceToken);
        }
    /**
     * 推送打开APP的消息
     *
     * @param deviceTokens
     * @param title
     * @param content
     * @return
     * @throws IOException
     */
    private static String sendPushHWMessageForOpenApp(List<String> deviceTokens, String title, String content)
            throws IOException {
        if (tokenExpiredTime <= System.currentTimeMillis()) {
            refreshToken();
        }
        // 仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
        JSONObject body = new JSONObject();
        body.put("title", title);// 消息标题
        body.put("content", content);// 消息内容体
        /* PushManager.requestToken为客户端申请token的方法,可以调用多次以防止申请token失败 */
        /* PushToken不支持手动编写,需使用客户端的onToken方法获取 */
        JSONArray deviceTokenList = new JSONArray();// 目标设备Token
        for (String deviceToken : deviceTokens) {
            deviceTokenList.add(deviceToken);
        }
        // 定义需要打开的appPkgName
        JSONObject param = new JSONObject();
        // 仅通知栏消息需要设置标题和内容,透传消息key和value为用户自定义
        JSONObject body = new JSONObject();
        body.put("title", title);// 消息标题
        body.put("content", content);// 消息内容体
        JSONObject action = new JSONObject();
        action.put("type", 3);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
                                // 打开APP:默认值,打开App的首页)
        action.put("param", param);// 消息点击动作参数
        // 定义需要打开的appPkgName
        JSONObject param = new JSONObject();
        JSONObject msg = new JSONObject();
        msg.put("type", 3);// 3: 通知栏消息,异步透传消息请根据接口文档设置
        msg.put("action", action);// 消息点击动作
        msg.put("body", body);// 通知栏消息body内容
        JSONObject action = new JSONObject();
        action.put("type", 3);// (1 自定义行为:行为由参数intent定义;2 打开URL:URL地址由参数url定义;3
        // 打开APP:默认值,打开App的首页)
        action.put("param", param);// 消息点击动作参数
        // 扩展信息,含BI消息统计,特定展示风格,消息折叠。
        JSONObject ext = new JSONObject();
        ext.put("biTag", "Trump");// 设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态
        // ext.put("icon",
        // "http://pic.qiantucdn.com/58pic/12/38/18/13758PIC4GV.jpg");//
        // 自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
        JSONObject msg = new JSONObject();
        msg.put("type", 3);// 3: 通知栏消息,异步透传消息请根据接口文档设置
        msg.put("action", action);// 消息点击动作
        msg.put("body", body);// 通知栏消息body内容
        // 华为PUSH消息总结构体
        JSONObject hps = new JSONObject();
        hps.put("msg", msg);
        hps.put("ext", ext);
        // 扩展信息,含BI消息统计,特定展示风格,消息折叠。
        JSONObject ext = new JSONObject();
        ext.put("biTag", "Trump");// 设置消息标签,如果带了这个标签,会在回执中推送给CP用于检测某种类型消息的到达率和状态
        // ext.put("icon",
        // "http://pic.qiantucdn.com/58pic/12/38/18/13758PIC4GV.jpg");//
        // 自定义推送消息在通知栏的图标,value为一个公网可以访问的URL
        JSONObject payload = new JSONObject();
        payload.put("hps", hps);
        // 华为PUSH消息总结构体
        JSONObject hps = new JSONObject();
        hps.put("msg", msg);
        hps.put("ext", ext);
        String postBody = MessageFormat.format(
                "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
                URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
                URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000), "UTF-8"),
                URLEncoder.encode(deviceTokenList.toString(), "UTF-8"), URLEncoder.encode(payload.toString(), "UTF-8"));
        JSONObject payload = new JSONObject();
        payload.put("hps", hps);
        String postUrl = apiUrl + "?nsp_ctx="
                + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
        String result = httpPost(postUrl, postBody, 5000, 5000);
        String postBody = MessageFormat.format(
                "access_token={0}&nsp_svc={1}&nsp_ts={2}&device_token_list={3}&payload={4}",
                URLEncoder.encode(accessToken, "UTF-8"), URLEncoder.encode("openpush.message.api.send", "UTF-8"),
                URLEncoder.encode(String.valueOf(System.currentTimeMillis() / 1000), "UTF-8"),
                URLEncoder.encode(deviceTokenList.toString(), "UTF-8"), URLEncoder.encode(payload.toString(), "UTF-8"));
        return result;
    }
        String postUrl = apiUrl + "?nsp_ctx="
                + URLEncoder.encode("{\"ver\":\"1\", \"appId\":\"" + appId + "\"}", "UTF-8");
        String result = httpPost(postUrl, postBody, 5000, 5000);
    /**
     *
     * 方法说明: 获取下发通知消息的认证Token
     *
     * @author mawurui createTime 2018年5月14日 下午4:47:26
     * @throws IOException
     */
    private static void refreshToken() throws IOException {
        String msgBody = MessageFormat.format("grant_type=client_credentials&client_secret={0}&client_id={1}",
                URLEncoder.encode(appSecret, "UTF-8"), appId);
        String response = httpPost(tokenUrl, msgBody, 5000, 5000);
        JSONObject obj = JSONObject.parseObject(response);
        accessToken = obj.getString("access_token");
        tokenExpiredTime = System.currentTimeMillis() + obj.getLong("expires_in") * 1000 - 5 * 60 * 1000;
    }
        return result;
    }
    public static String httpPost(String httpUrl, String data, int connectTimeout, int readTimeout) throws IOException {
        OutputStream outPut = null;
        HttpURLConnection urlConnection = null;
        InputStream in = null;
    /**
     * 方法说明: 获取下发通知消息的认证Token
     *
     * @throws IOException
     * @author mawurui createTime 2018年5月14日 下午4:47:26
     */
    private static void refreshToken() throws IOException {
        String msgBody = MessageFormat.format("grant_type=client_credentials&client_secret={0}&client_id={1}",
                URLEncoder.encode(appSecret, "UTF-8"), appId);
        String response = httpPost(tokenUrl, msgBody, 5000, 5000);
        JSONObject obj = JSONObject.parseObject(response);
        accessToken = obj.getString("access_token");
        tokenExpiredTime = System.currentTimeMillis() + obj.getLong("expires_in") * 1000 - 5 * 60 * 1000;
    }
        try {
            URL url = new URL(httpUrl);
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("POST");
            urlConnection.setDoOutput(true);
            urlConnection.setDoInput(true);
            urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            urlConnection.setConnectTimeout(connectTimeout);
            urlConnection.setReadTimeout(readTimeout);
            urlConnection.connect();
    public static String httpPost(String httpUrl, String data, int connectTimeout, int readTimeout) throws IOException {
        OutputStream outPut = null;
        HttpURLConnection urlConnection = null;
        InputStream in = null;
            // POST data
            outPut = urlConnection.getOutputStream();
            outPut.write(data.getBytes("UTF-8"));
            outPut.flush();
        try {
            URL url = new URL(httpUrl);
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("POST");
            urlConnection.setDoOutput(true);
            urlConnection.setDoInput(true);
            urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            urlConnection.setConnectTimeout(connectTimeout);
            urlConnection.setReadTimeout(readTimeout);
            urlConnection.connect();
            if (urlConnection.getResponseCode() < 400) {
                in = urlConnection.getInputStream();
            } else {
                in = urlConnection.getErrorStream();
            }
            // POST data
            outPut = urlConnection.getOutputStream();
            outPut.write(data.getBytes("UTF-8"));
            outPut.flush();
            List<String> lines = IOUtils.readLines(in, urlConnection.getContentEncoding());
            StringBuffer strBuf = new StringBuffer();
            for (String line : lines) {
                strBuf.append(line);
            }
            System.out.println(strBuf.toString());
            return strBuf.toString();
        } finally {
            IOUtils.closeQuietly(outPut);
            IOUtils.closeQuietly(in);
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
        }
    }
            if (urlConnection.getResponseCode() < 400) {
                in = urlConnection.getInputStream();
            } else {
                in = urlConnection.getErrorStream();
            }
            List<String> lines = IOUtils.readLines(in, urlConnection.getContentEncoding());
            StringBuffer strBuf = new StringBuffer();
            for (String line : lines) {
                strBuf.append(line);
            }
            System.out.println(strBuf.toString());
            return strBuf.toString();
        } finally {
            IOUtils.closeQuietly(outPut);
            IOUtils.closeQuietly(in);
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java
@@ -33,253 +33,249 @@
@Component
public class IOSPushUtil {
    private static IOSPushUtil iosPushUtil;
    private static IOSPushUtil iosPushUtil;
    @Autowired
    private BusinessSystemService businessSystemService;
    @Autowired
    private BusinessSystemService businessSystemService;
    @PostConstruct
    public void init() {
        iosPushUtil = this;
        iosPushUtil.businessSystemService = this.businessSystemService;
    }
    @PostConstruct
    public void init() {
        iosPushUtil = this;
        iosPushUtil.businessSystemService = this.businessSystemService;
    }
    /**
     *
     * 方法说明: IOS 多推
     *
     * @author mawurui createTime 2018年5月8日 上午10:19:57
     * @param deviceToken
     * @param packages
     * @param alert
     * @return
     * @throws Exception
     */
    public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type)
            throws Exception {
    /**
     * 方法说明: IOS 多推
     *
     * @param deviceToken
     * @param packages
     * @param alert
     * @return
     * @throws Exception
     * @author mawurui createTime 2018年5月8日 上午10:19:57
     */
    public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type, String pwd)
            throws Exception {
        // if (Constant.IS_TEST)
        // return null;
        // if (Constant.IS_TEST)
        // return null;
        Gson gson = new Gson();
        PushLogHelper.iosInfo("IOS推送设备数为:" + deviceTokenList.size());
        PushLogHelper.iosInfo("IOS推送的内容为:" + gson.toJson(info));
        List<String> tokenList = new ArrayList<String>();
        for (String deviceToken : deviceTokenList) {
            tokenList.add(deviceToken);
        }
        // json自定义传值
        Gson gson = new Gson();
        PushLogHelper.iosInfo("IOS推送设备数为:" + deviceTokenList.size());
        PushLogHelper.iosInfo("IOS推送的内容为:" + gson.toJson(info));
        List<String> tokenList = new ArrayList<String>();
        for (String deviceToken : deviceTokenList) {
            tokenList.add(deviceToken);
        }
        // json自定义传值
        JSONObject json = null;
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
                for (String st : sts) {
                    if (st.contains("id=")) {
                        auctionId = Long.parseLong(st.replace("id=", "").trim());
                    }
                }
            }
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = url;
            // HttpUtil.getShortLink(url);
            // if (StringUtil.isNullOrEmpty(shortUrl))
            // throw new Exception("获取短链出错");
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.welfare.getCode()) {
            json = IOSPushFactory.createWelfarePush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        JSONObject json = null;
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
                for (String st : sts) {
                    if (st.contains("id=")) {
                        auctionId = Long.parseLong(st.replace("id=", "").trim());
                    }
                }
            }
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = url;
            // HttpUtil.getShortLink(url);
            // if (StringUtil.isNullOrEmpty(shortUrl))
            // throw new Exception("获取短链出错");
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.welfare.getCode()) {
            json = IOSPushFactory.createWelfarePush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        // 分组推送 每50个设备为一组
        // 分组推送 每50个设备为一组
        InputStream certificate = IOSPushUtil.class.getClassLoader()
                .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
        String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd();
        if (tokenList != null && tokenList.size() > 0) {
            int pageSize = 50;
            int page = tokenList.size() % pageSize == 0 ? tokenList.size() / pageSize : tokenList.size() / pageSize + 1;
            for (int i = 0; i < page; i++) {
                int start = i * pageSize;
                int end = start + pageSize;
                if (end > tokenList.size())
                    end = tokenList.size();
                pushIOS(tokenList.subList(start, end), json, certificate, certificatePassword);
            }
        InputStream certificate = IOSPushUtil.class.getClassLoader()
                .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
        String certificatePassword = pwd;
        if (tokenList != null && tokenList.size() > 0) {
            int pageSize = 50;
            int page = tokenList.size() % pageSize == 0 ? tokenList.size() / pageSize : tokenList.size() / pageSize + 1;
            for (int i = 0; i < page; i++) {
                int start = i * pageSize;
                int end = start + pageSize;
                if (end > tokenList.size())
                    end = tokenList.size();
                pushIOS(tokenList.subList(start, end), json, certificate, certificatePassword);
            }
        }
        }
        return null;
    }
        return null;
    }
    public static String pushIOS(List<String> deviceTokenList, JSONObject json, InputStream certificate,
            String certificatePWD) throws Exception {
        List<String> tokenList = new ArrayList<String>();
        for (String deviceToken : deviceTokenList) {
            tokenList.add(deviceToken);
        }
        while (json.toString().getBytes().length > 256) {
            // 首先削减内容,然后削减标题
            String title = json.optJSONObject("aps").optJSONObject("alert").optString("title");
            String body = json.optJSONObject("aps").optJSONObject("alert").optString("body");
            if (StringUtil.isNullOrEmpty(body) || body.length() < 4) {
                // 削减标题
                if (!StringUtil.isNullOrEmpty(title) && body.length() > 6) {
                    json.optJSONObject("aps").optJSONObject("alert").put("title",
                            title.substring(0, title.length() - 1));
                    continue;
                }
            } else {
                json.optJSONObject("aps").optJSONObject("alert").put("body", body.substring(0, body.length() - 1));
                continue;
            }
        }
    public static String pushIOS(List<String> deviceTokenList, JSONObject json, InputStream certificate,
                                 String certificatePWD) throws Exception {
        List<String> tokenList = new ArrayList<String>();
        for (String deviceToken : deviceTokenList) {
            tokenList.add(deviceToken);
        }
        while (json.toString().getBytes().length > 256) {
            // 首先削减内容,然后削减标题
            String title = json.optJSONObject("aps").optJSONObject("alert").optString("title");
            String body = json.optJSONObject("aps").optJSONObject("alert").optString("body");
            if (StringUtil.isNullOrEmpty(body) || body.length() < 4) {
                // 削减标题
                if (!StringUtil.isNullOrEmpty(title) && body.length() > 6) {
                    json.optJSONObject("aps").optJSONObject("alert").put("title",
                            title.substring(0, title.length() - 1));
                    continue;
                }
            } else {
                json.optJSONObject("aps").optJSONObject("alert").put("body", body.substring(0, body.length() - 1));
                continue;
            }
        }
        LogHelper.test("IOS推送的字节数" + json.toString().getBytes().length);
        PushNotificationPayload payLoad = new PushNotificationPayload();
        payLoad = PushNotificationPayload.fromJSON(json.toString());
        LogHelper.test("IOS推送的字节数" + json.toString().getBytes().length);
        PushNotificationPayload payLoad = new PushNotificationPayload();
        payLoad = PushNotificationPayload.fromJSON(json.toString());
        PushNotificationManager pushManager = new PushNotificationManager();
        // true:表示的是产品线上发布推送服务 false:表示的是产品测试推送服务
        if (Constant.IS_TEST)
            pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
        else
            pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
        PushNotificationManager pushManager = new PushNotificationManager();
        // true:表示的是产品线上发布推送服务 false:表示的是产品测试推送服务
        if (Constant.IS_TEST)
            pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
        else
            pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
        List<Device> deviceList = new ArrayList<Device>();
        for (String token : tokenList) {
            if (!StringUtil.isNullOrEmpty(token))
                deviceList.add(new BasicDevice(token));
        }
        // 开始推送
        List<PushedNotification> notificationList = pushManager.sendNotifications(payLoad, deviceList);
        Gson gson = new Gson();
        if (notificationList != null)
            for (PushedNotification notification : notificationList) {
                PushLogHelper.iosInfo(gson.toJson(notification));
            }
        pushManager.stopConnection();
        return null;
    }
        List<Device> deviceList = new ArrayList<Device>();
        for (String token : tokenList) {
            if (!StringUtil.isNullOrEmpty(token))
                deviceList.add(new BasicDevice(token));
        }
        // 开始推送
        List<PushedNotification> notificationList = pushManager.sendNotifications(payLoad, deviceList);
        Gson gson = new Gson();
        if (notificationList != null)
            for (PushedNotification notification : notificationList) {
                PushLogHelper.iosInfo(gson.toJson(notification));
            }
        pushManager.stopConnection();
        return null;
    }
    /**
     *
     * @author mawurui createTime 2018年5月8日 下午12:12:19
     * @param info
     * @param json
     * @param pushRecord
     * @return
     * @throws Exception
     */
    public static int allFanLiQuanDevice(System b_IOS, List<String> deviceTokenList, String PACKAGES, String title,
            String content, String url, PushRecord pushRecord, int type) throws Exception {
    /**
     * @param info
     * @param json
     * @param pushRecord
     * @return
     * @throws Exception
     * @author mawurui createTime 2018年5月8日 下午12:12:19
     */
    public static int allFanLiQuanDevice(System b_IOS, List<String> deviceTokenList, String PACKAGES, String title,
                                         String content, String url, PushRecord pushRecord, int type,String pwd) throws Exception {
        return pushApp(deviceTokenList, PACKAGES, title, content, b_IOS, url, pushRecord, type);
    }
        return pushApp(deviceTokenList, PACKAGES, title, content, b_IOS, url, pushRecord, type,pwd);
    }
    /**
     *
     * @param info
     * @param params
     * @param pushRecord
     * @return 1:都成功 2:仅android 成功 3.仅IOS成功 4.都失败
     * @throws Exception
     */
    private static int pushApp(List<String> deviceTokenList, String PACKAGES, String title, String content,
            System b_IOS, String url, PushRecord pushRecord, int type) throws Exception {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        String IOS = allPushIOS(deviceTokenList, info, url, type);
        LogHelper.userInfo("IOS的推送日志:" + IOS);
        pushRecord.setIosPushId(IOS);
        if (IOS != null) {
            return 1;
        } else {
            return 4;
        }
    }
    /**
     * @param info
     * @param params
     * @param pushRecord
     * @return 1:都成功 2:仅android 成功 3.仅IOS成功 4.都失败
     * @throws Exception
     */
    private static int pushApp(List<String> deviceTokenList, String PACKAGES, String title, String content,
                               System b_IOS, String url, PushRecord pushRecord, int type, String pwd) throws Exception {
        MessageInfo info = new MessageInfo();
        info.setTitle(title);
        info.setContent(content);
        String IOS = allPushIOS(deviceTokenList, info, url, type, pwd);
        LogHelper.userInfo("IOS的推送日志:" + IOS);
        pushRecord.setIosPushId(IOS);
        if (IOS != null) {
            return 1;
        } else {
            return 4;
        }
    }
    /**
     * 执行推送
     *
     * @param tokenList
     * @param json
     * @throws Exception
     */
    public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception {
        InputStream certificate = IOSPushUtil.class.getClassLoader()
                .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
        String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd();
        pushIOS(tokenList, json, certificate, certificatePassword);
    }
    /**
     * 执行推送
     *
     * @param tokenList
     * @param json
     * @throws Exception
     */
    public static void executePushIOS(List<String> tokenList, JSONObject json, String pwd) throws Exception {
        InputStream certificate = IOSPushUtil.class.getClassLoader()
                .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
        String certificatePassword = pwd;
        pushIOS(tokenList, json, certificate, certificatePassword);
    }
    /**
     *
     * 方法说明: IOS 多推
     *
     * @author mawurui createTime 2018年5月8日 上午10:19:57
     * @param deviceToken
     * @param packages
     * @param alert
     * @return
     * @throws Exception
     */
    public static JSONObject getJSONObject(MessageInfo info, String url, int type) throws Exception {
    /**
     * 方法说明: IOS 多推
     *
     * @param deviceToken
     * @param packages
     * @param alert
     * @return
     * @throws Exception
     * @author mawurui createTime 2018年5月8日 上午10:19:57
     */
    public static JSONObject getJSONObject(MessageInfo info, String url, int type) throws Exception {
        // json自定义传值
        JSONObject json = null;
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
                for (String st : sts) {
                    if (st.contains("id=")) {
                        auctionId = Long.parseLong(st.replace("id=", "").trim());
                    }
                }
            }
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        // json自定义传值
        JSONObject json = null;
        if (type == PushTypeEnum.goodsdetail.getCode()) {
            Long auctionId = null;
            if (url.contains("id=")) {
                String[] sts = url.split("\\?")[1].split("&");
                for (String st : sts) {
                    if (st.contains("id=")) {
                        auctionId = Long.parseLong(st.replace("id=", "").trim());
                    }
                }
            }
            if (auctionId == null)
                throw new Exception("淘宝商品ID提取出错");
            json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.url.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                throw new Exception("获取短链出错");
            json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.ZNX.getCode()) {
            json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.weex.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.baichuan.getCode()) {
            String shortUrl = HttpUtil.getShortLink(url);
            if (StringUtil.isNullOrEmpty(shortUrl))
                shortUrl = url;
            json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
        } else if (type == PushTypeEnum.signin.getCode()) {
            json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
        }
        return json;
    }
        return json;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/push/OPPOPushUtil.java
@@ -75,12 +75,12 @@
     * @param goodsId
     * @throws PushException
     */
    public static void pushGoods(List<String> registerIds, String title, String content, int goodsType, Long goodsId)
    public static void pushGoods(List<String> registerIds, String title, String content, int goodsType, Long goodsId,String androidBaseActivity)
            throws PushException {
        if (registerIds != null && registerIds.size() > 100)
            throw new PushException(1, "设备数不能超过100个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName()
        String activity =androidBaseActivity
                + ".ui.recommend.GoodsBrowserActivity";
        Map<String, String> params = getParams("goodsdetail", activity, null, null, goodsId);
@@ -104,12 +104,12 @@
     *            -网页链接
     * @throws PushException
     */
    public static void pushUrl(List<String> registerIds, String title, String content, String url)
    public static void pushUrl(List<String> registerIds, String title, String content, String url,String androidBaseActivity)
            throws PushException {
        if (registerIds != null && registerIds.size() > 100)
            throw new PushException(1, "设备数不能超过1000个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.invite.ShareBrowserActivity";
        String activity =androidBaseActivity + ".ui.invite.ShareBrowserActivity";
        Map<String, String> params = getParams("url", activity, null, url, null);
        try {
            boolean success = push(registerIds, title, content, params);
@@ -147,9 +147,9 @@
        }
    }
    public static void pushWEEX(List<String> registerIds, String title, String content, String weexUrl)
    public static void pushWEEX(List<String> registerIds, String title, String content, String weexUrl,String androidBaseActivity)
            throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName()
        String activity =androidBaseActivity
                + ".ui.mine.weex.WeexApplicationActivity";
        Map<String, String> params = getParams("weex", activity, weexUrl, weexUrl, null);
        if (params == null)
@@ -179,8 +179,8 @@
        }
    }
    public static void pushWelfareCenter(List<String> registerIds, String title, String content) throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.WelfareCenterActivity";
    public static void pushWelfareCenter(List<String> registerIds, String title, String content,String androidBaseActivity) throws PushException {
        String activity =androidBaseActivity + ".ui.mine.WelfareCenterActivity";
        Map<String, String> params = getParams("welfare", activity, null, null, null);
        if (params == null)
            return;
@@ -194,9 +194,9 @@
        }
    }
    public static void pushUserSignInNotification(List<String> registerIds, String title, String content)
    public static void pushUserSignInNotification(List<String> registerIds, String title, String content,String androidBaseActivity)
            throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.goldtask.GoldTaskActivity";
        String activity =androidBaseActivity + ".ui.goldtask.GoldTaskActivity";
        Map<String, String> params = getParams("signin", activity, null, null, null);
        if (params == null)
            return;
fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java
@@ -58,7 +58,7 @@
     * @throws Exception
     */
    public static int allPushIOS(MessageInfo info, PushRecord pushRecord, String url, int type,
            List<String> deviceTokenList) throws Exception {
            List<String> deviceTokenList,String pwd) throws Exception {
        /*
         * com.yeshi.fanli.entity.system.System b_IOS =
@@ -69,7 +69,7 @@
        if (Constant.IS_TEST)
            return 1;
        String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type);
        String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type,pwd);
        LogHelper.userInfo("IOS的推送日志:" + IOS);
        pushRecord.setIosPushId(IOS);
@@ -136,7 +136,7 @@
     * @return
     */
    public static String singlePushIOS(MessageInfo info, PushRecord pushRecord, String url, int type,
            List<String> deviceTokenList) {
            List<String> deviceTokenList, String pwd) {
        if (Constant.IS_TEST)
            return null;
        if (deviceTokenList != null && deviceTokenList.size() > 0) {
@@ -145,7 +145,7 @@
                    try {
                        List<String> deviceList = new ArrayList<>();
                        deviceList.add(deviceToken);
                        String IOS = IOSPushUtil.allPushIOS(deviceList, info, url, type);
                        String IOS = IOSPushUtil.allPushIOS(deviceList, info, url, type,pwd);
                        pushRecord.setIosPushId(IOS);
                    } catch (Exception e) {
                        e.printStackTrace();
fanli/src/main/java/com/yeshi/fanli/util/push/VIVOPushUtil.java
@@ -153,12 +153,12 @@
     * @param goodsId
     * @throws PushException
     */
    public static void pushGoods(List<String> registerIds, String title, String content, int goodsType, Long goodsId)
    public static void pushGoods(List<String> registerIds, String title, String content, int goodsType, Long goodsId,String androidBaseActivity)
            throws PushException {
        if (registerIds != null && registerIds.size() > 500)
            throw new PushException(1, "设备数不能超过500个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName()
        String activity = androidBaseActivity
                + ".ui.recommend.GoodsBrowserActivity";
        Message.Builder builder = getMessageBuidler(PushTypeEnum.goodsdetail, title, content, activity, null, null,
                goodsId);
@@ -182,11 +182,11 @@
     *            -网页链接
     * @throws PushException
     */
    public static void pushUrl(List<String> registerIds, String title, String content, String url)
    public static void pushUrl(List<String> registerIds, String title, String content, String url,String androidBaseActivity)
            throws PushException {
        if (registerIds != null && registerIds.size() > 500)
            throw new PushException(1, "设备数不能超过500个");
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.invite.ShareBrowserActivity";
        String activity = androidBaseActivity + ".ui.invite.ShareBrowserActivity";
        Message.Builder builder = getMessageBuidler(PushTypeEnum.url, title, content, activity, null, url, null);
        try {
            boolean success = push(registerIds, builder);
@@ -221,9 +221,9 @@
        }
    }
    public static void pushWEEX(List<String> registerIds, String title, String content, String weexUrl)
    public static void pushWEEX(List<String> registerIds, String title, String content, String weexUrl,String androidBaseActivity)
            throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName()
        String activity = androidBaseActivity
                + ".ui.mine.weex.WeexApplicationActivity";
        Message.Builder builder = getMessageBuidler(PushTypeEnum.weex, title, content, activity, weexUrl, weexUrl,
                null);
@@ -249,8 +249,8 @@
        }
    }
    public static void pushWelfareCenter(List<String> registerIds, String title, String content) throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.WelfareCenterActivity";
    public static void pushWelfareCenter(List<String> registerIds, String title, String content,String androidBaseActivity) throws PushException {
        String activity = androidBaseActivity + ".ui.mine.WelfareCenterActivity";
        Message.Builder builder = getMessageBuidler(PushTypeEnum.welfare, title, content, activity, null, null, null);
        try {
            boolean success = push(registerIds, builder);
@@ -261,9 +261,9 @@
        }
    }
    public static void pushUserSignInNotification(List<String> registerIds, String title, String content)
    public static void pushUserSignInNotification(List<String> registerIds, String title, String content,String androidBaseActivity)
            throws PushException {
        String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.goldtask.GoldTaskActivity";
        String activity = androidBaseActivity + ".ui.goldtask.GoldTaskActivity";
        Message.Builder builder = getMessageBuidler(PushTypeEnum.signin, title, content, activity, null, null, null);
        try {
            boolean success = push(registerIds, builder);
fanli/src/main/java/com/yeshi/fanli/util/push/XiaoMiPushUtil.java
@@ -29,281 +29,262 @@
@Component
public class XiaoMiPushUtil {
    private static XiaoMiPushUtil xiaoMiPushUtil;
    private static XiaoMiPushUtil xiaoMiPushUtil;
    @Autowired
    private BusinessSystemService businessSystemService;
    @Autowired
    private BusinessSystemService businessSystemService;
    @PostConstruct
    public void init() {
        xiaoMiPushUtil = this;
        xiaoMiPushUtil.businessSystemService = this.businessSystemService;
    }
    @PostConstruct
    public void init() {
        xiaoMiPushUtil = this;
        xiaoMiPushUtil.businessSystemService = this.businessSystemService;
    }
    // AppKey
    private static String XIAOMI_F_ANDROID_APP_KEY = PropertiesUtil.getMap().get("xiaomi_f_android_app_key");
    // AppKey
    private static String XIAOMI_F_ANDROID_APP_KEY = PropertiesUtil.getMap().get("xiaomi_f_android_app_key");
    // AppSecert
    private static String XIAOMI_F_ANDROID_APP_SECERT = PropertiesUtil.getMap().get("xiaomi_f_android_app_secert");
    // AppSecert
    private static String XIAOMI_F_ANDROID_APP_SECERT = PropertiesUtil.getMap().get("xiaomi_f_android_app_secert");
    /**
     *
     * 方法说明: 小米推送安卓(全推)
     *
     * @author mawurui createTime 2018年3月7日 上午9:57:56
     * @param info
     * @param params
     * @param system
     * @return
     */
    public static String allPushAndroidForXM(MessageInfo info, Map<String, Object> map) {
        if (Constant.IS_TEST)
            return null;
    /**
     * 方法说明: 小米推送安卓(全推)
     *
     * @param info
     * @param params
     * @param system
     * @return
     * @author mawurui createTime 2018年3月7日 上午9:57:56
     */
    public static String allPushAndroidForXM(MessageInfo info, Map<String, Object> map) {
        if (Constant.IS_TEST)
            return null;
        String name = info.getPackageName();
        if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
                && !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
            return null;
        }
        String name = info.getPackageName();
        // 从info中取页面传来的值
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 申请的AppSecert
        String title = info.getTitle();
        String payload = info.getContent();
        String description = info.getContent();
        // 从info中取页面传来的值
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 申请的AppSecert
        String title = info.getTitle();
        String payload = info.getContent();
        String description = info.getContent();
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
                .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
                // 1表示透传,0表示通知栏消息(默认)
                .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
        // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.broadcastAll(message, 3);
            return result.getMessageId();// 成功 返回消息的Id, 失败返回null
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
                .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
                                                            // 1表示透传,0表示通知栏消息(默认)
                .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
                                // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.broadcastAll(message, 3);
            return result.getMessageId();// 成功 返回消息的Id, 失败返回null
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 批量推送
     *
     * @param info
     * @param map
     * @param regList 最大个数为1000
     * @return
     */
    public static String pushBatchAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regList) {
        if (Constant.IS_TEST)
            return null;
        if (regList == null || regList.size() == 0)
            return "";
    /**
     * 批量推送
     *
     * @param info
     * @param map
     * @param regList
     *            最大个数为1000
     * @return
     */
    public static String pushBatchAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regList) {
        if (Constant.IS_TEST)
            return null;
        if (regList == null || regList.size() == 0)
            return "";
        String name = info.getPackageName();
        String name = info.getPackageName();
        if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
                && !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
            return null;
        }
        // 从info中取页面传来的值
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 申请的AppSecert
        String title = info.getTitle();
        String payload = info.getContent();
        String description = info.getContent();
        // 从info中取页面传来的值
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT); // 申请的AppSecert
        String title = info.getTitle();
        String payload = info.getContent();
        String description = info.getContent();
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
                .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
                // 1表示透传,0表示通知栏消息(默认)
                .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
        // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.send(message, regList, 3);
            return result.getMessageId();// 成功 返回消息的Id, 失败返回null
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).payload(payload)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE))
                .description(description).passThrough(0) // 设置消息是否通过透传方式至App,
                                                            // 1表示透传,0表示通知栏消息(默认)
                .notifyType(1); // 设置通知类型, type类型(1-默认提示音, 2-使用默认震动提示,
                                // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.send(message, regList, 3);
            return result.getMessageId();// 成功 返回消息的Id, 失败返回null
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * 方法说明: 小米推送安卓(单推)
     *
     * @param info
     * @param params
     * @param system
     * @return
     * @author mawurui createTime 2018年3月7日 下午5:09:18
     */
    public static String singlePushAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regIds,
                                                System system) {
        String name = info.getPackageName();
    /**
     *
     * 方法说明: 小米推送安卓(单推)
     *
     * @author mawurui createTime 2018年3月7日 下午5:09:18
     * @param info
     * @param params
     * @param system
     * @return
     */
    public static String singlePushAndroidForXM(MessageInfo info, Map<String, Object> map, List<String> regIds,
            System system) {
        String name = info.getPackageName();
        if (!Constant.systemCommonConfig.getAndroidPackageName().equalsIgnoreCase(name)
                && !Constant.systemCommonConfig.getIosBundleId().equalsIgnoreCase(name)) {
            return null;
        }
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT);
        String title = info.getTitle();
        String content = info.getContent();
        String uId = info.getAlias();
        Constants.useOfficial(); // 启动推送方法
        String PackageName = info.getPackageName();
        Sender sender = new Sender(XIAOMI_F_ANDROID_APP_SECERT);
        String title = info.getTitle();
        String content = info.getContent();
        String uId = info.getAlias();
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).description(content)
                .passThrough(0) // 设置消息是否通过透传方式至App, 1表示透传,0表示通知栏消息(默认)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE)).notifyType(1); // 设置通知类型,
                                                                                    // type类型(1-默认提示音,
                                                                                    // 2-使用默认震动提示,
        // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.send(message, regIds, 3); // sender.sendToAlias(message,
                                                                // uId, 3);
            PushLogHelper.xmInfo("推送结果:" + result.getReason());
            return result.getMessageId();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
        Message message = null; // 做循环传来的key
        Builder builder = new Message.Builder().restrictedPackageName(PackageName).title(title).description(content)
                .passThrough(0) // 设置消息是否通过透传方式至App, 1表示透传,0表示通知栏消息(默认)
                .notifyId((int) (Math.random() * Integer.MAX_VALUE)).notifyType(1); // 设置通知类型,
        // type类型(1-默认提示音,
        // 2-使用默认震动提示,
        // 3-使用默认led灯光提示)
        // 将extra放入MessageInfo对象中, 循环遍历extra中的key 和 value
        if (map != null) {
            for (String key : map.keySet()) {
                builder.extra(key, map.get(key).toString());
            }
        }
        message = builder.build();
        try {
            Result result = sender.send(message, regIds, 3); // sender.sendToAlias(message,
            // uId, 3);
            PushLogHelper.xmInfo("推送结果:" + result.getReason());
            return result.getMessageId();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     *
     * 方法说明: 小米推送红包
     *
     * @author mawurui createTime 2018年3月8日 上午9:55:14
     * @param info
     */
    public static void pushByHongBao(List<String> regIds, System system) {
        MessageInfo info = new MessageInfo();
        info.setTitle("新到红包");
        info.setDescription("红包到来了...");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "hongbao");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     * 方法说明: 小米推送红包
     *
     * @param info
     * @author mawurui createTime 2018年3月8日 上午9:55:14
     */
    public static void pushByHongBao(List<String> regIds, System system) {
        MessageInfo info = new MessageInfo();
        info.setTitle("新到红包");
        info.setDescription("红包到来了...");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "hongbao");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     *
     * 方法说明: 小米推送提现申请
     *
     * @author mawurui createTime 2018年3月8日 上午10:00:16
     * @param info
     */
    public static void pushByApply(List<String> regIds, System system) {
        MessageInfo info = new MessageInfo();
        info.setTitle("提现申请");
        info.setDescription("提现审核中...");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "cash");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     * 方法说明: 小米推送提现申请
     *
     * @param info
     * @author mawurui createTime 2018年3月8日 上午10:00:16
     */
    public static void pushByApply(List<String> regIds, System system) {
        MessageInfo info = new MessageInfo();
        info.setTitle("提现申请");
        info.setDescription("提现审核中...");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "cash");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     *
     * 方法说明: 推送提现状态
     *
     * @author mawurui createTime 2018年3月8日 上午10:26:34
     * @param alias
     * @param state
     * @param system
     */
    public static void pushByExtract(List<String> regIds, int state, System system) {
        MessageInfo info = new MessageInfo();
        if (state == 0) {
            info.setTitle("提现成功");
            info.setDescription("您有一笔交易,已提现成功!");
        } else if (state == 1) {
            info.setTitle("提现失败");
            info.setDescription("您有一笔交易,提现失败!");
        } else {
            info.setTitle("提现失败");
            info.setDescription("提现被拒绝");
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "cash");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     * 方法说明: 推送提现状态
     *
     * @param alias
     * @param state
     * @param system
     * @author mawurui createTime 2018年3月8日 上午10:26:34
     */
    public static void pushByExtract(List<String> regIds, int state, System system) {
        MessageInfo info = new MessageInfo();
        if (state == 0) {
            info.setTitle("提现成功");
            info.setDescription("您有一笔交易,已提现成功!");
        } else if (state == 1) {
            info.setTitle("提现失败");
            info.setDescription("您有一笔交易,提现失败!");
        } else {
            info.setTitle("提现失败");
            info.setDescription("提现被拒绝");
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("type", "cash");
        XiaoMiPushUtil.singlePushAndroidForXM(info, JsonUtil.parseData(jsonObject), regIds, system);
    }
    /**
     *
     * @param info
     * @param params
     * @param pushRecord
     * @return 1:都成功 2:仅android 成功 3.仅IOS成功 4.都失败
     */
    private static int pushApp(MessageInfo info, JSONObject json, PushRecord pushRecord, System b_android) {
        // jsonXm 转换为 map
        JSONObject mapXm = JSONObject.fromObject(json);
        String android = allPushAndroidForXM(info, mapXm);
        LogHelper.userInfo("小米推送:" + android);
        pushRecord.setAndroidPushId(android);
        if (android != null) {
            return 1;
        } else {
            return 4;
        }
    }
    /**
     * @param info
     * @param params
     * @param pushRecord
     * @return 1:都成功 2:仅android 成功 3.仅IOS成功 4.都失败
     */
    private static int pushApp(MessageInfo info, JSONObject json, PushRecord pushRecord, System b_android) {
        // jsonXm 转换为 map
        JSONObject mapXm = JSONObject.fromObject(json);
        String android = allPushAndroidForXM(info, mapXm);
        LogHelper.userInfo("小米推送:" + android);
        pushRecord.setAndroidPushId(android);
        if (android != null) {
            return 1;
        } else {
            return 4;
        }
    }
    public static void pushZNX(List<String> regIds, String title, String content, String msgId) {
        // 小米开始推送
        MessageInfo info = new MessageInfo();
        info.setActivty(
                String.format("%s.ui.BrowserActivity", Constant.systemCommonConfig.getAndroidBaseactivityName()));
        info.setTitle(title);
        info.setContent(content);
        info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
        JSONObject json = new JSONObject();
        json.put("type", "ZNX");
        json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                Constant.systemCommonConfig.getAndroidBaseactivityName()));
    public static void pushZNX(List<String> regIds, String title, String content, String msgId, String androidPackageName, String androidBaseActivityName) {
        // 小米开始推送
        MessageInfo info = new MessageInfo();
        info.setActivty(
                String.format("%s.ui.BrowserActivity", androidBaseActivityName));
        info.setTitle(title);
        info.setContent(content);
        info.setPackageName(androidPackageName);
        JSONObject json = new JSONObject();
        json.put("type", "ZNX");
        json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
                androidBaseActivityName));
        JSONObject contentJson = new JSONObject();
        contentJson.put("id", msgId);
        contentJson.put("title", title);
        contentJson.put("content", content);
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
        json.put("content", contentJson);
        JSONObject mapXm = JSONObject.fromObject(json);
        XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, regIds, null);
    }
        JSONObject contentJson = new JSONObject();
        contentJson.put("id", msgId);
        contentJson.put("title", title);
        contentJson.put("content", content);
        contentJson.put("isOpen", 0);
        contentJson.put("createTime", java.lang.System.currentTimeMillis());
        json.put("content", contentJson);
        JSONObject mapXm = JSONObject.fromObject(json);
        XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, regIds, null);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/wx/MyWXLoginUtil.java
@@ -17,18 +17,9 @@
public class MyWXLoginUtil {
    public static String WEXIN_APPID = "wx43617e2ed82c5b28";
    public static String WEXIN_SECRET = "f8a65908fb4681bdd181de70f6ab9a3b";
    static {
        WEXIN_APPID = Constant.systemCommonConfig.getWxGZAppId();
        WEXIN_SECRET = Constant.systemCommonConfig.getWxGZAppSecret();
    }
    public static WeiXinUserParam getWxWYParam(String code) {
        WeiXinUserParam weiXinUserParam = WXAppLoginUtil.getWxParam(code, WEXIN_APPID, WEXIN_SECRET);
    public static WeiXinUserParam getWxWYParam(String code, String wxGZAppId, String wxGZAppSecret) {
        WeiXinUserParam weiXinUserParam = WXAppLoginUtil.getWxParam(code, wxGZAppId, wxGZAppSecret);
        return weiXinUserParam;
    }
@@ -73,8 +64,8 @@
        return user;
    }
    public static WeiXinUser getWeiXinWYUser(String code) {
        WeiXinUserParam param = getWxWYParam(code);
    public static WeiXinUser getWeiXinWYUser(String code, String wxGZAppId, String wxGZAppSecret) {
        WeiXinUserParam param = getWxWYParam(code,wxGZAppId,wxGZAppSecret);
        if (param == null) {
            return null;
        }
fanli/src/main/resource/mapping/SystemConfigMapper.xml
@@ -2,56 +2,57 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.SystemConfigMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemConfig">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="key" property="key" jdbcType="VARCHAR"/>
    <result column="value" property="value" jdbcType="VARCHAR"/>
    <result column="name" property="name" jdbcType="VARCHAR"/>
    <result column="updatetime" property="updatetime" jdbcType="BIGINT"/>
  </resultMap>
  <sql id="Base_Column_List">id,`key`,`value`,`name`,updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_config (id,`key`,`value`,`name`,updatetime) values (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{updatetime,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="key != null">`key`,</if>
      <if test="value != null">`value`,</if>
      <if test="name != null">`name`,</if>
      <if test="updatetime != null">updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">#{updatetime,jdbcType=BIGINT},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemConfig">update yeshi_ec_system_config set `key` = #{key,jdbcType=VARCHAR},`value` = #{value,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},updatetime = #{updatetime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig">update yeshi_ec_system_config
    <set>
      <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">`value`=#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
      <if test="updatetime != null">updatetime=#{updatetime,jdbcType=BIGINT},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getByKey" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_config  t
    WHERE t.`key` = #{key}
    LIMIT 1
  </select>
  <select id="getByKeyAndSystemId" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_system_config  t
    LEFT JOIN `yeshi_ec_system_systemconfig` g ON g.`scid` = t.`id`
    WHERE t.`key` = #{key} AND g.`sid` = #{systemId}
    LIMIT 1
  </select>
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemConfig">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="key" property="key" jdbcType="VARCHAR"/>
        <result column="value" property="value" jdbcType="VARCHAR"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="updatetime" property="updatetime" jdbcType="BIGINT"/>
        <result column="system" property="system" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">id,`key`,`value`,`name`,updatetime,system</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey"
            parameterType="java.lang.Long">delete from yeshi_ec_system_config where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true"
            keyProperty="id">insert into yeshi_ec_system_config (id,`key`,`value`,`name`,updatetime,system) values (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{updatetime,jdbcType=BIGINT},#{system,jdbcType=VARCHAR})</insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig" useGeneratedKeys="true"
            keyProperty="id">insert into yeshi_ec_system_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="key != null">`key`,</if>
            <if test="value != null">`value`,</if>
            <if test="name != null">`name`,</if>
            <if test="updatetime != null">updatetime,</if>
            <if test="system != null">system,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="key != null">#{key,jdbcType=VARCHAR},</if>
            <if test="value != null">#{value,jdbcType=VARCHAR},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="updatetime != null">#{updatetime,jdbcType=BIGINT},</if>
            <if test="system != null">#{system,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
            parameterType="com.yeshi.fanli.entity.system.SystemConfig">update yeshi_ec_system_config set `key` = #{key,jdbcType=VARCHAR},`value` = #{value,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},updatetime = #{updatetime,jdbcType=BIGINT},`system` = #{system,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemConfig">update
        yeshi_ec_system_config
        <set>
            <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
            <if test="value != null">`value`=#{value,jdbcType=VARCHAR},</if>
            <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
            <if test="updatetime != null">updatetime=#{updatetime,jdbcType=BIGINT},</if>
            <if test="system !=null">system =#{system,jdbcType=VARCHAR},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <select id="selectByKeyAndSystem"
            resultMap="BaseResultMap">SELECT * FROM yeshi_ec_system_config t where t.key=#{key} and t.system=#{system}</select>
</mapper>
fanli/src/main/resource/mapping/homemodule/SpecialMapper.xml
@@ -10,6 +10,7 @@
        <result column="b_main_picture" property="picture" jdbcType="VARCHAR" />
        <result column="b_icon" property="icon" jdbcType="VARCHAR" />
        <result column="b_sub_picture" property="subPicture" jdbcType="VARCHAR" />
        <result column="b_bg_color" property="bgColor" jdbcType="VARCHAR" />
        <result column="b_params" property="params" jdbcType="VARCHAR" />
        <result column="b_jump_login" property="jumpLogin" jdbcType="VARCHAR" />
        <result column="b_orderby" property="orderby" jdbcType="INTEGER" />
@@ -44,6 +45,7 @@
        <result column="b_main_picture" property="picture" jdbcType="VARCHAR" />
        <result column="b_icon" property="icon" jdbcType="VARCHAR" />
        <result column="b_sub_picture" property="subPicture" jdbcType="VARCHAR" />
        <result column="b_bg_color" property="bgColor" jdbcType="VARCHAR" />
        <result column="b_params" property="params" jdbcType="VARCHAR" />
        <result column="b_jump_login" property="jumpLogin" jdbcType="VARCHAR" />
        <result column="b_orderby" property="orderby" jdbcType="INTEGER" />
@@ -73,7 +75,7 @@
    </resultMap>
    
    
    <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime,b_system</sql>
    <sql id="Base_Column_List">b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime,b_system,b_bg_color</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
@@ -84,9 +86,9 @@
        yeshi_ec_special where b_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_special
        (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime,b_system)
        (b_id,b_name,b_card,b_card_id,b_main_picture,b_icon,b_sub_picture,b_jumpid,b_params,b_jump_login,b_orderby,b_order_man,b_order_woman,b_state,b_sex,b_show_type,b_remark,b_min_android_version_code,b_min_ios_version_code,b_start_time,b_end_time,b_createtime,b_updatetime,b_system,b_bg_color)
        values
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIOSVersionCode,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP},#{system,jdbcType=VARCHAR})</insert>
        (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{card,jdbcType=VARCHAR},#{cardId,jdbcType=BIGINT},#{picture,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{subPicture,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpLogin,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{orderMan,jdbcType=INTEGER},#{orderWoman,jdbcType=INTEGER},#{state,jdbcType=BIGINT},#{sex,jdbcType=INTEGER},#{showType,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{minAndroidVersionCode,jdbcType=INTEGER},#{minIOSVersionCode,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP},#{system,jdbcType=VARCHAR},#{bgColor,jdbcType=VARCHAR})</insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_special
@@ -98,6 +100,7 @@
            <if test="picture != null">b_main_picture,</if>
            <if test="icon != null">b_icon,</if>
            <if test="subPicture != null">b_sub_picture,</if>
            <if test="bgColor != null">b_bg_color,</if>
            <if test="jumpDetail != null">b_jumpid,</if>
            <if test="params != null">b_params,</if>
            <if test="jumpLogin != null">b_jump_login,</if>
@@ -125,6 +128,7 @@
            <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
            <if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
            <if test="subPicture != null">#{subPicture,jdbcType=VARCHAR},</if>
            <if test="bgColor != null">#{bgColor,jdbcType=VARCHAR},</if>
            <if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
            <if test="params != null">#{params,jdbcType=VARCHAR},</if>
            <if test="jumpLogin != null">#{jumpLogin,jdbcType=VARCHAR},</if>
@@ -162,7 +166,9 @@
        #{remark,jdbcType=VARCHAR},b_min_android_version_code = #{minAndroidVersionCode,jdbcType=INTEGER},b_min_ios_version_code = #{minIOSVersionCode,jdbcType=INTEGER},
        b_start_time = #{startTime,jdbcType=TIMESTAMP},b_end_time = #{endTime,jdbcType=TIMESTAMP},b_createtime =
        #{createtime,jdbcType=TIMESTAMP},b_updatetime =
        #{updatetime,jdbcType=TIMESTAMP},b_sex=#{sex,jdbcType=INTEGER},b_system=#{system,jdbcType=VARCHAR} where
        #{updatetime,jdbcType=TIMESTAMP},b_sex=#{sex,jdbcType=INTEGER},b_system=#{system,jdbcType=VARCHAR},b_bg_color=#{bgColor,jdbcType=VARCHAR}
        where
        b_id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.Special">
        update yeshi_ec_special
@@ -173,6 +179,7 @@
            <if test="picture != null">b_main_picture=#{picture,jdbcType=VARCHAR},</if>
            <if test="icon != null">b_icon=#{icon,jdbcType=VARCHAR},</if>
            <if test="subPicture != null">b_sub_picture=#{subPicture,jdbcType=VARCHAR},</if>
            <if test="bgColor != null">b_bg_color=#{bgColor,jdbcType=VARCHAR},</if>
            <if test="jumpDetail != null">b_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
            <if test="params != null">b_params=#{params,jdbcType=VARCHAR},</if>
            <if test="jumpLogin != null">b_jump_login=#{jumpLogin,jdbcType=VARCHAR},</if>
fanli/src/main/resource/mapping/push/PushQueueRecordMapper.xml
@@ -2,62 +2,77 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.push.PushQueueRecordMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushQueueRecord">
    <id column="qe_id" property="id" jdbcType="BIGINT"/>
    <result column="qe_type" property="type" jdbcType="INTEGER"/>
    <result column="qe_content" property="jsonContent" jdbcType="VARCHAR"/>
    <result column="qe_start_cursor" property="startCursor" jdbcType="BIGINT"/>
    <result column="qe_end_cursor" property="endCursor" jdbcType="BIGINT"/>
    <result column="qe_record_cursor" property="recordCursor" jdbcType="BIGINT"/>
    <result column="qe_push_num" property="pushNum" jdbcType="INTEGER"/>
    <result column="qe_state" property="state" jdbcType="INTEGER"/>
    <result column="qe_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="qe_endtime" property="endtime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">qe_id,qe_type,qe_content,qe_start_cursor,qe_end_cursor,qe_record_cursor,qe_push_num,qe_state,qe_createtime,qe_endtime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_push_queue where qe_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_queue where qe_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_queue (qe_id,qe_type,qe_content,qe_start_cursor,qe_end_cursor,qe_record_cursor,qe_push_num,qe_state,qe_createtime,qe_endtime) values (#{id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{jsonContent,jdbcType=VARCHAR},#{startCursor,jdbcType=BIGINT},#{endCursor,jdbcType=BIGINT},#{recordCursor,jdbcType=BIGINT},#{pushNum,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{endtime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_queue
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">qe_id,</if>
      <if test="type != null">qe_type,</if>
      <if test="jsonContent != null">qe_content,</if>
      <if test="startCursor != null">qe_start_cursor,</if>
      <if test="endCursor != null">qe_end_cursor,</if>
      <if test="recordCursor != null">qe_record_cursor,</if>
      <if test="pushNum != null">qe_push_num,</if>
      <if test="state != null">qe_state,</if>
      <if test="createtime != null">qe_createtime,</if>
      <if test="endtime != null">qe_endtime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="type != null">#{type,jdbcType=INTEGER},</if>
      <if test="jsonContent != null">#{jsonContent,jdbcType=VARCHAR},</if>
      <if test="startCursor != null">#{startCursor,jdbcType=BIGINT},</if>
      <if test="endCursor != null">#{endCursor,jdbcType=BIGINT},</if>
      <if test="recordCursor != null">#{recordCursor,jdbcType=BIGINT},</if>
      <if test="pushNum != null">#{pushNum,jdbcType=INTEGER},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="endtime != null">#{endtime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord">update yeshi_ec_push_queue set qe_type = #{type,jdbcType=INTEGER},qe_content = #{jsonContent,jdbcType=VARCHAR},qe_start_cursor = #{startCursor,jdbcType=BIGINT},qe_end_cursor = #{endCursor,jdbcType=BIGINT},qe_record_cursor = #{recordCursor,jdbcType=BIGINT},qe_push_num = #{pushNum,jdbcType=INTEGER},qe_state = #{state,jdbcType=INTEGER},qe_createtime = #{createtime,jdbcType=TIMESTAMP},qe_endtime = #{endtime,jdbcType=TIMESTAMP} where qe_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord">update yeshi_ec_push_queue
    <set>
      <if test="type != null">qe_type=#{type,jdbcType=INTEGER},</if>
      <if test="jsonContent != null">qe_content=#{jsonContent,jdbcType=VARCHAR},</if>
      <if test="startCursor != null">qe_start_cursor=#{startCursor,jdbcType=BIGINT},</if>
      <if test="endCursor != null">qe_end_cursor=#{endCursor,jdbcType=BIGINT},</if>
      <if test="recordCursor != null">qe_record_cursor=#{recordCursor,jdbcType=BIGINT},</if>
      <if test="pushNum != null">qe_push_num=#{pushNum,jdbcType=INTEGER},</if>
      <if test="state != null">qe_state=#{state,jdbcType=INTEGER},</if>
      <if test="createtime != null">qe_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="endtime != null">qe_endtime=#{endtime,jdbcType=TIMESTAMP},</if>
    </set> where qe_id = #{id,jdbcType=BIGINT}
  </update>
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushQueueRecord">
        <id column="qe_id" property="id" jdbcType="BIGINT"/>
        <result column="qe_type" property="type" jdbcType="INTEGER"/>
        <result column="qe_content" property="jsonContent" jdbcType="VARCHAR"/>
        <result column="qe_start_cursor" property="startCursor" jdbcType="BIGINT"/>
        <result column="qe_end_cursor" property="endCursor" jdbcType="BIGINT"/>
        <result column="qe_record_cursor" property="recordCursor" jdbcType="BIGINT"/>
        <result column="qe_push_num" property="pushNum" jdbcType="INTEGER"/>
        <result column="qe_state" property="state" jdbcType="INTEGER"/>
        <result column="qe_createtime" property="createtime" jdbcType="TIMESTAMP"/>
        <result column="qe_endtime" property="endtime" jdbcType="TIMESTAMP"/>
        <result column="qe_versions" property="versions" jdbcType="VARCHAR"/>
        <result column="qe_system" property="system" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">qe_id,qe_type,qe_content,qe_start_cursor,qe_end_cursor,qe_record_cursor,qe_push_num,qe_state,qe_createtime,qe_endtime,qe_versions,qe_system</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>from yeshi_ec_push_queue where qe_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey"
            parameterType="java.lang.Long">delete from yeshi_ec_push_queue where qe_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord" useGeneratedKeys="true"
            keyProperty="id">insert into yeshi_ec_push_queue (qe_id,qe_type,qe_content,qe_start_cursor,qe_end_cursor,qe_record_cursor,qe_push_num,qe_state,qe_createtime,qe_endtime,qe_id,qe_versions,qe_system) values (#{id,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{jsonContent,jdbcType=VARCHAR},#{startCursor,jdbcType=BIGINT},#{endCursor,jdbcType=BIGINT},#{recordCursor,jdbcType=BIGINT},#{pushNum,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{endtime,jdbcType=TIMESTAMP},#{id,jdbcType=BIGINT},#{versions,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR})</insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord" useGeneratedKeys="true"
            keyProperty="id">insert into yeshi_ec_push_queue
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">qe_id,</if>
            <if test="type != null">qe_type,</if>
            <if test="jsonContent != null">qe_content,</if>
            <if test="startCursor != null">qe_start_cursor,</if>
            <if test="endCursor != null">qe_end_cursor,</if>
            <if test="recordCursor != null">qe_record_cursor,</if>
            <if test="pushNum != null">qe_push_num,</if>
            <if test="state != null">qe_state,</if>
            <if test="createtime != null">qe_createtime,</if>
            <if test="endtime != null">qe_endtime,</if>
            <if test="versions != null">qe_versions,</if>
            <if test="system != null">qe_system,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="jsonContent != null">#{jsonContent,jdbcType=VARCHAR},</if>
            <if test="startCursor != null">#{startCursor,jdbcType=BIGINT},</if>
            <if test="endCursor != null">#{endCursor,jdbcType=BIGINT},</if>
            <if test="recordCursor != null">#{recordCursor,jdbcType=BIGINT},</if>
            <if test="pushNum != null">#{pushNum,jdbcType=INTEGER},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="endtime != null">#{endtime,jdbcType=TIMESTAMP},</if>
            <if test="versions != null">#{versions,jdbcType=VARCHAR},</if>
            <if test="system != null">#{system,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
            parameterType="com.yeshi.fanli.entity.push.PushQueueRecord">update yeshi_ec_push_queue set qe_type = #{type,jdbcType=INTEGER},qe_content = #{jsonContent,jdbcType=VARCHAR},qe_start_cursor = #{startCursor,jdbcType=BIGINT},qe_end_cursor = #{endCursor,jdbcType=BIGINT},qe_record_cursor = #{recordCursor,jdbcType=BIGINT},qe_push_num = #{pushNum,jdbcType=INTEGER},qe_state = #{state,jdbcType=INTEGER},qe_createtime = #{createtime,jdbcType=TIMESTAMP},qe_endtime = #{endtime,jdbcType=TIMESTAMP} ,qe_versions =#{versions,jdbcType=VARCHAR} ,qe_system =#{system,jdbcType=VARCHAR} where qe_id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushQueueRecord">update
        yeshi_ec_push_queue
        <set>
            <if test="type != null">qe_type=#{type,jdbcType=INTEGER},</if>
            <if test="jsonContent != null">qe_content=#{jsonContent,jdbcType=VARCHAR},</if>
            <if test="startCursor != null">qe_start_cursor=#{startCursor,jdbcType=BIGINT},</if>
            <if test="endCursor != null">qe_end_cursor=#{endCursor,jdbcType=BIGINT},</if>
            <if test="recordCursor != null">qe_record_cursor=#{recordCursor,jdbcType=BIGINT},</if>
            <if test="pushNum != null">qe_push_num=#{pushNum,jdbcType=INTEGER},</if>
            <if test="state != null">qe_state=#{state,jdbcType=INTEGER},</if>
            <if test="createtime != null">qe_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
            <if test="endtime != null">qe_endtime=#{endtime,jdbcType=TIMESTAMP},</if>
            <if test="versions !=null">qe_versions =#{versions,jdbcType=VARCHAR},</if>
            <if test="system !=null">qe_system =#{system,jdbcType=VARCHAR},</if>
        </set>
        where qe_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>