| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 账号打通
|
| | | * |
| | | * @param acceptData
|
| | | * @param mainUid
|
| | | * @param lessUid
|
| | | * @param session
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "connect")
|
| | | public void connect(AcceptData acceptData, long mainUid, long lessUid, HttpSession session, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (mainUid == 0 || lessUid == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "请上传打通用户ID"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | userAccountService.connectUsers(new UserInfo(mainUid), new UserInfo(lessUid));
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(mainUid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", GsonUtil.toJsonExpose(UserUtil.filterForClientUser(user)));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserAccountException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户ID
|
| | |
| | | form.setWxName(xinUser.getNickname());
|
| | | String wxHeadImg = COSManager.getInstance()
|
| | | .uploadFile(HttpUtil.getAsInputStream(xinUser.getHeadimgurl()),
|
| | | Constant.WXHEADURL + UUID.randomUUID().toString())
|
| | | FilePathEnum.userPortrait + UUID.randomUUID().toString())
|
| | | .getUrl();
|
| | | form.setWxPic(wxHeadImg);
|
| | | } else if (formLoginType == Constant.TAOBAO) {
|
| | |
| | | import com.yeshi.fanli.exception.config.HelpCenterException;
|
| | | import com.yeshi.fanli.service.inter.help.HelpCenterService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.AdActivityVersionControlService;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.db.MongoDBManager;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private HelpCenterMapper helpCenterMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MongoDBManager mongoDBManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private AdActivityVersionControlService adActivityVersionControlService;
|
| | | |
| | |
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(HelpCenter record) {
|
| | |
| | | public HelpCenter selectByPrimaryKey(Long id) {
|
| | | return helpCenterMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public HelpCenter selectByPrimaryKeyCache(Long id) {
|
| | | return selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String save(HelpCenter helpCenter, String content, String html) throws HelpCenterException,Exception {
|
| | | public String save(HelpCenter helpCenter, String content, String html) throws HelpCenterException, Exception {
|
| | | if (StringUtil.isNullOrEmpty(helpCenter.getTitle()))
|
| | | throw new HelpCenterException(1,"标题不能为空");
|
| | | |
| | | throw new HelpCenterException(1, "标题不能为空");
|
| | |
|
| | | if (helpCenter.getHelpClass() == null || helpCenter.getHelpClass().getId() <= 0)
|
| | | throw new HelpCenterException(1,"分类题不能为空");
|
| | | |
| | | throw new HelpCenterException(1, "分类题不能为空");
|
| | |
|
| | | Integer state = helpCenter.getState();
|
| | | if (state == null) {
|
| | | helpCenter.setState(0);
|
| | | }
|
| | | |
| | |
|
| | | Integer weight = helpCenter.getWeight();
|
| | | if (weight == null) {
|
| | | helpCenter.setWeight(0);
|
| | | }
|
| | | |
| | |
|
| | | helpCenter.setUpdatetime(new Date());
|
| | | Long id = helpCenter.getId();
|
| | | if (id == null) {
|
| | |
| | | helpCenterMapper.insert(helpCenter);
|
| | | } else {
|
| | | HelpCenter result = helpCenterMapper.selectByPrimaryKey(id);
|
| | | if (result == null) |
| | | throw new HelpCenterException(1,"此类内容已不存在,请刷新");
|
| | | |
| | | if (result == null)
|
| | | throw new HelpCenterException(1, "此类内容已不存在,请刷新");
|
| | |
|
| | | helpCenter.setCreatetime(result.getCreatetime());
|
| | | helpCenterMapper.updateByPrimaryKey(helpCenter);
|
| | | }
|
| | | |
| | |
|
| | | List<Map<String, Object>> positions = getPosition(html);
|
| | | if (positions != null && positions.size() > 0) {
|
| | | @SuppressWarnings("restriction")
|
| | | sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
|
| | | |
| | |
|
| | | for (int i = 0; i < positions.size(); i++) {
|
| | | Map<String, Object> map = positions.get(i);
|
| | | String base64Img = (String) map.get("base64Img");
|
| | |
| | |
|
| | | String type = (String) map.get("type");
|
| | | // 上传文件相对位置
|
| | | String fileUrl = "helpInfo/" + UUID.randomUUID().toString().replace("-", "") + "." +type;
|
| | | String fileUrl = FilePathEnum.helpCenterContent + UUID.randomUUID().toString().replace("-", "") + "."
|
| | | + type;
|
| | | /* 上传新图片 */
|
| | | String uploadFilePath = COSManager.getInstance().uploadFileByte(b, fileUrl).getUrl();
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | String replaceHtml = replaceIframe(html);
|
| | | Long backId = helpCenter.getId();
|
| | | HelpInfo helpInfo = new HelpInfo(backId, content, replaceHtml);
|
| | |
| | | indexStart = tm + compareStrLength;
|
| | | indexTypeStart = typetm + compareStrLength;
|
| | |
|
| | | //System.out.println(indexStart);
|
| | | //System.out.println(indexTypeStart);
|
| | | |
| | | // System.out.println(indexStart);
|
| | | // System.out.println(indexTypeStart);
|
| | |
|
| | | place.put("start", tm + 7);
|
| | |
|
| | | String suffix = content.substring(typetm + 11, tm - 1);
|
| | | place.put("type", suffix);
|
| | | |
| | |
|
| | | String newContent = content.substring(tm + 7, content.length());
|
| | | |
| | | |
| | |
|
| | | char qmark = '"';
|
| | | int end = newContent.indexOf(qmark);
|
| | | place.put("end", end);
|
| | |
|
| | | String base64Img = newContent.substring(0, end);
|
| | | place.put("base64Img", base64Img);
|
| | | |
| | | |
| | | String header = compareStrStart + suffix+ ";" + compareStr +"," +base64Img;
|
| | |
|
| | | String header = compareStrStart + suffix + ";" + compareStr + "," + base64Img;
|
| | | place.put("header", header);
|
| | | |
| | | |
| | |
|
| | | listMap.add(place);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public String replaceIframe(String html) {
|
| | | |
| | |
|
| | | String result = html;
|
| | | |
| | |
|
| | | // 字符串查找初始从0开始查找
|
| | | int indexStart = 0;
|
| | | // 需要对比的字符串
|
| | | String compareStr = "<iframe";
|
| | | |
| | |
|
| | | int compareStrLength = compareStr.length();
|
| | | |
| | |
|
| | | while (true) {
|
| | | |
| | |
|
| | | int tm = html.indexOf(compareStr, indexStart);
|
| | | |
| | |
|
| | | if (tm <= 0) {
|
| | | // 直到没有匹配结果为止
|
| | | break;
|
| | | } else {
|
| | | // 起始位置
|
| | | indexStart = tm + compareStrLength;
|
| | | |
| | |
|
| | | // 结束位置
|
| | | String newContent = html.substring(tm, html.length());
|
| | | int end = newContent.indexOf("</iframe>");
|
| | | |
| | | // 替换指定字段 <iframe src=""></iframe>
|
| | | String replaceStr = html.substring(tm, tm + end + 9);
|
| | | |
| | |
|
| | | // 替换指定字段 <iframe src=""></iframe>
|
| | | String replaceStr = html.substring(tm, tm + end + 9);
|
| | |
|
| | | char qmark = '"';
|
| | | // src 起始位置
|
| | | int srcindex = replaceStr.indexOf("src=", 0);
|
| | | |
| | |
|
| | | String replaceSrc = replaceStr.substring(srcindex + 5, replaceStr.length());
|
| | | // src "结束位置
|
| | | int endsrc = replaceSrc.indexOf(qmark, 0);
|
| | | |
| | | String src = replaceSrc.substring(0, endsrc +1);
|
| | | |
| | |
|
| | | String src = replaceSrc.substring(0, endsrc + 1);
|
| | |
|
| | | String voide = "<video src=\"" + src + " controls=\"controls\"> 您的浏览器不支持video标签,请更新浏览器</video>";
|
| | | |
| | |
|
| | | result = html.replace(replaceStr, voide);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | |
| | | return helpCenterMapper.countQuery(key, cid, state);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "helpCenterCache",key="'queryIdAndTitle-'+#pageId+'-'+#key+'-'+#cid")
|
| | | @Cacheable(value = "helpCenterCache", key = "'queryIdAndTitle-'+#pageId+'-'+#key+'-'+#cid")
|
| | | public List<HelpCenter> listValid(long pageId, int pageSize, String key, Long cid) {
|
| | | return helpCenterMapper.listValid(pageId, pageSize, key, cid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public int deleteBatchById(List<String> idList) {
|
| | | return helpCenterMapper.deleteBatchById(idList);
|
| | |
| | | public HelpInfo getHelpInfo(Long id) {
|
| | | return mongoDBManager.getHelpInfo(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "helpCenterCache",key="'getHelpInfoCache-'+#id")
|
| | | @Cacheable(value = "helpCenterCache", key = "'getHelpInfoCache-'+#id")
|
| | | public HelpInfo getHelpInfoCache(Long id) {
|
| | | return getHelpInfo(id);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public void deleteInfoBatchById(List<String> idList) {
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void deleteInfoBatchById(List<String> idList) {
|
| | | if (idList != null) {
|
| | | for (String id : idList) {
|
| | | mongoDBManager.removeHelpInfo(Long.parseLong(id));
|
| | |
| | | if (new File(targetPath).exists() && new File(targetPath).length() > 0) {
|
| | | String fileUrl = null;
|
| | | if (uid == null) {
|
| | | fileUrl = FilePathEnum.ercode.getPath() + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | fileUrl = FilePathEnum.invitePictureDemo.getPath() + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | } else {
|
| | | fileUrl = FilePathEnum.ercode.getPath() + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | }
|
| | |
| | | // 上传文件相对位置
|
| | | String fileUrl = null;
|
| | | if (uid == null) {
|
| | | fileUrl = FilePathEnum.ercode.getPath() + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | fileUrl = FilePathEnum.invitePictureDemo.getPath() + "ercode_" + uuid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | } else {
|
| | | fileUrl = FilePathEnum.ercode.getPath() + "ercode_" + uid + "_" + System.currentTimeMillis() + "_" + urlMd5 + ".jpg";
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.io.File;
|
| | | import java.io.FileWriter;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserConnectHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dto.user.wx.WXMPLoginData;
|
| | | import com.yeshi.fanli.dto.user.wx.WXMPLoginResult;
|
| | | import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.LoginResult;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserConnectHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException;
|
| | | import com.yeshi.fanli.exception.user.ThreeSaleException;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.extract.BindingAccountService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FilePathEnum;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void connectUsers(HttpSession session) throws UserAccountException {
|
| | | UserInfo mainUser = (UserInfo) session.getAttribute("WEIXIN_USERINFO");
|
| | | UserInfo lessUser = (UserInfo) session.getAttribute("LAST_LOGIN_USER");
|
| | |
|
| | | int lessUserLoginType = lessUser.getLoginType();
|
| | |
|
| | | if (mainUser == null || lessUser == null || mainUser.getId() == null || lessUser.getId() == null)
|
| | | throw new UserAccountException(30001, "缺少打通账号");
|
| | |
|
| | | mainUser = userInfoMapper.selectByPrimaryKeyForUpdate(mainUser.getId());
|
| | | lessUser = userInfoMapper.selectByPrimaryKeyForUpdate(lessUser.getId());
|
| | |
|
| | | session.removeAttribute("WEIXIN_USERINFO");
|
| | | session.removeAttribute("LAST_LOGIN_USER");
|
| | |
|
| | | if (mainUser == null || lessUser == null)
|
| | | throw new UserAccountException(30002, "缺少打通账号");
|
| | |
|
| | | // 判断是否有绑定相同类型的账号
|
| | | if (lessUserLoginType == 1) {// 次账号以淘宝登录
|
| | | if (!StringUtil.isNullOrEmpty(mainUser.getPhone()) && !StringUtil.isNullOrEmpty(lessUser.getPhone())
|
| | | && !lessUser.getPhone().equalsIgnoreCase(mainUser.getPhone()))
|
| | | throw new UserAccountException(30003, "请先解除其中一个账号的手机绑定");
|
| | |
|
| | | } else if (lessUserLoginType == 3) {// 次账号以手机号登录
|
| | | if (!StringUtil.isNullOrEmpty(mainUser.getOpenid()) && !StringUtil.isNullOrEmpty(lessUser.getOpenid())
|
| | | && !lessUser.getOpenid().equalsIgnoreCase(mainUser.getOpenid()))
|
| | | throw new UserAccountException(30003, "请先解除其中一个账号的淘宝绑定");
|
| | | }
|
| | | connectUsers(mainUser, lessUser);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void connectUsers(UserInfo mainUser, UserInfo lessUser) throws UserAccountException {
|
| | | mainUser = userInfoMapper.selectByPrimaryKeyForUpdate(mainUser.getId());
|
| | | lessUser = userInfoMapper.selectByPrimaryKeyForUpdate(lessUser.getId());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(mainUser.getOpenid()) && !StringUtil.isNullOrEmpty(lessUser.getOpenid()))
|
| | | throw new UserAccountException(9, "两个账号都绑定了淘宝,请解绑其中一个");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(mainUser.getPhone()) && !StringUtil.isNullOrEmpty(lessUser.getPhone()))
|
| | | throw new UserAccountException(9, "两个账号都绑定了手机号码,请解绑其中一个");
|
| | |
|
| | | if (lessUser.getMyHongBao().compareTo(new BigDecimal("10")) >= 0
|
| | | && mainUser.getMyHongBao().compareTo(new BigDecimal("10")) > 0)
|
| | | throw new UserAccountException(10, String.format("账户ID:%s 的资金超过10元,为保证资金安全请联系客服打通", lessUser.getId() + ""));
|
| | |
|
| | | // 判定是否绑定了同一支付宝
|
| | | BindingAccount mainUserAccount = bindingAccountService.getBindingAccountByUidAndType(mainUser.getId(),
|
| | | BindingAccount.TYPE_ALIPAY);
|
| | |
|
| | | BindingAccount lessUserAccount = bindingAccountService.getBindingAccountByUidAndType(lessUser.getId(),
|
| | | BindingAccount.TYPE_ALIPAY);
|
| | |
|
| | | // 有不同的支付宝账号
|
| | | boolean hasDiffrentAlipayAccount = false;
|
| | | if (mainUserAccount != null && lessUserAccount != null) {
|
| | | if (!mainUserAccount.getAccount().equalsIgnoreCase(lessUserAccount.getAccount()))
|
| | | hasDiffrentAlipayAccount = true;
|
| | | }
|
| | |
|
| | | if (hasDiffrentAlipayAccount)
|
| | | throw new UserAccountException(10, "两个账户都绑定了支付宝,请先解绑其中一个");
|
| | |
|
| | | // 判定是否有重叠的账号
|
| | | UserInfo updateUser = new UserInfo(mainUser.getId());
|
| | | if (!StringUtil.isNullOrEmpty(lessUser.getOpenid())) {
|
| | | updateUser.setOpenid(lessUser.getOpenid());
|
| | | updateUser.setTbName(lessUser.getTbName());
|
| | | updateUser.setTbPic(lessUser.getTbPic());
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(lessUser.getPhone())) {
|
| | | updateUser.setPhone(lessUser.getPhone());
|
| | | }
|
| | |
|
| | | // 备份原来的用户信息
|
| | | String logUrl = backupUserImportantInfo(lessUser.getId());
|
| | |
|
| | | // 添加打通记录
|
| | | UserConnectHistory userConnectHistory = new UserConnectHistory();
|
| | | userConnectHistory.setCreateTime(new Date());
|
| | | userConnectHistory.setLessUser(lessUser);
|
| | | userConnectHistory.setMainUser(mainUser);
|
| | | userConnectHistory.setLogUrl(logUrl);
|
| | | userConnectHistoryMapper.insertSelective(userConnectHistory);
|
| | |
|
| | | userInfoMapper.updateByPrimaryKeySelective(updateUser);
|
| | | // 删除原来的账号
|
| | | UserInfo updateLessUser = new UserInfo(lessUser.getId());
|
| | | updateLessUser.setState(UserInfo.STATE_DELETE);
|
| | | updateLessUser.setStateDesc("账号被打通删除");
|
| | | userInfoMapper.updateByPrimaryKeySelective(updateLessUser);
|
| | | // 融合业务
|
| | | userInfoMapper.connectUser(mainUser.getId(), lessUser.getId());
|
| | |
|
| | | // 查询是否有多余的新人红包
|
| | | int subCount = 0;
|
| | | int addCount = 0;
|
| | |
|
| | | userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId());
|
| | |
|
| | | userInfoDeleteRecordService.addDeleteRecord(lessUser.getId(), UserInfo.STATE_DELETE, "删除:账号被打通删除");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据系统与unionid寻找用户
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public String backupUserImportantInfo(Long uid) {
|
| | |
|
| | | String logPath = String.format(FileUtil.getCacheDir() + "/benfen_%s_" + uid + ".log",
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyyMMddHHmmss"));
|
| | |
|
| | | // 备份用户信息
|
| | | UserInfo user = userInfoMapper.selectAvailableByPrimaryKey(uid);
|
| | |
|
| | | // TODO 备份资金明细
|
| | |
|
| | | // 备份邀请关系
|
| | | List<ThreeSale> threeSaleList = new ArrayList<>();
|
| | |
|
| | | FileWriter fw = null;
|
| | | try {
|
| | | // 设置为:True,表示写入的时候追加数据
|
| | | fw = new FileWriter(new File(logPath), true);
|
| | |
|
| | | fw.write("#UserInfo" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(user) + "\r\n");
|
| | |
|
| | | fw.write("#ThreeSale" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(threeSaleList) + "\r\n");
|
| | |
|
| | | fw.close();
|
| | |
|
| | | String logUrl = COSManager.getInstance()
|
| | | .uploadFile(new File(logPath), FilePathEnum.beifen.getPath() + new File(logPath).getName()).getUrl();
|
| | | return logUrl;
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | } finally {
|
| | | if (new File(logPath).exists())
|
| | | new File(logPath).delete();
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void clearUserPortrait(Long uid) {
|
| | | if (uid == null)
|
| | | return;
|
| | |
| | | InputStream asInputStream = HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl());
|
| | | if (asInputStream != null) {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
|
| | | String.format(FilePathEnum.userPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(),
|
| | | String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(),
|
| | | System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl()))
|
| | | portrait = result.getUrl();
|
| | |
| | | LogHelper.test("微信头像下载失败: " + weiXinUser.getUnionid() + " " + headimgurl);
|
| | | } else {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String
|
| | | .format(FilePathEnum.userPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | .format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | headimgurl = result.getUrl();
|
| | | } else {
|
| | |
| | | InputStream asInputStream = HttpUtil.getAsInputStream(weiXinUser.getHeadimgurl());
|
| | | if (asInputStream != null) {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String
|
| | | .format(FilePathEnum.userPortrait.getPath() +"%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | .format(FilePathEnum.userWXPortrait.getPath() +"%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl()))
|
| | | portrait = result.getUrl();
|
| | | } else {
|
| | |
| | | LogHelper.test("微信头像下载失败: " + weiXinUser.getUnionid() + " " + headimgurl);
|
| | | } else {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String.format(
|
| | | FilePathEnum.userPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | headimgurl = result.getUrl();
|
| | | } else {
|
| | |
| | | LogHelper.test("微信头像下载失败: " + weiXinUser.getUnionid() + " " + headimgurl);
|
| | | } else {
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream, String.format(
|
| | | FilePathEnum.userPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", weiXinUser.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | headimgurl = result.getUrl();
|
| | | } else {
|
| | |
| | | public LoginResult loginNoInstallWX(AcceptData acceptData, String appId, String code, String phone,
|
| | | UserInfo tbUserInfo, int loginType) throws UserAccountException;
|
| | |
|
| | | /**
|
| | | * 打通微信账号与其他类型的一个账号
|
| | | * |
| | | * @param session
|
| | | * @throws UserAccountException
|
| | | */
|
| | | public void connectUsers(HttpSession session) throws UserAccountException;
|
| | |
|
| | | /**
|
| | | * 备份重要的用户信息
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public String backupUserImportantInfo(Long uid);
|
| | |
|
| | | /**
|
| | | * 打通两个账号,以主账号为主
|
| | | * |
| | | * @param mainUser
|
| | | * @param lessUser
|
| | | * @throws UserAccountException
|
| | | */
|
| | | public void connectUsers(UserInfo mainUser, UserInfo lessUser) throws UserAccountException;
|
| | |
|
| | | /**
|
| | | * 注册用户
|
| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | public enum FilePathEnum {
|
| | | userPortrait("/img/user/", "用户头像"), // -- /portrait/wx/ -- /wx/headImg/
|
| | | userERcode("/img/user/erCode/", "用户上传微信二维码"),
|
| | | userComplaint("/img/UserComplaint/", "用户吐槽图片"),
|
| | | userRankings("/userRankings/", "奖金排行榜假用户头像"),
|
| | | beifen("/beifen/", ""), |
| | | activityUserPortrait("/img/GoodsSubClass/", "活动用户头像"),
|
| | | apk("/apk/admin/", "上传Apk安装包"), // -- /img/admin/
|
| | | section("/section/", "后台上传图片路径"), // -- /img/admin/
|
| | | |
| | | shareGoods("/sharegoods/", "分享商品图片"),
|
| | | shareXCX("/sharegoods/xcx/", "分享小程序图片"),
|
| | | ercode("/ercode/", "分享邀请图二维码图片"),
|
| | | invite("/img/invite/", "分享邀请好友图片"),
|
| | | |
| | | helpClass("/img/HelpClass/", "帮助中心分类图片"),
|
| | | goodsClassOld("/ClassImg/", "商品一级分类图片-老版"),
|
| | | goodsClass("/img/GoodsClass/", "商品一级分类图片"),
|
| | | goodsSubClass("/img/GoodsSubClass/", "商品二级以下分类图片"),
|
| | | lable("/LableImg/", "标签图片"),
|
| | | taoBaoShop("/img/TaoBaoShop/", "淘宝店铺图片"),
|
| | | |
| | | brand("/img/brand/", "品牌图片"),
|
| | | article("/img/article/", "学院文章图片"),
|
| | | floatAD("/img/FloatAD/", "首页弹框图片"),
|
| | | homeNavbar("/img/HomeNavbar/", "导航栏图片"),
|
| | | specialCard("/img/SpecialCard/", "专题管理图片"),
|
| | | special("/img/special/", "专题图片"),
|
| | | swiper("/img/swiperPic/", "轮播图片"),
|
| | | banLiShopClass("/img/shopGoodsClass/", "板栗商城分类图片"),
|
| | | banLiShopGoods("/img/BanLiShopGoods/", "板栗商城商品图片");
|
| | | |
| | | // 用户相关
|
| | | userPortrait("/user/img/portrait/", "用户头像"),
|
| | | userWXPortrait("/user/img/portrait_wx/", "用户微信头像"),
|
| | | userERcode("/user/img/ercode/", "用户上传微信二维码"),
|
| | | userComplaint("/user/img/user_complaint/", "用户吐槽图片"),
|
| | | activityUserPortrait("/user/img/dynamic/portrait/", "动态用户头像"),
|
| | | ercode("/user/img/invite/", "分享邀请图二维码图片"),
|
| | | shareGoods("/user/img/sharegoods/", "分享商品图片"),
|
| | | shareXCX("/user/img/sharegoods_xcx/", "分享小程序图片"),
|
| | |
|
| | | // 编辑相关
|
| | | apk("/editor/apk/", "上传Apk安装包"), // -- /img/admin/
|
| | | section("/editor/upload_imgs/", "后台上传图片路径"), // -- /img/admin/
|
| | |
|
| | | userRankings("/editor/img/user_rankings/", "奖金排行榜假用户头像"),
|
| | | invite("/editor/img/invite/", "分享邀请好友图片素材"),
|
| | | invitePictureDemo("/editor/img/invite_demo/", "动态中生成的邀请图demo"),
|
| | |
|
| | | helpClass("/editor/img/help_class/", "帮助中心分类图片"),
|
| | | helpCenterContent("/editor/img/help_center/", "帮助中心内容图片"),
|
| | | goodsClassOld("/editor/img/class_old/", "商品一级分类图片-老版"),
|
| | | goodsClass("/editor/img/goods_class/", "商品一级分类图片"),
|
| | | goodsSubClass("/editor/img/goods_sub_class/", "商品二级以下分类图片"),
|
| | | lable("/editor/img/lable/", "标签图片"),
|
| | | taoBaoShop("/editor/img/taobao_shop/", "淘宝店铺图片"),
|
| | |
|
| | | brand("/editor/img/brand/", "品牌图片"),
|
| | | article("/editor/img/college/article/", "学院文章图片"),
|
| | | floatAD("/editor/img/float_ad/", "首页弹框图片"),
|
| | | homeNavbar("/editor/img/home_navbar/", "导航栏图片"),
|
| | | specialCard("/editor/img/special_card/", "专题管理图片"),
|
| | | special("/editor/img/special/", "专题图片"),
|
| | | swiper("/editor/img/swiper_pic/", "轮播图片"),
|
| | | banLiShopClass("/editor/img/shop/goods_class/", "板栗商城分类图片"),
|
| | | banLiShopGoods("/editor/img/shop/goods/", "板栗商城商品图片");
|
| | |
|
| | | private final String path;
|
| | | private final String desc;
|
| | |
| | | }
|
| | |
|
| | | FileUploadResult result = COSManager.getInstance().uploadFile(asInputStream,
|
| | | String.format(FilePathEnum.userPortrait.getPath() + "%s_%s.jpg", user.getUnionid(), System.currentTimeMillis() + ""));
|
| | | String.format(FilePathEnum.userWXPortrait.getPath() + "%s_%s.jpg", user.getUnionid(), System.currentTimeMillis() + ""));
|
| | | if (result != null && !StringUtil.isNullOrEmpty(result.getUrl())) {
|
| | | user.setHeadimgurl(result.getUrl());
|
| | | // COS删除其余头像
|