Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
19个文件已添加
40个文件已修改
1 文件已重命名
1个文件已删除
| | |
| | | </properties>
|
| | | </profile>
|
| | |
|
| | |
|
| | | <profile>
|
| | | <!-- 沙箱 -->
|
| | | <id>env-sandbox</id>
|
| | | <properties>
|
| | | <profiles.active>env-sandbox</profiles.active>
|
| | | </properties>
|
| | | </profile>
|
| | |
|
| | | </profiles>
|
| | |
|
| | |
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/aspect/LoginAspect.java |
| | |
| | |
|
| | | @Component
|
| | | @Aspect
|
| | | public class LoginAspect {
|
| | | public class AdminLoginAspect {
|
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | @Around("execution(public * com.yeshi.fanli.controller.admin.*.*(..))")
|
| | | @Around("execution(public * com.yeshi.fanli.controller.admin..*.*(..))")
|
| | | public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws IOException {
|
| | |
|
| | | Signature signature = joinPoint.getSignature();
|
| | |
| | | import org.aspectj.lang.annotation.Around;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.springframework.core.annotation.Order;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.web.context.request.RequestContextHolder;
|
| | | import org.springframework.web.context.request.ServletRequestAttributes;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.WXMPAcceptData;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | //@Component
|
| | | @Aspect
|
| | | @Order(2)
|
| | | public class WXMPSignValidateAspect {
|
| | | public static final String EDP = "execution(* com.yeshi.fanli.controller.wxmp.*.*.*(..))";
|
| | | public static final String EDP = "execution(* com.yeshi.fanli.controller.wxmp..*.*(..))";
|
| | |
|
| | | public static String KEY = "";
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin.goods;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/convertLink")
|
| | | public class ConvertLinkController {
|
| | |
|
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @RequestMapping(value = "convertLink")
|
| | | public void convertLink(String callback, String uid, String content, Boolean share, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(uid)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传用户ID"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传文本内容"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (share == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择是分享还是自购"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String result = null;
|
| | | try {
|
| | | result = convertLinkManager.convertLinkFromText(content, Long.parseLong(uid), share);
|
| | | } catch (NumberFormatException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户ID转换出错"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | return;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(result));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Resource
|
| | | private AdActivityVersionControlService adActivityVersionControlService;
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询帮助列表
|
| | | * @param callback
|
| | |
| | | if (pageId == null)
|
| | | pageId = 0L;
|
| | |
|
| | | List<HelpCenter> resultList = new ArrayList<>();
|
| | | List<HelpCenter> list1 = helpCenterService.listValid(pageId, pageSize, key, cid);
|
| | | List<HelpCenter> list = new ArrayList<>();
|
| | | if (list1 != null && list1.size() > 0)
|
| | | list.addAll(list1);
|
| | |
|
| | | List<HelpCenter> list = helpCenterService.listValid(pageId, pageSize, key, cid);
|
| | | if (list == null || list.size() == 0) {
|
| | | if (list.size() == 0) {
|
| | |
|
| | | pageId = 0L;
|
| | | } else {
|
| | | // 添加列表
|
| | | resultList.addAll(list);
|
| | |
|
| | | pageId = resultList.get(resultList.size()-1).getId();
|
| | | pageId = list.get(list.size() - 1).getId();
|
| | |
|
| | | // 版本过滤
|
| | | int version = Integer.parseInt(acceptData.getVersion());
|
| | | String platform = acceptData.getPlatform().toLowerCase();
|
| | | List<AppVersionInfo> versionList = appVersionService.listByPlatformAndMinVersionCode(platform,version);
|
| | | if (versionList == null || versionList.size() <= 0) {
|
| | | resultList.clear();
|
| | | list.clear();
|
| | | } else {
|
| | | List<Long> sourceIdList = new ArrayList<>();
|
| | | for (HelpCenter record : resultList) {
|
| | | for (HelpCenter record : list) {
|
| | | sourceIdList.add(record.getId());
|
| | | }
|
| | | List<Long> versionIdList = new ArrayList<>();
|
| | |
| | | Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
|
| | | AdActivityType.helpCenter, versionIdList);
|
| | |
|
| | | for (int i = 0; i < resultList.size(); i++) {
|
| | | if (!sets.contains(resultList.get(i).getId())) {
|
| | | resultList.remove(i--);
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (!sets.contains(list.get(i).getId())) {
|
| | | list.remove(i--);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pageId", pageId);
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList));
|
| | | data.put("result_list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取帮助详情
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 查询启用的分类
|
| | | * @param callback
|
| | |
| | | Set<Long> sets = adActivityVersionControlService.filterSourceIdByVersion(sourceIdList,
|
| | | AdActivityType.helpClass, versionIdList);
|
| | |
|
| | | for (int i = 0; i < resultList.size(); i++) {
|
| | | if (!sets.contains(resultList.get(i).getId())) {
|
| | | resultList.remove(i--);
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (!sets.contains(list.get(i).getId())) {
|
| | | list.remove(i--);
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 账号打通
|
| | | * |
| | | * @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) {
|
| | |
| | |
|
| | | // 2.0.6版本增加 学院栏目
|
| | | if (VersionUtil.greaterThan_2_0_6(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | list.add(menu6);
|
| | | //list.add(menu6);
|
| | | }
|
| | | list.add(menu4);
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.controller.wxmp.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.WXMPAcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SpecialLabel;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture;
|
| | | import com.yeshi.fanli.entity.dynamic.WXMPDynamicInfo;
|
| | | import com.yeshi.fanli.exception.dynamic.WXMPDynamicInfoException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.dynamic.WXMPDynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.JumpDetailUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller("WXMPDynamicController")
|
| | | @RequestMapping("/wxmp/api/v1/dynamic")
|
| | | public class DynamicController {
|
| | |
|
| | | @Resource
|
| | | private WXMPDynamicInfoService wxmpDynamicInfoService;
|
| | |
|
| | | @Resource
|
| | | private SpecialService specialService;
|
| | |
|
| | | /**
|
| | | * 首页专题
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHotList")
|
| | | public void getHotList(WXMPAcceptData acceptData, int page, PrintWriter out) {
|
| | |
|
| | | List<WXMPDynamicInfo> infoList = wxmpDynamicInfoService.listDynamicInfo(page, Constant.PAGE_SIZE);
|
| | | for (WXMPDynamicInfo info : infoList) {
|
| | | if (info.getImgs() != null)
|
| | | for (GoodsPicture goodsPicture : info.getImgs()) {
|
| | | JSONObject params = new JSONObject();
|
| | | if (goodsPicture.getGoodsVO() != null && goodsPicture.getJumpDetail() != null) {
|
| | | params.put("id", goodsPicture.getGoodsVO().getGoodsId());
|
| | | goodsPicture.setJumpDetail(null);
|
| | | goodsPicture.getGoodsVO().setImgList(null);
|
| | | goodsPicture.getGoodsVO().setShopInfo(null);
|
| | | goodsPicture.getGoodsVO().setCouponInfoList(null);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | long count = wxmpDynamicInfoService.countDynamicInfo();
|
| | | Gson gson = JsonUtil.getConvertDateToShortNameBuilder(JsonUtil
|
| | | .getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder().excludeFieldsWithoutExposeAnnotation()))
|
| | | .create();
|
| | | try {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", gson.toJson(infoList));
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "获取数据失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "copyText")
|
| | | public void copyText(WXMPAcceptData acceptData, String id, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(id)) {
|
| | | out.print(JsonUtil.loadFalseResult("商品ID未空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | String content = wxmpDynamicInfoService.copyContent(id, uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("content", content);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (WXMPDynamicInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getActivityList")
|
| | | public void getActivityList(WXMPAcceptData acceptData, int page, PrintWriter out) {
|
| | | // 平台区分
|
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
|
| | | List<String> listKey = new ArrayList<String>();
|
| | | listKey.add("special_channel_jd");
|
| | | listKey.add("special_channel_pdd");
|
| | |
|
| | | List<Special> list = specialService.listByPlaceKeyHasLabel((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE,
|
| | | listKey, platformCode, Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | long time = System.currentTimeMillis();
|
| | |
|
| | | // 删除尚未启用的过期的
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Special special = list.get(i);
|
| | | if (special.getJumpDetail() != null) {
|
| | | special.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(special.getJumpDetail()));
|
| | | }
|
| | |
|
| | | if (special.getState() == 1L) {
|
| | | list.remove(i--);
|
| | | } else {
|
| | | if (special.getStartTime() != null && special.getEndTime() != null)
|
| | | special.setTimeTask(true);
|
| | | else
|
| | | special.setTimeTask(false);
|
| | |
|
| | | if (special.isTimeTask()) {
|
| | | if (time < special.getStartTime().getTime() || time > special.getEndTime().getTime()) {
|
| | | list.remove(i--);
|
| | | } else// 设置倒计时
|
| | | {
|
| | | special.setCountDownTime((special.getEndTime().getTime() - time) / 1000);
|
| | | }
|
| | | }
|
| | |
|
| | | List<SpecialLabel> listLabels = special.getListLabels();
|
| | | if (listLabels != null && !listLabels.isEmpty()) {
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | for (SpecialLabel specialLabel : listLabels) {
|
| | | labels.add(new ClientTextStyleVO(specialLabel.getName(), specialLabel.getBgColor()));
|
| | | }
|
| | | special.setLabels(labels);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | long count = specialService.countByPlaceKeyList(listKey, platformCode,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getActivityDetail")
|
| | | public void getActivityDetail(WXMPAcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | if (uid == null)
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | | if (id == null)
|
| | | out.print(JsonUtil.loadFalseResult("活动ID为空"));
|
| | |
|
| | | Special special = specialService.selectByPrimaryKey(id);
|
| | | if (special == null) {
|
| | | out.print(JsonUtil.loadFalseResult("专题不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | jumpDetail.setActivity(null);
|
| | | jumpDetail.setController(null);
|
| | | String params = special.getParams();
|
| | | if (jumpDetail.getType().equalsIgnoreCase("jd")) {// 京东的专题活动
|
| | | JSONObject paramsJson = JSONObject.fromObject(params);
|
| | | // 京东转链
|
| | | String url = paramsJson.optString("url");
|
| | | String link = JDApiUtil.convertLinkWithSubUnionId(url, null, JDApiUtil.POSITION_FANLI + "", uid + "");
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(link)) {
|
| | | out.print(JsonUtil.loadFalseResult("转链失败"));
|
| | | return;
|
| | | }
|
| | | paramsJson.put("url", link);
|
| | | params = paramsJson.toString();
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | data.put("jumpDetail", gson.toJson(jumpDetail));
|
| | | data.put("params", params);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (StringUtil.isNullOrEmpty(swiper.getParams())) {
|
| | | params = JSONObject.fromObject(swiper.getParams());
|
| | | }
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail()));
|
| | | swiper.setParams(null);
|
| | | }
|
| | | data.put("bannerList", JsonUtil.getApiCommonGson().toJson(picList));
|
| | |
| | | String scene = goodsType+"#"+goodsId+"#" + inviteCode;
|
| | | FileUploadResult uploadResult = null;
|
| | | if (type == 1) {
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?info="+ scene;
|
| | | String erCodeUrl = "https://wxmp.banliapp.com/goods?i="+ scene;
|
| | | uploadResult = qrCodeService.drawGoodsPoster(erCodeUrl, user.getPortrait(), goods);
|
| | | } else {
|
| | | String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(), Constant.WXMP_APP_INFO.getAppSecret());
|
| | |
| | | if (StringUtil.isNullOrEmpty(swiper.getParams())) {
|
| | | params = JSONObject.fromObject(swiper.getParams());
|
| | | }
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail()));
|
| | | swiper.setParams(null);
|
| | | }
|
| | |
|
| | |
| | | params = JSONObject.fromObject(special.getParams());
|
| | | }
|
| | |
|
| | | special.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(jumpDetail, params));
|
| | | special.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(jumpDetail));
|
| | | special.setParams(null);
|
| | | }
|
| | |
|
| | |
| | | if (StringUtil.isNullOrEmpty(swiper.getParams())) {
|
| | | params = JSONObject.fromObject(swiper.getParams());
|
| | | }
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
|
| | | swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail()));
|
| | | swiper.setParams(null);
|
| | | }
|
| | |
|
| | |
| | | if (StringUtil.isNullOrEmpty(zhuShouMsg.getParams())) {
|
| | | params = JSONObject.fromObject(zhuShouMsg.getParams());
|
| | | }
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(zhuShouMsg.getJumpDetail(), params);
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(zhuShouMsg.getJumpDetail());
|
| | |
|
| | | commonMsgList.add(new UserCommonMsgVO(zhuShouMsg.getIcon(), zhuShouMsg.getTitle(),
|
| | | zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read,
|
| | |
| | | if (detail.getType() == MsgTypeOrderTypeEnum.share || detail.getType() == MsgTypeOrderTypeEnum.invite)
|
| | | params.put("orderHideNo", UserUtil.filterOrderId(detail.getOrderId()));
|
| | |
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("order_search"), params);
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("order_search"));
|
| | |
|
| | | UserMsgVO userMsgVO = UserMsgVOFactory.create(detail, wxmpJumDetail, params);
|
| | | userMsgVO.setType(MSG_TYPE_ORDER);
|
| | |
| | | // TODO 跳转地址
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", "http://apph5.yeshitv.com/special/1.0.9/jingXuanN_9.html?type=9_9");
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("web"), params);
|
| | | JumpDetailV2 wxmpJumDetail = JumpDetailUtil.getWXMPJumDetail(jumpDetailV2Service.getByTypeCache("web"));
|
| | | userSystemMsgVO.setJumpDetail(wxmpJumDetail);
|
| | |
|
| | | root.put("systemMsg", userSystemMsgVO);
|
New file |
| | |
| | | package com.yeshi.fanli.dao.dynamic;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.domain.Sort.Direction;
|
| | | import org.springframework.data.domain.Sort.Order;
|
| | | import org.springframework.data.mongodb.core.MongoTemplate;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.data.mongodb.core.query.Update;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.dynamic.WXMPDynamicInfo;
|
| | |
|
| | | @Repository
|
| | | public class WXMPDynamicInfoDao extends MongodbBaseDao<WXMPDynamicInfo> {
|
| | |
|
| | | @Resource
|
| | | private MongoTemplate mongoTemplate;
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: list
|
| | | * @Description: 列表查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<WXMPDynamicInfo> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<WXMPDynamicInfo> list(int start, int count) {
|
| | | Query query = new Query();
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, "createTime"));
|
| | | query.with(new Sort(orders));
|
| | | query.skip(start);
|
| | | query.limit(count);
|
| | | return mongoTemplate.find(query, WXMPDynamicInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: count
|
| | | * @Description: 数量查询
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long count() {
|
| | | Query query = new Query();
|
| | | return mongoTemplate.count(query, WXMPDynamicInfo.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: addShareCount
|
| | | * @Description: 添加分享次数 |
| | | * @param id |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addShareCount(String id) {
|
| | | WXMPDynamicInfo info = get(id);
|
| | | if (info == null) {
|
| | | return;
|
| | | }
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("id").is(id));
|
| | | Update update = new Update();
|
| | | if (info.getShareCount() != null)
|
| | | update.set("shareCount", info.getShareCount() + 1);
|
| | | else
|
| | | update.set("shareCount", 1);
|
| | | mongoTemplate.updateFirst(query, update, WXMPDynamicInfo.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import java.io.IOException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.concurrent.TimeUnit;
|
| | |
|
| | | import org.elasticsearch.action.search.SearchRequest;
|
| | | import org.elasticsearch.action.search.SearchResponse;
|
| | | import org.elasticsearch.client.RequestOptions;
|
| | | import org.elasticsearch.common.unit.TimeValue;
|
| | | import org.elasticsearch.index.query.BoolQueryBuilder;
|
| | | import org.elasticsearch.index.query.QueryBuilders;
|
| | | import org.elasticsearch.search.SearchHit;
|
| | |
| | | public List<ESOrder> query(String key, String uid, List<Integer> listPlatform) {
|
| | | List<ESOrder> list = new ArrayList<ESOrder>();
|
| | | // 商品名称模糊全词匹配
|
| | | BoolQueryBuilder should1 = QueryBuilders.boolQuery().should(QueryBuilders.wildcardQuery("orderNo.keyword", "*" + key + "*"))
|
| | | BoolQueryBuilder should1 = QueryBuilders.boolQuery()
|
| | | .should(QueryBuilders.wildcardQuery("orderNo.keyword", "*" + key + "*"))
|
| | | .should(QueryBuilders.wildcardQuery("goodsName.keyword", "*" + key + "*"));
|
| | | // 用户id匹配
|
| | |
|
| | | BoolQueryBuilder should2 = QueryBuilders.boolQuery().should(QueryBuilders.termQuery("uid", uid));
|
| | | //.should(QueryBuilders.termQuery("uidDirect", uid)).should(QueryBuilders.termQuery("uidDirect", uid));
|
| | | // .should(QueryBuilders.termQuery("uidDirect",
|
| | | // uid)).should(QueryBuilders.termQuery("uidDirect", uid));
|
| | |
|
| | | // 查询创建
|
| | | SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
| | |
| | | }
|
| | | sourceBuilder.query(QueryBuilders.boolQuery().must(should1).must(should2).must(should3));
|
| | | }
|
| | | |
| | | // 最大查询数为200
|
| | | sourceBuilder.size(200);
|
| | | // 超时20s
|
| | | sourceBuilder.timeout(new TimeValue(20, TimeUnit.SECONDS));
|
| | | SearchRequest searchRequest = new SearchRequest();
|
| | | searchRequest.indices(getDocument(ESOrder.class));
|
| | | searchRequest.source(sourceBuilder);
|
| | |
| | | @Repository
|
| | | public class NYouHuiGoodsDao extends MongodbBaseDao<NYouHuiGoods> {
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: selectByName
|
| | | * @Description: 根据名字查询
|
| | | * @param name
|
| | | * @return |
| | | * NYouHuiGoods 返回类型
|
| | | * @throws
|
| | | */
|
| | | public NYouHuiGoods selectByName(String name) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("name").is(name));
|
| | |
| | | return mongoTemplate.findOne(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: list
|
| | | * @Description: 查询列表
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<NYouHuiGoods> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<NYouHuiGoods> list(int start, int count) {
|
| | | Query query = new Query();
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, "updateTime"));
|
| | | query.with(new Sort(orders));
|
| | | query.skip(start);
|
| | | query.limit(count);
|
| | | return mongoTemplate.find(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: count
|
| | | * @Description: 查询数量
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long count() {
|
| | | Query query = new Query();
|
| | | return mongoTemplate.count(query, NYouHuiGoods.class);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.entity.order.ESOrder;
|
| | |
|
| | | public interface OrderSearchIndexMapper {
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: listByHBIds
|
| | | * @Description: 根据主hongbaoId检索
|
| | | * @param hbIdList
|
| | | * @return |
| | | * List<ESOrder> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<ESOrder> listByHBIds(@Param("hbIdList") List<Long> hbIdList);
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: listHBId
|
| | | * @Description: 检索需要新增的hongBaoId
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<Long> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<Long> listHBId(@Param("start") long start, @Param("count") int count);
|
| | |
|
| | | /**
|
| | | * 根据hongBaoId删除
|
| | | * @Title: deleteByHBIds
|
| | | * @Description: |
| | | * @param hbIdList
|
| | | * @return |
| | | * int 返回类型
|
| | | * @throws
|
| | | */
|
| | | int deleteByHBIds(@Param("hbIdList") List<Long> hbIdList);
|
| | |
|
| | | } |
| | |
| | | @org.yeshi.utils.mybatis.Column(name = "jp_min_ios_version")
|
| | | private Integer minIOSAppVersion;// 最小ios版本
|
| | |
|
| | | @Expose
|
| | | @org.yeshi.utils.mybatis.Column(name = "jp_path")
|
| | | private String path;//小程序路径
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.entity.dynamic;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | |
|
| | | @Document(collection = "wxmpDynamicInfo")
|
| | | public class WXMPDynamicInfo implements Serializable {
|
| | |
|
| | | public final static int SOURCE_NYH = 11;// 内优惠
|
| | | public final static int SOURCE_OWN = 20;// 自有编辑
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Id
|
| | | @Expose
|
| | | @Field("id")
|
| | | private String id;
|
| | |
|
| | | // 发布用户
|
| | | @Expose
|
| | | @Field("user")
|
| | | private ActivityUser user;
|
| | | // 图片内容
|
| | | @Expose
|
| | | @Field("imgs")
|
| | | private List<GoodsPicture> imgs;
|
| | |
|
| | | // 文案
|
| | | @Expose
|
| | | @Field("content")
|
| | | private String content;
|
| | |
|
| | | // 来源
|
| | | @Field("source")
|
| | | private Integer source;
|
| | |
|
| | | // 分享次数
|
| | | @Field("shareCount")
|
| | | private Integer shareCount;
|
| | |
|
| | | // 分享赚的资金
|
| | | @Expose
|
| | | @Field("shareMoney")
|
| | | private BigDecimal shareMoney;
|
| | |
|
| | | // 创建时间
|
| | | @Expose
|
| | | @Field("createTime")
|
| | | private Date createTime;
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public ActivityUser getUser() {
|
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(ActivityUser user) {
|
| | | this.user = user;
|
| | | }
|
| | |
|
| | | public List<GoodsPicture> getImgs() {
|
| | | return imgs;
|
| | | }
|
| | |
|
| | | public void setImgs(List<GoodsPicture> imgs) {
|
| | | this.imgs = imgs;
|
| | | }
|
| | |
|
| | | public String getContent() {
|
| | | return content;
|
| | | }
|
| | |
|
| | | public void setContent(String content) {
|
| | | this.content = content;
|
| | | }
|
| | |
|
| | | public Integer getSource() {
|
| | | return source;
|
| | | }
|
| | |
|
| | | public void setSource(Integer source) {
|
| | | this.source = source;
|
| | | }
|
| | |
|
| | | public Integer getShareCount() {
|
| | | return shareCount;
|
| | | }
|
| | |
|
| | | public void setShareCount(Integer shareCount) {
|
| | | this.shareCount = shareCount;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public BigDecimal getShareMoney() {
|
| | | return shareMoney;
|
| | | }
|
| | |
|
| | | public void setShareMoney(BigDecimal shareMoney) {
|
| | | this.shareMoney = shareMoney;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
|
| | | @Document(collection = "jdGoodsNYouHui")
|
| | | public class NYouHuiGoods {
|
| | |
| | | public void setSourceUrl(String sourceUrl) {
|
| | | this.sourceUrl = sourceUrl;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: toId
|
| | | * @Description: 转化唯一主键ID
|
| | | * @return |
| | | * String 返回类型
|
| | | * @throws
|
| | | */
|
| | | public String toId() {
|
| | | String idStr = this.name;
|
| | | idStr += "#";
|
| | | idStr += new Gson().toJson(this.skuList);
|
| | | return StringUtil.Md5(idStr);
|
| | | }
|
| | | }
|
| | |
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | |
| | | private static final long serialVersionUID = 1L;
|
| | | @Id
|
| | | private Long id;// 商品ID
|
| | | @Indexed
|
| | | @Field
|
| | | private Long goodsId;// 淘宝商品ID
|
| | | @Field
|
New file |
| | |
| | | package com.yeshi.fanli.exception.dynamic;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class WXMPDynamicInfoException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public WXMPDynamicInfoException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public WXMPDynamicInfoException() {
|
| | | super();
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityInviteInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture;
|
| | | import com.yeshi.fanli.entity.dynamic.WXMPDynamicInfo;
|
| | | import com.yeshi.fanli.entity.goods.jd.NYouHuiGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.WXMPDynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.goods.jd.NYouHuiService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | @Component
|
| | | public class DynamicInfoJob {
|
| | |
| | | @Resource
|
| | | private ActivityService activityService;
|
| | |
|
| | | @Resource
|
| | | private NYouHuiService nyouHuiService;
|
| | |
|
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | |
|
| | | @Resource
|
| | | private WXMPDynamicInfoService wxmpDynamicInfoService;
|
| | |
|
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | /**
|
| | | * 每10分钟 晚上00:00~06:00不下发任何一个商品
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | try {
|
| | | dynamicInfoService.insertTimeRecommend();
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 早上6,7,15,16,21,22,23点更新1次
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 早上11:00~14:00每半个小时更新
|
| | | */
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 下午17:00~20:00每半个小时更新
|
| | | */
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 每天零点删除3天之前数据
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 后台编辑动态: 每3分钟检索
|
| | | */
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | for (RecommendActivity activity : list) {
|
| | | Integer type = activity.getType();
|
| | | if (RecommendActivity.TYPE_SHARE_GOODS == type) {
|
| | |
| | |
|
| | | } else if (RecommendActivity.TYPE_INVITE == type) {
|
| | | // 邀请素材
|
| | | RecommendActivityInviteInfo inviteInfo = activityService.getRecommendActivityInviteInfoByActivityId(activity.getId());
|
| | | RecommendActivityInviteInfo inviteInfo = activityService
|
| | | .getRecommendActivityInviteInfoByActivityId(activity.getId());
|
| | | activity.setInviteInfo(inviteInfo);
|
| | |
|
| | | dynamicInfoService.insertInviteActivity(activity);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 每天6点天更新邀请素材
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: demoJobHandler
|
| | | * @Description: 更新小程序动态商品
|
| | | * @param param
|
| | | * @return
|
| | | * @throws Exception |
| | | * ReturnT<String> 返回类型
|
| | | * @throws
|
| | | */
|
| | | @XxlJob("dynamic-updateWXMPDynamicInfo")
|
| | | public ReturnT<String> updateWXMPDynamicInfoHandler(String param) throws Exception {
|
| | | addJDNYHInfo();
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加内优惠相关商品
|
| | | * @Title: addJDNYHInfo
|
| | | * @Description: |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void addJDNYHInfo() throws Exception {
|
| | |
|
| | | List<NYouHuiGoods> list = nyouHuiService.list(1, 1);
|
| | | if (list != null && list.size() > 0) {
|
| | | NYouHuiGoods goods = list.get(0);
|
| | | String id = goods.toId();
|
| | | WXMPDynamicInfo info = new WXMPDynamicInfo();
|
| | | info.setId(WXMPDynamicInfo.SOURCE_NYH + "#" + id);
|
| | | String desc = goods.getDesc();
|
| | |
|
| | | info.setSource(WXMPDynamicInfo.SOURCE_NYH);
|
| | | info.setUser(activityUserService.getRandomHaoHuo());
|
| | | // 做链接转换
|
| | | for (String link : goods.getLinkList()) {
|
| | | desc = desc.replaceFirst("\\[链接\\]", link);
|
| | | }
|
| | |
|
| | | desc = convertLinkManager.convertJDLinkFromText(desc, 0L, true);
|
| | | info.setContent(desc);
|
| | |
|
| | | List<JDGoods> goodsList = JDApiUtil.queryGoodsDetail(goods.getSkuList());
|
| | | List<GoodsPicture> imgs = new ArrayList<>();
|
| | |
|
| | | BigDecimal totalMoney = new BigDecimal(0);
|
| | | List<String> lastPicture = new ArrayList<>();
|
| | | for (JDGoods jdGoods : goodsList) {
|
| | | GoodsPicture picture = new GoodsPicture();
|
| | | BigDecimal money = JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getShareRate());
|
| | | totalMoney = totalMoney.add(money);
|
| | | picture.setGoodsVO(
|
| | | GoodsDetailVOFactory.convertJDGoods(jdGoods,
|
| | | new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
|
| | | hongBaoManageService.getShareRate(), null,
|
| | | hongBaoManageService.getVIPFanLiRate())));
|
| | | picture.setGoodState(0);
|
| | | picture.setJumpDetail(jumpDetailV2Service.getByTypeCache("goodsdetail"));
|
| | | picture.setParams(null);
|
| | | picture.setUrl(jdGoods.getPicUrl());
|
| | | imgs.add(picture);
|
| | | if (jdGoods.getImageList() != null)
|
| | | if (jdGoods.getImageList().size() > 4)
|
| | | lastPicture.addAll(jdGoods.getImageList().subList(1, 4));
|
| | | else if (jdGoods.getImageList().size() > 1)
|
| | | lastPicture.addAll(jdGoods.getImageList().subList(1, jdGoods.getImageList().size()));
|
| | | }
|
| | | info.setShareMoney(totalMoney);
|
| | | int count = 0;
|
| | | while (imgs.size() < 4 && count < 4) {
|
| | | count++;
|
| | | String picurl = lastPicture.get((int) (lastPicture.size() * Math.random()));
|
| | | if (picurl != null) {
|
| | | lastPicture.remove(picurl);
|
| | | GoodsPicture picture = new GoodsPicture();
|
| | | picture.setUrl(picurl);
|
| | | imgs.add(picture);
|
| | | }
|
| | | }
|
| | |
|
| | | info.setImgs(imgs);
|
| | |
|
| | | wxmpDynamicInfoService.addWXMPDynamicInfo(info);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.service.inter.order.ESOrderService;
|
| | |
|
| | | /**
|
| | | * 搜索引擎任务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class ElasticSearchJob {
|
| | |
|
| | | @Resource
|
| | | private ESOrderService esOrderService;
|
| | |
|
| | | /**
|
| | | * 每两个小时进行更新品牌商品信息
|
| | | */
|
| | | @XxlJob("orderSearchIndexAddHandler")
|
| | | public ReturnT<String> orderSearchIndexAddHandler(String param) throws Exception {
|
| | | Integer count = null;
|
| | | if (!StringUtil.isNullOrEmpty(param))
|
| | | count = Integer.parseInt(param);
|
| | | addIndex(count);
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | public void addIndex(Integer count) {
|
| | | if (count == null)
|
| | | count = 200;
|
| | | esOrderService.syncAddOrder(count);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return;
|
| | |
|
| | | int count = 0;
|
| | | int maxCount = 10;
|
| | | int maxCount = 15;
|
| | | for (int page = 1; page <= 10; page ++) {
|
| | | List<TaoBaoGoodsBrief> list = tljFreeBuyGoodsService.listPreGoods("", page);
|
| | | if (list == null || list.size() == 0)
|
| | |
| | | <result column="jp_controller" property="controller" jdbcType="VARCHAR" />
|
| | | <result column="jp_type" property="type" jdbcType="VARCHAR" />
|
| | | <result column="jp_need_login" property="needLogin" jdbcType="BOOLEAN" />
|
| | | <result column="jp_path" property="path" jdbcType="VARCHAR" />
|
| | | <result column="jp_min_android_version" property="minAndroidAppVersion"
|
| | | jdbcType="INTEGER" />
|
| | | <result column="jp_min_ios_version" property="minIOSAppVersion"
|
| | | jdbcType="INTEGER" />
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">jp_id,jp_name,jp_activity,jp_controller,jp_type,jp_need_login,jp_min_android_version,jp_min_ios_version
|
| | | <sql id="Base_Column_List">jp_id,jp_name,jp_activity,jp_controller,jp_type,jp_need_login,jp_min_android_version,jp_min_ios_version,jp_path
|
| | | </sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.common.JumpDetailV2"
|
| | | useGeneratedKeys="true" keyProperty="id">insert into
|
| | | yeshi_ec_action_jumpdetail_v2
|
| | | (jp_id,jp_name,jp_activity,jp_controller,jp_type,jp_need_login,jp_min_android_version,jp_min_ios_version)
|
| | | (jp_id,jp_name,jp_activity,jp_controller,jp_type,jp_need_login,jp_min_android_version,jp_min_ios_version,jp_path)
|
| | | values
|
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{activity,jdbcType=VARCHAR},#{controller,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{needLogin,jdbcType=BOOLEAN},#{minAndroidAppVersion,jdbcType=INTEGER},#{minIOSAppVersion,jdbcType=INTEGER})
|
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{activity,jdbcType=VARCHAR},#{controller,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR},#{needLogin,jdbcType=BOOLEAN},#{minAndroidAppVersion,jdbcType=INTEGER},#{minIOSAppVersion,jdbcType=INTEGER},#{path,jdbcType=VARCHAR})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.common.JumpDetailV2"
|
| | | useGeneratedKeys="true" keyProperty="id">
|
| | |
| | | <if test="needLogin != null">jp_need_login,</if>
|
| | | <if test="minAndroidAppVersion != null">jp_min_android_version,</if>
|
| | | <if test="minIOSAppVersion != null">jp_min_ios_version,</if>
|
| | | <if test="path != null">jp_path,</if>
|
| | | </trim>
|
| | | values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | |
| | | <if test="needLogin != null">#{jp_need_login,jdbcType=BOOLEAN},</if>
|
| | | <if test="minAndroidAppVersion != null">#{minAndroidAppVersion,jdbcType=INTEGER}</if>
|
| | | <if test="minIOSAppVersion != null">#{minIOSAppVersion,jdbcType=INTEGER}</if>
|
| | | <if test="path != null">#{path,jdbcType=VARCHAR}</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.common.JumpDetailV2">update
|
| | |
| | | #{controller,jdbcType=VARCHAR},jp_type =
|
| | | #{type,jdbcType=VARCHAR},jp_need_login = #{needLogin,jdbcType=BOOLEAN}
|
| | | ,jp_min_android_version =#{minAndroidAppVersion,jdbcType=INTEGER}
|
| | | ,jp_min_ios_version =#{minIOSAppVersion,jdbcType=INTEGER} where jp_id
|
| | | ,jp_min_ios_version =#{minIOSAppVersion,jdbcType=INTEGER} |
| | | ,jp_path =#{path,jdbcType=VARCHAR}
|
| | | |
| | | where jp_id
|
| | | = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.common.JumpDetailV2">
|
| | | update yeshi_ec_action_jumpdetail_v2
|
| | |
| | | <if test="minAndroidAppVersion !=null">jp_min_android_version
|
| | | =#{minAndroidAppVersion,jdbcType=INTEGER},</if>
|
| | | <if test="minIOSAppVersion !=null">jp_min_ios_version =#{minIOSAppVersion,jdbcType=INTEGER},
|
| | | </if>
|
| | | |
| | | <if test="path !=null">jp_path =#{path,jdbcType=VARCHAR},
|
| | | </if>
|
| | | </set>
|
| | | where jp_id = #{id,jdbcType=BIGINT}
|
| | |
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_action_jumpdetail_v2 jv
|
| | | WHERE jv.`jp_type`=#{type} AND #{version}>=jv.`jp_min_android_version` ORDER BY jv.`jp_min_android_version` DESC LIMIT 1
|
| | | WHERE jv.`jp_type`=#{type} AND #{version}>=jv.`jp_min_android_version`
|
| | | ORDER BY jv.`jp_min_android_version` DESC LIMIT 1
|
| | | </select>
|
| | |
|
| | | <select id="selectIOSByTypeAndVersion" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_action_jumpdetail_v2 jv
|
| | | WHERE jv.`jp_type`=#{type} AND #{version}>=jv.`jp_min_ios_version` ORDER BY jv.`jp_min_ios_version` DESC LIMIT 1
|
| | | WHERE jv.`jp_type`=#{type} AND #{version}>=jv.`jp_min_ios_version` ORDER BY
|
| | | jv.`jp_min_ios_version` DESC LIMIT 1
|
| | | </select>
|
| | |
|
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!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.order.OrderSearchIndexMapper">
|
| | |
|
| | | <resultMap id="BASERESULTMAP" type="com.yeshi.fanli.entity.order.ESOrder">
|
| | | <result column="uid" property="uid" jdbcType="BIGINT" />
|
| | | <result column="uidDirect" property="uidDirect" jdbcType="BIGINT" />
|
| | | <result column="uidIndirect" property="uidIndirect" jdbcType="BIGINT" />
|
| | | <result column="goodsName" property="goodsName" jdbcType="VARCHAR" />
|
| | | <result column="orderNo" property="orderNo" jdbcType="VARCHAR" />
|
| | | <result column="tradeId" property="tradeId" jdbcType="VARCHAR" />
|
| | | <result column="platform" property="platform" jdbcType="INTEGER" />
|
| | | </resultMap>
|
| | |
|
| | | <select id="listByHBIds" resultMap="BASERESULTMAP">
|
| | |
|
| | | SELECT CONCAT(a.platform,'#',a.tradeId) AS id,a.uid,v.`hb_uid` AS
|
| | | uidDirect,vv.`hb_uid` AS
|
| | | uidIndirect,a.goodsName,a.orderNo,a.tradeId,a.platform FROM (
|
| | |
|
| | | SELECT
|
| | | v.`hb_id`,co.`co_uid` AS uid,g.`cog_title` AS
|
| | | goodsName,CO.`co_order_no` AS orderNo,co.`co_trade_id` AS
|
| | | tradeId,co.`co_source_type` AS platform FROM yeshi_ec_common_order co
|
| | |
|
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_order_id`=co.`co_id`
|
| | |
|
| | | LEFT JOIN yeshi_ec_hongbao_v2 v ON v.`hb_id`=ho.`ho_hongbao_id`
|
| | |
|
| | | LEFT
|
| | | JOIN yeshi_ec_common_order_goods g ON
|
| | | g.`cog_id`=co.`co_order_goods_id`
|
| | |
|
| | | <foreach collection="hbIdList" item="hbId" open=" WHERE ("
|
| | | separator=" or " close=")">
|
| | | v.hb_id=#{hbId}
|
| | | </foreach>
|
| | |
|
| | | ) a
|
| | |
|
| | | LEFT JOIN yeshi_ec_hongbao_v2 v ON v.hb_pid=a.hb_id AND
|
| | | (v.`hb_type`=6 OR
|
| | | v.`hb_type`=21)
|
| | |
|
| | | LEFT JOIN yeshi_ec_hongbao_v2 vv ON
|
| | | vv.hb_pid=a.hb_id AND (vv.`hb_type`=7
|
| | | OR vv.`hb_type`=22)
|
| | |
|
| | | </select>
|
| | |
|
| | | <select id="listHBId" resultType="java.lang.Long">
|
| | |
|
| | | select id from
|
| | | yeshi_ec_common_order_change_trigger limit #{start},#{count}
|
| | |
|
| | | </select>
|
| | |
|
| | |
|
| | | <delete id="deleteByHBIds">
|
| | | delete from yeshi_ec_common_order_change_trigger
|
| | | <foreach collection="hbIdList" open=" where (" separator=" or "
|
| | | item="hbId" close=")">
|
| | | id=#{hbId}
|
| | | </foreach>
|
| | | </delete>
|
| | |
|
| | |
|
| | |
|
| | | </mapper>
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.dynamic;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.dynamic.WXMPDynamicInfoDao;
|
| | | import com.yeshi.fanli.entity.dynamic.WXMPDynamicInfo;
|
| | | import com.yeshi.fanli.exception.dynamic.WXMPDynamicInfoException;
|
| | | import com.yeshi.fanli.service.inter.dynamic.WXMPDynamicInfoService;
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | |
|
| | | @Service
|
| | | public class WXMPDynamicInfoServiceImpl implements WXMPDynamicInfoService {
|
| | |
|
| | | @Resource
|
| | | private WXMPDynamicInfoDao wxmpDynamicInfoDao;
|
| | |
|
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @Override
|
| | | public void addWXMPDynamicInfo(WXMPDynamicInfo info) throws WXMPDynamicInfoException {
|
| | | if (StringUtil.isNullOrEmpty(info.getContent()))
|
| | | throw new WXMPDynamicInfoException(1, "无文案");
|
| | |
|
| | | if (info.getSource() == null)
|
| | | throw new WXMPDynamicInfoException(1, "无来源");
|
| | |
|
| | | if (info.getUser() == null)
|
| | | throw new WXMPDynamicInfoException(1, "无发布用户");
|
| | | if (info.getId() == null)
|
| | | info.setId(StringUtil.Md5(UUID.randomUUID().toString()));
|
| | | if (info.getCreateTime() == null)
|
| | | info.setCreateTime(new Date());
|
| | | info.setShareCount(0);
|
| | | if (wxmpDynamicInfoDao.get(info.getId()) != null)
|
| | | throw new WXMPDynamicInfoException(2, "动态已存在");
|
| | |
|
| | | wxmpDynamicInfoDao.save(info);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<WXMPDynamicInfo> listDynamicInfo(int page, int pageSize) {
|
| | | return wxmpDynamicInfoDao.list((page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countDynamicInfo() {
|
| | | return wxmpDynamicInfoDao.count();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String copyContent(String id, Long uid) throws WXMPDynamicInfoException {
|
| | | // 转链
|
| | | WXMPDynamicInfo info = wxmpDynamicInfoDao.get(id);
|
| | | if (info == null)
|
| | | throw new WXMPDynamicInfoException(1, "信息不存在");
|
| | | // 转链
|
| | | String convertContent = null;
|
| | | try {
|
| | | convertContent = convertLinkManager.convertLinkFromText(info.getContent(), uid, true);
|
| | | } catch (Exception e) {
|
| | | throw new WXMPDynamicInfoException(2, e.getMessage());
|
| | | }
|
| | | wxmpDynamicInfoDao.addShareCount(id);
|
| | | return convertContent;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.goods.jd;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | return nyouHuiGoodsDao.selectByName(name);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<NYouHuiGoods> list(int page, int pageSize) {
|
| | | return nyouHuiGoodsDao.list((page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long count() {
|
| | | return nyouHuiGoodsDao.count();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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 AdActivityVersionControlService adActivityVersionControlService;
|
| | | |
| | |
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(HelpCenter record) {
|
| | |
| | |
|
| | | 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();
|
| | |
| | |
|
| | | 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;
|
| | | place.put("header", header);
|
| | | |
| | |
|
| | | listMap.add(place);
|
| | | }
|
| | |
| | | return helpCenterMapper.countQuery(key, cid, state);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Cacheable(value = "helpCenterCache",key="'queryIdAndTitle-'+#pageId+'-'+#key+'-'+#cid")
|
| | | public List<HelpCenter> listValid(long pageId, int pageSize, String key, Long cid) {
|
| | |
| | | public HelpInfo getHelpInfoCache(Long id) {
|
| | | return getHelpInfo(id);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.elastic.ESOrderDao;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderSearchIndexMapper;
|
| | | import com.yeshi.fanli.entity.order.ESOrder;
|
| | | import com.yeshi.fanli.service.inter.order.ESOrderService;
|
| | |
|
| | |
| | | public class ESOrderServiceImpl implements ESOrderService {
|
| | |
|
| | | @Resource
|
| | | private ESOrderDao esOrderDao;
|
| | | private OrderSearchIndexMapper orderSearchIndexMapper;
|
| | |
|
| | | @Resource
|
| | | private ESOrderDao esOrderDao;
|
| | |
|
| | | @Override
|
| | | public void add(ESOrder record) {
|
| | | esOrderDao.save(record, record.getPlatform() + "#" + record.getTradeId());
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<ESOrder> query(String key, String uid, List<Integer> listPlatform) {
|
| | | return esOrderDao.query(key, uid, listPlatform);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void syncAddOrder(int count) {
|
| | | List<Long> hbIdList = orderSearchIndexMapper.listHBId(0, count);
|
| | | if (hbIdList == null || hbIdList.size() == 0)
|
| | | return;
|
| | | List<ESOrder> list = orderSearchIndexMapper.listByHBIds(hbIdList);
|
| | | if (list != null)
|
| | | for (ESOrder order : list) {
|
| | | add(order);
|
| | | }
|
| | | orderSearchIndexMapper.deleteByHBIds(hbIdList);
|
| | | }
|
| | | }
|
| | |
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | goodsIdList.add(goods.getAuctionId());
|
| | |
|
| | | List<DaTaoKeDetailV2> dtList = listByGoodsIds(goodsIdList);
|
| | | List<DaTaoKeDetailV2> dtList = null;
|
| | |
|
| | | try {
|
| | | dtList = listByGoodsIds(goodsIdList);
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | if (dtList != null)
|
| | | for (DaTaoKeDetailV2 goods : dtList)
|
| | |
| | | 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 {
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.dynamic;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.dynamic.WXMPDynamicInfo;
|
| | | import com.yeshi.fanli.exception.dynamic.WXMPDynamicInfoException;
|
| | |
|
| | | /**
|
| | | * 微信小程序动态商品服务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface WXMPDynamicInfoService {
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: addWXMPDynamicInfo
|
| | | * @Description: 添加微信小程序动态信息
|
| | | * @param info
|
| | | * @throws WXMPDynamicInfoException |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addWXMPDynamicInfo(WXMPDynamicInfo info) throws WXMPDynamicInfoException;
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: listDynamicInfo
|
| | | * @Description: 动态列表
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<WXMPDynamicInfo> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<WXMPDynamicInfo> listDynamicInfo(int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: countDynamicInfo
|
| | | * @Description: 动态总数量
|
| | | * @return |
| | | * Long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public Long countDynamicInfo();
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: copyContent
|
| | | * @Description: 复制动态文案
|
| | | * @param id
|
| | | * @return |
| | | * String 返回类型
|
| | | * @throws
|
| | | */
|
| | | public String copyContent(String id,Long uid) throws WXMPDynamicInfoException;
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.goods.jd;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.goods.jd.NYouHuiGoods;
|
| | |
|
| | | public interface NYouHuiService {
|
| | |
| | | */
|
| | | public NYouHuiGoods selectByName(String name);
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: list
|
| | | * @Description: 查询列表
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<NYouHuiGoods> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<NYouHuiGoods> list(int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * |
| | | * @Title: count
|
| | | * @Description: 计算所有的数量
|
| | | * @return |
| | | * long 返回类型
|
| | | * @throws
|
| | | */
|
| | | public long count();
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | List<ESOrder> query(String key, String uid, List<Integer> listPlatform);
|
| | |
|
| | | /**
|
| | | * @Title: syncAddOrder
|
| | | * @Description: 同步新增加的订单
|
| | | * @param count |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | void syncAddOrder(int count);
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
|
| | | /**
|
| | | * 注册用户
|
| | |
| | | * @throws
|
| | | */
|
| | |
|
| | | private String convertJDLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | | public String convertJDLinkFromText(String text, Long uid, boolean share) throws Exception {
|
| | |
|
| | | StringBuilder builder = new StringBuilder(text);
|
| | | String newText = builder.toString();
|
| | |
| | | else if ("ios".equalsIgnoreCase(platform))
|
| | | return 2;
|
| | | else if ("wxmp".equalsIgnoreCase(platform))
|
| | | return 4;// 未知
|
| | | return 4;
|
| | | else
|
| | | return 0;
|
| | | return 0;// 未知
|
| | | }
|
| | |
|
| | | public static String getAppName(String platform, String version) {
|
| | |
| | | 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/
|
| | | // 用户相关
|
| | | 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/", "分享小程序图片"),
|
| | |
|
| | | shareGoods("/sharegoods/", "分享商品图片"),
|
| | | shareXCX("/sharegoods/xcx/", "分享小程序图片"),
|
| | | ercode("/ercode/", "分享邀请图二维码图片"),
|
| | | invite("/img/invite/", "分享邀请好友图片"),
|
| | | // 编辑相关
|
| | | apk("/editor/apk/", "上传Apk安装包"), // -- /img/admin/
|
| | | section("/editor/upload_imgs/", "后台上传图片路径"), // -- /img/admin/
|
| | |
|
| | | helpClass("/img/HelpClass/", "帮助中心分类图片"),
|
| | | goodsClassOld("/ClassImg/", "商品一级分类图片-老版"),
|
| | | goodsClass("/img/GoodsClass/", "商品一级分类图片"),
|
| | | goodsSubClass("/img/GoodsSubClass/", "商品二级以下分类图片"),
|
| | | lable("/LableImg/", "标签图片"),
|
| | | taoBaoShop("/img/TaoBaoShop/", "淘宝店铺图片"),
|
| | | userRankings("/editor/img/user_rankings/", "奖金排行榜假用户头像"),
|
| | | invite("/editor/img/invite/", "分享邀请好友图片素材"),
|
| | | invitePictureDemo("/editor/img/invite_demo/", "动态中生成的邀请图demo"),
|
| | |
|
| | | 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/", "板栗商城商品图片");
|
| | | 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;
|
| | |
| | | package com.yeshi.fanli.util;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.Iterator;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class JumpDetailUtil {
|
| | | /**
|
| | |
| | | * @param params
|
| | | * @return
|
| | | */
|
| | | public static JumpDetailV2 getWXMPJumDetail(JumpDetailV2 detail, JSONObject params) {
|
| | | String path = detail.getPath();
|
| | | if (params != null) {
|
| | | path += "?";
|
| | | for (Iterator<String> its = params.keys(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | try {
|
| | | path += (key + "=" + URLEncoder.encode(params.optString(key), "UTF-8") + "&");
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | if (path.endsWith("&"))
|
| | | path = path.substring(0, path.length() - 1);
|
| | | JumpDetailV2 v2 = new JumpDetailV2();
|
| | | v2.setPath(path);
|
| | | v2.setType(detail.getType());
|
| | | return v2;
|
| | | public static JumpDetailV2 getWXMPJumDetail(JumpDetailV2 detail) {
|
| | | detail.setActivity(null);
|
| | | detail.setController(null);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static List<JDGoods> queryGoodsDetail(List<Long> skuIdList) {
|
| | | JDFilter filter = new JDFilter();
|
| | | filter.setPageIndex(1);
|
| | | filter.setPageSize(20);
|
| | | filter.setListId(skuIdList);
|
| | | JDSearchResult searchResult = queryByKey(filter);
|
| | | if (searchResult != null) {
|
| | | List<JDGoods> list = searchResult.getGoodsList();
|
| | | if (list != null && list.size() > 0)
|
| | | return list;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 通过商品搜索接口批量获取详情
|
| | | *
|
| | |
| | | * @throws
|
| | | */
|
| | | public static List<String> getTokenListFromText(String str) {
|
| | | String pattern = "(₳{1}[A-Za-z0-9]+₳{1})|(¥{1}[A-Za-z0-9]+¥{1})|(¥{1}[A-Za-z0-9]+¥{1})";
|
| | | String pattern = "(₳{1}[A-Za-z0-9]+₳{1})|(¥{1}[A-Za-z0-9]+¥{1})|(¥{1}[A-Za-z0-9]+¥{1})|(€{1}[A-Za-z0-9]+€{1})";
|
| | | Pattern r = Pattern.compile(pattern);
|
| | | Matcher m = r.matcher(str);
|
| | | List<String> urlList = new ArrayList<>();
|
| | |
| | | }
|
| | |
|
| | | 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删除其余头像
|
New file |
| | |
| | | elastic.scheme=http
|
| | | elastic.port=9200
|
| | | elastic.host=172.16.16.3 |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xmlns:context="http://www.springframework.org/schema/context"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | |
| | | <bean name="inetAddressbean" class="java.net.InetAddress"></bean> |
| | | <bean name="httpHostbean" class="org.apache.http.HttpHost">
|
| | | <constructor-arg ref="inetAddressbean"></constructor-arg>
|
| | | <constructor-arg value="${elastic.host}" ></constructor-arg>
|
| | | <constructor-arg value="${elastic.port}"></constructor-arg>
|
| | | <constructor-arg value="${elastic.scheme}"></constructor-arg> |
| | | </bean> |
| | | </beans> |
New file |
| | |
| | | task =false
|
| | | outnetwork =true
|
| | | test=true |
New file |
| | |
| | | appId =1255749512
|
| | | secretId =AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25
|
| | | secretKey =xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo
|
| | | bucketName =ec
|
| | | region=ap-guangzhou |
New file |
| | |
| | | mongo.dbname=flq
|
| | | mongo.port=27017
|
| | |
|
| | | mongo.host=172.16.16.40
|
| | | mongo.username=admin
|
| | | mongo.password=123456
|
| | | mongo.connectionsPerHost=8
|
| | | mongo.threadsAllowedToBlockForConnectionMultiplier=4
|
| | | mongo.connectTimeout=1000
|
| | | mongo.maxWaitTime=1500
|
| | | mongo.autoConnectRetry=true
|
| | | mongo.socketKeepAlive=true
|
| | | mongo.socketTimeout=1500
|
| | | mongo.slaveOk=true
|
| | | mongo.writeNumber=1
|
| | | mongo.riteTimeout=0
|
| | | mongo.writeFsync=true |
New file |
| | |
| | | redis.addr=172.16.16.3
|
| | | redis.port=6379 |
| | | redis.auth=weikou2014
|
| | | redis.max_total=1024 |
| | | redis.max_idle=200
|
| | | redis.max_wait=10000
|
| | | redis.timeout=5000
|
| | | redis.test_on_borrow=true |
New file |
| | |
| | | rocketmq.AccessKey=LTAI4FwmTxVCuzTaoZtDiV8z
|
| | | rocketmq.SecretKey=ixWg90QbYFKP6ae5xpAo2P1qwIyll5
|
| | | #测试 http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
|
| | | #正式 http://MQ_INST_1205444665315884_BbaMbxF4.mq-internet-access.mq-internet.aliyuncs.com:80
|
| | | rocketmq.NAMESRV_ADDR=http://MQ_INST_1205444665315884_Bbkj89nI.mq-internet-access.mq-internet.aliyuncs.com:80
|
| | |
|
| | |
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
| | | <import resource="classpath:/rocket/producer.xml" />
|
| | | <import resource="classpath:/rocket/transactionProducer.xml" />
|
| | | </beans> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <beans xmlns="http://www.springframework.org/schema/beans"
|
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans
|
| | | http://www.springframework.org/schema/beans/spring-beans.xsd
|
| | | http://www.springframework.org/schema/context
|
| | | http://www.springframework.org/schema/context/spring-context.xsd">
|
| | |
|
| | | <!-- 不执行任务 -->
|
| | |
|
| | |
|
| | | </beans> |
| | |
| | | <value>classpath:mongo.properties</value>
|
| | | <value>classpath:rocketmq.properties</value>
|
| | | <value>classpath:xxl-job-executor.properties</value>
|
| | | <value>classpath:elasticsearch.properties</value>
|
| | | </array>
|
| | | </property>
|
| | | </bean>
|
| | |
|
| | | <import resource="classpath:rocketmq.xml" />
|
| | | <import resource="classpath:xxl-job.xml" />
|
| | | <import resource="classpath:elasticsearch.xml" />
|
| | | |
| | | |
| | |
|
| | |
|
| | |
|
| | |
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | |
|
| | | @Test
|
| | | public void test2() {
|
| | | // String link = TaoKeApiUtil.officialActivityConvert("87140050199",
|
| | | // "1571715733668", "20211660");
|
| | | // System.out.println(link);
|
| | |
|
| | | String text = HttpUtil.get("https://m.tb.cn/h.eBj7iNJ?sm=c4049c");
|
| | | System.out.println(text);
|
| | | |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(571754672318L,
|
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET));
|
| | | System.out.println(goods);
|
| | |
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Test
|
| | | public void test6() {
|
| | | TaoBaoGoodsBrief goods = TaoBaoUtil.getSimpleGoodsBrief(607940944794L);
|
| | | System.out.println(goods);
|
| | | String text = "[玫瑰]各位亲友好,记得领券哦[愉快]" + "【京东1月3日领券精选】\n" + "[红包]抢红包 最高888\n" + "https://u.jd.com/8xeCfl\n"
|
| | | + "🚅火车票神券50元\n" + "https://u.jd.com/cMReZz\n" + "🌟居家好物9.9包邮\n" + "https://u.jd.com/AG2z4A\n"
|
| | | + "👔男装3件7折\n" + "https://u.jd.com/kgMslr\n" + "👗女装清仓5折起\n" + "https://u.jd.com/kgMslr\n" + "🛍有礼有年货\n"
|
| | | + "https://u.jd.com/qdvIiG\n" + "💋SK-II大促\n" + "https://u.jd.com/7XybkD\n" + "💰超级百亿补贴\n"
|
| | | + "https://u.jd.com/qVFjDL\n" + "🍼母婴券年货节\n" + "https://u.jd.com/kA0scy\n" + "🛍超市满199-100\n"
|
| | | + "https://u.jd.com/eQSwNn\n" + "[發]内购券大全\n" + "https://u.jd.com/zIHmUy\n" + "[福]Plus全品券\n"
|
| | | + "https://u.jd.com/d9fcGr\n" + "⚡京东秒杀\n" + "https://u.jd.com/WSIi1z\n" + "【记得与更多好友分享[愉快]】";
|
| | | ConvertLinkManager convertLinkManager = BeanUtil.getBean(ConvertLinkManager.class);
|
| | | try {
|
| | | System.out.println(convertLinkManager.convertLinkFromText(text, 437032L, true));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Test
|
| | |
| | | public void test3() {
|
| | | UserOrderWeiQuanRecordService service = BeanUtil.getBean(UserOrderWeiQuanRecordService.class);
|
| | | TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService = BeanUtil.getBean(TaoBaoWeiQuanOrderService.class);
|
| | | String[] sts = new String[] { "579042228537648772","767622209118533749","584142029127826311","770248738403368629","770974179347634248","711783427021923325","756141056240980857","711783427020923325","751754816157378937","583950605974863901"};
|
| | | String[] sts = new String[] {"756271874447755338","769373473533206978","752844641559634248","783423777826741052","773694880942796632","770552928635634248","582743790043310703","747354881395634248"};
|
| | | for (String orderId : sts)
|
| | | service.addTaoBaoWeiQuan(taoBaoWeiQuanOrderService.selectByTradeId(orderId));
|
| | | }
|
| | |
| | |
|
| | |
|
| | |
|
| | | @Test
|
| | | public void queryMatch() {
|
| | | try {
|
| | | ESOrderDao dao = BeanUtil.getBean(ESOrderDao.class);
|
| | | List<ESOrder> list = dao.query("8C", "974767");
|
| | | for (ESOrder esOrder: list) {
|
| | | System.out.println(esOrder.getUid() + " "+ esOrder.getGoodsName());
|
| | | System.out.println(esOrder.getUidDirect() + " "+ esOrder.getUidIndirect());
|
| | | }
|
| | | System.out.println("-------------结束-------------");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | // @Test
|
| | | // public void queryMatch() {
|
| | | // try {
|
| | | // ESOrderDao dao = BeanUtil.getBean(ESOrderDao.class);
|
| | | // List<ESOrder> list = dao.query("8C", "974767");
|
| | | // for (ESOrder esOrder: list) {
|
| | | // System.out.println(esOrder.getUid() + " "+ esOrder.getGoodsName());
|
| | | // System.out.println(esOrder.getUidDirect() + " "+ esOrder.getUidIndirect());
|
| | | // }
|
| | | // System.out.println("-------------结束-------------");
|
| | | // } catch (Exception e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | // }
|
| | |
|
| | | }
|
| | |
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>org.elasticsearch.client</groupId>
|
| | | <artifactId>elasticsearch-rest-high-level-client</artifactId>
|
| | | <version>7.5.1</version>
|
| | | </dependency>
|
| | |
|
| | | <dependency>
|
| | | <groupId>org.springframework.data</groupId>
|
| | | <artifactId>spring-data-elasticsearch</artifactId>
|
| | | <version>3.2.3.RELEASE</version>
|
| | |
| | | <modules>
|
| | | <module>utils</module>
|
| | | <module>fanli</module>
|
| | |
|
| | |
|
| | | </modules>
|
| | | </project> |
| | |
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import com.fasterxml.jackson.core.JsonProcessingException;
|
| | | import com.fasterxml.jackson.databind.JavaType;
|
| | | import com.fasterxml.jackson.databind.ObjectMapper;
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | |
| | | desc = (nowDay - oldDay) + "天前";
|
| | | }
|
| | | out.value(desc);
|
| | | }
|
| | | } else
|
| | | out.value("");
|
| | | }
|
| | |
|
| | | @Override
|