1 文件已重命名
43个文件已修改
4个文件已添加
| | |
| | | return;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | |
|
| | | try {
|
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | out.print(JsonUtil.loadFalseResult(3, "商品已下架"));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "获取商品简版详情出错", auctionId + "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | boolean isNative = false;
|
| | | String pid = null;
|
| | |
|
| | | boolean specialConvert = false;
|
| | |
|
| | | if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
|
| | | specialConvert = true;
|
| | | } else
|
| | | specialConvert = false;
|
| | |
|
| | | String specialId = null;
|
| | | String relationId=null;
|
| | | // 查询用户ID是否绑定了会员运营ID
|
| | | UserExtraTaoBaoInfo userInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (userInfo != null && !StringUtil.isNullOrEmpty(userInfo.getSpecialId()) && userInfo.getSpecialValid() != null
|
| | | && userInfo.getSpecialValid() == true) {
|
| | | specialId = userInfo.getSpecialId();
|
| | | relationId=userInfo.getRelationId();
|
| | | // 已经绑定
|
| | | try {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
|
| | | isNative = true;
|
| | | specialConvert = true;
|
| | | } else
|
| | | isNative = false;
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | out.print(JsonUtil.loadFalseResult(3, "商品已下架"));
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "获取商品简版详情出错", auctionId + "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | if (specialConvert) {
|
| | | isNative = true;
|
| | | } else
|
| | | isNative = false;
|
| | |
|
| | | pid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "isGoodsExtend")
|
| | | public void isGoodsExtend(AcceptData acceptData,String goodsId, String goodsType, PrintWriter out) {
|
| | | public void isGoodsExtend(AcceptData acceptData, String goodsId, String goodsType, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(goodsId)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "未参与推广"));
|
| | | return;
|
| | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SpecialService specialService;
|
| | | |
| | |
|
| | | // 消息的类型
|
| | | final static String MSG_TYPE_ORDER = "order";
|
| | |
| | | */
|
| | | @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST)
|
| | | public void getHomeMsgList(AcceptData acceptData, Long uid, int page, HttpSession session, PrintWriter out) {
|
| | |
|
| | | if (uid != null && uid == 0)
|
| | | uid = null;
|
| | | String device = acceptData.getDevice();
|
| | | if (device == null || device.trim().length() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("设备号不能为空"));
|
| | |
| | | root.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 获取消息列表
|
| | | *
|
| | |
| | | */
|
| | | @RequestMapping(value = "getHomeMsgListNew", method = RequestMethod.POST)
|
| | | public void getHomeMsgListNew(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | |
| | | if (uid != null && uid == 0)
|
| | | uid = null;
|
| | |
|
| | | List<UserMsgCenter> listCenter = new ArrayList<>();
|
| | | |
| | |
|
| | | // 1、活动区域
|
| | | List<Special> listSpecial = specialService.listByPlaceKey("msg_activities");
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special: listSpecial) {
|
| | | |
| | | for (Special special : listSpecial) {
|
| | |
|
| | | boolean needLogin = special.isJumpLogin();
|
| | | JumpDetailV2 jumpDetail = special.getJumpDetail();
|
| | | if (jumpDetail != null) {
|
| | | jumpDetail.setNeedLogin(needLogin);
|
| | | special.setJumpDetail(jumpDetail);
|
| | | }
|
| | | |
| | |
|
| | | UserMsgCenter msgCenter = new UserMsgCenter();
|
| | | msgCenter.setSpecial(special);
|
| | | listCenter.add(msgCenter);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 2、消息区域
|
| | | if (uid != null && uid > 0) {
|
| | | int page = 1;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (list.size() > 0 ) {
|
| | |
|
| | | if (list.size() > 0) {
|
| | | // 时间排序
|
| | | listSort(list);
|
| | | |
| | | if (list.size() >= 20 ) {
|
| | |
|
| | | if (list.size() >= 20) {
|
| | | list = list.subList(0, 19);
|
| | | }
|
| | | |
| | | for (UserMsgVO userMsgVO: list) {
|
| | |
|
| | | for (UserMsgVO userMsgVO : list) {
|
| | | UserMsgCenter userMsgCenter = new UserMsgCenter();
|
| | | userMsgCenter.setUserMsg(userMsgVO);
|
| | | listCenter.add(userMsgCenter);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 3、添加欢迎语
|
| | | Long time = (uid == null ? System.currentTimeMillis() : userInfoService.selectByPKey(uid).getCreatetime());
|
| | | // 创建时间在28号后的才有新人欢迎
|
| | |
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | map.put("title", "新人欢迎");
|
| | | map.put("content", "恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
|
| | | map.put("createTime",new Date(time));
|
| | | map.put("createTime", new Date(time));
|
| | | UserMsgCenter msgCenternre = new UserMsgCenter();
|
| | | msgCenternre.setWelcomeMsg(map);
|
| | | listCenter.add(msgCenternre);
|
| | | }
|
| | | |
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | builder = getTimeDescJsonBuilder(builder);
|
| | | JSONObject root = new JSONObject();
|
| | | |
| | |
|
| | | if (uid != null && uid > 0) {
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
|
| | | if (usm != null) {
|
| | | root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "系统消息", usm.getTitle(),
|
| | | usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", "http://img.flqapp.com/resource/msg/icon_msg_system.png",getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
|
| | | root.put("systemMsg",
|
| | | new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), "系统消息", usm.getTitle(),
|
| | | usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
|
| | | "http://img.flqapp.com/resource/msg/icon_msg_system.png",
|
| | | getTimeDesc(new Date(), usm.getCreateTime()), num.getTypeSystem()));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | root.put("list", builder.create().toJson(listCenter));
|
| | | root.put("count", listCenter.size());
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | |
|
| | | public static void listSort(List<UserMsgVO> list) {
|
| | | Collections.sort(list, new Comparator<UserMsgVO>() {
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 获取系统消息列表
|
| | | *
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.bus.search.HotSearch;
|
| | | import com.yeshi.fanli.entity.bus.su.search.SuperHotSearch;
|
| | | import com.yeshi.fanli.entity.system.CustomerContent;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.user.HistorySearchService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private SuperHotSearchService superHotSearchSerivce;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CustomerContentService customerContentService;
|
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | |
|
| | | // 优惠券
|
| | | /*
|
| | |
| | | @RequestMapping(value = "search", method = RequestMethod.GET)
|
| | | public void search(String callback, AcceptData acceptData, String kw, int page, String filter, String order,
|
| | | String startprice, String endprice, String fastFilter, PrintWriter out) {
|
| | | /*
|
| | | * System system = webControllerUtil.getSystem(acceptData); if(system ==
|
| | | * null){
|
| | | * out.print(JsonUtil.loadFalseResult(WebControllerUtil.NOSYSTEM));
|
| | | * return; }
|
| | | */
|
| | | if (!StringUtil.isNullOrEmpty(fastFilter)) {
|
| | | if (!StringUtil.isNullOrEmpty(filter)) {
|
| | | JSONArray filterArray = JSONArray.fromObject(filter);
|
| | |
| | | }
|
| | | }
|
| | | JSONObject data = search(kw, page, filter, order, startprice, endprice);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "searchGoods", method = RequestMethod.GET)
|
| | | public void searchGoods(String callback, AcceptData acceptData, String kw, int page, int pagesize, String filters,
|
| | | String rate, String order, String startprice, String endprice, PrintWriter out) {
|
| | | /*
|
| | | * System system = webControllerUtil.getSystem(acceptData); if(system ==
|
| | | * null){
|
| | | * out.print(JsonUtil.loadFalseResult(WebControllerUtil.NOSYSTEM));
|
| | | * return; }
|
| | | */
|
| | | if (pagesize > 100)
|
| | | return;
|
| | |
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setPage(page);
|
| | | sf.setPageSize(pagesize);
|
| | | sf.setKey(StringUtil.isNullOrEmpty(kw) ? "" : kw);
|
| | | boolean recommend = false;
|
| | | if (!StringUtil.isNullOrEmpty(filters)) {
|
| | | JSONArray array = JSONArray.fromObject(filters);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String type = array.optJSONObject(i).optString("type");
|
| | | if ("quantype".equalsIgnoreCase(type)) {
|
| | | sf.setQuan(1);
|
| | | } else if ("baoyou".equalsIgnoreCase(type)) {
|
| | | sf.setBaoYou(true);
|
| | | } else if ("usertype".equalsIgnoreCase(type)) {
|
| | | sf.setTmall(true);
|
| | | } else if ("recommend".equalsIgnoreCase(type)) {
|
| | | //
|
| | | recommend = true;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(startprice))
|
| | | sf.setStartPrice(new BigDecimal(startprice));
|
| | | if (!StringUtil.isNullOrEmpty(endprice))
|
| | | sf.setEndPrice(new BigDecimal(endprice));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(rate))
|
| | | try {
|
| | | sf.setStartTkRate(Integer.parseInt(rate));
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(kw))
|
| | | recommend = true;
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | |
|
| | | long count = 0;
|
| | | if (recommend) {
|
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listRecommendBykey((page - 1) * pagesize, pagesize, kw,
|
| | | sf.getQuan() == 1 ? 1 : 0, sf.isTmall() ? 1 : 0,
|
| | | StringUtil.isNullOrEmpty(startprice) ? null : Double.parseDouble(startprice),
|
| | | StringUtil.isNullOrEmpty(endprice) ? null : Double.parseDouble(endprice),
|
| | | StringUtil.isNullOrEmpty(rate) ? null : Double.parseDouble(rate), null, 1);
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | if (listQuery != null && listQuery.size() > 0) {
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null));
|
| | | }
|
| | | }
|
| | | count = qualityGoodsService.countRecommendBykey(kw, sf.getQuan() == 1 ? 1 : 0, sf.isTmall() ? 1 : 0,
|
| | | StringUtil.isNullOrEmpty(startprice) ? null : Double.parseDouble(startprice),
|
| | | StringUtil.isNullOrEmpty(endprice) ? null : Double.parseDouble(endprice),
|
| | | StringUtil.isNullOrEmpty(rate) ? null : Double.parseDouble(rate), null);
|
| | |
|
| | | } else {
|
| | | TaoBaoSearchResult result = TaoBaoUtil.search(sf);
|
| | | if (result != null) {
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs();
|
| | | int fq = sf.getQuan();
|
| | | int fh = sf.getHongbao();
|
| | | boolean ft = sf.isTmall();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | if (fq == 0 && fh == 0 && !ft) {
|
| | | if (taoBaoGoodsBriefs != null)
|
| | | for (TaoBaoGoodsBrief bf : taoBaoGoodsBriefs) {
|
| | | listExtra.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(bf, proportion.toString(), ""));
|
| | | }
|
| | | } else {
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
|
| | | if(taoBaoGoodsBriefs!=null)
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), "");
|
| | | listExtra.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | | }
|
| | | count = result.getTaoBaoHead().getDocsfound();
|
| | | }
|
| | |
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | Gson gson2 = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("result", gson2.toJson(listExtra));
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | |
| | | } else {
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra;
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), "");
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(),
|
| | | "");
|
| | | re.add(taoBaoGoodsBriefExtra);
|
| | | }
|
| | | }
|
| | |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum; |
| | | |
| | | public interface UserMoneyDebtMapper extends BaseMapper<UserMoneyDebt> { |
| | | |
| | |
| | | * @param sourceId |
| | | * @return |
| | | */ |
| | | UserMoneyDebt selectByUidAndSourceId(@Param("uid")Long uid,@Param("sourceId") Long sourceId); |
| | | UserMoneyDebt selectByUidAndTypeAndSourceId(@Param("uid") Long uid, @Param("type") UserMoneyDebtTypeEnum type, |
| | | @Param("sourceId") Long sourceId); |
| | | |
| | | UserMoneyDebt selectByTypeAndSourceId(@Param("type") UserMoneyDebtTypeEnum type, |
| | | @Param("sourceId") Long sourceId); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 根据来源类型与订单号查询列表 |
| | | * |
| | | * @param sourceType |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | List<CommonOrder> listBySourceTypeAndOrderNo(@Param("sourceType") int sourceType, @Param("orderNo") String orderNo); |
| | | |
| | | |
| | | /** |
| | | * 查询券奖励金额以及订单信息 |
| | | * |
| | | * @param uid |
| | | * @param state |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | List<CommonOrderVO> getCouponHongbaoByOrderNo(@Param("uid") Long uid, @Param("hongBaoState") Integer hongBaoState, |
| | | List<CommonOrderVO> getCouponHongbaoByOrderNo(@Param("uid") Long uid, @Param("hongBaoState") Integer hongBaoState, |
| | | @Param("orderNo") String orderNo); |
| | | |
| | | |
| | | /** |
| | | * 查询券奖励金额以及订单信息 |
| | | * |
| | | * @param uid |
| | | * @param state |
| | | * @param orderNo |
| | | * @return |
| | | */ |
| | | CommonOrderVO getCommonOrderByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo, |
| | | CommonOrderVO getCommonOrderByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo, |
| | | @Param("orderState") Integer orderState); |
| | | |
| | | /** |
| | | * 根据来源和交易ID获取订单详情 |
| | | * @param sourceType |
| | | * @param tradeId |
| | | * @return |
| | | */ |
| | | |
| | | CommonOrder selectBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.taobao.TBPid; |
| | | |
| | |
| | | TBPid selectAvailablePid(String likeStr); |
| | | |
| | | Long count(); |
| | | |
| | | List<TBPid> listByTypeAndUse(@Param("use")boolean use,@Param("start")long start,@Param("count")int count); |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack; |
| | |
| | | * @param hongBaoId |
| | | * @return |
| | | */ |
| | | TaoBaoWeiQuanDrawBack selectByOrderItemIdAndUid(@Param("orderItemId") String orderItemId, |
| | | @Param("uid") Long uid); |
| | | TaoBaoWeiQuanDrawBack selectByOrderItemIdAndUid(@Param("orderItemId") String orderItemId, @Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 根据子订单号查询 |
| | | * |
| | | * @param orderItemId |
| | | * @return |
| | | */ |
| | | List<TaoBaoWeiQuanDrawBack> selectByOrderItemId(String orderItemId); |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao.dataoke; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail; |
| | | |
| | | public interface DaTaoKeDetailMapper extends BaseMapper<DaTaoKeDetail> { |
| | | |
| | | /** |
| | | * 根据ID批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | int deleteByIdList(@Param("ids") List<Long> ids); |
| | | |
| | | /** |
| | | * 批量插入 |
| | | * |
| | | * @param detailList |
| | | * @return |
| | | */ |
| | | int insertByBatch(@Param("detailList") List<DaTaoKeDetail> detailList); |
| | | |
| | | /** |
| | | * 通过最小更新时间做删除 |
| | | * @return |
| | | */ |
| | | int deleteByMinUpdateTime(Long minTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | /**
|
| | | * 用户资金变化
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class UserMoneyChangeDTO {
|
| | | private Long uid;
|
| | | private BigDecimal chnageMoney;// 变化的资金金额
|
| | |
|
| | | public UserMoneyChangeDTO() {
|
| | |
|
| | | }
|
| | |
|
| | | public UserMoneyChangeDTO(Long uid, BigDecimal chnageMoney) {
|
| | | this.uid = uid;
|
| | | this.chnageMoney = chnageMoney;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public BigDecimal getChnageMoney() {
|
| | | return chnageMoney;
|
| | | }
|
| | |
|
| | | public void setChnageMoney(BigDecimal chnageMoney) {
|
| | | this.chnageMoney = chnageMoney;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.taobao;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | |
|
| | | public class WeiQuanOrderResult {
|
| | | public int totalCount;
|
| | | public List<TaoBaoWeiQuanOrder> orderList;
|
| | |
|
| | | }
|
| | |
| | | @Table("yeshi_ec_user_debt")
|
| | | public class UserMoneyDebt {
|
| | | public enum UserMoneyDebtTypeEnum {
|
| | | hongBao("返利退款"), other("其他");
|
| | | order("维权退款"), other("其他");
|
| | | private final String desc;
|
| | |
|
| | | private UserMoneyDebtTypeEnum(String desc) {
|
| | |
| | | package com.yeshi.fanli.entity.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | public class TaoBaoGoodsBriefExtra extends TaoBaoGoodsBrief {
|
| | |
|
| | |
| | | private String tbToken;
|
| | | @Expose
|
| | | private int collected; // 0-没有收藏 1-已收藏
|
| | | |
| | | @Expose
|
| | | private int moneyType;////资金类型1-返 2-奖
|
| | | |
| | | @Expose
|
| | | private List<ClientTextStyleVO> labels;////标签
|
| | | |
| | | @Expose
|
| | | private int salesType;//销量类型:1-月销量 2-2小时销量 3-今日销量
|
| | | |
| | | |
| | |
|
| | | public int getMoneyType() {
|
| | | return moneyType;
|
| | | }
|
| | |
|
| | | public void setMoneyType(int moneyType) {
|
| | | this.moneyType = moneyType;
|
| | | }
|
| | |
|
| | | public List<ClientTextStyleVO> getLabels() {
|
| | | return labels;
|
| | | }
|
| | |
|
| | | public void setLabels(List<ClientTextStyleVO> labels) {
|
| | | this.labels = labels;
|
| | | }
|
| | |
|
| | | public int getSalesType() {
|
| | | return salesType;
|
| | | }
|
| | |
|
| | | public void setSalesType(int salesType) {
|
| | | this.salesType = salesType;
|
| | | }
|
| | |
|
| | | public String getTbToken() {
|
| | | return tbToken;
|
| | |
| | | private BigDecimal commissionJiHua;// 计划(通用)佣金比例
|
| | | @Column(name = "que_siteid")
|
| | | @SerializedName("Que_siteid")
|
| | | private Integer queSiteId;
|
| | | private String queSiteId;
|
| | | @Column(name = "commission")
|
| | | @SerializedName("Commission")
|
| | | private BigDecimal commission;// 佣金
|
| | |
| | | this.commissionJiHua = commissionJiHua;
|
| | | }
|
| | |
|
| | | public Integer getQueSiteId() {
|
| | | public String getQueSiteId() {
|
| | | return queSiteId;
|
| | | }
|
| | |
|
| | | public void setQueSiteId(Integer queSiteId) {
|
| | | public void setQueSiteId(String queSiteId) {
|
| | | this.queSiteId = queSiteId;
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | |
|
| | |
| | | @Component
|
| | | public class UpdateDaTaoKeJob {
|
| | |
|
| | | |
| | | @Resource
|
| | | private QualityFactoryService qualityFactoryService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | | // 两小时执行一次 对商品信息进行更新
|
| | | @Scheduled(cron = "0 0 0/2 * * ?")
|
| | | public void doUpdateJob() {
|
| | | |
| | |
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listgoods = DaTaoKeUtil.getDingDongQiang();
|
| | | if (listgoods == null || listgoods.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | /* 操作人: 开发账号 */
|
| | | AdminUser admin = new AdminUser(2L);
|
| | |
| | | autoRule.setEndWeight(3000);
|
| | | autoRule.setGoodsSource(QualityFactory.SOURCE_TAOBAO_DATAOKE);
|
| | | qualityFactoryService.autoInsertOrUpadateStorage(listgoods, null, autoRule);
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | | @Scheduled(cron = "0 0/20 * * * ? ")
|
| | | public void doSyncJob() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | try {
|
| | | daTaoKeGoodsService.startSyncGoods();
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return orderList;
|
| | | }
|
| | |
|
| | | private void addOrder(List<TaoBaoOrder> orderList) {
|
| | | public void addOrder(List<TaoBaoOrder> orderList) {
|
| | |
|
| | | if (orderList != null)
|
| | | for (int i = 0; i < orderList.size(); i++) {
|
| | |
| | | public void addLostOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("处理丢失订单");
|
| | | List<LostOrder> list = lostOrderService.listByStateAndResultCode(LostOrder.STATE_PASS,
|
| | | LostOrder.RESULT_CODE_VERFING, 1, 50);
|
| | | if (list != null)
|
| | |
| | | String key = "addorder-" + lo.getOrderId();
|
| | | redisManager.removeCommonString(key);
|
| | | addOrder(taoBaoOrderList);
|
| | | LogHelper.test("自动处理淘宝订单:" + lo.getOrderId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理淘宝结算订单,每小时执行一次
|
| | | * 处理淘宝结算订单,30fen执行一次
|
| | | */
|
| | | @Scheduled(cron = "30 0 0/1 * * ? ")
|
| | | public void doSettleOrders() {
|
| | |
| | | addOrder(orderList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 13分钟更新最近13分钟的结算数据
|
| | | */
|
| | | @Scheduled(cron = "0 0/13 * * * ? ")
|
| | | public void doSettleOrdersToday() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | // 处理3-15天前的订单,每天跑一次
|
| | | Calendar ca = Calendar.getInstance();
|
| | | long startTime = ca.getTimeInMillis() - 1000 * 60 * 5L - 1000 * 60 * 13L;
|
| | | long endTime = startTime + 1000 * 60 * 13L;
|
| | | List<TaoBaoOrder> orderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, false);
|
| | | List<TaoBaoOrder> tempOrderList = TaoKeOrderApiUtil.getTaoBaoSettleOrders(startTime, endTime, true);
|
| | | if (tempOrderList != null && tempOrderList.size() > 0)
|
| | | orderList.addAll(tempOrderList);
|
| | | addOrder(orderList);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_debt where ud_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByUidAndSourceId" resultMap="BaseResultMap"> |
| | | |
| | | <select id="selectByUidAndTypeAndSourceId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_debt where ud_uid = #{uid} and ud_source_id=#{sourceId} limit 1 for update |
| | | from yeshi_ec_user_debt where ud_uid = #{uid} and ud_type=#{type} and |
| | | ud_source_id=#{sourceId} limit 1 for update |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="selectByTypeAndSourceId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_debt where ud_type=#{type} and |
| | | ud_source_id=#{sourceId} limit 1 for update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_user_debt where ud_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | <result column="userId" property="userId" jdbcType="VARCHAR" /> |
| | | <result column="userName" property="userName" jdbcType="VARCHAR" /> |
| | | <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> |
| | | |
| | | |
| | | <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> |
| | | |
| | | |
| | | <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <association property="userInfo" column="co_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> |
| | | |
| | | |
| | | <association property="commonOrderGoods" column="co_order_goods_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> |
| | | |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id |
| | | </sql> |
| | |
| | | yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and |
| | | co_order_no=#{orderNo} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * |
| | | FROM |
| | | yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and |
| | | co_trade_id=#{tradeId} limit 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listByTypeAndUse" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_pid where used =#{use} order by id desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_pid where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TBPid" |
| | |
| | | =#{orderItemId} and twd_uid=#{uid} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByOrderItemId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiquan_drawback where twd_order_item_id |
| | | =#{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_weiquan_drawback where twd_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | <result column="goods_id" property="goodsId" jdbcType="BIGINT" /> |
| | | <result column="commission_jihua" property="commissionJiHua" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="que_siteid" property="queSiteId" jdbcType="INTEGER" /> |
| | | <result column="que_siteid" property="queSiteId" jdbcType="VARCHAR" /> |
| | | <result column="commission" property="commission" jdbcType="DECIMAL" /> |
| | | <result column="pic" property="pic" jdbcType="VARCHAR" /> |
| | | <result column="org_price" property="orgPrice" jdbcType="DECIMAL" /> |
| | |
| | | jdbcType="VARCHAR" /> |
| | | <result column="quan_surplus" property="quanSurplus" jdbcType="INTEGER" /> |
| | | <result column="seller_id" property="sellerId" jdbcType="BIGINT" /> |
| | | <result column="udapte_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,d_title,title,dsr,commission_queqiao,quan_receive,quan_price,yongjin_type,quan_time,jihua_link,price,jihua_shenhe,introduce,cid,sales_num,quan_link,is_tmall,goods_id,commission_jihua,que_siteid,commission,pic,org_price,quan_m_link,quan_id,quan_condition,quan_surplus,seller_id,udapte_time |
| | | <sql id="Base_Column_List">id,d_title,title,dsr,commission_queqiao,quan_receive,quan_price,yongjin_type,quan_time,jihua_link,price,jihua_shenhe,introduce,cid,sales_num,quan_link,is_tmall,goods_id,commission_jihua,que_siteid,commission,pic,org_price,quan_m_link,quan_id,quan_condition,quan_surplus,seller_id,update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_goods_dataoke where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByIdList"> |
| | | delete from |
| | | yeshi_ec_goods_dataoke where |
| | | <foreach collection="ids" item="goodsId" open="(" close=")" |
| | | separator=" or "> |
| | | id=#{goodsId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteByMinUpdateTime" parameterType="java.lang.Long"> |
| | | DELETE FROM |
| | | yeshi_ec_goods_dataoke WHERE #{0}>UNIX_TIMESTAMP(update_time)*1000 |
| | | </delete> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_goods_dataoke where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_goods_dataoke |
| | | (id,d_title,title,dsr,commission_queqiao,quan_receive,quan_price,yongjin_type,quan_time,jihua_link,price,jihua_shenhe,introduce,cid,sales_num,quan_link,is_tmall,goods_id,commission_jihua,que_siteid,commission,pic,org_price,quan_m_link,quan_id,quan_condition,quan_surplus,seller_id,udapte_time) |
| | | |
| | | <insert id="insertByBatch"> |
| | | insert into yeshi_ec_goods_dataoke |
| | | (id,d_title,title,dsr,commission_queqiao,quan_receive,quan_price,yongjin_type,quan_time,jihua_link,price,jihua_shenhe,introduce,cid,sales_num,quan_link,is_tmall,goods_id,commission_jihua,que_siteid,commission,pic,org_price,quan_m_link,quan_id,quan_condition,quan_surplus,seller_id,update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{dTitle,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{dsr,jdbcType=VARCHAR},#{commissionQueQiao,jdbcType=DECIMAL},#{quanReceive,jdbcType=INTEGER},#{quanPrice,jdbcType=DECIMAL},#{yongJinType,jdbcType=INTEGER},#{quanTime,jdbcType=VARCHAR},#{jiHuaLink,jdbcType=VARCHAR},#{price,jdbcType=DECIMAL},#{jiHuaShenHe,jdbcType=INTEGER},#{introduce,jdbcType=VARCHAR},#{cid,jdbcType=INTEGER},#{salesNum,jdbcType=INTEGER},#{quanLink,jdbcType=VARCHAR},#{isTmall,jdbcType=INTEGER},#{goodsId,jdbcType=BIGINT},#{commissionJiHua,jdbcType=DECIMAL},#{queSiteId,jdbcType=INTEGER},#{commission,jdbcType=DECIMAL},#{pic,jdbcType=VARCHAR},#{orgPrice,jdbcType=DECIMAL},#{quanMLink,jdbcType=VARCHAR},#{quanId,jdbcType=VARCHAR},#{quanCondition,jdbcType=VARCHAR},#{quanSurplus,jdbcType=INTEGER},#{sellerId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP}) |
| | | |
| | | <foreach collection="detailList" item="item" separator=","> |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | #{item.id,jdbcType=BIGINT}, |
| | | #{item.dTitle,jdbcType=VARCHAR}, |
| | | #{item.title,jdbcType=VARCHAR}, |
| | | #{item.dsr,jdbcType=VARCHAR}, |
| | | #{item.commissionQueQiao,jdbcType=DECIMAL}, |
| | | #{item.quanReceive,jdbcType=INTEGER}, |
| | | #{item.quanPrice,jdbcType=DECIMAL}, |
| | | #{item.yongJinType,jdbcType=INTEGER}, |
| | | #{item.quanTime,jdbcType=VARCHAR}, |
| | | #{item.jiHuaLink,jdbcType=VARCHAR}, |
| | | #{item.price,jdbcType=DECIMAL}, |
| | | #{item.jiHuaShenHe,jdbcType=INTEGER}, |
| | | #{item.introduce,jdbcType=VARCHAR}, |
| | | #{item.cid,jdbcType=INTEGER}, |
| | | #{item.salesNum,jdbcType=INTEGER}, |
| | | #{item.quanLink,jdbcType=VARCHAR}, |
| | | #{item.isTmall,jdbcType=INTEGER}, |
| | | #{item.goodsId,jdbcType=BIGINT}, |
| | | #{item.commissionJiHua,jdbcType=DECIMAL}, |
| | | #{item.queSiteId,jdbcType=VARCHAR}, |
| | | #{item.commission,jdbcType=DECIMAL}, |
| | | #{item.pic,jdbcType=VARCHAR}, |
| | | #{item.orgPrice,jdbcType=DECIMAL}, |
| | | #{item.quanMLink,jdbcType=VARCHAR}, |
| | | #{item.quanId,jdbcType=VARCHAR}, |
| | | #{item.quanCondition,jdbcType=VARCHAR}, |
| | | #{item.quanSurplus,jdbcType=INTEGER}, |
| | | #{item.sellerId,jdbcType=BIGINT}, |
| | | #{item.updateTime,jdbcType=TIMESTAMP} |
| | | </trim> |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_goods_dataoke |
| | | (id,d_title,title,dsr,commission_queqiao,quan_receive,quan_price,yongjin_type,quan_time,jihua_link,price,jihua_shenhe,introduce,cid,sales_num,quan_link,is_tmall,goods_id,commission_jihua,que_siteid,commission,pic,org_price,quan_m_link,quan_id,quan_condition,quan_surplus,seller_id,update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{dTitle,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{dsr,jdbcType=VARCHAR},#{commissionQueQiao,jdbcType=DECIMAL},#{quanReceive,jdbcType=INTEGER},#{quanPrice,jdbcType=DECIMAL},#{yongJinType,jdbcType=INTEGER},#{quanTime,jdbcType=VARCHAR},#{jiHuaLink,jdbcType=VARCHAR},#{price,jdbcType=DECIMAL},#{jiHuaShenHe,jdbcType=INTEGER},#{introduce,jdbcType=VARCHAR},#{cid,jdbcType=INTEGER},#{salesNum,jdbcType=INTEGER},#{quanLink,jdbcType=VARCHAR},#{isTmall,jdbcType=INTEGER},#{goodsId,jdbcType=BIGINT},#{commissionJiHua,jdbcType=DECIMAL},#{queSiteId,jdbcType=VARCHAR},#{commission,jdbcType=DECIMAL},#{pic,jdbcType=VARCHAR},#{orgPrice,jdbcType=DECIMAL},#{quanMLink,jdbcType=VARCHAR},#{quanId,jdbcType=VARCHAR},#{quanCondition,jdbcType=VARCHAR},#{quanSurplus,jdbcType=INTEGER},#{sellerId,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="quanCondition != null">quan_condition,</if> |
| | | <if test="quanSurplus != null">quan_surplus,</if> |
| | | <if test="sellerId != null">seller_id,</if> |
| | | <if test="updateTime != null">udapte_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="isTmall != null">#{isTmall,jdbcType=INTEGER},</if> |
| | | <if test="goodsId != null">#{goodsId,jdbcType=BIGINT},</if> |
| | | <if test="commissionJiHua != null">#{commissionJiHua,jdbcType=DECIMAL},</if> |
| | | <if test="queSiteId != null">#{queSiteId,jdbcType=INTEGER},</if> |
| | | <if test="queSiteId != null">#{queSiteId,jdbcType=VARCHAR},</if> |
| | | <if test="commission != null">#{commission,jdbcType=DECIMAL},</if> |
| | | <if test="pic != null">#{pic,jdbcType=VARCHAR},</if> |
| | | <if test="orgPrice != null">#{orgPrice,jdbcType=DECIMAL},</if> |
| | |
| | | #{isTmall,jdbcType=INTEGER},goods_id = |
| | | #{goodsId,jdbcType=BIGINT},commission_jihua = |
| | | #{commissionJiHua,jdbcType=DECIMAL},que_siteid = |
| | | #{queSiteId,jdbcType=INTEGER},commission = |
| | | #{commission,jdbcType=DECIMAL},pic = #{pic,jdbcType=VARCHAR},org_price |
| | | #{queSiteId,jdbcType=VARCHAR},commission = |
| | | #{commission,jdbcType=DECIMAL},pic = |
| | | #{pic,jdbcType=VARCHAR},org_price |
| | | = #{orgPrice,jdbcType=DECIMAL},quan_m_link = |
| | | #{quanMLink,jdbcType=VARCHAR},quan_id = |
| | | #{quanId,jdbcType=VARCHAR},quan_condition = |
| | | #{quanCondition,jdbcType=VARCHAR},quan_surplus = |
| | | #{quanSurplus,jdbcType=INTEGER},seller_id = |
| | | #{sellerId,jdbcType=BIGINT},udapte_time = |
| | | #{sellerId,jdbcType=BIGINT},update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail"> |
| | |
| | | <if test="goodsId != null">goods_id=#{goodsId,jdbcType=BIGINT},</if> |
| | | <if test="commissionJiHua != null">commission_jihua=#{commissionJiHua,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="queSiteId != null">que_siteid=#{queSiteId,jdbcType=INTEGER},</if> |
| | | <if test="queSiteId != null">que_siteid=#{queSiteId,jdbcType=VARCHAR},</if> |
| | | <if test="commission != null">commission=#{commission,jdbcType=DECIMAL},</if> |
| | | <if test="pic != null">pic=#{pic,jdbcType=VARCHAR},</if> |
| | | <if test="orgPrice != null">org_price=#{orgPrice,jdbcType=DECIMAL},</if> |
| | |
| | | <if test="quanCondition != null">quan_condition=#{quanCondition,jdbcType=VARCHAR},</if> |
| | | <if test="quanSurplus != null">quan_surplus=#{quanSurplus,jdbcType=INTEGER},</if> |
| | | <if test="sellerId != null">seller_id=#{sellerId,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">udapte_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreeSaleCMQManager;
|
| | | import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | package com.yeshi.fanli.service.impl.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDebtMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDebtReturnHistoryMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebtReturnHistory;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyService;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyDebtServiceImpl implements UserMoneyDebtService {
|
| | |
| | | @Resource
|
| | | private UserMoneyDebtMapper userMoneyDebtMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDebtReturnHistoryMapper userMoneyDebtReturnHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoWeiQuanDrawBackService taoBaoWeiQuanDrawBackService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Override
|
| | | public void addUserMoneyDebt(UserMoneyDebt debt) throws UserMoneyDebtException {
|
| | | if (debt == null)
|
| | | return;
|
| | |
|
| | | if (debt.getType() == UserMoneyDebtTypeEnum.hongBao) {
|
| | | if (debt.getType() == UserMoneyDebtTypeEnum.order) {
|
| | | if (debt.getSourceId() == null)
|
| | | throw new UserMoneyDebtException(1, "sourceId为空");
|
| | | if (debt.getUid() == null || debt.getOriginMoney() == null)
|
| | |
| | | if (debt.getCreateTime() == null)
|
| | | debt.setCreateTime(new Date());
|
| | |
|
| | | UserMoneyDebt old = userMoneyDebtMapper.selectByUidAndSourceId(debt.getUid(), debt.getSourceId());
|
| | | UserMoneyDebt old = userMoneyDebtMapper.selectByUidAndTypeAndSourceId(debt.getUid(), debt.getType(),
|
| | | debt.getSourceId());
|
| | | if (old != null) {
|
| | | throw new UserMoneyDebtException(3, "对应用户的红包已经存在");
|
| | | throw new UserMoneyDebtException(3, "对应维权已经存在");
|
| | | }
|
| | | userMoneyDebtMapper.insertSelective(debt);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserMoneyDebt selectByTypeAndSourceId(UserMoneyDebtTypeEnum type, Long sourceId) {
|
| | |
|
| | | return userMoneyDebtMapper.selectByTypeAndSourceId(type, sourceId);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void repayDebt(UserMoneyDebt debt, BigDecimal money) throws UserMoneyDebtException {
|
| | | if (debt == null || debt.getId() == null)
|
| | | throw new UserMoneyDebtException(1, "参数不完整");
|
| | |
|
| | | if (money == null || money.compareTo(new BigDecimal(0)) <= 0)
|
| | | throw new UserMoneyDebtException(2, "偿还资金需大于0");
|
| | |
|
| | | UserMoneyDebt old = userMoneyDebtMapper.selectByPrimaryKey(debt.getId());
|
| | | if (old == null)
|
| | | throw new UserMoneyDebtException(3, "借贷关系不存在");
|
| | |
|
| | | if (old.getUid().longValue() != debt.getUid())
|
| | | throw new UserMoneyDebtException(4, "只能本人还钱");
|
| | |
|
| | | if (money.compareTo(old.getLeftMoney()) < 0)
|
| | | throw new UserMoneyDebtException(5, "不够还");
|
| | |
|
| | | UserMoneyDebt update = new UserMoneyDebt();
|
| | | update.setId(old.getId());
|
| | | update.setUpdateTime(new Date());
|
| | | update.setLeftMoney(old.getLeftMoney().subtract(money));
|
| | | userMoneyDebtMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | UserMoneyDebtReturnHistory history = new UserMoneyDebtReturnHistory();
|
| | | history.setBeiZhu(null);
|
| | | history.setCreateTime(new Date());
|
| | | history.setDebt(old);
|
| | | history.setMoney(money);
|
| | | history.setUid(old.getUid());
|
| | | userMoneyDebtReturnHistoryMapper.insertSelective(history);
|
| | |
|
| | | if (debt.getType() == UserMoneyDebtTypeEnum.order) {
|
| | | HongBaoV2 hb = hongBaoV2Service.selectByPrimaryKey(debt.getSourceId());
|
| | | if (hb == null) {
|
| | | throw new UserMoneyDebtException(6, "偿还的订单ID不存在");
|
| | | }
|
| | |
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = taoBaoWeiQuanDrawBackService.selectByHongBaoId(hb.getId());
|
| | | if (weiQuanDrawBack == null)
|
| | | throw new UserMoneyDebtException(7, "尚未找到退款信息");
|
| | |
|
| | | // 资金变化,添加用户资金记录,添加相关通知
|
| | | Long uid = debt.getUid();
|
| | | switch (hb.getType()) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLiWeiQuan(uid, weiQuanDrawBack,
|
| | | money);
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(), money,
|
| | | userInfoService.getMyHB(uid));
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShareWeiQuan(debt.getUid(),
|
| | | weiQuanDrawBack, money);
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(debt.getUid(), weiQuanDrawBack.getOrderId(),
|
| | | money, userInfoService.getMyHB(uid));
|
| | |
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | |
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInviteWeiQuan(uid, weiQuanDrawBack,
|
| | | money);
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(), money,
|
| | | userInfoService.getMyHB(uid));
|
| | | break;
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonOrderGoodsMapper commonOrderGoodsMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponRecordService userSystemCouponRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | | |
| | |
|
| | | // 奖励订单图片
|
| | | public final static String PIC_REWARD= "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | | |
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png";
|
| | |
|
| | | // 免单状态图片
|
| | | public final static String PIC_FREE_ON = "http://img.flqapp.com/resource/order/order_state_freeing.png";
|
| | | public final static String PIC_FREE_FAIL = "http://img.flqapp.com/resource/order/order_state_free_fail.png";
|
| | | public final static String PIC_FREE_SUCCEED = "http://img.flqapp.com/resource/order/order_state_free_suc.png";
|
| | |
|
| | | public final static String PIC_FREE_FAIL = "http://img.flqapp.com/resource/order/order_state_free_fail.png";
|
| | | public final static String PIC_FREE_SUCCEED = "http://img.flqapp.com/resource/order/order_state_free_suc.png";
|
| | |
|
| | | @Override
|
| | | public int insert(CommonOrder record) {
|
| | |
| | |
|
| | | return listOrder;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public Map<String, BigDecimal> countHistoryOrder(Long uid, Integer day) {
|
| | | return commonOrderMapper.countHistoryOrder(uid, day);
|
| | |
| | | public void listDataFactory(List<CommonOrderVO> listOrder, List<CommonOrderVO> listGoods, Long uid) {
|
| | |
|
| | | List<String> listNo = new ArrayList<String>();
|
| | | for (CommonOrderVO commonOrderVO: listOrder) {
|
| | | for (CommonOrderVO commonOrderVO : listOrder) {
|
| | | listNo.add(commonOrderVO.getOrderNo());
|
| | | }
|
| | | |
| | |
|
| | | // 已经使用券订单
|
| | | List<UserSystemCouponRecord> couponRecordList = userSystemCouponRecordService.getRecordByOrderNoList(listNo);
|
| | | |
| | | |
| | |
|
| | | /* 组合商品信息 */
|
| | | for (CommonOrderVO commonOrder : listGoods) {
|
| | |
|
| | |
| | |
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | | |
| | |
|
| | | // 是否存在奖励券
|
| | | boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid);
|
| | | |
| | |
|
| | | /* 组织订单状态 等信息 */
|
| | | for (CommonOrderVO order : listOrder) {
|
| | |
|
| | |
| | | order.setOrderOrigin("2");
|
| | | order.setHongBaoTypePic(CommonOrder.TYPE_SHARE);
|
| | | signList.add(CommonOrder.TYPE_SHARE);
|
| | | |
| | |
|
| | | } else if (HongBaoV2.TYPE_YAOQING == hongBaoType || HongBaoV2.TYPE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_ERJI == hongBaoType || HongBaoV2.TYPE_SHARE_YIJI == hongBaoType
|
| | | || HongBaoV2.TYPE_SHARE_ERJI == hongBaoType) {
|
| | |
| | | hongBaoMap.put("content", hongbaoInfo + " ¥" + hongBao.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | hongBaoMap.put("fontColor", hongbaoInfoFontColor);
|
| | | order.setHongBaoInfo(hongBaoMap);
|
| | | |
| | |
|
| | | // 非自购的订单 不显示返利、免单详情
|
| | | if (HongBaoV2.TYPE_ZIGOU != hongBaoType) {
|
| | | // 订单标识
|
| | | order.setSignList(signList);
|
| | | |
| | |
|
| | | } else {
|
| | | |
| | |
|
| | | // 是否免单商品
|
| | | boolean freeOrder = false;
|
| | | // 是否奖励成功
|
| | | boolean rewardSuccess = false;
|
| | | |
| | |
|
| | | // 奖励订单、免单 使用记录
|
| | | if (couponRecordList != null && couponRecordList.size() > 0) {
|
| | | |
| | | for (UserSystemCouponRecord couponRecord: couponRecordList) {
|
| | |
|
| | | for (UserSystemCouponRecord couponRecord : couponRecordList) {
|
| | | // 订单号匹配
|
| | | if (order.getOrderNo().equals(couponRecord.getOrderNo())) {
|
| | | |
| | |
|
| | | String systemCouponType = couponRecord.getCouponType();
|
| | | Integer state = couponRecord.getState();
|
| | | |
| | |
|
| | | // 奖励订单: 且成功
|
| | | if (CouponTypeEnum.rebatePercentCoupon.name().equals(systemCouponType)
|
| | | && UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | rewardSuccess = true;
|
| | | signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | |
| | |
|
| | | } else if (CouponTypeEnum.freeCoupon.name().equals(systemCouponType)
|
| | | || CouponTypeEnum.welfareFreeCoupon.name().equals(systemCouponType)) {
|
| | | |
| | | if (UserSystemCouponRecord.STATE_FREE_ON == state) {
|
| | |
|
| | | if (UserSystemCouponRecord.STATE_FREE_ON == state) {
|
| | | // 免单中
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_ON);
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_ON);
|
| | | } else if (UserSystemCouponRecord.STATE_SUCCESS == state) {
|
| | | // 免单成功
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_SUCCEED);
|
| | | } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
|
| | | } else if (UserSystemCouponRecord.STATE_FAIL_RULE == state
|
| | | || UserSystemCouponRecord.STATE_FAIL_DRAWBACK == state) {
|
| | | // 规则不匹配、退款
|
| | | freeOrder = true;
|
| | | signList.add(PIC_FREE_FAIL);
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 订单标识
|
| | | order.setSignList(signList);
|
| | | |
| | |
|
| | | boolean rewardOrder = false;
|
| | | |
| | | int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
|
| | |
|
| | | int type = 1; // 1 常规跳转页面 2弹出选项(奖励券)
|
| | | if (rewardSuccess) {
|
| | | // 奖励成功
|
| | | rewardOrder = true; |
| | | } else if(hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType &&
|
| | | HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | rewardOrder = true;
|
| | | } else if (hasRewardCoupon && !freeOrder && HongBaoV2.TYPE_ZIGOU == hongBaoType
|
| | | && HongBaoV2.STATE_YILINGQU == hongBaoState) {
|
| | | // 有可用的奖励券 、非免单订单 、且已到账的 、返利订单
|
| | | type = 2;
|
| | | rewardOrder = true; |
| | | rewardOrder = true;
|
| | | }
|
| | | |
| | | if (rewardOrder) { |
| | |
|
| | | if (rewardOrder) {
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 奖励券进度详情
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | |
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | | jump.put("type", type); |
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", type);
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | |
|
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | |
|
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | |
| | | if (freeOrder) { |
| | |
|
| | | if (freeOrder) {
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 返利、免单详情
|
| | | rewardStyleVO.setContent("免单详情 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | |
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", order.getOrderNo());
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", 1); // 页面跳转
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("freeCouponDetail"));
|
| | |
|
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | |
|
| | | order.setRewardDetail(rewardMap);
|
| | | }
|
| | | }
|
| | |
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | taoBaoGoods=TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
|
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | goods = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | |
| | | // 已失效
|
| | | order.setHongBaoState(3);
|
| | | }
|
| | | |
| | |
|
| | | List<HongBaoV2> listhb = hongBaoV2Service.listChildrenById(order.getHongbaoId());
|
| | | if (listhb != null && listhb.size() > 0) {
|
| | | if (listhb.size() == 1) {
|
| | | UserInfo userInfo = listhb.get(0).getUserInfo();
|
| | | if (userInfo != null) {
|
| | | order.setLevelOneId(userInfo.getId()+"");
|
| | | order.setLevelOneId(userInfo.getId() + "");
|
| | | order.setLevelOneMoney(listhb.get(0).getMoney() + "");
|
| | | }
|
| | | } else if (listhb.size() == 2) {
|
| | | UserInfo userInfo = listhb.get(0).getUserInfo();
|
| | | if (userInfo != null) {
|
| | | order.setLevelOneId(userInfo.getId()+"");
|
| | | order.setLevelOneId(userInfo.getId() + "");
|
| | | order.setLevelOneMoney(listhb.get(0).getMoney() + "");
|
| | | }
|
| | | |
| | |
|
| | | UserInfo userInfo2 = listhb.get(1).getUserInfo();
|
| | | if (userInfo2 != null) {
|
| | | order.setLevelTwoId(userInfo2.getId()+"");
|
| | | order.setLevelTwoId(userInfo2.getId() + "");
|
| | | order.setLevelTwoMoney(listhb.get(1).getMoney() + "");
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrderVO getInfoByOrderNo(Long uid,String orderNo) throws CommonOrderException{
|
| | | public CommonOrderVO getInfoByOrderNo(Long uid, String orderNo) throws CommonOrderException {
|
| | | List<CommonOrderVO> list = getOrderByUid(1, uid, null, null, null, orderNo, null, null, null);
|
| | | if (list == null || list.size() == 0) {
|
| | | return null;
|
| | |
| | | return list.get(0);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState) throws CommonOrderException {
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState)
|
| | | throws CommonOrderException {
|
| | |
|
| | | CommonOrderVO commonOrderVO = commonOrderMapper.getCommonOrderByOrderNo(uid, orderNo, orderState);
|
| | | // 订单信息为空
|
| | |
| | |
|
| | | return commonOrderVO;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer hongBaoState, String orderNo) throws CommonOrderException {
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer hongBaoState, String orderNo)
|
| | | throws CommonOrderException {
|
| | |
|
| | | List<CommonOrderVO> listOrder = commonOrderMapper.getCouponHongbaoByOrderNo(uid, hongBaoState, orderNo);
|
| | |
|
| | |
| | | return listOrder;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public JSONObject getRewardJumpInfo(String orderNo) {
|
| | | |
| | |
|
| | | JSONObject map = new JSONObject();
|
| | | // 订单标识
|
| | | List<String> signList = new ArrayList<String>();
|
| | | signList.add(CommonOrder.TYPE_FANLI);
|
| | | signList.add(PIC_REWARD); // 加入奖励成功图片
|
| | | map.put("signList", signList);
|
| | | |
| | | |
| | |
|
| | | ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO();
|
| | | // 奖励券进度详情
|
| | | rewardStyleVO.setContent("返利奖励 >");
|
| | | rewardStyleVO.setColor( "#E5005C");
|
| | | rewardStyleVO.setColor("#E5005C");
|
| | | rewardStyleVO.setBottomColor("#FFDCEA");
|
| | | |
| | | Map<String, Object> jumpLink = new HashMap<String,Object>();
|
| | |
|
| | | Map<String, Object> jumpLink = new HashMap<String, Object>();
|
| | | jumpLink.put("orderNo", orderNo);
|
| | | |
| | | Map<String, Object> jump = new HashMap<String,Object>();
|
| | | jump.put("type", 1); |
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | | |
| | | Map<String, Object> rewardMap = new HashMap<String,Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | | |
| | | map.put("rewardDetail", rewardMap);
|
| | | |
| | |
|
| | | Map<String, Object> jump = new HashMap<String, Object>();
|
| | | jump.put("type", 1);
|
| | | jump.put("params", jumpLink);
|
| | | jump.put("jumpDetail", jumpDetailV2Service.getByTypeCache("rewardCouponDetail"));
|
| | |
|
| | | Map<String, Object> rewardMap = new HashMap<String, Object>();
|
| | | rewardMap.put("text", rewardStyleVO);
|
| | | rewardMap.put("jump", jump);
|
| | |
|
| | | map.put("rewardDetail", rewardMap);
|
| | |
|
| | | return map;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonOrder selectBySourceTypeAndTradeId(int sourceType, String tradeId) {
|
| | |
|
| | | return commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.OrderItemException;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | |
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | @Override
|
| | | public void processOrder(Map<String, List<TaoBaoOrder>> orders) {
|
| | | List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
|
| | |
| | |
|
| | | if (orders.get(orderId) != null && orders.get(orderId).size() > 0) {
|
| | | List<TaoBaoOrder> list = orders.get(orderId);
|
| | | String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(),
|
| | | list.get(0).getSourceMediaId(), list.get(0).getAdPositionId());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(list.get(0).getRelationId())) {
|
| | | shareOrderMap.put(orderId, list);
|
| | | } else if (!StringUtil.isNullOrEmpty(list.get(0).getSpecialId())) {
|
| | | if (!StringUtil.isNullOrEmpty(list.get(0).getSpecialId())
|
| | | || pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)) {// 设置渠道ID当做会员运营ID的位置ID
|
| | | fanliOrderMap.put(orderId, list);
|
| | | } else if (!StringUtil.isNullOrEmpty(list.get(0).getRelationId())) {
|
| | | shareOrderMap.put(orderId, list);
|
| | | } else {
|
| | | String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(),
|
| | | list.get(0).getSourceMediaId(), list.get(0).getAdPositionId());
|
| | |
|
| | | PidUser pidUser = pidUserMapper.selectByPid(pid);
|
| | | if (pidUser != null && pidUser.getType() == PidUser.TYPE_SHARE_GOODS) {// 商品分享订单
|
| | | // List<PidOrder> pidOrderList = new ArrayList<>();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | userMoneyDetailMapper.insertSelective(userMoneyDetail);
|
| | | userMoneyService.addUserMoney(uid, money, userMoneyDetail);
|
| | | // 添加资金明细与红包的映射关系
|
| | | for (HongBaoV2 v2 : userHongBao.get(uid)) {
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), userMoneyDetail.getId());
|
| | | }
|
| | | // 增加用户资金
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | |
|
| | | // 站内信+推送
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | |
| | | if (orderList != null && orderList.size() > 0 & !StringUtil.isNullOrEmpty(orderList.get(0).getSettlementTime()))
|
| | | order.setJieSuanTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | | if (order.getJieSuanTime().getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | return;
|
| | | }
|
| | | // if (order.getJieSuanTime().getTime() >=
|
| | | // TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | // return;
|
| | | // }
|
| | |
|
| | | // TODO 处理维权成功但是已到账的订单
|
| | |
|
| | | if (order.getJieSuanTime().getTime() > TimeUtil.convertToTimeTemp("2019-01-01", "yyyy-MM-dd")) {// 结算时间在2月1号的开始处理已到账但是维权的
|
| | | CommonOrder commonOrder = commonOrderService.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | order.getOrderItemId());
|
| | | if (commonOrder != null && !StringUtil.isNullOrEmpty(commonOrder.getTradeId())) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null
|
| | | && hongBaoOrder.getHongBaoV2().getState() == HongBaoV2.STATE_YILINGQU) {// 已经到账的看是否需要扣款
|
| | | TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackService
|
| | | .selectByOrderItemId(order.getOrderItemId());
|
| | | if (drawBack == null) {// 还未扣款
|
| | | try {
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(order.getOrderId());
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanInvite(order.getOrderId());
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanShare(order.getOrderId());
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, null, "订单号:" + order.getOrderId());
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | // 2018-08-05 过后的订单才处理维权
|
| | | Date balanceTime = null;
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getId());
|
| | | if (hongBaoOrder != null)
|
| | | if (hongBaoOrder != null) {
|
| | | balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
|
| | | shareGoodsCount += hongBaoOrder.getCommonOrder().getCount();
|
| | | }
|
| | | shareOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | if (balanceTime != null
|
| | | && balanceTime.getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | |
| | | orderMapper.insertSelective(order);
|
| | | oldOrder = order;
|
| | | } else {
|
| | | UserExtraTaoBaoInfo info = userExtraTaoBaoInfoService
|
| | | .getBySpecialId(orderList.get(0).getSpecialId());
|
| | | UserExtraTaoBaoInfo info = null;
|
| | | if (pid.equalsIgnoreCase(TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID)
|
| | | && !StringUtil.isNullOrEmpty(orderList.get(0).getRelationId())) {
|
| | | info = userExtraTaoBaoInfoService.getByRelationId(orderList.get(0).getRelationId());
|
| | | } else if (!StringUtil.isNullOrEmpty(orderList.get(0).getSpecialId())) {
|
| | | info = userExtraTaoBaoInfoService.getBySpecialId(orderList.get(0).getSpecialId());
|
| | | }
|
| | | if (info != null && info.getUser() != null) {
|
| | | uid = info.getUser().getId();
|
| | | // 插入到Order中
|
| | |
| | | */
|
| | | @Transactional
|
| | | public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes) throws PushException {
|
| | | |
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | |
|
| | | try {
|
| | |
|
| | |
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, String versions) throws PushException {
|
| | | |
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, String versions)
|
| | | throws PushException {
|
| | |
|
| | | String gid = auctionId + "";
|
| | | JSONObject json = new JSONObject();
|
| | | // json.put("url", "http://item.taobao.com/item.htm?id=" + gid);// IOS使用
|
| | |
| | | json.put("type", "goodsdetail");
|
| | | json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | |
|
| | | // 版本推送
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | | info.setContent(content);
|
| | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException {
|
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | | json.put("type", "url");
|
| | | json.put("webUrl", url);
|
| | | json.put("miPushUrl", String.format("%s.ui.invite.ShareBrowserActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | |
|
| | | // 版本推送
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException {
|
| | | |
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
|
| | |
|
| | |
| | | json.put("content", contentJson);
|
| | | json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | |
|
| | | // 版本推送
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | |
|
| | | // 小米 全推
|
| | |
| | | json.put("content", contentJson);
|
| | | json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | |
|
| | | // 版本推送
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | // 小米 单推
|
| | | try {
|
| | | PushUtils.singlePushXiaoMi(info, json, pushRecord);
|
| | |
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", weexUrl);
|
| | | json.put("type", "weex");
|
| | | |
| | |
|
| | | // 版本推送
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | | info.setContent(content);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions) throws PushException {
|
| | | |
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions)
|
| | | throws PushException {
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | | json.put("type", "baichuan");
|
| | |
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException {
|
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("type", "welfare");
|
| | | json.put("miPushUrl", String.format("%s.ui.mine.WelfareCenterActivity",
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoOrder selectByTradeId(String tradeId) {
|
| | | return taoBaoOrderMapper.selectTaoBaoOrderByTradeId(tradeId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanDrawBackMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | |
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDebtService userMoneyDebtService;
|
| | |
|
| | | @Override
|
| | | public void addWeiQuanDrawBack(TaoBaoWeiQuanDrawBack taoBaoWeiQuanDrawBack) {
|
| | | taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(taoBaoWeiQuanDrawBack.getOrderItemId(),
|
| | | taoBaoWeiQuanDrawBack.getUser().getId());
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void addDebt(Long uid, Long hbId, BigDecimal money) throws UserMoneyDebtException {
|
| | | UserMoneyDebt debt = new UserMoneyDebt();
|
| | | debt.setBeiZhu(null);
|
| | | debt.setCreateTime(new Date());
|
| | | debt.setLeftMoney(money);
|
| | | debt.setOriginMoney(money);
|
| | | debt.setSourceId(hbId);
|
| | | debt.setType(UserMoneyDebtTypeEnum.order);
|
| | | debt.setUid(uid);
|
| | | userMoneyDebtService.addUserMoneyDebt(debt);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | |
| | | // 计算淘宝联盟返给平台的资金
|
| | | BigDecimal sumFee = new BigDecimal("0");
|
| | | for (TaoBaoOrder order : orderList)
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | if (order.getSubsidy() != null)
|
| | | sumFee = sumFee.add(order.getSubsidy());
|
| | | }
|
| | | if (new BigDecimal(0).compareTo(sumFee) == 0)
|
| | | throw new TaoBaoWeiQuanException(TaoBaoWeiQuanException.CODE_NEDD_UPDATE_ORDER, "需要更新订单");
|
| | |
|
| | |
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | | List<TaoBaoWeiQuanDrawBack> newWeiQuanDrawBackList = new ArrayList<>();
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | |
| | | continue;
|
| | | // 退款的资金
|
| | | fanMoney = fanMoney.add(weiQuanOrder.getFanMoney());
|
| | | // 插入记录
|
| | | weiQuanDrawBack = new TaoBaoWeiQuanDrawBack();
|
| | | weiQuanDrawBack.setCreateTime(new Date());
|
| | | // 暂时设为0
|
| | |
| | | weiQuanDrawBack.setOrderId(weiQuanOrder.getOrderId());
|
| | | weiQuanDrawBack.setOrderItemId(weiQuanOrder.getOrderItemId());
|
| | | weiQuanDrawBack.setUser(new UserInfo(uid));
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);
|
| | | newWeiQuanDrawBackList.add(weiQuanDrawBack);
|
| | | }
|
| | |
|
| | | if (fanMoney.compareTo(new BigDecimal("0")) <= 0)
|
| | | continue;
|
| | |
|
| | | // 插入记录
|
| | | for (TaoBaoWeiQuanDrawBack drawBack : newWeiQuanDrawBackList) {
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(drawBack);
|
| | | }
|
| | |
|
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | // 计算资金是否充足
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | | {
|
| | | // 添加债务
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrderMapper
|
| | | .selectTaoBaoOrderByTradeId(weiQuanOrder.getOrderItemId());
|
| | | if (taoBaoOrder != null) {
|
| | | BigDecimal totalFee = taoBaoOrder.geteIncome();
|
| | | if (taoBaoOrder.getSubsidy() != null)
|
| | | totalFee = totalFee.add(taoBaoOrder.getSubsidy());
|
| | | //
|
| | | CommonOrder co = commonOrderMapper.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanOrder.getOrderItemId());
|
| | | if (co != null) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
|
| | | BigDecimal drawback = MoneyBigDecimalUtil.div(
|
| | | hongBaoOrder.getHongBaoV2().getMoney().multiply(weiQuanOrder.getFanMoney()),
|
| | | totalFee);
|
| | | try {
|
| | | addDebt(uid, hongBaoOrder.getHongBaoV2().getId(), drawback);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "资金借贷异常");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | continue;
|
| | | }
|
| | |
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 新版资金记录
|
| | | try {
|
| | |
| | | // 计算淘宝联盟返给平台的资金
|
| | | BigDecimal sumFee = new BigDecimal("0");
|
| | | for (TaoBaoOrder order : orderList)
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | if (order.getSubsidy() != null)
|
| | | sumFee = sumFee.add(order.getSubsidy());
|
| | | }
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | |
|
| | |
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | |
|
| | | List<TaoBaoWeiQuanDrawBack> newWeiQuanDrawBackList = new ArrayList<>();
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | |
| | | weiQuanDrawBack.setOrderId(weiQuanOrder.getOrderId());
|
| | | weiQuanDrawBack.setOrderItemId(weiQuanOrder.getOrderItemId());
|
| | | weiQuanDrawBack.setUser(new UserInfo(uid));
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);
|
| | | newWeiQuanDrawBackList.add(weiQuanDrawBack);
|
| | | }
|
| | |
|
| | | if (fanMoney.compareTo(new BigDecimal("0")) <= 0)
|
| | |
| | |
|
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | |
|
| | | for (TaoBaoWeiQuanDrawBack drawBack : newWeiQuanDrawBackList)
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(drawBack);
|
| | | // 计算资金是否充足
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | | {
|
| | | // 添加债务
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrderMapper
|
| | | .selectTaoBaoOrderByTradeId(weiQuanOrder.getOrderItemId());
|
| | | if (taoBaoOrder != null) {
|
| | | BigDecimal totalFee = taoBaoOrder.geteIncome();
|
| | | if (taoBaoOrder.getSubsidy() != null)
|
| | | totalFee = totalFee.add(taoBaoOrder.getSubsidy());
|
| | | //
|
| | | CommonOrder co = commonOrderMapper.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanOrder.getOrderItemId());
|
| | | if (co != null) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Mapper
|
| | | .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | for (int i = 0; i < hongBaoList.size(); i++) {
|
| | | if (hongBaoList.get(i).getUserInfo().getId().longValue() != uid) {
|
| | | hongBaoList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | |
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | BigDecimal drawback = MoneyBigDecimalUtil
|
| | | .div(hb.getMoney().multiply(weiQuanOrder.getFanMoney()), totalFee);
|
| | | try {
|
| | | addDebt(uid, hb.getId(), drawback);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "资金借贷异常");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | continue;
|
| | | }
|
| | |
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 新版资金记录
|
| | | try {
|
| | |
| | | // 计算淘宝联盟返给平台的资金
|
| | | BigDecimal sumFee = new BigDecimal("0");
|
| | | for (TaoBaoOrder order : orderList)
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | if (order.getSubsidy() != null)
|
| | | sumFee = sumFee.add(order.getSubsidy());
|
| | | }
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<CommonOrderVO> typeList = new ArrayList<>();
|
| | |
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | | List<TaoBaoWeiQuanDrawBack> newWeiQuanDrawBackList = new ArrayList<>();
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | |
| | | weiQuanDrawBack.setOrderId(weiQuanOrder.getOrderId());
|
| | | weiQuanDrawBack.setOrderItemId(weiQuanOrder.getOrderItemId());
|
| | | weiQuanDrawBack.setUser(new UserInfo(uid));
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);
|
| | | newWeiQuanDrawBackList.add(weiQuanDrawBack);
|
| | | }
|
| | |
|
| | | if (fanMoney.compareTo(new BigDecimal("0")) <= 0)
|
| | | continue;
|
| | |
|
| | | for (TaoBaoWeiQuanDrawBack drawBack : newWeiQuanDrawBackList)
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(drawBack);
|
| | |
|
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | |
|
| | | // 计算资金是否充足
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | | {
|
| | | // 添加债务
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrderMapper
|
| | | .selectTaoBaoOrderByTradeId(weiQuanOrder.getOrderItemId());
|
| | | if (taoBaoOrder != null) {
|
| | | BigDecimal totalFee = taoBaoOrder.geteIncome();
|
| | | if (taoBaoOrder.getSubsidy() != null)
|
| | | totalFee = totalFee.add(taoBaoOrder.getSubsidy());
|
| | | //
|
| | | CommonOrder co = commonOrderMapper.selectBySourceTypeAndTradeId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanOrder.getOrderItemId());
|
| | | if (co != null) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Mapper
|
| | | .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | for (int i = 0; i < hongBaoList.size(); i++) {
|
| | | if (hongBaoList.get(i).getUserInfo().getId().longValue() != uid) {
|
| | | hongBaoList.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | |
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | BigDecimal drawback = MoneyBigDecimalUtil
|
| | | .div(hb.getMoney().multiply(weiQuanOrder.getFanMoney()), totalFee);
|
| | | try {
|
| | | addDebt(uid, hb.getId(), drawback);
|
| | | } catch (UserMoneyDebtException e) {
|
| | | throw new TaoBaoWeiQuanException(101, "资金借贷异常");
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | continue;
|
| | | }
|
| | |
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | |
|
| | | // 新版资金记录
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemId(String orderItemId) {
|
| | | List<TaoBaoWeiQuanDrawBack> list = taoBaoWeiQuanDrawBackMapper.selectByOrderItemId(orderItemId);
|
| | | if (list != null && list.size() > 0)
|
| | | return list.get(0);
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByHongBaoId(Long hbId) {
|
| | | Long uid = null;
|
| | | HongBaoV2 hb = hongBaoV2Mapper.selectByPrimaryKey(hbId);
|
| | | uid = hb.getUserInfo().getId();
|
| | | if (hb.getParent() != null)
|
| | | hb = hb.getParent();
|
| | | HongBaoOrder hbo = hongBaoOrderMapper.selectByHongBaoId(hb.getId());
|
| | | if (hbo != null && hbo.getCommonOrder() != null) {
|
| | | return taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(hbo.getCommonOrder().getTradeId(), uid);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao.dataoke;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.dataoke.DaTaoKeDetailMapper;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeApiResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | |
| | | public void startSyncGoods() {
|
| | | // 判断是否有正在进行的更新
|
| | | String key1 = "dataoke-updating";
|
| | | if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key1)))
|
| | | return;
|
| | |
|
| | | String key2 = "dataoke-update-time";
|
| | | String updateTime = redisManager.getCommonString(key2);
|
| | | if (!StringUtil.isNullOrEmpty(updateTime)) {
|
| | | DaTaoKeApiResult result = DaTaoKeApiUtil.goodsList(1);
|
| | | if (result.getUpdateTime().equalsIgnoreCase(updateTime)) {// 和上次更新在同一时间
|
| | | return;
|
| | | }
|
| | | }
|
| | | // if (!StringUtil.isNullOrEmpty(redisManager.getCommonString(key1)))
|
| | | // return;
|
| | |
|
| | | // 开始更新
|
| | | redisManager.cacheCommonString(key1, "1");
|
| | | List<DaTaoKeDetail> goodsList = new ArrayList<>();
|
| | | for (int p = 1; p < 2000; p++) {
|
| | | redisManager.cacheCommonString(key1, "1", 60 * 20);
|
| | | long firstTime = System.currentTimeMillis() - 1000 * 60 * 5L;
|
| | | int totalCount = 0;
|
| | | for (int p = 1; p <= 2000; p++) {// 10W数据
|
| | | DaTaoKeApiResult result = DaTaoKeApiUtil.goodsList(p);
|
| | | goodsList.addAll(result.getDetailList());
|
| | | if (result.getDetailList().size() < 50)// 更新完成
|
| | | {
|
| | | redisManager.removeCommonString(key1);
|
| | | break;
|
| | | }
|
| | | addGoodsList(result.getDetailList());
|
| | | totalCount += result.getDetailList().size();
|
| | | }
|
| | | |
| | | //
|
| | | |
| | | |
| | |
|
| | | LogHelper.test("大淘客总共更新数据数量:" + totalCount);
|
| | | // 清除过期数据
|
| | | if (totalCount > 50000)// 保证有5w数据再清除过期
|
| | | {
|
| | | daTaoKeDetailMapper.deleteByMinUpdateTime(firstTime);
|
| | | LogHelper.test("删除大淘客过期数据:" + totalCount);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void addGoodsList(List<DaTaoKeDetail> goodsList) {
|
| | | List<Long> idList = new ArrayList<>();
|
| | | for (DaTaoKeDetail goods : goodsList) {
|
| | | goods.setUpdateTime(new Date());
|
| | | idList.add(goods.getId());
|
| | | }
|
| | | // 批量删除
|
| | | daTaoKeDetailMapper.deleteByIdList(idList);
|
| | | // 批量插入
|
| | | daTaoKeDetailMapper.insertByBatch(goodsList);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | Constant.alipayConfig.getAppId(), privateKey, "json", "gbk", null, "RSA2");
|
| | | AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
|
| | | String uuid = UUID.randomUUID().toString().replace("-", "");
|
| | | String appName = systemConfigService.get("appName", extract.getSystem());
|
| | | String appName = Constant.systemCommonConfig.getProjectChineseName();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("out_biz_no", uuid);
|
| | | json.put("payee_type", "ALIPAY_LOGONID");
|
| | | json.put("payee_account", extract.getAccount());
|
| | | json.put("amount", extract.getMoney());
|
| | | json.put("payer_show_name", appName + "提现");
|
| | | json.put("payer_show_name", appName + "App" + "提现");
|
| | | json.put("payee_real_name", extract.getName());
|
| | | json.put("remark", "来自" + appName + "的提现");
|
| | | json.put("remark", "来自" + appName + "App" + "的提现");
|
| | | request.setBizContent(json.toString());
|
| | | AlipayFundTransToaccountTransferResponse response = null;
|
| | | try {
|
| | |
| | | phone = phone.replaceAll(" ", "");
|
| | |
|
| | | // 苹果应用商店上线测试号码
|
| | | if ("17316780233".equalsIgnoreCase(phone) && "258168".equalsIgnoreCase(vcode)) {
|
| | | if ("17316780233".equalsIgnoreCase(phone) && "2581".equalsIgnoreCase(vcode)) {
|
| | | ;
|
| | | } else {
|
| | |
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyService;
|
| | | import com.yeshi.fanli.util.cmq.UserMoneyChangeCMQManager;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyServiceImpl implements UserMoneyService {
|
| | |
|
| | | @Resource
|
| | | private ShareMapper shareMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Override
|
| | | public BigDecimal getMoneyToday(Long uid) {
|
| | |
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void subUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail) {
|
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.subHongBaoByUid(uid, money);
|
| | | try {
|
| | | UserMoneyChangeCMQManager.getInstance()
|
| | | .addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, new BigDecimal(0).subtract(money)));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail) {
|
| | | userMoneyDetailMapper.insertSelective(detail);
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | | try {
|
| | | UserMoneyChangeCMQManager.getInstance().addUserMoneyChangeMsg(new UserMoneyChangeDTO(uid, money));
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.money;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | |
|
| | | public interface UserMoneyDebtService {
|
| | |
| | | */
|
| | | public void addUserMoneyDebt(UserMoneyDebt debt) throws UserMoneyDebtException;
|
| | |
|
| | | /**
|
| | | * 根据类型与源ID获取
|
| | | * |
| | | * @param type
|
| | | * @param sourceId
|
| | | * @return
|
| | | */
|
| | | public UserMoneyDebt selectByTypeAndSourceId(UserMoneyDebtTypeEnum type, Long sourceId);
|
| | |
|
| | | /**
|
| | | * 偿还
|
| | | * |
| | | * @param debt
|
| | | * @throws UserMoneyDebtException
|
| | | */
|
| | | public void repayDebt(UserMoneyDebt debt,BigDecimal money) throws UserMoneyDebtException;
|
| | |
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 统计奖金订单数量、金额
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | * @param day
|
| | |
| | | public Map<String, Object> countBonusOrderMoneyAndNumber(Long uid, Integer type, Integer day, String startTime,
|
| | | String endTime);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据条件统计
|
| | | *
|
| | |
| | | */
|
| | | public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrder, Long uid) throws CommonOrderException;
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据用户ID,订单状态,结算时间统计订单数量
|
| | | * |
| | | * @param uid
|
| | | * @param state
|
| | | * @param minDate
|
| | |
| | |
|
| | | /**
|
| | | * 后端查询订单列表
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @param uid
|
| | |
| | | * @param orderNo
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param dateType 1昨天 2今天 3本月 4 上月
|
| | | * @param dateType
|
| | | * 1昨天 2今天 3本月 4 上月
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | |
| | | Integer orderState, String orderNo, String startTime, String endTime, Integer dateType)
|
| | | throws CommonOrderException;
|
| | |
|
| | | public long countQueryByUid(Long uid, Integer state, Integer type, Integer orderState, String orderNo, String startTime,
|
| | | String endTime, Integer dateType) throws CommonOrderException;
|
| | | public long countQueryByUid(Long uid, Integer state, Integer type, Integer orderState, String orderNo,
|
| | | String startTime, String endTime, Integer dateType) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 查询所有用户订单 |
| | | * 查询所有用户订单
|
| | | * |
| | | * @param start
|
| | | * @param count
|
| | | * @param keyType
|
| | |
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | |
| | | public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state, Integer type,
|
| | | Integer orderState, String startTime, String endTime) throws CommonOrderException;
|
| | |
|
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState, String startTime,
|
| | | String endTime) throws CommonOrderException;
|
| | | public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state,
|
| | | Integer type, Integer orderState, String startTime, String endTime) throws CommonOrderException;
|
| | |
|
| | | public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState,
|
| | | String startTime, String endTime) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 根据订单号获取信息
|
| | | * |
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | |
| | |
|
| | | /**
|
| | | * 查询券奖励金额以及订单信息
|
| | | * |
| | | * @param uid
|
| | | * @param state
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer state, String orderNo) throws CommonOrderException;
|
| | | public List<CommonOrderVO> getCouponHongbaoByOrderNo(Long uid, Integer state, String orderNo)
|
| | | throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 查询订单
|
| | | * |
| | | * @param uid
|
| | | * @param orderNo
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState) throws CommonOrderException;
|
| | | public CommonOrderVO getCommonOrderByOrderNo(Long uid, String orderNo, Integer orderState)
|
| | | throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 使用奖励券成功后跳转 修改
|
| | | * |
| | | * @param orderNo
|
| | | * @return
|
| | | */
|
| | | public JSONObject getRewardJumpInfo(String orderNo);
|
| | |
|
| | | /**
|
| | | * 根据交易号获取订单详情
|
| | | * |
| | | * @param sourceType
|
| | | * @param tradeId
|
| | | * @return
|
| | | */
|
| | | public CommonOrder selectBySourceTypeAndTradeId(int sourceType, String tradeId);
|
| | |
|
| | | }
|
| | |
| | | * @param realtionId
|
| | | */
|
| | | public void bindSpecialIdAndRealtionId(String tradeId, String specialId, String realtionId);
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 根据交易ID获取订单号
|
| | | * @param tradeId
|
| | | * @return
|
| | | */
|
| | | public TaoBaoOrder selectByTradeId(String tradeId);
|
| | |
|
| | | }
|
| | |
| | | * @throws TaoBaoWeiQuanException
|
| | | */
|
| | | public void doWeiQuanInvite(String orderId) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 通过淘宝子订单查询扣款详情
|
| | | * @param orderItemId
|
| | | * @return
|
| | | */
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemId(String orderItemId);
|
| | | |
| | | |
| | | /**
|
| | | * 通过红包ID查询
|
| | | * @param hbId
|
| | | * @return
|
| | | */
|
| | | public TaoBaoWeiQuanDrawBack selectByHongBaoId(Long hbId);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | |
|
| | | /**
|
| | | * 用户资金服务
|
| | | *
|
| | |
| | |
|
| | | /**
|
| | | * 获取用户上月红包收益(创建时间为上月)
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal getMoneyLastMonth(Long uid);
|
| | |
|
| | | /**
|
| | | * 减去用户资金
|
| | | * @param uid
|
| | | * @param money
|
| | | * @param detail
|
| | | */
|
| | | public void subUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail);
|
| | |
|
| | | /**
|
| | | * 增加用户资金
|
| | | * @param uid
|
| | | * @param money
|
| | | * @param detail
|
| | | */
|
| | | public void addUserMoney(Long uid, BigDecimal money, UserMoneyDetail detail);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager;
|
| | |
|
| | | /**
|
| | | * 系统初始化
|
| | |
| | | public static final String TAOBAO_COMMON_APPKEY = "24838852";
|
| | | public static final String TAOBAO_COMMON_APPSECRET = "bc8265e2bf8d8115329d652f9d3d4cd8";
|
| | | public static final String TAOBAO_COMMON_PID = "mm_124933865_43788020_437192946";
|
| | | // 淘宝将渠道ID处理成会员ID的pid
|
| | | public static final String TAOBAO_RELATION_AS_SPECIAL_PID = "";
|
| | |
|
| | | }
|
File was renamed from fanli/src/main/java/com/yeshi/fanli/util/ThreeSaleCMQManager.java |
| | |
| | | package com.yeshi.fanli.util;
|
| | | package com.yeshi.fanli.util.cmq;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
New file |
| | |
| | | package com.yeshi.fanli.util.cmq;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.yeshi.utils.CMQUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.qcloud.cmq.Message;
|
| | | import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
|
| | | public class UserMoneyChangeCMQManager {
|
| | |
|
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
|
| | | private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
|
| | | private static UserMoneyChangeCMQManager userMoneyChangeCMQManager;
|
| | | private static CMQUtil cmqUtil;
|
| | |
|
| | | private final static String TOPIC_NAME = "topic_user_money";
|
| | |
|
| | | public static String QUEUE_DEBT = TOPIC_NAME + "_" + "debt";
|
| | |
|
| | | public static String SUBSCRIBE_DEBT = "debt";
|
| | |
|
| | | static {
|
| | | cmqUtil = CMQUtil.getInstance(secretId, secretKey);
|
| | | // 创建主题,添加订阅
|
| | | cmqUtil.createTopic(TOPIC_NAME);
|
| | | // 用户券订阅
|
| | | String[] subscripts = new String[] { SUBSCRIBE_DEBT };
|
| | | String[] queues = new String[] { QUEUE_DEBT };
|
| | |
|
| | | for (int i = 0; i < subscripts.length; i++) {
|
| | | String queueName = queues[i];
|
| | | cmqUtil.createQueue(queueName);
|
| | | cmqUtil.subscribeTopic(TOPIC_NAME, subscripts[i], queueName);
|
| | | }
|
| | | }
|
| | |
|
| | | public static UserMoneyChangeCMQManager getInstance() {
|
| | | if (userMoneyChangeCMQManager == null)
|
| | | userMoneyChangeCMQManager = new UserMoneyChangeCMQManager();
|
| | | return userMoneyChangeCMQManager;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 发布
|
| | | * |
| | | * @param history
|
| | | */
|
| | | public void addUserMoneyChangeMsg(UserMoneyChangeDTO dto) {
|
| | | if (dto == null)
|
| | | return;
|
| | | cmqUtil.publishTopicMessage(TOPIC_NAME, new Gson().toJson(dto));
|
| | | LogHelper.test("邀请消息投递成功");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 消费队列消息
|
| | | * |
| | | * @param queueName
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public Map<String, UserMoneyChangeDTO> consumeQueueMsg(String queueName, int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, queueName);
|
| | | Map<String, UserMoneyChangeDTO> map = new HashMap<>();
|
| | |
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | UserMoneyChangeDTO dto = new Gson().fromJson(result, UserMoneyChangeDTO.class);
|
| | | map.put(msg.receiptHandle, dto);
|
| | | }
|
| | | return map;
|
| | | }
|
| | |
|
| | | public void deleteQueueMsg(String queueName, String receiptHandle) {
|
| | | cmqUtil.deleteMsg(queueName, receiptHandle);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public class DaTaoKeApiUtil {
|
| | | final static String API_KEY = "a083abb893";
|
| | | final static String API_KEY_2 = "b7a5ea2cd9";
|
| | | static Gson gson = new Gson();
|
| | |
|
| | | public static DaTaoKeApiResult goodsList(int page) {
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&page=%s",
|
| | | API_KEY, page + "");
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, page + "");
|
| | | String result = HttpUtil.get(url);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("result");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | list.add(gson.fromJson(array.optJSONObject(i).toString(), DaTaoKeDetail.class));
|
New file |
| | |
| | | package com.yeshi.fanli.util.pinduoduo;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
|
| | | public class PinDuoDuoApiUtil {
|
| | | private final static String CLIENT_ID = "9f6ee5ebd3b94c2080c4d51c2427e9fa";
|
| | | private final static String CLIENT_SECRET = "95e1f1904385664bf4b87d4b34de12f9f31c505d";
|
| | |
|
| | | private static String getSign(Map<String, String> map) {
|
| | | List<String> keyList = new ArrayList<>();
|
| | | Iterator<String> keys = map.keySet().iterator();
|
| | | while (keys.hasNext()) {
|
| | | String key = keys.next();
|
| | | keyList.add(key);
|
| | | }
|
| | | Collections.sort(keyList);
|
| | | String org = "";
|
| | | for (String key : keyList) {
|
| | | org += key + map.get(key);
|
| | | }
|
| | | return StringUtil.Md5(CLIENT_SECRET + org + CLIENT_SECRET).toUpperCase();
|
| | | }
|
| | |
|
| | | private static String baseRequest(Map<String, String> map) {
|
| | | map.put("client_id", CLIENT_ID);
|
| | | map.put("timestamp", System.currentTimeMillis() / 1000 + "");
|
| | | map.put("sign", getSign(map));
|
| | | Iterator<String> keys = map.keySet().iterator();
|
| | | String url = "https://gw-api.pinduoduo.com/api/router?";
|
| | | while (keys.hasNext()) {
|
| | | String key = keys.next();
|
| | | try {
|
| | | url += key + "=" + URLEncoder.encode(map.get(key), "UTF-8") + "&";
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | if (url.endsWith("&"))
|
| | | url = url.substring(0, url.length() - 1);
|
| | |
|
| | | String result = HttpUtil.post(url);
|
| | | return result;
|
| | | }
|
| | |
|
| | | public static void searchGoods(String key) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.goods.search");
|
| | | map.put("keyword", key);
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | public static void convert(Long goodsId) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.goods.promotion.url.generate");
|
| | | map.put("p_id", "8590899_61877633");
|
| | | JSONArray array = new JSONArray();
|
| | | array.add(goodsId);
|
| | | map.put("goods_id_list", array.toString());
|
| | | map.put("custom_parameters", "437032");
|
| | |
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | public static void createPid() {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.goods.pid.generate");
|
| | | map.put("number", "1");
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | public static void getOrders() {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.order.list.increment.get");
|
| | | map.put("start_update_time", System.currentTimeMillis() / 1000 - 60 * 60 + "");
|
| | | map.put("end_update_time", System.currentTimeMillis() / 1000 + "");
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取商品详情
|
| | | * |
| | | * @param goodsId
|
| | | */
|
| | | public static void getGoodsDetail(Long goodsId) {
|
| | | JSONArray array = new JSONArray();
|
| | | array.add(goodsId);
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.goods.detail");
|
| | | map.put("goods_id_list", array.toString());
|
| | | String result = baseRequest(map);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type)
|
| | | throws Exception {
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | return null;
|
| | |
|
| | | Gson gson = new Gson();
|
| | | PushLogHelper.iosInfo("IOS推送设备数为:" + deviceTokenList.size());
|
| | | PushLogHelper.iosInfo("IOS推送的内容为:" + gson.toJson(info));
|
| | |
| | | int end = start + pageSize;
|
| | | if (end > tokenList.size())
|
| | | end = tokenList.size();
|
| | | pushIOS(tokenList.subList(start, end), json,certificate,certificatePassword);
|
| | | pushIOS(tokenList.subList(start, end), json, certificate, certificatePassword);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | public static String pushIOS(List<String> deviceTokenList, JSONObject json,InputStream certificate,String certificatePWD) throws Exception {
|
| | | public static String pushIOS(List<String> deviceTokenList, JSONObject json, InputStream certificate,
|
| | | String certificatePWD) throws Exception {
|
| | | List<String> tokenList = new ArrayList<String>();
|
| | | for (String deviceToken : deviceTokenList) {
|
| | | tokenList.add(deviceToken);
|
| | |
| | | PushNotificationManager pushManager = new PushNotificationManager();
|
| | | // true:表示的是产品线上发布推送服务 false:表示的是产品测试推送服务
|
| | | if (Constant.IS_TEST)
|
| | | pushManager.initializeConnection(
|
| | | new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
|
| | | pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
|
| | | else
|
| | | pushManager
|
| | | .initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
|
| | | pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
|
| | |
|
| | | List<Device> deviceList = new ArrayList<Device>();
|
| | | for (String token : tokenList) {
|
| | |
| | | InputStream certificate = IOSPushUtil.class.getClassLoader()
|
| | | .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件
|
| | | String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd();
|
| | | pushIOS(tokenList, json,certificate,certificatePassword);
|
| | | pushIOS(tokenList, json, certificate, certificatePassword);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | * @throws Exception
|
| | | */
|
| | | public static int allPushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) throws Exception {
|
| | | |
| | | if(Constant.IS_TEST)
|
| | | return 1;
|
| | |
|
| | |
|
| | | JSONObject mapXm = JSONObject.fromObject(json);
|
| | |
| | | * @return
|
| | | */
|
| | | public static int singlePushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) {
|
| | | if(Constant.IS_TEST)
|
| | | return 1;
|
| | |
|
| | | JSONObject mapXm = JSONObject.fromObject(json);
|
| | |
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoHttpUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | tg.setTaoBaoHongBaoInfo(hongBaoInfo);
|
| | |
|
| | | // 测试使用
|
| | | tg.setMoneyType(Math.random() > 0.5 ? 1 : 2);
|
| | | tg.setSalesType(Math.random() > 0.5 ? 1 : 2);
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签测试内容", "#FF0000"));
|
| | | tg.setLabels(labels);
|
| | |
|
| | | return tg;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | tg.setTaoBaoHongBaoInfo(hongBaoInfo);
|
| | |
|
| | | // 测试使用
|
| | | tg.setMoneyType(Math.random() > 0.5 ? 1 : 2);
|
| | | tg.setSalesType(Math.random() > 0.5 ? 1 : 2);
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签测试内容", "#FF0000"));
|
| | | tg.setLabels(labels);
|
| | |
|
| | | return tg;
|
| | | }
|
| | |
| | | JSONArray array = sellerJson.optJSONArray("evaluates");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | if ("宝贝描述".equalsIgnoreCase(item.optString("title"))) {
|
| | | if ("宝贝描述".equalsIgnoreCase(item.optString("title").trim())) {
|
| | | shop.setScoreGoods(new BigDecimal(item.optString("score").trim()));
|
| | | shop.setScoreGoodsD(new BigDecimal(item.optString("level").trim()));
|
| | | } else if ("卖家服务".equalsIgnoreCase(item.optString("title"))) {
|
| | | } else if ("卖家服务".equalsIgnoreCase(item.optString("title").trim())) {
|
| | | shop.setScoreSeller(new BigDecimal(item.optString("score").trim()));
|
| | | shop.setScoreSellerD(new BigDecimal(item.optString("level").trim()));
|
| | | } else if ("物流服务".equalsIgnoreCase(item.optString("title"))) {
|
| | | } else if ("物流服务".equalsIgnoreCase(item.optString("title").trim())) {
|
| | | shop.setScoreLogistics(new BigDecimal(item.optString("score").trim()));
|
| | | shop.setScoreLogisticsD(new BigDecimal(item.optString("level").trim()));
|
| | | }
|
| | |
| | | goods.setPictUrlWhite(item.optString("white_image"));
|
| | | return goods;
|
| | | }
|
| | | |
| | | public static void getShopGoodsList(Long shopId)
|
| | | {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "tmall.omni.pc.iteminfo.getbyshopid");
|
| | | map.put("shop_id",shopId+"");
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey("24838852");
|
| | | app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map,app);
|
| | | System.out.println(json);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.dto.order.OrderQuery;
|
| | | import com.yeshi.fanli.dto.taobao.WeiQuanOrderResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | return orderList;
|
| | | }
|
| | |
|
| | | public static List<TaoBaoWeiQuanOrder> getTaoBaoWeiQuanOrderList() {
|
| | | public static WeiQuanOrderResult getTaoBaoRelationWeiQuanOrderList(Date startTime, int page, boolean third) {
|
| | |
|
| | | return null;
|
| | | return getRelationAndSpecialWeiQuanOrderList(startTime, page, third, 1);
|
| | | }
|
| | |
|
| | | public static WeiQuanOrderResult getTaoBaoSpecialWeiQuanOrderList(Date startTime, int page, boolean third) {
|
| | |
|
| | | return getRelationAndSpecialWeiQuanOrderList(startTime, page, third, 2);
|
| | | }
|
| | |
|
| | | private static WeiQuanOrderResult getRelationAndSpecialWeiQuanOrderList(Date startTime, int page, boolean third,
|
| | | int bizType) {
|
| | | WeiQuanOrderResult finalResult = new WeiQuanOrderResult();
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> list = new ArrayList<>();
|
| | | finalResult.orderList = list;
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.relation.refund");
|
| | |
|
| | | JSONObject option = new JSONObject();
|
| | | option.put("search_type", 1);
|
| | | option.put("refund_type", third ? 2 : 1);
|
| | | option.put("start_time", TimeUtil.getGernalTime(startTime.getTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | option.put("page_no", page);
|
| | | option.put("page_size", 100);
|
| | | option.put("biz_type", bizType);
|
| | | map.put("search_option", option.toString());
|
| | |
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
|
| | | JSONObject results = json.optJSONObject("tbk_relation_refund_response").optJSONObject("result")
|
| | | .optJSONObject("data").optJSONObject("results");
|
| | | if (results == null)
|
| | | return finalResult;
|
| | |
|
| | | int count = results.optInt("total_count");
|
| | | finalResult.totalCount = count;
|
| | | JSONArray array = results.optJSONArray("result");
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JSONObject item = array.optJSONObject(i);
|
| | | TaoBaoWeiQuanOrder order = new TaoBaoWeiQuanOrder();
|
| | | order.setGoodsName(item.optString("tb_auction_title"));
|
| | | BigDecimal fanMoney = new BigDecimal(0);
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund3rd_pub"))) {
|
| | | fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund3rd_pub")));
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund3rd_pub"))) {
|
| | | fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund3rd_pub")));
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("tk_subsidy_fee_refund_pub"))) {
|
| | | fanMoney.add(new BigDecimal(item.optString("tk_subsidy_fee_refund_pub")));
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("tk_commission_fee_refund_pub"))) {
|
| | | fanMoney.add(new BigDecimal(item.optString("tk_commission_fee_refund_pub")));
|
| | | }
|
| | |
|
| | | if (fanMoney.compareTo(new BigDecimal(0)) == 0)
|
| | | fanMoney = null;
|
| | |
|
| | | order.setFanMoney(fanMoney);
|
| | | order.setJieSuanTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(item.optString("earning_time"), "yyyy-MM-dd HH:mm:ss")));
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("refund_fee")))
|
| | | order.setMoney(new BigDecimal(item.optString("refund_fee")));
|
| | | order.setOrderId(item.optString("tb_trade_parent_id"));
|
| | | order.setOrderItemId(item.optString("tb_trade_id"));
|
| | | int state = item.optInt("refund_status");
|
| | | if (state == 4)
|
| | | order.setState("维权创建");
|
| | | else if (state == 2)
|
| | | order.setState("维权成功");
|
| | | else if (state == 3)
|
| | | order.setState("维权失败");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(item.optString("tk_refund_suit_time")))
|
| | | order.setWeiQuanFinishTime(new Date(
|
| | | TimeUtil.convertToTimeTemp(item.optString("tk_refund_suit_time"), "yyyy-MM-dd HH:mm:ss")));
|
| | | order.setWeiQuanTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(item.optString("tk_refund_time"), "yyyy-MM-dd HH:mm:ss")));
|
| | | list.add(order);
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return finalResult;
|
| | | }
|
| | | }
|