发起提现增加统计,添加京东订单与商品,拼多多订单与商品
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | if (record.getExtraInfo() != null) {
|
| | | if (record.getExtraInfo().getOrderCount50More() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0)
|
| | | warnLevel = 2;
|
| | | StringBuffer desc = new StringBuffer();
|
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
|
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount());
|
| | | if (System.currentTimeMillis() > TimeUtil.convertToTimeTemp("2019-06-21", "yyyy-MM-dd")) {
|
| | | desc.append("大笔订单数:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单佣金:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#"); |
| | | if (record.getExtraInfo().getOrderCount50More() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderCount() >1
|
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(10)) >= 0)
|
| | | warnLevel = 2;
|
| | | } else {
|
| | | if (record.getExtraInfo().getOrderCount50More() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0)
|
| | | warnLevel = 2;
|
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
|
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount());
|
| | | }
|
| | | record.setExtraInfoStr(desc.toString());
|
| | | }
|
| | | record.setWarnLevel(warnLevel);
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderService taoBaoOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderCountService taoBaoOrderCountService;
|
| | |
|
| | | |
| | | @Resource
|
| | | private TaoBaoWeiQuanDrawBackService taoBaoWeiQuanDrawBackService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | /**
|
| | | * 统计历史订单-淘宝订单
|
| | | * |
| | | * @param callback
|
| | | * @param request
|
| | | * @param out
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("typeOrder", countByOdrerType);
|
| | | |
| | |
|
| | | // 统计今日 未失效订单数量 相同订单号合并为一单
|
| | | int todayOrder = taoBaoOrderCountService.countToday();
|
| | | // 统计昨日 未失效订单数量 相同订单号合并为一单
|
| | |
| | |
|
| | | data.put("todayOrder", todayOrder);
|
| | | data.put("yesterdayOrder", yesterdayOrder);
|
| | | |
| | |
|
| | | data.put("genzong", yesterdayOrder);
|
| | | data.put("yesterdayOrder", yesterdayOrder);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询所有用户订单列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getUserOrderList")
|
| | | public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType,
|
| | | String key, Integer state, Integer type, Integer orderState, String startTime, String endTime, |
| | | PrintWriter out) {
|
| | |
|
| | | public void getUserOrderList(String callback, Integer pageIndex, Integer pageSize, Integer keyType, String key,
|
| | | Integer state, Integer type, Integer orderState, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
| | | if (type != null && type == 0) {
|
| | | type = null; // 所有类型订单
|
| | | }
|
| | | |
| | |
|
| | | if (endTime != null && endTime.trim().length() > 0) {
|
| | | endTime += " 23:59:59";
|
| | | }
|
| | |
| | | long count = 0;
|
| | |
|
| | | // 查询列表
|
| | | List<CommonOrderVO> list = commonOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, |
| | | keyType, key, state, type, orderState, startTime, endTime);
|
| | | |
| | | List<CommonOrderVO> list = commonOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, keyType, key,
|
| | | state, type, orderState, startTime, endTime);
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | // 统计总数
|
| | | count = commonOrderService.countQuery(keyType, key, state, type, orderState, startTime, endTime);
|
| | | }
|
| | | |
| | |
|
| | | // 查询是否维权
|
| | | for (CommonOrderVO order : list) {
|
| | | // 查询是否维权
|
| | | TaoBaoWeiQuanOrder weiQuanOrder = taoBaoWeiQuanOrderService.listByorderItemId(order.getTradeId());
|
| | | if (weiQuanOrder != null)// 有维权
|
| | | {
|
| | | order.setState(CommonOrder.STATE_WQ);
|
| | | TaoBaoWeiQuanDrawBack drawBack = taoBaoWeiQuanDrawBackService
|
| | | .selectByOrderItemId(weiQuanOrder.getOrderItemId());
|
| | | if (drawBack != null) {// 已经退款
|
| | | order.setWeiQuanState(weiQuanOrder.getState());
|
| | | // 计算退款资金
|
| | | UserMoneyDetail detail = null;
|
| | | switch (order.getHongBaoType()) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | detail = userMoneyDetailService.selectByTypeAndUidAndIdentifyCode(
|
| | | UserMoneyDetailTypeEnum.fanliWeiQuan, Long.parseLong(order.getUserId()),
|
| | | drawBack.getId());
|
| | | if (detail == null)
|
| | | detail = userMoneyDetailService.selectByTypeAndUidAndIdentifyCode(
|
| | | UserMoneyDetailTypeEnum.weiQuan, Long.parseLong(order.getUserId()),
|
| | | drawBack.getId());
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | case HongBaoV2.TYPE_SHARE_YIJI:
|
| | | case HongBaoV2.TYPE_SHARE_ERJI:
|
| | | detail = userMoneyDetailService.selectByTypeAndUidAndIdentifyCode(
|
| | | UserMoneyDetailTypeEnum.inviteWeiQuan, Long.parseLong(order.getUserId()),
|
| | | drawBack.getId());
|
| | | break;
|
| | |
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | detail = userMoneyDetailService.selectByTypeAndUidAndIdentifyCode(
|
| | | UserMoneyDetailTypeEnum.shareWeiQuan, Long.parseLong(order.getUserId()),
|
| | | drawBack.getId());
|
| | | break;
|
| | | }
|
| | | if (detail != null) {
|
| | | // 退款成功
|
| | | order.setWeiQuanBackMoney(detail.getMoney().abs().toString());
|
| | | } else {// 尚未退款
|
| | | order.setWeiQuanBackMoney("-" + order.getHongBao());
|
| | | }
|
| | |
|
| | | } else {// 尚未退款
|
| | | order.setWeiQuanBackMoney("-" + order.getHongBao());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询订单列表用户uid
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryOrder")
|
| | | public void getHistoryOrder(String callback, Integer pageIndex, Integer pageSize, Long uid, Integer state, Integer type, |
| | | Integer orderState, String orderNo, String startTime, String endTime, PrintWriter out) {
|
| | | public void getHistoryOrder(String callback, Integer pageIndex, Integer pageSize, Long uid, Integer state,
|
| | | Integer type, Integer orderState, String orderNo, String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("uid不能为空"));
|
| | |
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
| | | if (type != null && type == 0) {
|
| | | type = null; // 所有类型订单
|
| | | }
|
| | | |
| | |
|
| | | if (endTime != null && endTime.trim().length() > 0) {
|
| | | endTime += " 23:59:59";
|
| | | }
|
| | |
| | | long count = 0;
|
| | |
|
| | | // 查询列表
|
| | | List<CommonOrderVO> list = commonOrderService.listQueryByUid((pageIndex - 1) * pageSize, pageSize , |
| | | uid, state, type, orderState, orderNo, startTime, endTime, null);
|
| | | List<CommonOrderVO> list = commonOrderService.listQueryByUid((pageIndex - 1) * pageSize, pageSize, uid,
|
| | | state, type, orderState, orderNo, startTime, endTime, null);
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | // 统计总数
|
| | | count = commonOrderService.countQueryByUid(uid, state, type, orderState, orderNo, startTime,
|
| | | endTime, null);
|
| | | count = commonOrderService.countQueryByUid(uid, state, type, orderState, orderNo, startTime, endTime,
|
| | | null);
|
| | | }
|
| | | |
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "get24HOderChannelCharts")
|
| | | public void get24HOderChannelCharts(String callback, String channelArray, Integer dateType,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | | public void get24HOderChannelCharts(String callback, String channelArray, Integer dateType, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | |
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | |
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | |
| | | for (String channel : channelList) {
|
| | | List<Map<String, Object>> list = hongBaoV2CountService.count24HOderByChannel(channel, dateType, year, startTime, endTime);
|
| | |
|
| | | |
| | | for (String channel : channelList) {
|
| | | List<Map<String, Object>> list = hongBaoV2CountService.count24HOderByChannel(channel, dateType, year,
|
| | | startTime, endTime);
|
| | |
|
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | }
|
| | | |
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | |
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | |
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | |
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | |
|
| | | data.put("line_list", line_list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 统计提现申请总次数
|
| | | * |
| | | * @param callback
|
| | | * @param channelArray 渠道名 为空是统计所有
|
| | | * @param dateType 显示视图:日-1 、月-2、 年-3
|
| | | * @param state 状态: 1-未到账 2-已到账 3-已失效
|
| | | * @param year |
| | | * @param channelArray
|
| | | * 渠道名 为空是统计所有
|
| | | * @param dateType
|
| | | * 显示视图:日-1 、月-2、 年-3
|
| | | * @param state
|
| | | * 状态: 1-未到账 2-已到账 3-已失效
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHongBaoNum")
|
| | | public void getHongBaoNum(String callback,String channelArray, Integer dateType, Integer state,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | | public void getHongBaoNum(String callback, String channelArray, Integer dateType, Integer state, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 1);
|
| | | JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 1);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | |
| | |
|
| | | /**
|
| | | * 统计提现申请总金额
|
| | | * |
| | | * @param callback
|
| | | * @param channelArray 渠道名 为空是统计所有
|
| | | * @param dateType 显示视图:日-1 、月-2、 年-3
|
| | | * @param state 状态: 1-未到账 2-已到账 3-已失效
|
| | | * @param year |
| | | * @param channelArray
|
| | | * 渠道名 为空是统计所有
|
| | | * @param dateType
|
| | | * 显示视图:日-1 、月-2、 年-3
|
| | | * @param state
|
| | | * 状态: 1-未到账 2-已到账 3-已失效
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHongBaoMoney")
|
| | | public void getHongBaoMoney(String callback,String channelArray, Integer dateType, Integer state,
|
| | | String year, String startTime, String endTime, PrintWriter out) {
|
| | | public void getHongBaoMoney(String callback, String channelArray, Integer dateType, Integer state, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | | JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 2);
|
| | |
|
| | | JSONObject data = countHistoryHongBao(channelArray, dateType, state, year, startTime, endTime, 2);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | |
| | | /**
|
| | | * 统计红包信息
|
| | | * |
| | | * @param channelArray
|
| | | * @param dateType
|
| | | * @param state
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject countHistoryHongBao(String channelArray, Integer dateType, Integer state, String year, String startTime,
|
| | | String endTime, int countType) throws Exception {
|
| | | public JSONObject countHistoryHongBao(String channelArray, Integer dateType, Integer state, String year,
|
| | | String startTime, String endTime, int countType) throws Exception {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | |
| | | List<String> channelList = null;
|
| | | if (channelArray != null && channelArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | channelList = gson.fromJson(channelArray, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | |
| | | channelList.add("all");
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | |
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | for (String channel : channelList) {
|
| | | List<Map<String, Object>> list = null;
|
| | | if (countType == 1 ) {
|
| | | list = hongBaoV2CountService.countHongBaoNum(channel, dateType, state, year, |
| | | startTime, endTime);
|
| | | if (countType == 1) {
|
| | | list = hongBaoV2CountService.countHongBaoNum(channel, dateType, state, year, startTime, endTime);
|
| | | } else if (countType == 2) {
|
| | | list = hongBaoV2CountService.countHongBaoMoney(channel, dateType, state, year, |
| | | startTime, endTime);
|
| | | list = hongBaoV2CountService.countHongBaoMoney(channel, dateType, state, year, startTime, endTime);
|
| | | }
|
| | | |
| | |
|
| | | if ("all".equalsIgnoreCase(channel)) {
|
| | | channel = "总计";
|
| | | }
|
| | | |
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", channel);
|
| | |
|
| | |
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | |
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | |
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | |
|
| | | data.put("line_list", line_list);
|
| | | |
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 分类型订单数与比例 |
| | | * 分类型订单数与比例
|
| | | * |
| | | * @param callback
|
| | | * @param dateType 日 -1 月-2 年-3
|
| | | * @param type 返利订单-1 分享订单-2 邀请订单-3 |
| | | * @param dateType
|
| | | * 日 -1 月-2 年-3
|
| | | * @param type
|
| | | * 返利订单-1 分享订单-2 邀请订单-3
|
| | | * @param year
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTypeNumber")
|
| | | public void getTypeNumber(String callback, Integer dateType, String typeArray, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | | |
| | | public void getTypeNumber(String callback, Integer dateType, String typeArray, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | |
| | | List<Integer> channelList = null;
|
| | | if (typeArray != null && typeArray.trim().length() > 0) {
|
| | | Gson gson = new Gson();
|
| | | channelList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {}.getType());
|
| | | channelList = gson.fromJson(typeArray, new TypeToken<ArrayList<Integer>>() {
|
| | | }.getType());
|
| | | }
|
| | |
|
| | | if (channelList == null || channelList.size() == 0) {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | |
| | |
|
| | | try {
|
| | |
|
| | | |
| | | JSONArray line_list = new JSONArray();
|
| | | for (Integer type : channelList) {
|
| | | |
| | | List<Map<String, Object>> list = hongBaoV2CountService.countHongBaoType(dateType,
|
| | | type, year, startTime, endTime);
|
| | | |
| | | |
| | |
|
| | | List<Map<String, Object>> list = hongBaoV2CountService.countHongBaoType(dateType, type, year, startTime,
|
| | | endTime);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (type == 1) {
|
| | | innerList.put("name", "返利订单");
|
| | |
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | |
|
| | | line_list.add(innerList);
|
| | | }
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | |
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | |
|
| | | data.put("line_list", line_list);
|
| | | |
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 订单跟踪准确率(返利券用户订单/淘宝联盟订单)
|
| | | * |
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getTrackAccuracyRate")
|
| | | public void getTrackAccuracyRate(String callback, Integer dateType, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | | |
| | | public void getTrackAccuracyRate(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | |
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | |
| | | List<Map<String, Object>> list = commonOrderCountService.getTrackAccuracyRate(dateType,
|
| | | year, startTime, endTime);
|
| | | |
| | |
|
| | | List<Map<String, Object>> list = commonOrderCountService.getTrackAccuracyRate(dateType, year, startTime,
|
| | | endTime);
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | |
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | | line_list.add(innerList);
|
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | |
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | |
|
| | | data.put("line_list", line_list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 当前未收货订单数
|
| | | * |
| | | * @param callback
|
| | | * @param type 订单状态-暂未使用
|
| | | * @param type
|
| | | * 订单状态-暂未使用
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryUnreceived")
|
| | | public void getHistoryUnreceived(String callback, Integer type, PrintWriter out) {
|
| | | try {
|
| | | |
| | |
|
| | | Long total = commonOrderCountService.countByState(1);
|
| | | if (total == null) {
|
| | | total = 0L;
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 维权订单数
|
| | | * |
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getWeiQaunOrderNumber")
|
| | | public void getWeiQaunOrderNumber(String callback, Integer dateType, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | | |
| | | public void getWeiQaunOrderNumber(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | JSONObject data = countWeiQaunOrder(dateType, year, startTime, endTime, 1);
|
| | | JSONObject data = countWeiQaunOrder(dateType, year, startTime, endTime, 1);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 维权订单金额
|
| | | * |
| | | * @param callback
|
| | | * @param dateType
|
| | | * @param year
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getWeiQaunOrderMoney")
|
| | | public void getWeiQaunOrderMoney(String callback, Integer dateType, String year,
|
| | | String startTime, String endTime, PrintWriter out) {
|
| | | |
| | | public void getWeiQaunOrderMoney(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | JSONObject data = countWeiQaunOrder(dateType, year, startTime, endTime, 2);
|
| | | JSONObject data = countWeiQaunOrder(dateType, year, startTime, endTime, 2);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计红包信息
|
| | | * |
| | | * @param channelArray
|
| | | * @param dateType
|
| | | * @param state
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject countWeiQaunOrder(Integer dateType, String year, String startTime,
|
| | | String endTime, int countType) throws Exception {
|
| | | public JSONObject countWeiQaunOrder(Integer dateType, String year, String startTime, String endTime, int countType)
|
| | | throws Exception {
|
| | |
|
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) {
|
| | | startTime = null;
|
| | |
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | |
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null; |
| | | |
| | | if (startTime != null) |
| | | startTime = null; |
| | | |
| | | if (endTime != null) |
| | | endTime = null; |
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | | |
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | List<Map<String, Object>> list = null;
|
| | | if (countType == 1 ) {
|
| | | if (countType == 1) {
|
| | | list = commonOrderCountService.countWeiQaunOrderNumber(dateType, year, startTime, endTime);
|
| | | } else if (countType == 2) {
|
| | | list = commonOrderCountService.countWeiQaunOrderMoney(dateType, year, startTime, endTime);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | |
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | |
| | | line_list.add(innerList);
|
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (objectDate != null) {
|
| | |
| | | } else {
|
| | | data.put("xAxis_list", gson.toJson(dateList));
|
| | | }
|
| | | |
| | |
|
| | | data.put("line_list", line_list);
|
| | | |
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
| | | goodsSubClassService.countClick(acceptData, goodsSubClass);
|
| | | }
|
| | |
|
| | | SearchFilter sf = new SearchFilter();
|
| | | String catesId = "";
|
| | | // 查询是否有淘宝分类ID
|
| | | List<TaoBaoClass> tbClassList = taoBaoClassService.listBySystemSubCid(0, 10, goodsSubClass.getId());
|
| | | if (tbClassList != null && tbClassList.size() > 0)
|
| | | for (TaoBaoClass tbc : tbClassList) {
|
| | | catesId += tbc.getCategoryId() + ",";
|
| | | }
|
| | | if (catesId.endsWith(","))
|
| | | catesId = catesId.substring(0, catesId.length() - 1);
|
| | | sf.setCateIds(catesId);
|
| | | if (!StringUtil.isNullOrEmpty(catesId))// 按分类名称搜索
|
| | | {
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | searchfilter.setCateIds(catesId);
|
| | | searchfilter.setPage(page);
|
| | | searchfilter.setPageSize(20);
|
| | | if (Integer.parseInt(order) == 0)
|
| | | searchfilter.setMaterialId("6707");
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | JSONObject result = taoKeGoodsService.searchWuLiao(searchfilter);
|
| | | long count = result.optLong("count");
|
| | | JSONArray resultArray = result.getJSONArray("result");
|
| | | // 查询是否超过了最大的商品数
|
| | | if (resultArray == null || resultArray.size() < 20) {
|
| | | // 需要根据关键字查询
|
| | | searchfilter.setCateIds(null);
|
| | | searchfilter.setPage((int) (count % 20 == 0 ? count / 20 - 1 : count / 20));
|
| | | searchfilter.setPageSize(20);
|
| | | searchfilter.setKey(goodsSubClass.getKey());
|
| | | result = taoKeGoodsService.searchWuLiao(searchfilter);
|
| | | if (resultArray != null)
|
| | | result.optJSONArray("result").addAll(0, resultArray);
|
| | | result.put("count", result.optLong("count") + count);
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | return;
|
| | | } else {
|
| | | String searchParam = goodsSubClass.getSearchJson();
|
| | | Gson gs = new Gson();
|
| | | SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
|
| | | searchfilter.setCateIds(catesId);
|
| | | searchfilter.setPage(page);
|
| | | searchfilter.setPageSize(20);
|
| | | if (Integer.parseInt(order) == 0)
|
| | | searchfilter.setMaterialId("6707");
|
| | | searchfilter.setKey(goodsSubClass.getKey());
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | JSONObject result = taoKeGoodsService.searchWuLiao(searchfilter);
|
| | | if (1 > 0) {
|
| | | out.print(JsonUtil.loadTrueResult(result));
|
| | | return;
|
| | | }
|
| | | }
|
| | | /* 搜索关键词 */
|
| | | String searchKey = goodsSubClass.getName();
|
| | | String key = goodsSubClass.getKey();
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSpecialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SuperSpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Resource
|
| | | private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | | // 筛选
|
| | | List<TaoBaoGoodsBriefExtra> goodsList = new ArrayList<>();
|
| | |
|
| | | List<TaoBaoGoodsBrief> gList = recommendGoodsDeleteHistoryService
|
| | | .filterGoods(acceptData.getDevice(), result.getTaoBaoGoodsBriefs());
|
| | | // 设备推荐
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | | if (gList != null)
|
| | | for (TaoBaoGoodsBrief goods : gList) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000
|
| | | && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | | }
|
| | | }
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | | (int) (java.lang.System.currentTimeMillis() - startTime), "推荐数量:" + goodsList.size()));
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | if (goodsList != null)
|
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | goodsList.parallelStream().forEach(goods -> {
|
| | |
|
| | | // 获取详情
|
| | |
| | | // }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(kw) && (kw.startsWith("http://") || kw.startsWith("https://"))) {
|
| | | out.print(JsonUtil.loadFalseResult("无法搜索链接"));
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", new JSONArray());
|
| | | data.put("count", 0);
|
| | | data.put("nav", new JSONArray());
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null,null,null, page, 20, sort);
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, null, null, page, 20, sort);
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 goods : result.getGoodsList()) {
|
| | | listExtra.add(
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.jd; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.jd.JDOrderItem; |
| | | |
| | | public interface JDOrderItemMapper extends BaseMapper<JDOrderItem> { |
| | | |
| | | /** |
| | | * 根据交易ID查询 |
| | | * |
| | | * @param tradeId |
| | | * @return |
| | | */ |
| | | JDOrderItem selectByTradeId(String tradeId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.jd; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.jd.JDOrder; |
| | | |
| | | public interface JDOrderMapper extends BaseMapper<JDOrder> { |
| | | |
| | | /** |
| | | * 根据订单号检索 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | JDOrder selectByOrderId(Long orderId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail; |
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum; |
| | | import com.yeshi.fanli.vo.money.UserMonthMoneyVO; |
| | | |
| | | public interface UserMoneyDetailMapper extends BaseMapper<UserMoneyDetail> { |
| | |
| | | BigDecimal getTotalMoneyByTypeAndUidWithDate(@Param("uid") Long uid, @Param("typeList") List<String> typeList, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | |
| | | /** |
| | | * 根据类型,用户ID,唯一标识查询 |
| | | * @param type |
| | | * @param uid |
| | | * @param sourceIdentifyId |
| | | * @return |
| | | */ |
| | | UserMoneyDetail selectByTypeAndUidAndIdentifyCode(@Param("type") UserMoneyDetailTypeEnum type, |
| | | @Param("uid") Long uid, @Param("sourceIdentifyId") Long sourceIdentifyId); |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | @Param("sourceType") int sourceType); |
| | | |
| | | /** |
| | | * 返利超过一定金额的订单数量 |
| | | * 返利超过100的,且最小时间 |
| | | * |
| | | * @param uid |
| | | * @param minTime |
| | | * @return |
| | | */ |
| | | public int countHongBaoOrderCountMoreByUid(@Param("money") BigDecimal money, @Param("uid") Long uid); |
| | | public int countOrderCountMoneyMoreByUidAndMinTime(@Param("uid") Long uid, @Param("minTime") Date minTime, |
| | | @Param("money") BigDecimal money); |
| | | |
| | | /** |
| | | * 维权订单数量(包含邀请赚) |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public int countWeiQuanOrderByUid(Long uid); |
| | | public int countWeiQuanOrderByUid(@Param("uid") Long uid, @Param("minTime") Date minTime); |
| | | |
| | | /** |
| | | * 维权订单返还的金额 |
| | |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(Long uid); |
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(@Param("uid") Long uid, @Param("minTime") Date minTime); |
| | | |
| | | /** |
| | | * 安全订单数量 |
| | | * |
| | | * 维权订单数量 |
| | | * @param uid |
| | | * @param minMoney |
| | | * @param minTime |
| | | * @return |
| | | */ |
| | | public int countSafeOrderByUid(Long uid); |
| | | public int countWeiQuanOrderWithMinCommision(@Param("uid")Long uid,@Param("minMoney") BigDecimal minMoney,@Param("minTime") Date minTime); |
| | | |
| | | } |
| | |
| | | List<DeviceTokenHW> selectByDeviceAndUid(@Param("device") String device, @Param("uid") Long uid); |
| | | |
| | | List<DeviceTokenHW> selectList(@Param("start") long start, @Param("count") int count); |
| | | |
| | | |
| | | List<DeviceTokenHW> selectByUid(Long uid); |
| | | |
| | | Long selectCount(); |
| | | |
| | | List<DeviceTokenHW> selectByDevice(String device); |
| | | |
| | | int bindUidByDevice(@Param("uid") Long uid, @Param("device") String device); |
| | | |
| | | } |
| | |
| | | TaoBaoWeiQuanOrder selectByOrderIdAndOrderItemId(@Param("orderId") String orderId, |
| | | @Param("orderItemId") String orderItemId); |
| | | |
| | | TaoBaoWeiQuanOrder selectByOrderItemId(String orderItemId); |
| | | |
| | | // 按订单号和维权状态查询 |
| | | List<TaoBaoWeiQuanOrder> selectListByOrderIdAndState(@Param("orderId") String orderId, |
| | | @Param("state") String state); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 统计总金额 |
| | | * @param dateType |
| | | * |
| | | * @param dateType |
| | | * @param years |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> countWeiQaunOrderNumber(@Param("dateType")Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | List<Map<String, Object>> countWeiQaunOrderNumber(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | /** |
| | | * 统计总个数 |
| | | * @param dateType |
| | | * |
| | | * @param dateType |
| | | * @param years |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> countWeiQaunOrderMoney(@Param("dateType")Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | List<Map<String, Object>> countWeiQaunOrderMoney(@Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | |
| | | } |
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
| | | Criteria.where("finalPrice").gte(minPrice.multiply(new BigDecimal(100)).intValue()));
|
| | | query.addCriteria(ca);
|
| | | query.limit(count);
|
| | | query.skip(start);
|
| | | query.skip(start).with(new Sort(Sort.Direction.DESC, "goods.biz30day"));
|
| | | return mongoTemplate.find(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dto.jd;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | |
|
| | | public class JDOrderResult {
|
| | | private boolean hasMore;
|
| | | private List<JDOrder> orderList;
|
| | |
|
| | | public JDOrderResult(boolean hasMore, List<JDOrder> orderList) {
|
| | | this.hasMore = hasMore;
|
| | | this.orderList = orderList;
|
| | | }
|
| | | |
| | | public JDOrderResult() {
|
| | | |
| | | }
|
| | |
|
| | | public boolean isHasMore() {
|
| | | return hasMore;
|
| | | }
|
| | |
|
| | | public void setHasMore(boolean hasMore) {
|
| | | this.hasMore = hasMore;
|
| | | }
|
| | |
|
| | | public List<JDOrder> getOrderList() {
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | public void setOrderList(List<JDOrder> orderList) {
|
| | | this.orderList = orderList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public class ExtractOrderStatisticDTO {
|
| | |
|
| | | private int orderCount50More;// 返利超过超过50元的订单数量
|
| | | private int orderCount50More;// 返利超过50元的订单数量
|
| | |
|
| | | private Integer orderCount100More;// 返利超过100元的订单数量
|
| | |
|
| | | private int weiQuanOrderCount;// 维权订单数量
|
| | |
|
| | |
| | | this.safeOrderCount = safeOrderCount;
|
| | | }
|
| | |
|
| | | public Integer getOrderCount100More() {
|
| | | return orderCount100More;
|
| | | }
|
| | |
|
| | | public void setOrderCount100More(Integer orderCount100More) {
|
| | | this.orderCount100More = orderCount100More;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private String salesTip;// 模糊销量
|
| | | @SerializedName("activity_type")
|
| | | private Integer activityType;// 活动类型,0-无活动;1-秒杀;3-限量折扣;12-限时折扣;13-大促活动;14-名品折扣;15-品牌清仓;16-食品超市;17-一元幸运团;18-爱逛街;19-时尚穿搭;20-男人帮;21-9块9;22-竞价活动;23-榜单活动;24-幸运半价购;25-定金预售;26-幸运人气购;27-特色主题活动;28-断码清仓;29-一元话费;30-电器城;31-每日好店;32-品牌卡;101-大促搜索池;102-大促品类分会场;
|
| | |
|
| | | @SerializedName("mall_id")
|
| | | private Long mallId;//店铺ID
|
| | | // mall_id:4217177,cps_sign:null,cat_id:null mall_rate:10
|
| | | |
| | | private Integer state;//状态 1-下线 0-正常
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public Long getMallId() {
|
| | | return mallId;
|
| | | }
|
| | |
|
| | | public void setMallId(Long mallId) {
|
| | | this.mallId = mallId;
|
| | | }
|
| | |
|
| | | public Long getGoodsId() {
|
| | | return goodsId;
|
| | |
| | | private int totalCount;// 总数量
|
| | | private List<PDDOrder> orderList;// 商品列表
|
| | |
|
| | | public PDDOrderResult() {
|
| | | }
|
| | |
|
| | | public PDDOrderResult(int totalCount, List<PDDOrder> orderList) {
|
| | | this.totalCount = totalCount;
|
| | | this.orderList = orderList;
|
| | | }
|
| | |
|
| | | public int getTotalCount() {
|
| | | return totalCount;
|
| | | }
|
| | |
| | | this.totalCount = totalCount;
|
| | | }
|
| | |
|
| | | public List<PDDOrder> getGoodsList() {
|
| | | public List<PDDOrder> getOrderList() {
|
| | | return orderList;
|
| | | }
|
| | |
|
| | | public void setGoodsList(List<PDDOrder> orderList) {
|
| | | public void setOrderList(List<PDDOrder> orderList) {
|
| | | this.orderList = orderList;
|
| | | }
|
| | |
|
| | | public PDDOrderResult() {
|
| | | }
|
| | |
|
| | | public PDDOrderResult(int totalCount, List<PDDOrder> orderList) {
|
| | | this.totalCount = totalCount;
|
| | | this.orderList = orderList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public final static int RULE_HOT_HUWAI = 100 + 13;
|
| | | public final static int RULE_HOT_XIANGBAO = 100 + 11;
|
| | | public final static int RULE_HAOHUO = 200;
|
| | | public final static int RULE_HAODIAN = 300;
|
| | |
|
| | | public static ActivityUserRule[] RULES = new ActivityUserRule[] { new ActivityUserRule(RULE_DEFAULT, "默认"),
|
| | | new ActivityUserRule(RULE_HOT, "单品热销"), new ActivityUserRule(RULE_HOT_JUJIA, "居家百货"),
|
| | |
| | |
|
| | | public final static int ORDER_TYPE_TAOBAO = 1;// 淘宝
|
| | | public final static int ORDER_TYPE_JINGDONG = 2;// 京东
|
| | | public final static int ORDER_TYPE_PDD = 3;// 拼多多
|
| | |
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | |
| | | public class CommonGoods {
|
| | | public static int GOODS_TYPE_TB = 1;// 淘宝天猫
|
| | | public static int GOODS_TYPE_JD = 2;// 京东
|
| | | public static int GOODS_TYPE_PDD = 3;// 拼多多
|
| | |
|
| | | public static int SHOP_TYPE_TB = 1;// 淘宝
|
| | | public static int SHOP_TYPE_TM = 2;// 天猫
|
New file |
| | |
| | | package com.yeshi.fanli.entity.jd;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.SerializedName;
|
| | |
|
| | | @Table("yeshi_ec_jd_order")
|
| | | public class JDOrder {
|
| | | @Column(name = "jo_id")
|
| | | private Long id;// 主键ID
|
| | | // 主订单维度
|
| | | @Column(name = "jo_finish_time")
|
| | | private Long finishTime;// 订单完成时间(时间戳,毫秒)
|
| | | @Column(name = "jo_order_emt")
|
| | | private Integer orderEmt;// 下单设备(1:PC,2:无线)
|
| | | @Column(name = "jo_order_id")
|
| | | private Long orderId;// 订单ID
|
| | | @Column(name = "jo_order_time")
|
| | | private Long orderTime;// 下单时间(时间戳,毫秒)
|
| | | @Column(name = "jo_parent_id")
|
| | | private Long parentId;// 父单的订单ID,仅当发生订单拆分时返回, 0:未拆分,有值则表示此订单为子订单
|
| | | @Column(name = "jo_pay_month")
|
| | | private String payMonth;// 订单维度预估结算时间(格式:yyyyMMdd),0:未结算,订单的预估结算时间仅供参考。账号未通过资质审核或订单发生售后,会影响订单实际结算时间。
|
| | | @Column(name = "jo_plus")
|
| | | private Integer plus;// 下单用户是否为PLUS会员 0:否,1:是
|
| | | @Column(name = "jo_pop_id")
|
| | | private Long popId;// 商家ID
|
| | | @Column(name = "jo_union_id")
|
| | | private Long unionId;// 推客的联盟ID
|
| | | @Column(name = "jo_ext1")
|
| | | private String ext1;// 推客生成推广链接时传入的扩展字段,订单维度(需要联系运营开放白名单才能拿到数据)
|
| | | @Column(name = "jo_valid_code")
|
| | | private Integer validCode;// 订单维度的有效码
|
| | | @Column(name = "jo_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "jo_update_time")
|
| | | private Date updateTime;
|
| | | @SerializedName("skuList")
|
| | | private List<JDOrderItem> orderItemList;
|
| | |
|
| | | public List<JDOrderItem> getOrderItemList() {
|
| | | return orderItemList;
|
| | | }
|
| | |
|
| | | public void setOrderItemList(List<JDOrderItem> orderItemList) {
|
| | | this.orderItemList = orderItemList;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getFinishTime() {
|
| | | return finishTime;
|
| | | }
|
| | |
|
| | | public void setFinishTime(Long finishTime) {
|
| | | this.finishTime = finishTime;
|
| | | }
|
| | |
|
| | | public Integer getOrderEmt() {
|
| | | return orderEmt;
|
| | | }
|
| | |
|
| | | public void setOrderEmt(Integer orderEmt) {
|
| | | this.orderEmt = orderEmt;
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public Long getOrderTime() {
|
| | | return orderTime;
|
| | | }
|
| | |
|
| | | public void setOrderTime(Long orderTime) {
|
| | | this.orderTime = orderTime;
|
| | | }
|
| | |
|
| | | public Long getParentId() {
|
| | | return parentId;
|
| | | }
|
| | |
|
| | | public void setParentId(Long parentId) {
|
| | | this.parentId = parentId;
|
| | | }
|
| | |
|
| | | public String getPayMonth() {
|
| | | return payMonth;
|
| | | }
|
| | |
|
| | | public void setPayMonth(String payMonth) {
|
| | | this.payMonth = payMonth;
|
| | | }
|
| | |
|
| | | public Integer getPlus() {
|
| | | return plus;
|
| | | }
|
| | |
|
| | | public void setPlus(Integer plus) {
|
| | | this.plus = plus;
|
| | | }
|
| | |
|
| | | public Long getPopId() {
|
| | | return popId;
|
| | | }
|
| | |
|
| | | public void setPopId(Long popId) {
|
| | | this.popId = popId;
|
| | | }
|
| | |
|
| | | public Long getUnionId() {
|
| | | return unionId;
|
| | | }
|
| | |
|
| | | public void setUnionId(Long unionId) {
|
| | | this.unionId = unionId;
|
| | | }
|
| | |
|
| | | public String getExt1() {
|
| | | return ext1;
|
| | | }
|
| | |
|
| | | public void setExt1(String ext1) {
|
| | | this.ext1 = ext1;
|
| | | }
|
| | |
|
| | | public Integer getValidCode() {
|
| | | return validCode;
|
| | | }
|
| | |
|
| | | public void setValidCode(Integer validCode) {
|
| | | this.validCode = validCode;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.jd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_jd_order_item")
|
| | | public class JDOrderItem {
|
| | | // 子订单维度
|
| | | @Column(name = "joi_id")
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "joi_order_id")
|
| | | private Long orderId;
|
| | |
|
| | | @Column(name = "joi_actual_cos_price")
|
| | | private BigDecimal actualCosPrice;// 实际计算佣金的金额。订单完成后,会将误扣除的运费券金额更正。如订单完成后发生退款,此金额会更新。
|
| | |
|
| | | @Column(name = "joi_actual_fee")
|
| | | private BigDecimal actualFee;// 推客获得的实际佣金(实际计佣金额*佣金比例*最终比例)。如订单完成后发生退款,此金额会更新。
|
| | |
|
| | | @Column(name = "joi_commission_rate")
|
| | | private BigDecimal commissionRate;// 佣金比例
|
| | |
|
| | | @Column(name = "joi_estimate_cos_price")
|
| | | private BigDecimal estimateCosPrice;// 预估计佣金额
|
| | |
|
| | | @Column(name = "joi_estimate_fee")
|
| | | private BigDecimal estimateFee;// 推客的预估佣金(预估计佣金额*佣金比例*最终比例),如订单完成前发生退款,此金额不会更新。
|
| | |
|
| | | @Column(name = "joi_final_rate")
|
| | | private BigDecimal finalRate;// 最终比例(分成比例+补贴比例)
|
| | |
|
| | | @Column(name = "joi_cid1")
|
| | | private Long cid1;// 一级类目ID
|
| | |
|
| | | @Column(name = "joi_frozen_sku_num")
|
| | | private Long frozenSkuNum;// 商品售后中数量
|
| | |
|
| | | @Column(name = "joi_pid")
|
| | | private String pid;// 联盟子站长身份标识,格式:子站长ID_子站长网站ID_子站长推广位ID
|
| | |
|
| | | @Column(name = "joi_position_id")
|
| | | private Long positionId;// 推广位ID,0代表无推广位
|
| | |
|
| | | @Column(name = "joi_price")
|
| | | private BigDecimal price;// 商品单价
|
| | |
|
| | | @Column(name = "joi_cid2")
|
| | | private Long cid2;// 二级类目ID
|
| | |
|
| | | @Column(name = "joi_site_id")
|
| | | private Long siteId;// 网站ID,0:无网站
|
| | |
|
| | | @Column(name = "joi_sku_id")
|
| | | private Long skuId;// 商品ID
|
| | |
|
| | | @Column(name = "joi_sku_name")
|
| | | private String skuName;// 商品名称
|
| | |
|
| | | @Column(name = "joi_sku_num")
|
| | | private Long skuNum;// 商品数量
|
| | |
|
| | | @Column(name = "joi_sku_return_num")
|
| | | private Long skuReturnNum;// 商品已退货数量
|
| | |
|
| | | @Column(name = "joi_sub_side_rate")
|
| | | private BigDecimal subSideRate;// 分成比例
|
| | |
|
| | | @Column(name = "joi_sub_sidy_rate")
|
| | | private BigDecimal subsidyRate;// 补贴比例
|
| | |
|
| | | @Column(name = "joi_cid3")
|
| | | private Long cid3;// 三级类目ID
|
| | |
|
| | | @Column(name = "joi_union_alias")
|
| | | private String unionAlias;// PID所属母账号平台名称(原第三方服务商来源)
|
| | |
|
| | | @Column(name = "joi_union_tag")
|
| | | private String unionTag;// 联盟标签数据(整型的二进制字符串(32位),目前只返回8位:00000001。数据从右向左进行,每一位为1表示符合联盟的标签特征,第1位:京喜红包,第2位:组合推广订单,第3位:拼购订单,第5位:有效首次购订单(00011XXX表示有效首购,最终奖励活动结算金额会结合订单状态判断,以联盟后台对应活动效果数据报表https://union.jd.com/active为准)。例如:00000001:京喜红包订单,00000010:组合推广订单,00000100:拼购订单,00011000:有效首购,00000111:京喜红包+组合推广+拼购等)
|
| | |
|
| | | @Column(name = "joi_union_traffic_group")
|
| | | private Integer unionTrafficGroup;// 渠道组 1:1号店,其他:京东
|
| | |
|
| | | @Column(name = "joi_valid_code")
|
| | | private Integer validCode;// sku维度的有效码(-1:未知,2.无效-拆单,3.无效-取消,4.无效-京东帮帮主订单,5.无效-账号异常,6.无效-赠品类目不返佣,7.无效-校园订单,8.无效-企业订单,9.无效-团购订单,10.无效-开增值税专用发票订单,11.无效-乡村推广员下单,12.无效-自己推广自己下单,13.无效-违规订单,14.无效-来源与备案网址不符,15.待付款,16.已付款,17.已完成,18.已结算(5.9号不再支持结算状态回写展示))注:自2018/7/13起,自己推广自己下单已经允许返佣,故12无效码仅针对历史数据有效
|
| | |
|
| | | @Column(name = "joi_sub_union_id")
|
| | | private String subUnionId;// 子联盟ID(需要联系运营开放白名单才能拿到数据)
|
| | |
|
| | | @Column(name = "joi_trace_type")
|
| | | private Integer traceType;// 2:同店;3:跨店
|
| | |
|
| | | @Column(name = "joi_pay_month")
|
| | | private Integer payMonth;// 订单行维度预估结算时间(格式:yyyyMMdd)
|
| | | // ,0:未结算。订单的预估结算时间仅供参考。账号未通过资质审核或订单发生售后,会影响订单实际结算时间。
|
| | | @Column(name = "joi_pop_id")
|
| | | private Long popId;// 商家ID,订单行维度
|
| | |
|
| | | @Column(name = "joi_ext1")
|
| | | private String ext1;// 推客生成推广链接时传入的扩展字段(需要联系运营开放白名单才能拿到数据)。<订单行维度>
|
| | |
|
| | | @Column(name = "joi_trade_id")
|
| | | private String tradeId;// 交易ID=orderId+商品ID
|
| | |
|
| | | @Column(name = "joi_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | @Column(name = "joi_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | @Column(name = "joi_order_by")
|
| | | private Integer orderBy;
|
| | |
|
| | | private JDOrder order;// 父订单
|
| | |
|
| | | public JDOrder getOrder() {
|
| | | return order;
|
| | | }
|
| | |
|
| | | public void setOrder(JDOrder order) {
|
| | | this.order = order;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(Long orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public BigDecimal getActualCosPrice() {
|
| | | return actualCosPrice;
|
| | | }
|
| | |
|
| | | public void setActualCosPrice(BigDecimal actualCosPrice) {
|
| | | this.actualCosPrice = actualCosPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getActualFee() {
|
| | | return actualFee;
|
| | | }
|
| | |
|
| | | public void setActualFee(BigDecimal actualFee) {
|
| | | this.actualFee = actualFee;
|
| | | }
|
| | |
|
| | | public BigDecimal getCommissionRate() {
|
| | | return commissionRate;
|
| | | }
|
| | |
|
| | | public void setCommissionRate(BigDecimal commissionRate) {
|
| | | this.commissionRate = commissionRate;
|
| | | }
|
| | |
|
| | | public BigDecimal getEstimateCosPrice() {
|
| | | return estimateCosPrice;
|
| | | }
|
| | |
|
| | | public void setEstimateCosPrice(BigDecimal estimateCosPrice) {
|
| | | this.estimateCosPrice = estimateCosPrice;
|
| | | }
|
| | |
|
| | | public BigDecimal getEstimateFee() {
|
| | | return estimateFee;
|
| | | }
|
| | |
|
| | | public void setEstimateFee(BigDecimal estimateFee) {
|
| | | this.estimateFee = estimateFee;
|
| | | }
|
| | |
|
| | | public BigDecimal getFinalRate() {
|
| | | return finalRate;
|
| | | }
|
| | |
|
| | | public void setFinalRate(BigDecimal finalRate) {
|
| | | this.finalRate = finalRate;
|
| | | }
|
| | |
|
| | | public Long getCid1() {
|
| | | return cid1;
|
| | | }
|
| | |
|
| | | public void setCid1(Long cid1) {
|
| | | this.cid1 = cid1;
|
| | | }
|
| | |
|
| | | public Long getFrozenSkuNum() {
|
| | | return frozenSkuNum;
|
| | | }
|
| | |
|
| | | public void setFrozenSkuNum(Long frozenSkuNum) {
|
| | | this.frozenSkuNum = frozenSkuNum;
|
| | | }
|
| | |
|
| | | public String getPid() {
|
| | | return pid;
|
| | | }
|
| | |
|
| | | public void setPid(String pid) {
|
| | | this.pid = pid;
|
| | | }
|
| | |
|
| | | public Long getPositionId() {
|
| | | return positionId;
|
| | | }
|
| | |
|
| | | public void setPositionId(Long positionId) {
|
| | | this.positionId = positionId;
|
| | | }
|
| | |
|
| | | public BigDecimal getPrice() {
|
| | | return price;
|
| | | }
|
| | |
|
| | | public void setPrice(BigDecimal price) {
|
| | | this.price = price;
|
| | | }
|
| | |
|
| | | public Long getCid2() {
|
| | | return cid2;
|
| | | }
|
| | |
|
| | | public void setCid2(Long cid2) {
|
| | | this.cid2 = cid2;
|
| | | }
|
| | |
|
| | | public Long getSiteId() {
|
| | | return siteId;
|
| | | }
|
| | |
|
| | | public void setSiteId(Long siteId) {
|
| | | this.siteId = siteId;
|
| | | }
|
| | |
|
| | | public Long getSkuId() {
|
| | | return skuId;
|
| | | }
|
| | |
|
| | | public void setSkuId(Long skuId) {
|
| | | this.skuId = skuId;
|
| | | }
|
| | |
|
| | | public String getSkuName() {
|
| | | return skuName;
|
| | | }
|
| | |
|
| | | public void setSkuName(String skuName) {
|
| | | this.skuName = skuName;
|
| | | }
|
| | |
|
| | | public Long getSkuNum() {
|
| | | return skuNum;
|
| | | }
|
| | |
|
| | | public void setSkuNum(Long skuNum) {
|
| | | this.skuNum = skuNum;
|
| | | }
|
| | |
|
| | | public Long getSkuReturnNum() {
|
| | | return skuReturnNum;
|
| | | }
|
| | |
|
| | | public void setSkuReturnNum(Long skuReturnNum) {
|
| | | this.skuReturnNum = skuReturnNum;
|
| | | }
|
| | |
|
| | | public BigDecimal getSubSideRate() {
|
| | | return subSideRate;
|
| | | }
|
| | |
|
| | | public void setSubSideRate(BigDecimal subSideRate) {
|
| | | this.subSideRate = subSideRate;
|
| | | }
|
| | |
|
| | | public BigDecimal getSubsidyRate() {
|
| | | return subsidyRate;
|
| | | }
|
| | |
|
| | | public void setSubsidyRate(BigDecimal subsidyRate) {
|
| | | this.subsidyRate = subsidyRate;
|
| | | }
|
| | |
|
| | | public Long getCid3() {
|
| | | return cid3;
|
| | | }
|
| | |
|
| | | public void setCid3(Long cid3) {
|
| | | this.cid3 = cid3;
|
| | | }
|
| | |
|
| | | public String getUnionAlias() {
|
| | | return unionAlias;
|
| | | }
|
| | |
|
| | | public void setUnionAlias(String unionAlias) {
|
| | | this.unionAlias = unionAlias;
|
| | | }
|
| | |
|
| | | public String getUnionTag() {
|
| | | return unionTag;
|
| | | }
|
| | |
|
| | | public void setUnionTag(String unionTag) {
|
| | | this.unionTag = unionTag;
|
| | | }
|
| | |
|
| | | public Integer getUnionTrafficGroup() {
|
| | | return unionTrafficGroup;
|
| | | }
|
| | |
|
| | | public void setUnionTrafficGroup(Integer unionTrafficGroup) {
|
| | | this.unionTrafficGroup = unionTrafficGroup;
|
| | | }
|
| | |
|
| | | public Integer getValidCode() {
|
| | | return validCode;
|
| | | }
|
| | |
|
| | | public void setValidCode(Integer validCode) {
|
| | | this.validCode = validCode;
|
| | | }
|
| | |
|
| | | public String getSubUnionId() {
|
| | | return subUnionId;
|
| | | }
|
| | |
|
| | | public void setSubUnionId(String subUnionId) {
|
| | | this.subUnionId = subUnionId;
|
| | | }
|
| | |
|
| | | public Integer getTraceType() {
|
| | | return traceType;
|
| | | }
|
| | |
|
| | | public void setTraceType(Integer traceType) {
|
| | | this.traceType = traceType;
|
| | | }
|
| | |
|
| | | public Integer getPayMonth() {
|
| | | return payMonth;
|
| | | }
|
| | |
|
| | | public void setPayMonth(Integer payMonth) {
|
| | | this.payMonth = payMonth;
|
| | | }
|
| | |
|
| | | public Long getPopId() {
|
| | | return popId;
|
| | | }
|
| | |
|
| | | public void setPopId(Long popId) {
|
| | | this.popId = popId;
|
| | | }
|
| | |
|
| | | public String getExt1() {
|
| | | return ext1;
|
| | | }
|
| | |
|
| | | public void setExt1(String ext1) {
|
| | | this.ext1 = ext1;
|
| | | }
|
| | |
|
| | | public String getTradeId() {
|
| | | return tradeId;
|
| | | }
|
| | |
|
| | | public void setTradeId(String tradeId) {
|
| | | this.tradeId = tradeId;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
|
| | | public void setOrderBy(Integer orderBy) {
|
| | | this.orderBy = orderBy;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private Long id;
|
| | | @Column(name = "dh_token")
|
| | | private String deviceToken;
|
| | | @Column(name = "dh_token_md5")
|
| | | private String deviceTokenMd5;
|
| | | @Column(name = "dh_device")
|
| | | private String device;
|
| | | @Column(name = "dh_uid")
|
| | |
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public String getDeviceTokenMd5() {
|
| | | return deviceTokenMd5;
|
| | | }
|
| | |
|
| | | public void setDeviceTokenMd5(String deviceTokenMd5) {
|
| | | this.deviceTokenMd5 = deviceTokenMd5;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.jd; |
| | | |
| | | public class JDOrderException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public JDOrderException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public JDOrderException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
| | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsService;
|
| | | |
| | |
|
| | | /**
|
| | | * 限时秒杀 数据更新
|
| | |
| | | if (listTaoKe == null || listTaoKe.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<Long> listDaoKeId = new ArrayList<Long>();
|
| | | for (DaTaoKeDetail daTaoKeDetail: listTaoKe) {
|
| | | for (DaTaoKeDetail daTaoKeDetail : listTaoKe) {
|
| | | listDaoKeId.add(daTaoKeDetail.getId());
|
| | | }
|
| | | |
| | |
|
| | | List<DaTaoKeDetail> listDetail = daTaoKeGoodsService.listByIds(listDaoKeId);
|
| | | if (listDetail == null || listDetail.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | for (DaTaoKeDetail daTaoKeDetail: listDetail) {
|
| | | listgoods.add( TaoBaoUtil.convert(daTaoKeDetail));
|
| | | for (DaTaoKeDetail daTaoKeDetail : listDetail) {
|
| | | listgoods.add(TaoBaoUtil.convert(daTaoKeDetail));
|
| | | }
|
| | |
|
| | | String formatDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | // 20分钟更新一次
|
| | | @Scheduled(cron = "0 0/20 * * * ? ")
|
| | | // 1个小时更新一次
|
| | | @Scheduled(cron = "0 0 0/1 * * ? ")
|
| | | public void doSyncJob() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 每天早上同步一次
|
| | | @Scheduled(cron = "0 0 6 * * ? ")
|
| | | public void doSyncJobNew() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
| | | */
|
| | | @Scheduled(cron = "0 15 0/6 * * ? ")
|
| | | public void removeFlashSaleGoods() {
|
| | |
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
| | | // 更新品牌商品,每天早上6点执行一次
|
| | | @Scheduled(cron = "0 0 6 * * ? ")
|
| | | public void updateBrandGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ?")
|
| | | public void update618() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | LogHelper.test("更新618商品");
|
| | | taoBaoGoodsActivityService.sysncS618Goods();
|
| | | }
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.jd.JDOrderItemMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.jd.JDOrderItem"> |
| | | <id column="joi_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="joi_order_id" property="orderId" jdbcType="BIGINT" /> |
| | | <result column="joi_actual_cos_price" property="actualCosPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_actual_fee" property="actualFee" jdbcType="DECIMAL" /> |
| | | <result column="joi_commission_rate" property="commissionRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_estimate_cos_price" property="estimateCosPrice" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_estimate_fee" property="estimateFee" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_final_rate" property="finalRate" jdbcType="DECIMAL" /> |
| | | <result column="joi_cid1" property="cid1" jdbcType="BIGINT" /> |
| | | <result column="joi_frozen_sku_num" property="frozenSkuNum" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_pid" property="pid" jdbcType="VARCHAR" /> |
| | | <result column="joi_position_id" property="positionId" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_price" property="price" jdbcType="DECIMAL" /> |
| | | <result column="joi_cid2" property="cid2" jdbcType="BIGINT" /> |
| | | <result column="joi_site_id" property="siteId" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_id" property="skuId" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_name" property="skuName" jdbcType="VARCHAR" /> |
| | | <result column="joi_sku_num" property="skuNum" jdbcType="BIGINT" /> |
| | | <result column="joi_sku_return_num" property="skuReturnNum" |
| | | jdbcType="BIGINT" /> |
| | | <result column="joi_sub_side_rate" property="subSideRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_sub_sidy_rate" property="subsidyRate" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="joi_cid3" property="cid3" jdbcType="BIGINT" /> |
| | | <result column="joi_union_alias" property="unionAlias" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="joi_union_tag" property="unionTag" jdbcType="VARCHAR" /> |
| | | <result column="joi_union_traffic_group" property="unionTrafficGroup" |
| | | jdbcType="INTEGER" /> |
| | | <result column="joi_valid_code" property="validCode" jdbcType="INTEGER" /> |
| | | <result column="joi_sub_union_id" property="subUnionId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="joi_trace_type" property="traceType" jdbcType="INTEGER" /> |
| | | <result column="joi_pay_month" property="payMonth" jdbcType="INTEGER" /> |
| | | <result column="joi_pop_id" property="popId" jdbcType="BIGINT" /> |
| | | <result column="joi_ext1" property="ext1" jdbcType="VARCHAR" /> |
| | | <result column="joi_trade_id" property="tradeId" jdbcType="VARCHAR" /> |
| | | <result column="joi_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="joi_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="joi_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByTradeId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order_item where joi_trade_id = #{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_jd_order_item where joi_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_jd_order_item |
| | | (joi_id,joi_order_id,joi_actual_cos_price,joi_actual_fee,joi_commission_rate,joi_estimate_cos_price,joi_estimate_fee,joi_final_rate,joi_cid1,joi_frozen_sku_num,joi_pid,joi_position_id,joi_price,joi_cid2,joi_site_id,joi_sku_id,joi_sku_name,joi_sku_num,joi_sku_return_num,joi_sub_side_rate,joi_sub_sidy_rate,joi_cid3,joi_union_alias,joi_union_tag,joi_union_traffic_group,joi_valid_code,joi_sub_union_id,joi_trace_type,joi_pay_month,joi_pop_id,joi_ext1,joi_trade_id,joi_create_time,joi_update_time,joi_order_by) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{orderId,jdbcType=BIGINT},#{actualCosPrice,jdbcType=DECIMAL},#{actualFee,jdbcType=DECIMAL},#{commissionRate,jdbcType=DECIMAL},#{estimateCosPrice,jdbcType=DECIMAL},#{estimateFee,jdbcType=DECIMAL},#{finalRate,jdbcType=DECIMAL},#{cid1,jdbcType=BIGINT},#{frozenSkuNum,jdbcType=BIGINT},#{pid,jdbcType=VARCHAR},#{positionId,jdbcType=BIGINT},#{price,jdbcType=DECIMAL},#{cid2,jdbcType=BIGINT},#{siteId,jdbcType=BIGINT},#{skuId,jdbcType=BIGINT},#{skuName,jdbcType=VARCHAR},#{skuNum,jdbcType=BIGINT},#{skuReturnNum,jdbcType=BIGINT},#{subSideRate,jdbcType=DECIMAL},#{subsidyRate,jdbcType=DECIMAL},#{cid3,jdbcType=BIGINT},#{unionAlias,jdbcType=VARCHAR},#{unionTag,jdbcType=VARCHAR},#{unionTrafficGroup,jdbcType=INTEGER},#{validCode,jdbcType=INTEGER},#{subUnionId,jdbcType=VARCHAR},#{traceType,jdbcType=INTEGER},#{payMonth,jdbcType=INTEGER},#{popId,jdbcType=BIGINT},#{ext1,jdbcType=VARCHAR},#{tradeId,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{orderBy,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_jd_order_item |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">joi_id,</if> |
| | | <if test="orderId != null">joi_order_id,</if> |
| | | <if test="actualCosPrice != null">joi_actual_cos_price,</if> |
| | | <if test="actualFee != null">joi_actual_fee,</if> |
| | | <if test="commissionRate != null">joi_commission_rate,</if> |
| | | <if test="estimateCosPrice != null">joi_estimate_cos_price,</if> |
| | | <if test="estimateFee != null">joi_estimate_fee,</if> |
| | | <if test="finalRate != null">joi_final_rate,</if> |
| | | <if test="cid1 != null">joi_cid1,</if> |
| | | <if test="frozenSkuNum != null">joi_frozen_sku_num,</if> |
| | | <if test="pid != null">joi_pid,</if> |
| | | <if test="positionId != null">joi_position_id,</if> |
| | | <if test="price != null">joi_price,</if> |
| | | <if test="cid2 != null">joi_cid2,</if> |
| | | <if test="siteId != null">joi_site_id,</if> |
| | | <if test="skuId != null">joi_sku_id,</if> |
| | | <if test="skuName != null">joi_sku_name,</if> |
| | | <if test="skuNum != null">joi_sku_num,</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num,</if> |
| | | <if test="subSideRate != null">joi_sub_side_rate,</if> |
| | | <if test="subsidyRate != null">joi_sub_sidy_rate,</if> |
| | | <if test="cid3 != null">joi_cid3,</if> |
| | | <if test="unionAlias != null">joi_union_alias,</if> |
| | | <if test="unionTag != null">joi_union_tag,</if> |
| | | <if test="unionTrafficGroup != null">joi_union_traffic_group,</if> |
| | | <if test="validCode != null">joi_valid_code,</if> |
| | | <if test="subUnionId != null">joi_sub_union_id,</if> |
| | | <if test="traceType != null">joi_trace_type,</if> |
| | | <if test="payMonth != null">joi_pay_month,</if> |
| | | <if test="popId != null">joi_pop_id,</if> |
| | | <if test="ext1 != null">joi_ext1,</if> |
| | | <if test="tradeId != null">joi_trade_id,</if> |
| | | <if test="createTime != null">joi_create_time,</if> |
| | | <if test="updateTime != null">joi_update_time,</if> |
| | | <if test="orderBy != null">joi_order_by,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="actualCosPrice != null">#{actualCosPrice,jdbcType=DECIMAL},</if> |
| | | <if test="actualFee != null">#{actualFee,jdbcType=DECIMAL},</if> |
| | | <if test="commissionRate != null">#{commissionRate,jdbcType=DECIMAL},</if> |
| | | <if test="estimateCosPrice != null">#{estimateCosPrice,jdbcType=DECIMAL},</if> |
| | | <if test="estimateFee != null">#{estimateFee,jdbcType=DECIMAL},</if> |
| | | <if test="finalRate != null">#{finalRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid1 != null">#{cid1,jdbcType=BIGINT},</if> |
| | | <if test="frozenSkuNum != null">#{frozenSkuNum,jdbcType=BIGINT},</if> |
| | | <if test="pid != null">#{pid,jdbcType=VARCHAR},</if> |
| | | <if test="positionId != null">#{positionId,jdbcType=BIGINT},</if> |
| | | <if test="price != null">#{price,jdbcType=DECIMAL},</if> |
| | | <if test="cid2 != null">#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="skuName != null">#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">#{skuReturnNum,jdbcType=BIGINT},</if> |
| | | <if test="subSideRate != null">#{subSideRate,jdbcType=DECIMAL},</if> |
| | | <if test="subsidyRate != null">#{subsidyRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid3 != null">#{cid3,jdbcType=BIGINT},</if> |
| | | <if test="unionAlias != null">#{unionAlias,jdbcType=VARCHAR},</if> |
| | | <if test="unionTag != null">#{unionTag,jdbcType=VARCHAR},</if> |
| | | <if test="unionTrafficGroup != null">#{unionTrafficGroup,jdbcType=INTEGER},</if> |
| | | <if test="validCode != null">#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="subUnionId != null">#{subUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="traceType != null">#{traceType,jdbcType=INTEGER},</if> |
| | | <if test="payMonth != null">#{payMonth,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">#{popId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem">update |
| | | yeshi_ec_jd_order_item set joi_order_id = |
| | | #{orderId,jdbcType=BIGINT},joi_actual_cos_price = |
| | | #{actualCosPrice,jdbcType=DECIMAL},joi_actual_fee = |
| | | #{actualFee,jdbcType=DECIMAL},joi_commission_rate = |
| | | #{commissionRate,jdbcType=DECIMAL},joi_estimate_cos_price = |
| | | #{estimateCosPrice,jdbcType=DECIMAL},joi_estimate_fee = |
| | | #{estimateFee,jdbcType=DECIMAL},joi_final_rate = |
| | | #{finalRate,jdbcType=DECIMAL},joi_cid1 = |
| | | #{cid1,jdbcType=BIGINT},joi_frozen_sku_num = |
| | | #{frozenSkuNum,jdbcType=BIGINT},joi_pid = |
| | | #{pid,jdbcType=VARCHAR},joi_position_id = |
| | | #{positionId,jdbcType=BIGINT},joi_price = |
| | | #{price,jdbcType=DECIMAL},joi_cid2 = |
| | | #{cid2,jdbcType=BIGINT},joi_site_id = |
| | | #{siteId,jdbcType=BIGINT},joi_sku_id = |
| | | #{skuId,jdbcType=BIGINT},joi_sku_name = |
| | | #{skuName,jdbcType=VARCHAR},joi_sku_num = |
| | | #{skuNum,jdbcType=BIGINT},joi_sku_return_num = |
| | | #{skuReturnNum,jdbcType=BIGINT},joi_sub_side_rate = |
| | | #{subSideRate,jdbcType=DECIMAL},joi_sub_sidy_rate = |
| | | #{subsidyRate,jdbcType=DECIMAL},joi_cid3 = |
| | | #{cid3,jdbcType=BIGINT},joi_union_alias = |
| | | #{unionAlias,jdbcType=VARCHAR},joi_union_tag = |
| | | #{unionTag,jdbcType=VARCHAR},joi_union_traffic_group = |
| | | #{unionTrafficGroup,jdbcType=INTEGER},joi_valid_code = |
| | | #{validCode,jdbcType=INTEGER},joi_sub_union_id = |
| | | #{subUnionId,jdbcType=VARCHAR},joi_trace_type = |
| | | #{traceType,jdbcType=INTEGER},joi_pay_month = |
| | | #{payMonth,jdbcType=INTEGER},joi_pop_id = |
| | | #{popId,jdbcType=BIGINT},joi_ext1 = |
| | | #{ext1,jdbcType=VARCHAR},joi_trade_id = |
| | | #{tradeId,jdbcType=VARCHAR},joi_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},joi_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP},joi_order_by = |
| | | #{orderBy,jdbcType=INTEGER} where joi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.jd.JDOrderItem"> |
| | | update yeshi_ec_jd_order_item |
| | | <set> |
| | | <if test="orderId != null">joi_order_id=#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="actualCosPrice != null">joi_actual_cos_price=#{actualCosPrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="actualFee != null">joi_actual_fee=#{actualFee,jdbcType=DECIMAL},</if> |
| | | <if test="commissionRate != null">joi_commission_rate=#{commissionRate,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="estimateCosPrice != null">joi_estimate_cos_price=#{estimateCosPrice,jdbcType=DECIMAL}, |
| | | </if> |
| | | <if test="estimateFee != null">joi_estimate_fee=#{estimateFee,jdbcType=DECIMAL},</if> |
| | | <if test="finalRate != null">joi_final_rate=#{finalRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid1 != null">joi_cid1=#{cid1,jdbcType=BIGINT},</if> |
| | | <if test="frozenSkuNum != null">joi_frozen_sku_num=#{frozenSkuNum,jdbcType=BIGINT},</if> |
| | | <if test="pid != null">joi_pid=#{pid,jdbcType=VARCHAR},</if> |
| | | <if test="positionId != null">joi_position_id=#{positionId,jdbcType=BIGINT},</if> |
| | | <if test="price != null">joi_price=#{price,jdbcType=DECIMAL},</if> |
| | | <if test="cid2 != null">joi_cid2=#{cid2,jdbcType=BIGINT},</if> |
| | | <if test="siteId != null">joi_site_id=#{siteId,jdbcType=BIGINT},</if> |
| | | <if test="skuId != null">joi_sku_id=#{skuId,jdbcType=BIGINT},</if> |
| | | <if test="skuName != null">joi_sku_name=#{skuName,jdbcType=VARCHAR},</if> |
| | | <if test="skuNum != null">joi_sku_num=#{skuNum,jdbcType=BIGINT},</if> |
| | | <if test="skuReturnNum != null">joi_sku_return_num=#{skuReturnNum,jdbcType=BIGINT},</if> |
| | | <if test="subSideRate != null">joi_sub_side_rate=#{subSideRate,jdbcType=DECIMAL},</if> |
| | | <if test="subsidyRate != null">joi_sub_sidy_rate=#{subsidyRate,jdbcType=DECIMAL},</if> |
| | | <if test="cid3 != null">joi_cid3=#{cid3,jdbcType=BIGINT},</if> |
| | | <if test="unionAlias != null">joi_union_alias=#{unionAlias,jdbcType=VARCHAR},</if> |
| | | <if test="unionTag != null">joi_union_tag=#{unionTag,jdbcType=VARCHAR},</if> |
| | | <if test="unionTrafficGroup != null">joi_union_traffic_group=#{unionTrafficGroup,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="validCode != null">joi_valid_code=#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="subUnionId != null">joi_sub_union_id=#{subUnionId,jdbcType=VARCHAR},</if> |
| | | <if test="traceType != null">joi_trace_type=#{traceType,jdbcType=INTEGER},</if> |
| | | <if test="payMonth != null">joi_pay_month=#{payMonth,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">joi_pop_id=#{popId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">joi_ext1=#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="tradeId != null">joi_trade_id=#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">joi_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">joi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="orderBy != null">joi_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where joi_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.jd.JDOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.jd.JDOrder"> |
| | | <id column="jo_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="jo_finish_time" property="finishTime" jdbcType="BIGINT" /> |
| | | <result column="jo_order_emt" property="orderEmt" jdbcType="INTEGER" /> |
| | | <result column="jo_order_id" property="orderId" jdbcType="BIGINT" /> |
| | | <result column="jo_order_time" property="orderTime" jdbcType="BIGINT" /> |
| | | <result column="jo_parent_id" property="parentId" jdbcType="BIGINT" /> |
| | | <result column="jo_pay_month" property="payMonth" jdbcType="VARCHAR" /> |
| | | <result column="jo_plus" property="plus" jdbcType="INTEGER" /> |
| | | <result column="jo_pop_id" property="popId" jdbcType="BIGINT" /> |
| | | <result column="jo_union_id" property="unionId" jdbcType="BIGINT" /> |
| | | <result column="jo_ext1" property="ext1" jdbcType="VARCHAR" /> |
| | | <result column="jo_valid_code" property="validCode" jdbcType="INTEGER" /> |
| | | <result column="jo_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="jo_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">jo_id,jo_finish_time,jo_order_emt,jo_order_id,jo_order_time,jo_parent_id,jo_pay_month,jo_plus,jo_pop_id,jo_union_id,jo_ext1,jo_valid_code,jo_create_time,jo_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order where jo_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_jd_order where jo_order_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_jd_order where jo_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.jd.JDOrder" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_jd_order |
| | | (jo_id,jo_finish_time,jo_order_emt,jo_order_id,jo_order_time,jo_parent_id,jo_pay_month,jo_plus,jo_pop_id,jo_union_id,jo_ext1,jo_valid_code,jo_create_time,jo_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{finishTime,jdbcType=BIGINT},#{orderEmt,jdbcType=INTEGER},#{orderId,jdbcType=BIGINT},#{orderTime,jdbcType=BIGINT},#{parentId,jdbcType=BIGINT},#{payMonth,jdbcType=VARCHAR},#{plus,jdbcType=INTEGER},#{popId,jdbcType=BIGINT},#{unionId,jdbcType=BIGINT},#{ext1,jdbcType=VARCHAR},#{validCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.jd.JDOrder" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_jd_order |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">jo_id,</if> |
| | | <if test="finishTime != null">jo_finish_time,</if> |
| | | <if test="orderEmt != null">jo_order_emt,</if> |
| | | <if test="orderId != null">jo_order_id,</if> |
| | | <if test="orderTime != null">jo_order_time,</if> |
| | | <if test="parentId != null">jo_parent_id,</if> |
| | | <if test="payMonth != null">jo_pay_month,</if> |
| | | <if test="plus != null">jo_plus,</if> |
| | | <if test="popId != null">jo_pop_id,</if> |
| | | <if test="unionId != null">jo_union_id,</if> |
| | | <if test="ext1 != null">jo_ext1,</if> |
| | | <if test="validCode != null">jo_valid_code,</if> |
| | | <if test="createTime != null">jo_create_time,</if> |
| | | <if test="updateTime != null">jo_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="finishTime != null">#{finishTime,jdbcType=BIGINT},</if> |
| | | <if test="orderEmt != null">#{orderEmt,jdbcType=INTEGER},</if> |
| | | <if test="orderId != null">#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="orderTime != null">#{orderTime,jdbcType=BIGINT},</if> |
| | | <if test="parentId != null">#{parentId,jdbcType=BIGINT},</if> |
| | | <if test="payMonth != null">#{payMonth,jdbcType=VARCHAR},</if> |
| | | <if test="plus != null">#{plus,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">#{popId,jdbcType=BIGINT},</if> |
| | | <if test="unionId != null">#{unionId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="validCode != null">#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.jd.JDOrder">update |
| | | yeshi_ec_jd_order set jo_finish_time = |
| | | #{finishTime,jdbcType=BIGINT},jo_order_emt = |
| | | #{orderEmt,jdbcType=INTEGER},jo_order_id = |
| | | #{orderId,jdbcType=BIGINT},jo_order_time = |
| | | #{orderTime,jdbcType=BIGINT},jo_parent_id = |
| | | #{parentId,jdbcType=BIGINT},jo_pay_month = |
| | | #{payMonth,jdbcType=VARCHAR},jo_plus = |
| | | #{plus,jdbcType=INTEGER},jo_pop_id = |
| | | #{popId,jdbcType=BIGINT},jo_union_id = |
| | | #{unionId,jdbcType=BIGINT},jo_ext1 = |
| | | #{ext1,jdbcType=VARCHAR},jo_valid_code = |
| | | #{validCode,jdbcType=INTEGER},jo_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},jo_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where jo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.jd.JDOrder"> |
| | | update yeshi_ec_jd_order |
| | | <set> |
| | | <if test="finishTime != null">jo_finish_time=#{finishTime,jdbcType=BIGINT},</if> |
| | | <if test="orderEmt != null">jo_order_emt=#{orderEmt,jdbcType=INTEGER},</if> |
| | | <if test="orderId != null">jo_order_id=#{orderId,jdbcType=BIGINT},</if> |
| | | <if test="orderTime != null">jo_order_time=#{orderTime,jdbcType=BIGINT},</if> |
| | | <if test="parentId != null">jo_parent_id=#{parentId,jdbcType=BIGINT},</if> |
| | | <if test="payMonth != null">jo_pay_month=#{payMonth,jdbcType=VARCHAR},</if> |
| | | <if test="plus != null">jo_plus=#{plus,jdbcType=INTEGER},</if> |
| | | <if test="popId != null">jo_pop_id=#{popId,jdbcType=BIGINT},</if> |
| | | <if test="unionId != null">jo_union_id=#{unionId,jdbcType=BIGINT},</if> |
| | | <if test="ext1 != null">jo_ext1=#{ext1,jdbcType=VARCHAR},</if> |
| | | <if test="validCode != null">jo_valid_code=#{validCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">jo_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">jo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where jo_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | income ,if(b.money is null,0,b.money) as expend |
| | | FROM |
| | | |
| | | (select #{item} as `time`) c |
| | | (select #{item} |
| | | as `time`) c |
| | | |
| | | left join |
| | | |
| | | ( |
| | | SELECT |
| | | DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m') AS |
| | | d.`umd_createtime`,'%Y-%m') |
| | | AS |
| | | `time`,SUM(d.`umd_money`) |
| | | AS money |
| | | FROM |
| | |
| | | |
| | | LEFT JOIN |
| | | ( |
| | | SELECT DATE_FORMAT( |
| | | SELECT |
| | | DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m') AS |
| | | `time`,SUM(d.`umd_money`) AS money |
| | | `time`,SUM(d.`umd_money`) |
| | | AS money |
| | | FROM |
| | | `yeshi_ec_user_money_detail` |
| | | d |
| | | WHERE d.`umd_uid`=#{uid} AND |
| | | WHERE d.`umd_uid`=#{uid} |
| | | AND |
| | | d.`umd_money` <![CDATA[<0]]> |
| | | AND DATE_FORMAT( |
| | | d.`umd_createtime`,'%Y-%m')=#{item} GROUP BY |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="selectByTypeAndUidAndIdentifyCode" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_money_detail where |
| | | umd_uid=#{uid} and |
| | | umd_type=#{type} and umd_source_identify_id=#{sourceIdentifyId} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="countWeiQuanOrderByUid" parameterType="java.lang.Long" |
| | | <select id="countOrderCountMoneyMoreByUidAndMinTime" resultType="java.lang.Integer"> |
| | | SELECT COUNT(DISTINCT( h.id)) FROM |
| | | ( |
| | | SELECT IF(v.`hb_pid` IS NOT |
| | | NULL,v.`hb_pid`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v WHERE |
| | | v.`hb_uid`=#{uid} |
| | | ) h LEFT JOIN yeshi_ec_hongbao_order ho ON |
| | | h.id=ho.`ho_hongbao_id` LEFT |
| | | JOIN yeshi_ec_common_order co ON |
| | | co.`co_id`=ho.`ho_order_id` WHERE co.`co_third_create_time`>#{minTime} |
| | | and |
| | | (co.`co_estimate`>=#{money} OR co.`co_eIncome`>=#{money}) |
| | | </select> |
| | | |
| | | <select id="countWeiQuanOrderByUid" |
| | | resultType="java.lang.Integer"> |
| | | SELECT COUNT(*) FROM |
| | | ( |
| | | SELECT IF(v.`hb_pid` IS NOT NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE v.`hb_uid`=#{0} |
| | | ) a LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON co.co_id=ho.`ho_order_id` |
| | | LEFT JOIN `yeshi_ec_taobao_weiqaun_order` wo ON |
| | | SELECT IF(v.`hb_pid` IS NOT |
| | | NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN |
| | | yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE v.`hb_uid`=#{uid} and |
| | | v.`hb_create_time`>=#{minTime} |
| | | ) a |
| | | LEFT JOIN yeshi_ec_hongbao_order ho |
| | | ON ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON |
| | | co.co_id=ho.`ho_order_id` |
| | | LEFT JOIN |
| | | `yeshi_ec_taobao_weiqaun_order` wo |
| | | ON |
| | | wo.`tmo_order_item_id`=co.`co_trade_id` |
| | | WHERE co.`co_id`>0 AND wo.`tmo_id`>0 |
| | | WHERE co.`co_id`>0 AND |
| | | wo.`tmo_id`>0 |
| | | |
| | | </select> |
| | | |
| | | <select id="sumWeiQuanOrderFanAmountByUid" parameterType="java.lang.Long" |
| | | resultType="java.math.BigDecimal"> |
| | | SELECT SUM(wo.`tmo_fan_money`) FROM |
| | | <select id="sumWeiQuanOrderFanAmountByUid" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM(wo.`tmo_fan_money`) FROM |
| | | ( |
| | | SELECT IF(v.`hb_pid` IS NOT NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE v.`hb_uid`=#{0} |
| | | ) a LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON co.co_id=ho.`ho_order_id` |
| | | SELECT IF(v.`hb_pid` IS |
| | | NOT |
| | | NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT |
| | | JOIN |
| | | yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE |
| | | v.`hb_uid`=#{uid} |
| | | ) a |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON |
| | | ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON |
| | | co.co_id=ho.`ho_order_id` |
| | | |
| | | LEFT JOIN `yeshi_ec_taobao_weiqaun_order` wo ON |
| | | LEFT JOIN |
| | | `yeshi_ec_taobao_weiqaun_order` wo |
| | | ON |
| | | wo.`tmo_order_item_id`=co.`co_trade_id` |
| | | WHERE co.`co_id`>0 AND wo.`tmo_id`>0 |
| | | WHERE co.`co_id`>0 AND |
| | | wo.`tmo_id`>0 and co_third_create_time>=#{minTime} |
| | | </select> |
| | | |
| | | |
| | | <select id="countSafeOrderByUid" parameterType="java.lang.Long" |
| | | resultType="java.lang.Integer"> |
| | | SELECT COUNT(co.`co_id`) FROM |
| | | |
| | | <select id="countWeiQuanOrderWithMinCommision" resultType="java.lang.Integer"> |
| | | |
| | | SELECT count(distinct(a.id)) FROM |
| | | ( |
| | | SELECT IF(v.`hb_pid` IS NOT NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE v.`hb_uid`=#{0} |
| | | ) a LEFT JOIN yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON co.co_id=ho.`ho_order_id` |
| | | SELECT IF(v.`hb_pid` IS |
| | | NOT |
| | | NULL,p.`hb_id`,v.`hb_id`) AS id FROM |
| | | yeshi_ec_hongbao_v2 v LEFT |
| | | JOIN |
| | | yeshi_ec_hongbao_v2 p ON |
| | | p.`hb_id`=v.`hb_pid` WHERE |
| | | v.`hb_uid`=#{0} |
| | | ) a |
| | | LEFT JOIN yeshi_ec_hongbao_order ho ON |
| | | ho.`ho_hongbao_id`=a.id LEFT |
| | | JOIN yeshi_ec_common_order co ON |
| | | co.co_id=ho.`ho_order_id` |
| | | |
| | | WHERE co.`co_id`>0 AND co.`co_settle_time` IS NOT NULL AND |
| | | (UNIX_TIMESTAMP()- UNIX_TIMESTAMP(co.`co_settle_time`))>180*24*60*60; |
| | | |
| | | LEFT JOIN |
| | | `yeshi_ec_taobao_weiqaun_order` wo |
| | | ON |
| | | wo.`tmo_order_item_id`=co.`co_trade_id` |
| | | WHERE co.`co_id`>0 AND |
| | | tmo_fan_money>=#{minMoney} and co_third_create_time>=#{minTime} |
| | | wo.`tmo_id`>0 and wo |
| | | </select> |
| | | |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.entity.dao.PDDOrderMapper"> |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.pdd.PDDOrder"> |
| | | <id column="po_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="po_order_sn" property="orderSn" jdbcType="VARCHAR" /> |
| | |
| | | <result column="dh_token" property="deviceToken" jdbcType="VARCHAR" /> |
| | | <result column="dh_device" property="device" jdbcType="VARCHAR" /> |
| | | <result column="dh_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="dh_token_md5" property="deviceTokenMd5" |
| | | jdbcType="VARCHAR" /> |
| | | <association property="user" column="dh_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">dh_id,dh_token,dh_device,dh_uid as id,dh_updatetime</sql> |
| | | <sql id="Base_Column_List">dh_id,dh_token,dh_device,dh_uid as |
| | | id,dh_updatetime,dh_token_md5 |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByDeviceAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_device = #{device} and |
| | | dh_uid=#{uid} |
| | | </select> |
| | | |
| | | <select id="selectList" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw limit #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="selectByUid" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_uid = #{0} |
| | | </select> |
| | | |
| | | <select id="selectCount" resultType="java.lang.Long"> |
| | | select |
| | | count(dh_id) |
| | | from |
| | | <select id="selectCount" resultType="java.lang.Long">select count(dh_id) from |
| | | yeshi_ec_uid_devicetoken_hw |
| | | </select> |
| | | |
| | | <select id="selectByDevice" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_device = #{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_uid_devicetoken_hw where dh_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_uid_devicetoken_hw |
| | | (dh_id,dh_token,dh_device,dh_uid,dh_updatetime) values |
| | | (#{id,jdbcType=BIGINT},#{deviceToken,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{user.id,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (dh_id,dh_token,dh_device,dh_uid,dh_updatetime,dh_token_md5) values |
| | | (#{id,jdbcType=BIGINT},#{deviceToken,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR},#{user.id,jdbcType=BIGINT},#{updateTime,jdbcType=TIMESTAMP},#{deviceTokenMd5,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="device != null">dh_device,</if> |
| | | <if test="user != null">dh_uid,</if> |
| | | <if test="updateTime != null">dh_updatetime,</if> |
| | | <if test="deviceTokenMd5 != null">dh_token_md5,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="device != null">#{device,jdbcType=VARCHAR},</if> |
| | | <if test="user != null">#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceTokenMd5 != null">#{deviceTokenMd5,jdbcType=VARCHAR}</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW">update |
| | |
| | | #{deviceToken,jdbcType=VARCHAR},dh_device = |
| | | #{device,jdbcType=VARCHAR},dh_uid = |
| | | #{user.id,jdbcType=BIGINT},dh_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} where dh_id = |
| | | #{updateTime,jdbcType=TIMESTAMP} ,dh_token_md5 |
| | | =#{deviceTokenMd5,jdbcType=VARCHAR} where dh_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenHW"> |
| | | update yeshi_ec_uid_devicetoken_hw |
| | | <set> |
| | |
| | | <if test="device != null">dh_device=#{device,jdbcType=VARCHAR},</if> |
| | | <if test="user != null">dh_uid=#{user.id,jdbcType=BIGINT},</if> |
| | | <if test="updateTime != null">dh_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="deviceTokenMd5 !=null">dh_token_md5 =#{deviceTokenMd5,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where dh_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | |
| | | <update id="bindUidByDevice"> |
| | | update yeshi_ec_uid_devicetoken_hw |
| | | <set> |
| | | dh_uid=#{uid} |
| | | </set> |
| | | where dh_device = #{device} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_id =#{orderId} and |
| | | tmo_state=#{state} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="selectByOrderItemId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_taobao_weiqaun_order where tmo_order_item_id =#{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_taobao_weiqaun_order where tmo_id = #{id,jdbcType=BIGINT} |
| | |
| | |
|
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityInviteInfo;
|
| | |
| | |
|
| | | @Service
|
| | | public class DynamicInfoServiceImpl implements DynamicInfoService {
|
| | | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | |
|
| | | @Resource
|
| | | private DynamicInfoDao dynamicInfoDao;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoShopService taoBaoShopService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private InviteMaterialService inviteMaterialService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private QrCodeService qrCodeService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void insert(DynamicInfo record) {
|
| | | dynamicInfoDao.insert(record);
|
| | | dynamicInfoDao.insert(record);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public DynamicInfo getById(String id) {
|
| | | return dynamicInfoDao.getById(id);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void insertTimeInvite() {
|
| | | InviteMaterial inviteMaterial = inviteMaterialService.getInviteMaterial();
|
| | | if (inviteMaterial == null) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Date date = new Date();
|
| | | String materialId = inviteMaterial.getId();
|
| | | String content = inviteMaterial.getText();
|
| | | |
| | | ActivityUser user=activityUserService.selectByPrimaryKey(2L);
|
| | | |
| | |
|
| | | ActivityUser user = activityUserService.selectByPrimaryKey(2L);
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(content)) {
|
| | | DynamicInfo dynamicTxt= new DynamicInfo();
|
| | | DynamicInfo dynamicTxt = new DynamicInfo();
|
| | | dynamicTxt.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicTxt.setInviteMaterialId(materialId);
|
| | | dynamicTxt.setClassId(4L);
|
| | |
| | | dynamicTxt.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | dynamicTxt.setCreateTime(date);
|
| | | dynamicTxt.setUpdateTime(date);
|
| | | |
| | |
|
| | | SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
|
| | | |
| | |
|
| | | StringBuffer buffer = new StringBuffer();
|
| | | buffer.append("-------------------\n");
|
| | | buffer.append("今天 : " + format.format(date));
|
| | |
| | | buffer.append("早安~\n");
|
| | | buffer.append("我的邀请码:【邀请码】\n");
|
| | | buffer.append("购物省钱返利券App:【邀请链接】");
|
| | | |
| | | content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。") .replaceAll("\\;", "\\;")
|
| | |
|
| | | content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。").replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | | |
| | |
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(content + "\n" + buffer.toString());
|
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | listtitle.add(row1);
|
| | | dynamicTxt.setTitle(listtitle);
|
| | | |
| | |
|
| | | // 空数据
|
| | | List<GoodsPicture> listImg = new ArrayList<GoodsPicture>();
|
| | | dynamicTxt.setImgs(listImg);
|
| | | |
| | |
|
| | | dynamicInfoDao.insert(dynamicTxt);
|
| | | }
|
| | | |
| | |
|
| | | String picture = inviteMaterial.getPicture();
|
| | | if (!StringUtil.isNullOrEmpty(picture)) {
|
| | | DynamicInfo dynamicPic = new DynamicInfo();
|
| | |
| | | dynamicPic.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | dynamicPic.setCreateTime(date);
|
| | | dynamicPic.setUpdateTime(date);
|
| | | |
| | |
|
| | | try {
|
| | | // 画图
|
| | | String url = qrCodeService.drawInviteToGreet(picture, null, null, null, content, new Date());
|
| | | |
| | |
|
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | dynamicPic.setTitle(listtitle);
|
| | | |
| | |
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | |
| | | List<GoodsPicture> listImg = new ArrayList<GoodsPicture>();
|
| | | listImg.add(p2);
|
| | | dynamicPic.setImgs(listImg);
|
| | | |
| | |
|
| | | dynamicInfoDao.insert(dynamicPic);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | inviteMaterialService.updateState(1, materialId);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void insertShopInfo() {
|
| | | List<String> brandIdList = DaTaoKeApiUtil.getBrandIdList();
|
| | |
| | | LogHelper.test("大淘客品牌id获取失败(DynamicInfoService-insertShopInfo)");
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | Long classId = 3L;
|
| | | Long subclassId = 0L;
|
| | | List<DynamicInfo> listInfo = dynamicInfoDao.query(classId, subclassId);
|
| | |
| | | if (listInfo != null && listInfo.size() > 0) {
|
| | | for (int i = 0; i < brandIdList.size(); i++) {
|
| | | String brandId = brandIdList.get(i);
|
| | | |
| | |
|
| | | for (int j = 0; j < listInfo.size(); j++) {
|
| | | String id = listInfo.get(j).getId();
|
| | | if (brandId.equals(id)) {
|
| | | brandIdList.remove(brandId);
|
| | | i--;
|
| | | |
| | |
|
| | | listInfo.remove(listInfo.get(j));
|
| | | j--;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (brandIdList == null || brandIdList.size() == 0) {
|
| | | LogHelper.test("大淘客品牌已全部爬取(DynamicInfoService-insertShopInfo)");
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | int index = (int) (Math.random() * brandIdList.size());
|
| | | String brandId = brandIdList.get(index);
|
| | | |
| | |
|
| | | TaoBaoShopDTO dynamicShopInfo = DaTaoKeApiUtil.getDynamicShopInfo(brandId);
|
| | | if (dynamicShopInfo == null) {
|
| | | LogHelper.test("大淘客品牌信息爬取失败(DynamicInfoService-insertShopInfo)");
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = dynamicShopInfo.getListGoods();
|
| | | if (listGoods == null || listGoods.size() == 0) {
|
| | | LogHelper.test("大淘客品牌商品信息爬取失败(DynamicInfoService-insertShopInfo)");
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Long sellerId = dynamicShopInfo.getSellerId();
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = listGoods.get(0);
|
| | | TaoBaoShop taoBaoShop = taoBaoShopService.getTaoBaoShop(taoBaoGoodsBrief.getAuctionId(), sellerId);
|
| | |
| | | if (StringUtil.isNullOrEmpty(shopLink)) {
|
| | | taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
|
| | | }
|
| | | |
| | |
|
| | | DynamicInfo dynamicVO = new DynamicInfo();
|
| | | dynamicVO.setId(brandId);
|
| | | dynamicVO.setClassId(classId);
|
| | | dynamicVO.setSubclassId(subclassId);
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_TWO);
|
| | | dynamicVO.setShop(taoBaoShop);
|
| | | dynamicVO.setUser(activityUserService.listRand(1).get(0));
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8)); |
| | | List<ActivityRuleUser> userList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAODIAN, 1, 50);
|
| | | dynamicVO.setUser(userList.get((int) (userList.size() * Math.random())).getActivityUser());
|
| | | dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
|
| | | dynamicVO.setUpdateTime(new Date());
|
| | | |
| | |
|
| | | // 介绍内容
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | |
| | | List<ClientTextStyleVO> listTitle = new ArrayList<ClientTextStyleVO>();
|
| | | listTitle.add(row1);
|
| | | dynamicVO.setTitle(listTitle);
|
| | | |
| | |
|
| | | // 商品信息
|
| | | List<GoodsPicture> listPicture = new ArrayList<GoodsPicture>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : listGoods) {
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null);
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief,
|
| | | proportion.toString(), null);
|
| | | taoBaoGoodsBriefExtra.setCouponInfo(null);
|
| | | taoBaoGoodsBriefExtra.setUpdatetime(new Date());
|
| | | |
| | |
|
| | | if (!taoBaoGoodsBriefExtra.isCoupon()) {
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | }
|
| | | |
| | |
|
| | | String goodsId = goodsBrief.getAuctionId().toString();
|
| | | JSONObject item = new JSONObject();
|
| | | item.put("id", goodsId);
|
| | | item.put("from", "dynamics");
|
| | | |
| | |
|
| | | GoodsPicture goodsPicture = new GoodsPicture();
|
| | | goodsPicture.setH(100);
|
| | | goodsPicture.setW(100);
|
| | |
| | | goodsPicture.setJumpDetail(jumpDetailV2Service.getByTypeCache("goodsdetail"));
|
| | | goodsPicture.setParams(item.toString());
|
| | | goodsPicture.setGoods(taoBaoGoodsBriefExtra);
|
| | | |
| | |
|
| | | listPicture.add(goodsPicture);
|
| | | }
|
| | | dynamicVO.setImgs(listPicture);
|
| | | |
| | |
|
| | | dynamicInfoDao.insert(dynamicVO);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void insertTimeRecommend() {
|
| | | try {
|
| | |
| | | List<GoodsClass> list = DaTaoKeUtil.goodsClasses;
|
| | | int index = (int) (Math.random() * list.size());
|
| | | Long subclassId = list.get(index).getId();
|
| | | int cid = Integer.parseInt(subclassId +"");
|
| | | int cid = Integer.parseInt(subclassId + "");
|
| | | int count = 0;
|
| | | double random = Math.random();
|
| | | if (random > 0.4) {
|
| | |
| | | // 分享奖金
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(daTaoKe);
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | |
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | if (!taoBaoGoodsBriefExtra.isCoupon()) {
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | shareMoney = MoneyBigDecimalUtil.add(shareMoney, money);
|
| | | // 商品图片
|
| | |
| | | taoBaoGoodsBriefExtra.setCouponInfo(null);
|
| | | GoodsPicture goodsPicture = getGoodsPicture(daTaoKe);
|
| | | goodsPicture.setGoods(taoBaoGoodsBriefExtra);
|
| | | |
| | |
|
| | | listPicture.add(goodsPicture);
|
| | | }
|
| | |
|
| | |
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(daTaoKe);
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | |
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | if (!taoBaoGoodsBriefExtra.isCoupon()) {
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | }
|
| | | taoBaoGoodsBriefExtra.setTkRate(taoBaoGoodsBrief.getTkRate());
|
| | | |
| | |
|
| | | // 分享奖金
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | |
| | | if (pic.equals(img)) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | listimgs.add(img);
|
| | | GoodsPicture picture = new GoodsPicture();
|
| | | picture.setH(100);
|
| | |
| | | listPicture.add(picture);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | taoBaoGoodsBriefExtra.setImgList(imgList);
|
| | |
|
| | | // 组织动态信息
|
| | |
| | | dynamicInfo.setShareType(DynamicInfo.SHARE_TYPE_ONE);
|
| | | dynamicInfo.setShowType(DynamicInfo.SHOW_TYPE_TWO);
|
| | | dynamicInfo.setListGoodsBrief(listGoods);
|
| | | |
| | |
|
| | | String desc = DaTaoKeUtil.getDesc(daTaoKe);
|
| | | if (!StringUtil.isNullOrEmpty(desc)) {
|
| | | int index = desc.lastIndexOf("\n");
|
| | | String newDesc = desc.substring(index + 1);
|
| | | if(StringUtil.isNullOrEmpty(newDesc)) {
|
| | | if (StringUtil.isNullOrEmpty(newDesc)) {
|
| | | desc = desc.substring(0, index);
|
| | | }
|
| | | }
|
| | |
| | | goodsPicture.setW(100);
|
| | | goodsPicture.setUrl(TbImgUtil.getTBSize320Img(daTaoKe.getPic()));
|
| | | goodsPicture.setJumpDetail(jumpDetailV2Service.getByTypeCache("goodsdetail"));
|
| | | |
| | |
|
| | | String goodsId = daTaoKe.getGoodsId().toString();
|
| | | JSONObject item = new JSONObject();
|
| | | item.put("id", goodsId);
|
| | |
| | | return goodsPicture;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public void insertInviteActivity(RecommendActivity activity) throws Exception{
|
| | | |
| | | public void insertInviteActivity(RecommendActivity activity) throws Exception {
|
| | |
|
| | | String title = activity.getTitle();
|
| | | |
| | |
|
| | | String picUrl = null;
|
| | | List<String> imageList = activity.getImageList();
|
| | | if (imageList != null && imageList.size() > 0) {
|
| | | picUrl = imageList.get(0);
|
| | | }
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(picUrl)) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 判断是否已存在
|
| | | String dynamicInfoId = null;
|
| | | |
| | | Long activityId = activity.getId();
|
| | |
|
| | | Long activityId = activity.getId();
|
| | | DynamicInfo dynamicVO = dynamicInfoDao.getByActivityId(activityId);
|
| | | if (dynamicVO == null) {
|
| | | dynamicVO = new DynamicInfo();
|
| | |
| | | } else {
|
| | | dynamicInfoId = dynamicVO.getId();
|
| | | }
|
| | | |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | title = title.replaceAll("<p>", "").replaceAll("</p>", "").replaceAll("<br>", "\n");
|
| | | |
| | |
|
| | | int index = title.lastIndexOf("\n");
|
| | | String newDesc = title.substring(index + 1);
|
| | | if(StringUtil.isNullOrEmpty(newDesc)) {
|
| | | if (StringUtil.isNullOrEmpty(newDesc)) {
|
| | | title = title.substring(0, index);
|
| | | }
|
| | | |
| | | title = title.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。") .replaceAll("\\;", "\\;")
|
| | |
|
| | | title = title.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。").replaceAll("\\;", "\\;")
|
| | | .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
|
| | | }
|
| | | |
| | |
|
| | | dynamicVO.setId(UUID.randomUUID().toString().replace("-", ""));
|
| | | dynamicVO.setActivityId(activityId);
|
| | | dynamicVO.setClassId(4L);
|
| | | dynamicVO.setSubclassId(0L);
|
| | | dynamicVO.setShareType(DynamicInfo.SHARE_TYPE_INVITE);
|
| | | dynamicVO.setUpdateTime(new Date());
|
| | | |
| | | |
| | |
|
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null || shareCount <= 0) {
|
| | | dynamicVO.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | } else {
|
| | | dynamicVO.setShareCount(shareCount);
|
| | | }
|
| | | |
| | |
|
| | | // 发布用户
|
| | | ActivityUser activityUser = activity.getActivityUser();
|
| | | if (activityUser == null) {
|
| | |
| | | } else {
|
| | | dynamicVO.setUser(activityUser);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 介绍内容
|
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | if(!StringUtil.isNullOrEmpty(title)) {
|
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(title );
|
| | | row1.setContent(title);
|
| | | listtitle.add(row1);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 图片
|
| | | List<GoodsPicture> listImg = new ArrayList<GoodsPicture>();
|
| | | if(StringUtil.isNullOrEmpty(picUrl)) {
|
| | | if (StringUtil.isNullOrEmpty(picUrl)) {
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ZERO);
|
| | | } else {
|
| | | dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_ONE);
|
| | | RecommendActivityInviteInfo inviteInfo = activity.getInviteInfo();
|
| | | |
| | | Integer pX = null; |
| | |
|
| | | Integer pX = null;
|
| | | Integer pY = null;
|
| | | Integer size = null;
|
| | | if (inviteInfo != null) {
|
| | |
| | | pY = inviteInfo.getPy();
|
| | | size = inviteInfo.getSize();
|
| | | }
|
| | | |
| | |
|
| | | // 图片
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl , null, null, pX, pY, size, null);
|
| | | String imgLink = qrCodeService.drawInviteQrCodeNew(picUrl, null, null, pX, pY, size, null);
|
| | | GoodsPicture p2 = new GoodsPicture();
|
| | | p2.setW(100);
|
| | | p2.setH(100);
|
| | |
| | | p2.setPx(pX);
|
| | | p2.setPy(pY);
|
| | | p2.setSize(size);
|
| | | |
| | |
|
| | | listImg.add(p2);
|
| | | }
|
| | | |
| | |
|
| | | dynamicVO.setImgs(listImg);
|
| | | dynamicVO.setTitle(listtitle);
|
| | | |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dynamicInfoId)) {
|
| | | dynamicInfoDao.deleteById(dynamicInfoId);
|
| | | }
|
| | | |
| | |
|
| | | dynamicInfoDao.insert(dynamicVO);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void insertActivityRecommend(RecommendActivity activity) {
|
| | | if (activity == null || activity.getGoodsList() == null) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | String dynamicInfoId = null;
|
| | | DynamicInfo dynamicInfo = dynamicInfoDao.getByActivityId(activity.getId());
|
| | |
| | | } else {
|
| | | dynamicInfoId = dynamicInfo.getId();
|
| | | }
|
| | | |
| | |
|
| | | dynamicInfo.setClassId(2L);
|
| | | dynamicInfo.setSubclassId(0L);
|
| | | dynamicInfo.setUser(activity.getActivityUser());
|
| | | dynamicInfo.setActivityId(activity.getId());
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | |
| | | |
| | |
|
| | | List<ClientTextStyleVO> listtitle = new ArrayList<ClientTextStyleVO>();
|
| | | String title = activity.getTitle();
|
| | | if (!StringUtil.isNullOrEmpty(title)) {
|
| | | title = title.replaceAll("<p>", "");
|
| | | title = title.replaceAll("</p>", "");
|
| | | title = title.replaceAll("<br>", "\n");
|
| | | |
| | |
|
| | | int index = title.lastIndexOf("\n");
|
| | | String newDesc = title.substring(index + 1);
|
| | | if(StringUtil.isNullOrEmpty(newDesc)) {
|
| | | if (StringUtil.isNullOrEmpty(newDesc)) {
|
| | | title = title.substring(0, index);
|
| | | }
|
| | | |
| | |
|
| | | ClientTextStyleVO row1 = new ClientTextStyleVO();
|
| | | row1.setColor("#333333");
|
| | | row1.setContent(title );
|
| | | row1.setContent(title);
|
| | | listtitle.add(row1);
|
| | | }
|
| | | dynamicInfo.setTitle(listtitle);
|
| | | |
| | | |
| | |
|
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null || shareCount <= 0) {
|
| | | dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
|
| | | } else {
|
| | | dynamicInfo.setShareCount(shareCount);
|
| | | }
|
| | | |
| | |
|
| | | // 发布用户
|
| | | ActivityUser activityUser = activity.getActivityUser();
|
| | | if (activityUser == null) {
|
| | |
| | |
|
| | | if (activity.getGoodsList() != null) {
|
| | | for (RecommendActivityTaoBaoGoods activityGoods : activity.getGoodsList()) {
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = null;
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = null;
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = null;
|
| | | String auctionId = activityGoods.getAuctionId();
|
| | | try {
|
| | | taoBaoGoodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(auctionId));
|
| | | |
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | |
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | if (!taoBaoGoodsBriefExtra.isCoupon()) {
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(taoBaoGoodsBrief);
|
| | | shareMoney = MoneyBigDecimalUtil.add(shareMoney, money);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | taoBaoGoodsBrief = activityGoods.getTaoBaoGoodsBrief();
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | taoBaoGoodsBriefExtra.setCoupon(false);
|
| | | taoBaoGoodsBrief = activityGoods.getTaoBaoGoodsBrief();
|
| | | taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | taoBaoGoodsBriefExtra.setState(1);
|
| | | taoBaoGoodsBriefExtra.setCoupon(false);
|
| | | }
|
| | | listGoods.add(taoBaoGoodsBrief);
|
| | | |
| | |
|
| | | // 商品图片
|
| | | taoBaoGoodsBriefExtra.setCouponInfo(null);
|
| | | taoBaoGoodsBriefExtra.setUpdatetime(new Date());
|
| | | |
| | |
|
| | | JSONObject item = new JSONObject();
|
| | | item.put("id", auctionId);
|
| | | item.put("from", "dynamics");
|
| | | |
| | |
|
| | | GoodsPicture goodsPicture = new GoodsPicture();
|
| | | goodsPicture.setH(100);
|
| | | goodsPicture.setW(100);
|
| | |
| | | goodsPicture.setJumpDetail(jumpDetailV2Service.getByTypeCache("goodsdetail"));
|
| | | goodsPicture.setParams(item.toString());
|
| | | goodsPicture.setGoods(taoBaoGoodsBriefExtra);
|
| | | |
| | |
|
| | | listPicture.add(goodsPicture);
|
| | | }
|
| | | }
|
| | | dynamicInfo.setImgs(listPicture);
|
| | | dynamicInfo.setListGoodsBrief(listGoods);
|
| | | |
| | |
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | | shareMoneyDesc.setBottomColor("#E8AE48");
|
| | |
| | | dynamicInfo.setShowType(DynamicInfo.SHOW_TYPE_THREE);
|
| | | dynamicInfo.setShareType(DynamicInfo.SHARE_TYPE_NINE); // 分享类型9图
|
| | | }
|
| | | |
| | | |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dynamicInfoId)) {
|
| | | dynamicInfoDao.deleteById(dynamicInfoId);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void deleteActivity(Long activityId) {
|
| | | DynamicInfo dynamicInfo = dynamicInfoDao.getByActivityId(activityId);
|
| | |
| | | dynamicInfoDao.deleteById(dynamicInfo.getId());
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void removeByDate(Date createTime) {
|
| | | dynamicInfoDao.removeByDate(createTime);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void updateShareCount(DynamicInfo record) {
|
| | | dynamicInfoDao.updateShareCount(record);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "dynamicCache", key = "'count-'+#cid+'-'+#subId")
|
| | | public long count(Long cid, Long subId) {
|
| | |
| | | @Cacheable(value = "dynamicCache", key = "'query-'+#start+'-'+#count+'-'+#cid+'-'+#subId")
|
| | | public List<DynamicInfo> query(int start, int count, Long cid, Long subId) {
|
| | | List<DynamicInfo> list = dynamicInfoDao.query(start, count, cid, subId);
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | |
| | | updateGoodInfo(list);
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | return list;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 更新商品信息
|
| | | */
|
| | | public void updateGoodInfo(List<DynamicInfo> list) {
|
| | | |
| | |
|
| | | // 外网进行更新
|
| | | if (!Constant.IS_OUTNET) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (DynamicInfo dynamicInfo: list) {
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | | // 邀请数据不做更新
|
| | | long classId = dynamicInfo.getClassId();
|
| | | if (classId == 4) {
|
| | | break;
|
| | | }
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null || imgs.size() == 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | // 是否一个小时之内已更新
|
| | | Date updateTime = dynamicInfo.getUpdateTime();
|
| | | if (updateTime != null) {
|
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数 |
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数 |
| | | long diff = System.currentTimeMillis() - updateTime.getTime(); |
| | | long day = diff / nd;// 计算差多少天 |
| | | long hour = diff % nd / nh + day * 24;// 计算差多少小时 |
| | | long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
|
| | | long nh = 1000 * 60 * 60;// 一小时的毫秒数
|
| | | long diff = System.currentTimeMillis() - updateTime.getTime();
|
| | | long day = diff / nd;// 计算差多少天
|
| | | long hour = diff % nd / nh + day * 24;// 计算差多少小时
|
| | | if (hour < 1) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 已下架ID
|
| | | List<Long> listDown = new ArrayList<Long>();
|
| | | // 商品列表
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | |
| | | for (GoodsPicture goodsPicture: imgs) {
|
| | |
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | TaoBaoGoodsBriefExtra oldExtra = goodsPicture.getGoods();
|
| | | if (oldExtra == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | Integer state = oldExtra.getState();
|
| | | if (state != null && state == 1) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(oldExtra.getAuctionId());
|
| | | |
| | |
|
| | | // 更新商品信息
|
| | | try {
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goodsBrief);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | listGoods.add(goodsBrief);
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | |
|
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | BigDecimal shareMoney = taoBaoGoodsBriefService.getShareGoodsUserHongBao(goodsBrief);
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | |
| | | shareMoneyDesc.setContent("预估分享奖金:¥" + shareMoney);
|
| | | dynamicInfo.setDesc(shareMoneyDesc);
|
| | | }
|
| | | |
| | | TaoBaoGoodsBriefExtra newExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null);
|
| | | |
| | |
|
| | | TaoBaoGoodsBriefExtra newExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief,
|
| | | proportion.toString(), null);
|
| | |
|
| | | if (!newExtra.isCoupon()) {
|
| | | newExtra.setState(1);
|
| | | }
|
| | | newExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(oldExtra);
|
| | | |
| | |
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | listDown.add(oldExtra.getAuctionId());
|
| | | |
| | |
|
| | | oldExtra.setState(1);
|
| | | oldExtra.setCoupon(false);
|
| | | oldExtra.setUpdatetime(new Date());
|
| | | goodsPicture.setGoods(oldExtra);
|
| | | |
| | |
|
| | | // 商品真实下架
|
| | | goodsPicture.setGoodState(1);
|
| | | |
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | |
|
| | | // 更新热销单品的分享奖金 ,其余不做更新
|
| | | if (classId == 1) {
|
| | | ClientTextStyleVO shareMoneyDesc = new ClientTextStyleVO();
|
| | | shareMoneyDesc.setColor("#FFFFFF");
|
| | |
| | | }
|
| | | }
|
| | | dynamicInfo.setImgs(imgs);
|
| | | |
| | |
|
| | | // 商品已下架
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = dynamicInfo.getListGoodsBrief();
|
| | | if (listGoodsBrief != null && listGoodsBrief.size() > 0) {
|
| | | |
| | | if (listGoods.size() > 0 ) {
|
| | |
|
| | | if (listGoods.size() > 0) {
|
| | | if (classId == 1) {
|
| | | dynamicInfo.setListGoodsBrief(listGoods);
|
| | | } else {
|
| | | for (int i =0; i < listGoodsBrief.size(); i ++) {
|
| | | for (int i = 0; i < listGoodsBrief.size(); i++) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = listGoodsBrief.get(i);
|
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | |
| | |
|
| | | boolean isadd = true;
|
| | | for (TaoBaoGoodsBrief goods: listGoods) {
|
| | | if(goods.getAuctionId().equals(auctionId) || goods.getAuctionId() == auctionId) {
|
| | | for (TaoBaoGoodsBrief goods : listGoods) {
|
| | | if (goods.getAuctionId().equals(auctionId) || goods.getAuctionId() == auctionId) {
|
| | | isadd = false;
|
| | | break;
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (isadd) {
|
| | | // 商品已下架 则添加原来商品信息
|
| | | if (listDown.size() > 0 && listDown.contains(taoBaoGoodsBrief.getAuctionId())) {
|
| | |
| | | }
|
| | | } else {
|
| | | if (listDown.size() > 0) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief: listGoodsBrief) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
|
| | | if (listDown.contains(taoBaoGoodsBrief.getAuctionId())) {
|
| | | taoBaoGoodsBrief.setState(1);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | dynamicInfo.setUpdateTime(new Date());
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.jd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.jd.JDOrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | |
|
| | | @Service
|
| | | public class JDOrderProcessServiceImpl implements JDOrderProcessService {
|
| | |
|
| | | @Resource
|
| | | private PDDOrderMapper pddOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Override
|
| | | public void handleOrder(JDOrder jdOrder) throws PDDOrderException {
|
| | | // 区分分享与返利
|
| | | if (jdOrder.getOrderItemList() != null && jdOrder.getOrderItemList().size() > 0) {
|
| | | long positionId = jdOrder.getOrderItemList().get(0).getPositionId();
|
| | | if (positionId == JDApiUtil.POSITION_FANLI) {
|
| | | handleFanLiOrder(jdOrder);
|
| | | } else if (positionId == JDApiUtil.POSITION_SHARE) {
|
| | | handleShareOrder(jdOrder);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleFanLiOrder(JDOrder jdOrder) {
|
| | | if (jdOrder != null) {
|
| | | Order oldOrder = orderService.findOrderByOrderIdAndType(jdOrder.getOrderId() + "", Constant.SOURCE_TYPE_JD);
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (oldOrder == null) {
|
| | | // 计算订单状态
|
| | | int state = Order.STATE_SHIXIAO;
|
| | | for (JDOrderItem item : jdOrder.getOrderItemList()) {
|
| | | if (item.getValidCode() >= 16) {
|
| | | state = Order.STATE_YIZHIFU;
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(jdOrder.getExt1())) {
|
| | | uid = Long.parseLong(jdOrder.getExt1());
|
| | | Order order = new Order();
|
| | | order.setBeizhu("PID返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(jdOrder.getOrderId() + "");
|
| | | order.setOrderType(Order.ORDER_TYPE_JINGDONG);
|
| | | order.setState(state);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | order.setVersion(2);
|
| | | // 加入到订单表
|
| | | orderMapper.insertSelective(order);
|
| | | oldOrder = order;
|
| | | }
|
| | | } else {
|
| | | uid = oldOrder.getUserInfo().getId();
|
| | | }
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 计算订单总额度
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | for (JDOrderItem itemOrder : jdOrder.getOrderItemList()) {
|
| | | money = money.add(itemOrder.getEstimateCosPrice());
|
| | | }
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = jdOrder.getValidCode() + "";
|
| | | updateOrder.setThirdState(thirdState);
|
| | | updateOrder.setThirdCreateTime(new Date(jdOrder.getOrderTime()));
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addJDOrder出错", "订单号:" + jdOrder.getOrderId());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addHongBao出错", "订单号:" + jdOrder.getOrderId());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleShareOrder(JDOrder jdOrder) {
|
| | | if (jdOrder != null) {
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (!StringUtil.isNullOrEmpty(jdOrder.getExt1()))
|
| | | uid = Long.parseLong(jdOrder.getExt1());
|
| | |
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | commonOrderList = commonOrderService.addJDOrder(jdOrder, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addJDOrder出错", "订单号:" + jdOrder.getOrderId());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addHongBao出错", "订单号:" + jdOrder.getOrderId());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.jd;
|
| | |
|
| | | 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.jd.JDOrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.jd.JDOrderMapper;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.exception.jd.JDOrderException;
|
| | | import com.yeshi.fanli.service.inter.jd.JDOrderService;
|
| | |
|
| | | @Service
|
| | | public class JDOrderServiceImpl implements JDOrderService {
|
| | | @Resource
|
| | | private JDOrderItemMapper jdOrderItemMapper;
|
| | | @Resource
|
| | | private JDOrderMapper jdOrderMapper;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addJDOrder(JDOrder order) throws JDOrderException {
|
| | | if (order == null)
|
| | | throw new JDOrderException(1, "订单为空");
|
| | | JDOrder oldOrder = jdOrderMapper.selectByOrderId(order.getOrderId());
|
| | | if (oldOrder != null)// 更新
|
| | | {
|
| | | order.setId(oldOrder.getId());
|
| | | order.setUpdateTime(new Date());
|
| | | jdOrderMapper.updateByPrimaryKeySelective(order);
|
| | | for (JDOrderItem item : order.getOrderItemList()) {// 新增
|
| | | JDOrderItem oldItem = jdOrderItemMapper.selectByTradeId(item.getTradeId());
|
| | | if (oldItem != null)// 更新
|
| | | {
|
| | | item.setId(oldItem.getId());
|
| | | item.setUpdateTime(new Date());
|
| | | jdOrderItemMapper.updateByPrimaryKeySelective(item);
|
| | | } else {// 新增
|
| | | item.setCreateTime(new Date());
|
| | | jdOrderItemMapper.insertSelective(item);
|
| | | }
|
| | | }
|
| | | } else {// 新增
|
| | | if (order.getOrderItemList() == null || order.getOrderItemList().size() == 0)
|
| | | throw new JDOrderException(2, "子订单为空");
|
| | |
|
| | | if (order.getCreateTime() == null)
|
| | | order.setCreateTime(new Date());
|
| | | jdOrderMapper.insertSelective(order);
|
| | |
|
| | | for (JDOrderItem item : order.getOrderItemList()) {// 新增
|
| | | if (item.getCreateTime() == null)
|
| | | item.setCreateTime(new Date());
|
| | | jdOrderItemMapper.insertSelective(item);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createShareOrder(uid, orderId, 0, orderState, payMoney, money,
|
| | | null);
|
| | | // 暂时不推送
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail, false);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | // try {
|
| | | // msgOrderDetailService.updateMsgOrderDetail(detail, false);
|
| | | // } catch (MsgOrderDetailException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, 0, orderState, payMoney, money,
|
| | | null);
|
| | | // 暂时不推送
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail, false);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | // try {
|
| | | // msgOrderDetailService.updateMsgOrderDetail(detail, false);
|
| | | // } catch (MsgOrderDetailException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderTradeIdMap;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.CommonOrderFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
|
| | |
|
| | | for (TaoBaoOrder taoBaoOrder : taoBaoOrders) {
|
| | | CommonOrder commonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(taoBaoOrder.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, taoBaoOrder.getOrderBy());
|
| | | if (commonOrder == null)// 新增
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrderGoods cog = new CommonOrderGoods();
|
| | | cog.setGoodsId(taoBaoOrder.getAuctionId() + "");
|
| | | cog.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | newCommonOrder.setCommonOrderGoods(cog);
|
| | | newCommonOrder.setStateWholeOrder(wholeOrderState);
|
| | | // 订单商品插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(),
|
| | | cog.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | commonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(taoBaoOrder.getAuctionId() + "");
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | // 商品是否已经插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | TaoBaoGoodsBrief taoBaoGoods = null;
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
|
| | | try {
|
| | | taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(taoBaoOrder.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, "AUCTIONID:" + taoBaoOrder.getAuctionId(), "");
|
| | | try {
|
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
|
| | | } catch (Exception e1) {
|
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
|
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | | if (commonGoods != null)
|
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods);
|
| | | }
|
| | | taoBaoGoods = TaoBaoUtil.getSimpleGoodsBrief(taoBaoOrder.getAuctionId());
|
| | | } catch (Exception e1) {
|
| | | CommonGoods commonGoods = commonGoodsService.getCommonGoodsByGoodsIdAndGoodsType(
|
| | | taoBaoOrder.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | | if (commonGoods != null)
|
| | | taoBaoGoods = TaoBaoUtil.convert(commonGoods);
|
| | | }
|
| | | if (taoBaoGoods != null) {
|
| | | goods = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | } else
|
| | | goods.setId(commonGoodsList.get(commonGoodsList.size() - 1).getId());
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | commonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrder.setStateWholeOrder(wholeOrderState);
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | |
|
| | | // 插入映射,保证交易ID的完整性
|
| | | commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
|
| | | commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
|
| | |
|
| | | commonOrderList.add(commonOrder);
|
| | | continue;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (commonOrder.getState() == CommonOrder.STATE_JS || commonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | commonOrderList.add(commonOrder);
|
| | | continue;
|
| | | }
|
| | | CommonOrder newCommonOrder = TaoBaoOrderUtil.convert(taoBaoOrder);
|
| | |
|
| | | // 交易ID一致才修改
|
| | | if (commonOrder.getTradeId() != null
|
| | | && commonOrder.getTradeId().equalsIgnoreCase(newCommonOrder.getTradeId())) {
|
| | |
|
| | | CommonOrder updateCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | updateCommonOrder.seteIncome(newCommonOrder.geteIncome());
|
| | | updateCommonOrder.setEstimate(newCommonOrder.getEstimate());
|
| | | updateCommonOrder.setPayment(newCommonOrder.getPayment());
|
| | | updateCommonOrder.setSettlement(newCommonOrder.getSettlement());
|
| | | updateCommonOrder.setSettleTime(newCommonOrder.getSettleTime());
|
| | | updateCommonOrder.setState(newCommonOrder.getState());
|
| | | updateCommonOrder.setStateWholeOrder(wholeOrderState);
|
| | | updateCommonOrder.setUpdateTime(new Date());
|
| | | updateCommonOrder.setTradeId(newCommonOrder.getTradeId());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
|
| | | commonOrderList.add(commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId()));
|
| | | } else
|
| | | commonOrderList.add(commonOrder);
|
| | | if (taoBaoGoods != null) {
|
| | | cog = CommonOrderGoodsFactory.create(taoBaoGoods);
|
| | | }
|
| | | cog.setCreateTime(new Date());
|
| | | cog.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(cog);
|
| | | }
|
| | | newCommonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrderList.add(addCommonOrder(newCommonOrder));
|
| | | }
|
| | | return commonOrderList;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public List<CommonOrder> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | // 判断所有的订单状态
|
| | | int invalidCount = 0;
|
| | | for (PDDOrder order : pddOrderList) {
|
| | | if (order.getOrderStatus() == -1 || order.getOrderStatus() == 4 || order.getOrderStatus() == 8) {
|
| | | invalidCount++;
|
| | | }
|
| | | }
|
| | | // 获取整体订单的状态
|
| | | int wholeOrderState = 0;
|
| | | if (pddOrderList.size() == invalidCount)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_SHIXIAO;
|
| | | else if (invalidCount == 0)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_YOUXIAO;
|
| | | else
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
|
| | |
|
| | | for (PDDOrder pddOrder : pddOrderList) {
|
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(pddOrder);
|
| | | CommonOrderGoods cog = new CommonOrderGoods();
|
| | | cog.setGoodsId(pddOrder.getGoodsId() + "");
|
| | | cog.setGoodsType(Constant.SOURCE_TYPE_PDD);
|
| | | newCommonOrder.setCommonOrderGoods(cog);
|
| | | newCommonOrder.setStateWholeOrder(wholeOrderState);
|
| | | // 订单商品插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(),
|
| | | cog.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | PDDGoodsDetail pddGoods = null;
|
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(cog.getGoodsId()));
|
| | | if (pddGoods != null) {
|
| | | cog = CommonOrderGoodsFactory.create(pddGoods);
|
| | | }
|
| | | cog.setCreateTime(new Date());
|
| | | cog.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(cog);
|
| | | newCommonOrder.setCommonOrderGoods(cog);
|
| | | }
|
| | | newCommonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrderList.add(addCommonOrder(newCommonOrder));
|
| | | }
|
| | | return commonOrderList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException {
|
| | | List<CommonOrder> commonOrderList = new ArrayList<>();
|
| | | // 判断所有的订单状态
|
| | | int invalidCount = 0;
|
| | | for (JDOrderItem tb : jdOrder.getOrderItemList()) {
|
| | | if (tb.getValidCode() < 16) {
|
| | | invalidCount++;
|
| | | }
|
| | | }
|
| | |
|
| | | // 获取整体订单的状态
|
| | | int wholeOrderState = 0;
|
| | | if (jdOrder.getOrderItemList().size() == invalidCount)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_SHIXIAO;
|
| | | else if (invalidCount == 0)
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_YOUXIAO;
|
| | | else
|
| | | wholeOrderState = CommonOrder.STATE_WHOLE_ORDER_BUFENYOUXIAO;
|
| | |
|
| | | List<JDOrderItem> orderItemList = jdOrder.getOrderItemList();
|
| | | jdOrder.setOrderItemList(null);
|
| | |
|
| | | for (JDOrderItem itemOrder : orderItemList) {
|
| | | itemOrder.setOrder(jdOrder);
|
| | | CommonOrder newCommonOrder = CommonOrderFactory.create(itemOrder);
|
| | | CommonOrderGoods cog = new CommonOrderGoods();
|
| | | cog.setGoodsId(itemOrder.getSkuId() + "");
|
| | | cog.setGoodsType(Constant.SOURCE_TYPE_JD);
|
| | | newCommonOrder.setCommonOrderGoods(cog);
|
| | | newCommonOrder.setStateWholeOrder(wholeOrderState);
|
| | | // 订单商品插入
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper.listByGoodsIdAndGoodsType(cog.getGoodsId(),
|
| | | cog.getGoodsType());
|
| | | if (commonGoodsList.size() <= 0)// 不存在就插入商品
|
| | | {
|
| | | JDGoods goods = JDApiUtil.getGoodsDetail(itemOrder.getSkuId());
|
| | |
|
| | | if (goods != null) {
|
| | | cog = CommonOrderGoodsFactory.create(goods);
|
| | | }
|
| | | cog.setCreateTime(new Date());
|
| | | cog.setUpdateTime(new Date());
|
| | | commonOrderGoodsMapper.insertSelective(cog);
|
| | | }
|
| | | newCommonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrderList.add(addCommonOrder(newCommonOrder));
|
| | | }
|
| | | return commonOrderList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加订单
|
| | | * |
| | | * @param commonOrder
|
| | | */
|
| | | @Transactional
|
| | | private CommonOrder addCommonOrder(CommonOrder commonOrder) throws CommonOrderException {
|
| | | // 判断商品是否存在
|
| | | if (commonOrder == null)
|
| | | throw new CommonOrderException(1, "订单为空");
|
| | | if (commonOrder.getUserInfo() == null)
|
| | | throw new CommonOrderException(2, "订单用户为空");
|
| | |
|
| | | if (commonOrder.getCommonOrderGoods() == null || commonOrder.getCommonOrderGoods().getGoodsId() == null
|
| | | || commonOrder.getCommonOrderGoods().getGoodsType() == null)
|
| | | throw new CommonOrderException(3, "订单商品为空");
|
| | | // 不存在就插入,存在就不管
|
| | | CommonOrderGoods goods = commonOrder.getCommonOrderGoods();
|
| | |
|
| | | // 之前不存在于数据库
|
| | | if (commonOrder.getCommonOrderGoods().getId() == null) {
|
| | | List<CommonOrderGoods> commonGoodsList = commonOrderGoodsMapper
|
| | | .listByGoodsIdAndGoodsType(goods.getGoodsId(), goods.getGoodsType());
|
| | |
|
| | | if (commonGoodsList == null || commonGoodsList.size() < 1) {// 不存在
|
| | | commonOrderGoodsMapper.insertSelective(goods);
|
| | | } else {// 存在
|
| | | goods = commonGoodsList.get(0);
|
| | | }
|
| | | if (goods.getId() == null)
|
| | | throw new CommonOrderException(4, "商品插入失败");
|
| | | commonOrder.setCommonOrderGoods(goods);
|
| | | }
|
| | |
|
| | | CommonOrder oldCommonOrder = commonOrderMapper.selectByOrderNoAndOrderTypeAndOrderBy(commonOrder.getOrderNo(),
|
| | | commonOrder.getSourceType(), commonOrder.getOrderBy());
|
| | |
|
| | | if (oldCommonOrder == null)// 新增
|
| | | {
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | | // 插入映射,保证交易ID的完整性
|
| | | commonOrderTradeIdMapMapper.insertSelective(new CommonOrderTradeIdMap(commonOrder.getId(),
|
| | | commonOrder.getTradeId(), new Date(), commonOrder.getSourceType()));
|
| | | return commonOrder;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | | if (oldCommonOrder.getState() == CommonOrder.STATE_JS || oldCommonOrder.getState() == CommonOrder.STATE_SX) {
|
| | | return oldCommonOrder;
|
| | | }
|
| | | // 交易ID一致才修改
|
| | | if (commonOrder.getTradeId() != null
|
| | | && commonOrder.getTradeId().equalsIgnoreCase(oldCommonOrder.getTradeId())) {
|
| | | CommonOrder updateCommonOrder = new CommonOrder(oldCommonOrder.getId());
|
| | | updateCommonOrder.seteIncome(commonOrder.geteIncome());
|
| | | updateCommonOrder.setEstimate(commonOrder.getEstimate());
|
| | | updateCommonOrder.setPayment(commonOrder.getPayment());
|
| | | updateCommonOrder.setSettlement(commonOrder.getSettlement());
|
| | | updateCommonOrder.setSettleTime(commonOrder.getSettleTime());
|
| | | updateCommonOrder.setState(commonOrder.getState());
|
| | | updateCommonOrder.setStateWholeOrder(commonOrder.getStateWholeOrder());
|
| | | updateCommonOrder.setUpdateTime(new Date());
|
| | | updateCommonOrder.setTradeId(commonOrder.getTradeId());
|
| | | commonOrderMapper.updateByPrimaryKeySelective(updateCommonOrder);
|
| | | return commonOrderMapper.selectByPrimaryKey(updateCommonOrder.getId());
|
| | | } else
|
| | | return oldCommonOrder;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | return commonOrderMapper.selectBySourceTypeAndTradeId(sourceType, tradeId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | LogHelper.error("返利失败:" + hb1.getId());
|
| | | return;
|
| | | }
|
| | | // 维权中的不返利
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "维权创建");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "等待处理");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | | if (hongBaoOrder.getCommonOrder() != null
|
| | | && hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | // 维权中的不返利
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "维权创建");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "等待处理");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | | }
|
| | |
|
| | | // 查询同一订单号的红包
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(
|
| | |
| | | if (hongBaoOrder.getCommonOrder().getSettleTime() != null && hongBaoOrder.getCommonOrder().getSettleTime()
|
| | | .getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | try {
|
| | |
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | |
|
| | | if (hongBaoOrder.getCommonOrder().getSourceType() == Constant.SOURCE_TYPE_TAOBAO)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | if (e.getCode() == TaoBaoWeiQuanException.CODE_NEDD_UPDATE_ORDER) {
|
| | | List<TaoBaoOrder> olist = taoBaoOrderService
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Override
|
| | | public int countHongBaoOrderCount50MoreByUid(Long uid) {
|
| | | return hongBaoOrderMapper.countHongBaoOrderCountMoreByUid(new BigDecimal(50), uid);
|
| | | public int countOrderCount100MoreByUidAndMinTime(Long uid, Date minTime) {
|
| | | return hongBaoOrderMapper.countOrderCountMoneyMoreByUidAndMinTime(uid, minTime, new BigDecimal(100));
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int countWeiQuanOrderByUid(Long uid) {
|
| | | return hongBaoOrderMapper.countWeiQuanOrderByUid(uid);
|
| | | public int countWeiQuanOrderByUid(Long uid, Date minTime) {
|
| | | return hongBaoOrderMapper.countWeiQuanOrderByUid(uid, minTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(Long uid) {
|
| | | BigDecimal money = hongBaoOrderMapper.sumWeiQuanOrderFanAmountByUid(uid);
|
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(Long uid,Date minTime) {
|
| | | BigDecimal money = hongBaoOrderMapper.sumWeiQuanOrderFanAmountByUid(uid,minTime);
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int countSafeOrderByUid(Long uid) {
|
| | | return hongBaoOrderMapper.countSafeOrderByUid(uid);
|
| | | public int countWeiQuanOrderWithMinCommision(Long uid, BigDecimal minMoney, Date minTime) {
|
| | | return hongBaoOrderMapper.countWeiQuanOrderWithMinCommision(uid, minMoney, minTime);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.pdd;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.pdd.PDDOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.pdd.PDDOrderProcessService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
|
| | | @Service
|
| | | public class PDDOrderProcessServiceImpl implements PDDOrderProcessService {
|
| | |
|
| | | @Resource
|
| | | private PDDOrderMapper pddOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Override
|
| | | public void handleOrder(PDDOrder pddOrder) throws PDDOrderException {
|
| | | // 区分分享与返利
|
| | | if (pddOrder.getpId().equalsIgnoreCase(PinDuoDuoApiUtil.PID_FANLI)) {
|
| | | handleFanLiOrder(pddOrder);
|
| | | } else if (pddOrder.getpId().equalsIgnoreCase(PinDuoDuoApiUtil.PID_SHARE)) {
|
| | | handleShareOrder(pddOrder);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleFanLiOrder(PDDOrder pddOrder) {
|
| | | if (pddOrder != null) {
|
| | | Order oldOrder = orderService.findOrderByOrderIdAndType(pddOrder.getOrderSn(), Constant.SOURCE_TYPE_PDD);
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | | if (oldOrder == null) {
|
| | | if (!StringUtil.isNullOrEmpty(pddOrder.getCustomParameters())) {
|
| | | uid = Long.parseLong(pddOrder.getCustomParameters());
|
| | | Order order = new Order();
|
| | | order.setBeizhu("PID返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(pddOrder.getOrderSn());
|
| | | order.setOrderType(Order.ORDER_TYPE_PDD);
|
| | | order.setState(Order.STATE_YIZHIFU);
|
| | | order.setUserInfo(new UserInfo(uid));
|
| | | order.setVersion(2);
|
| | | // 加入到订单表
|
| | | orderMapper.insertSelective(order);
|
| | | oldOrder = order;
|
| | | }
|
| | | } else {
|
| | | uid = oldOrder.getUserInfo().getId();
|
| | | }
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 计算订单总额度
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | money = money.add(MoneyBigDecimalUtil.div(new BigDecimal(pddOrder.getOrderAmount()), new BigDecimal(100)));
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = pddOrder.getOrderStatus() + "";
|
| | | updateOrder.setThirdState(thirdState);
|
| | | updateOrder.setThirdCreateTime(new Date(pddOrder.getOrderCreateTime() * 1000));
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | List<PDDOrder> pddOrderList = new ArrayList<>();
|
| | | pddOrderList.add(pddOrder);
|
| | | commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_ZIGOU);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void handleShareOrder(PDDOrder pddOrder) {
|
| | | if (pddOrder != null) {
|
| | | // 原来不存在订单
|
| | | Long uid = null;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(pddOrder.getCustomParameters()))
|
| | | uid = Long.parseLong(pddOrder.getCustomParameters());
|
| | |
|
| | | // 尚未找到和PID对应的用户
|
| | | if (uid == null)
|
| | | return;
|
| | |
|
| | | // 用第一个子订单锁定用户
|
| | | List<CommonOrder> commonOrderList = null;
|
| | | try {
|
| | | List<PDDOrder> pddOrderList = new ArrayList<>();
|
| | | pddOrderList.add(pddOrder);
|
| | | commonOrderList = commonOrderService.addPDDOrder(pddOrderList, uid);
|
| | | hongBaoV2Service.addHongBao(commonOrderList, HongBaoV2.TYPE_SHARE_GOODS);
|
| | | } catch (CommonOrderException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | } catch (HongBaoException e) {
|
| | | LogHelper.errorDetailInfo(e, "addTaoBaoOrder或addHongBao出错", "订单号:" + pddOrder.getOrderSn());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | DeviceTokenHW deviceTokenHW = new DeviceTokenHW();
|
| | | deviceTokenHW.setDevice(device);
|
| | | deviceTokenHW.setDeviceToken(token);
|
| | | deviceTokenHW.setDeviceTokenMd5(StringUtil.Md5(token));
|
| | | deviceTokenHW.setUpdateTime(new Date());
|
| | | if (uid != null)
|
| | | deviceTokenHW.setUser(new UserInfo(uid));
|
| | |
| | | for (DeviceTokenHW deviceTokenHW : list) {
|
| | | DeviceTokenHW update = new DeviceTokenHW();
|
| | | update.setId(deviceTokenHW.getId());
|
| | | if (!StringUtil.isNullOrEmpty(token))
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | update.setDeviceToken(token);
|
| | | update.setDeviceTokenMd5(StringUtil.Md5(token));
|
| | | }
|
| | | update.setUpdateTime(new Date());
|
| | | if (uid != null)
|
| | | update.setUser(new UserInfo(uid));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void bindUid(String device, Long uid) {
|
| | | deviceTokenHWMapper.bindUidByDevice(uid, device);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | if (drawBackMoney.compareTo(userGetMoney) > 0)
|
| | | drawBackMoney = userGetMoney;// 退款金额不能比获得的金额大
|
| | | // 计算资金是否充足
|
| | | UserInfo user = userInfoMapper.selectByPKey(uid);
|
| | | if (user != null && user.getMyHongBao().compareTo(drawBackMoney) < 0)// 资金不足
|
| | |
| | | return taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(orderId, "维权成功");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanOrder listByorderItemId(String tradeId) {
|
| | | return taoBaoWeiQuanOrderMapper.selectByOrderItemId(tradeId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | auditRecord.setBeforeMoney(user.getMyHongBao());
|
| | | auditRecord.setExtract(extract);
|
| | |
|
| | | Date minTime = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 180L);
|
| | | // 统计数据
|
| | | int orderCount50More = orderUserStatisticService.countHongBaoOrderCount50MoreByUid(user.getId());
|
| | | BigDecimal weiQuanOrderFanAmount = orderUserStatisticService.sumWeiQuanOrderFanAmountByUid(user.getId());
|
| | | int weiQuanOrderCount = orderUserStatisticService.countWeiQuanOrderByUid(user.getId());
|
| | | int safeOrderCount = orderUserStatisticService.countSafeOrderByUid(user.getId());
|
| | | auditRecord.setExtraInfoStr(new Gson().toJson(new ExtractOrderStatisticDTO(orderCount50More, weiQuanOrderCount,
|
| | | weiQuanOrderFanAmount, safeOrderCount)));
|
| | | int orderCount50More = orderUserStatisticService.countOrderCount100MoreByUidAndMinTime(user.getId(), minTime);
|
| | |
|
| | | BigDecimal weiQuanOrderFanAmount = orderUserStatisticService.sumWeiQuanOrderFanAmountByUid(user.getId(),
|
| | | minTime);
|
| | | int weiQuanOrderCount = orderUserStatisticService.countWeiQuanOrderByUid(user.getId(), minTime);
|
| | | auditRecord.setExtraInfoStr(new Gson()
|
| | | .toJson(new ExtractOrderStatisticDTO(orderCount50More, weiQuanOrderCount, weiQuanOrderFanAmount, 0)));
|
| | | extractAuditRecordMapper.insertSelective(auditRecord);
|
| | |
|
| | | // 新版资金详情
|
| | |
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserMoneyDetail selectByTypeAndUidAndIdentifyCode(UserMoneyDetailTypeEnum type, Long uid,
|
| | | Long sourceIdentifyId) {
|
| | | return userMoneyDetailMapper.selectByTypeAndUidAndIdentifyCode(type, uid, sourceIdentifyId);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.jd;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | |
|
| | | public interface JDOrderProcessService {
|
| | | /**
|
| | | * 处理拼多多订单
|
| | | * |
| | | * @param pddOrder
|
| | | * @throws PDDOrderException
|
| | | */
|
| | | public void handleOrder(JDOrder jdOrder) throws PDDOrderException;
|
| | |
|
| | | /**
|
| | | * 处理返利订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleFanLiOrder(JDOrder jdOrder);
|
| | |
|
| | | /**
|
| | | * 处理分享订单
|
| | | * |
| | | * @param pddOrderO
|
| | | */
|
| | | public void handleShareOrder(JDOrder jdOrder);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.jd;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.exception.jd.JDOrderException;
|
| | |
|
| | | public interface JDOrderService {
|
| | |
|
| | | public void addJDOrder(JDOrder order) throws JDOrderException;
|
| | |
|
| | | }
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
| | | public List<CommonOrder> listBySourceTypeAndOrderId(int sourceType, String orderId);
|
| | |
|
| | | /**
|
| | | * 缓存普通订单
|
| | | * 缓存淘宝类普通订单
|
| | | *
|
| | | * @param taoBaoOrder
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrder> addTaoBaoOrder(List<TaoBaoOrder> taoBaoOrder, Long uid) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 缓存拼多多类普通订单
|
| | | * |
| | | * @param pddOrderList
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrder> addPDDOrder(List<PDDOrder> pddOrderList, Long uid) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 缓存京东普通订单
|
| | | * |
| | | * @param jdOrderList
|
| | | * @param uid
|
| | | * @return
|
| | | * @throws CommonOrderException
|
| | | */
|
| | | public List<CommonOrder> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException;
|
| | |
|
| | | /**
|
| | | * 根据用户ID,订单状态,结算时间统计订单数量
|
| | | *
|
| | | * @param uid
|
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | /**
|
| | | * 用户订单统计服务
|
| | |
| | | */
|
| | | public interface OrderUserStatisticService {
|
| | | /**
|
| | | * 返利超过超过50元的订单数量
|
| | | * 订单佣金大于100的数量(大于某个最小时间)
|
| | | *
|
| | | * @param uid
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | public int countHongBaoOrderCount50MoreByUid(Long uid);
|
| | | public int countOrderCount100MoreByUidAndMinTime(Long uid, Date minTime);
|
| | |
|
| | | /**
|
| | | * 维权订单数量(包含邀请赚)
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public int countWeiQuanOrderByUid(Long uid);
|
| | | public int countWeiQuanOrderByUid(Long uid, Date minTime);
|
| | |
|
| | | /**
|
| | | * 维权订单返还的金额
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(Long uid);
|
| | | public BigDecimal sumWeiQuanOrderFanAmountByUid(Long uid,Date minTime);
|
| | |
|
| | | /**
|
| | | * 安全订单数量
|
| | | * |
| | | * 维权订单数量
|
| | | * @param uid
|
| | | * @param minMoney
|
| | | * @param minTime
|
| | | * @return
|
| | | */
|
| | | public int countSafeOrderByUid(Long uid);
|
| | | public int countWeiQuanOrderWithMinCommision(Long uid, BigDecimal minMoney, Date minTime);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.pdd;
|
| | |
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.exception.pdd.PDDOrderException;
|
| | |
|
| | | public interface PDDOrderProcessService {
|
| | | /**
|
| | | * 处理拼多多订单
|
| | | * |
| | | * @param pddOrder
|
| | | * @throws PDDOrderException
|
| | | */
|
| | | public void handleOrder(PDDOrder pddOrder) throws PDDOrderException;
|
| | |
|
| | | /**
|
| | | * 处理返利订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleFanLiOrder(PDDOrder pddOrder);
|
| | |
|
| | | /**
|
| | | * 处理分享订单
|
| | | * |
| | | * @param pddOrder
|
| | | */
|
| | | public void handleShareOrder(PDDOrder pddOrder);
|
| | | }
|
| | |
| | | */
|
| | | void unBindDeviceToken(String device);
|
| | |
|
| | | /**
|
| | | * 将用户ID绑定到设备上
|
| | | * |
| | | * @param device
|
| | | * @param uid
|
| | | */
|
| | | void bindUid(String device, Long uid);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<TaoBaoWeiQuanOrder> getWeiQuanSuccessOrders(String orderId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据交易ID查询维权状态
|
| | | * @param tradeId
|
| | | * @return
|
| | | */
|
| | | public TaoBaoWeiQuanOrder listByorderItemId(String tradeId);
|
| | |
|
| | | }
|
| | |
| | | public BigDecimal statisticUserTypeMoneyWithDate(Long uid, List<UserMoneyDetailTypeEnum> typeList, Date minDate,
|
| | | Date maxDate);
|
| | |
|
| | | /**
|
| | | * 根据类型,用户ID与唯一标识符查询
|
| | | * |
| | | * @param type
|
| | | * @param uid
|
| | | * @param sourceIdentifyId
|
| | | * @return
|
| | | */
|
| | | public UserMoneyDetail selectByTypeAndUidAndIdentifyCode(UserMoneyDetailTypeEnum type, Long uid,
|
| | | Long sourceIdentifyId);
|
| | |
|
| | | }
|
| | |
| | | import java.lang.reflect.Method;
|
| | | import java.security.MessageDigest;
|
| | | import java.security.NoSuchAlgorithmException;
|
| | | import java.util.List;
|
| | | import java.util.regex.Matcher;
|
| | | import java.util.regex.Pattern;
|
| | |
|
| | |
| | | // 是否为电话号码
|
| | | public static boolean isMobile(String mobile) {
|
| | |
|
| | | String regex = "^((13[0-9])|(17[0-9])|(15[^4,\\D])|(18[0-9])|(19[0-9])|(16[0-9]))\\d{8}$";
|
| | | String regex = "^((13[0-9])|(14[0-9])|(17[0-9])|(15[^4,\\D])|(18[0-9])|(19[0-9])|(16[0-9]))\\d{8}$";
|
| | | Pattern p = Pattern.compile(regex);
|
| | | Matcher m = p.matcher(mobile);
|
| | |
|
| | |
| | | }
|
| | | return code;
|
| | | }
|
| | | |
| | |
|
| | | public static String getVerifyCode(int count) {
|
| | | String sts = "0123456789";
|
| | | String code = "";
|
| | |
| | | }
|
| | | return code;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // ��ȡ���ŷ��͵ĸ�ʽ
|
| | | public static String getMessageStyle(String code) {
|
| | |
| | | }
|
| | |
|
| | | public static boolean isJson(String content) {
|
| | | try {
|
| | | JSONObject.fromObject(content);
|
| | | return true;
|
| | | } catch (Exception e) {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | try {
|
| | | JSONObject.fromObject(content);
|
| | | return true;
|
| | | } catch (Exception e) {
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
|
| | | public static String concat(List list, String sperator) {
|
| | | if (list == null)
|
| | | return null;
|
| | | String str = "";
|
| | | for (Object obj : list) {
|
| | | str += obj + sperator;
|
| | | }
|
| | | if (str.endsWith(sperator))
|
| | | str = str.substring(0, str.length() - sperator.length());
|
| | | return str;
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.dataoke;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | |
| | | import java.util.Set;
|
| | | import java.util.TreeMap;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.HttpException;
|
| | | import org.apache.commons.httpclient.methods.GetMethod;
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.jsoup.nodes.Element;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | |
|
| | | static Gson gson = new Gson();
|
| | |
|
| | | private static String get(String url) {
|
| | | HttpClient client = new HttpClient();
|
| | | try {
|
| | | client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
|
| | | client.getHttpConnectionManager().getParams().setSoTimeout(5000);
|
| | | GetMethod method = new GetMethod(url);
|
| | | client.executeMethod(method);
|
| | | return method.getResponseBodyAsString();
|
| | | } catch (HttpException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return "";
|
| | | }
|
| | |
|
| | | private static String request(String url) {
|
| | | String result = null;
|
| | |
|
| | | while (result == null) {
|
| | | try {
|
| | | result = HttpUtil.get(url);
|
| | | if (result != null && result.startsWith("<html>"))
|
| | | result = get(url);
|
| | | if ((result != null && result.startsWith("<html>")) || StringUtil.isNullOrEmpty(result))
|
| | | result = null;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | public class CommonGoodsFactory {
|
| | |
|
| | |
| | | return cg;
|
| | | }
|
| | |
|
| | | public static CommonGoods create(PDDGoodsDetail goods) {
|
| | | if (goods == null)
|
| | | return null;
|
| | |
|
| | | CommonGoods cg = new CommonGoods();
|
| | |
|
| | | if (goods.getCouponRemainQuantity() != null)
|
| | | cg.setCouponLeftCount(Integer.parseInt(goods.getCouponRemainQuantity() + ""));
|
| | | else
|
| | | cg.setCouponLeftCount(0);
|
| | | if (goods.getCouponMinOrderAmount() != null)
|
| | | cg.setCouponStartPrice(
|
| | | MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponMinOrderAmount()), new BigDecimal(100)));
|
| | | else
|
| | | cg.setCouponStartPrice(new BigDecimal(0));
|
| | |
|
| | | if (goods.getCouponDiscount() != null && goods.getCouponDiscount() > 0) {
|
| | | cg.setCouponAmount(MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), new BigDecimal(100)));
|
| | | if (cg.getCouponStartPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | cg.setCouponInfo(String.format("满%s元减%s元", cg.getCouponStartPrice() + "", cg.getCouponAmount() + ""));
|
| | | else
|
| | | cg.setCouponInfo(String.format("%s元无条件券", cg.getCouponAmount() + ""));
|
| | | } else {
|
| | | cg.setCouponAmount(new BigDecimal(0));
|
| | | }
|
| | |
|
| | | cg.setCouponTotalCount(Integer.parseInt(goods.getCouponTotalQuantity() + ""));
|
| | | cg.setGoodsId(goods.getGoodsId());
|
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_PDD);
|
| | | cg.setPicture(goods.getGoodsThumbnailUrl());
|
| | | cg.setPictureWhite(null);
|
| | | cg.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinNormalPrice()), new BigDecimal(100)));
|
| | | cg.setSales(Integer.parseInt(goods.getSoldQuantity() + ""));
|
| | | cg.setRate(MoneyBigDecimalUtil.div(new BigDecimal(goods.getPromotionRate()), new BigDecimal(10)));
|
| | | cg.setSellerId(goods.getMallId());
|
| | | cg.setSellerName(goods.getMallName());
|
| | | cg.setShopType(goods.getMerchantType());
|
| | | cg.setState(CommonGoods.STATE_NORMAL);
|
| | | cg.setTitle(goods.getGoodsName());
|
| | | // 保留字段
|
| | | cg.setVideoCover(null);
|
| | | cg.setVideoUrl(null);
|
| | | cg.setState(goods.getState());
|
| | | cg.setMaterialLibType(1);
|
| | | return cg;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | public class CommonOrderGoodsFactory {
|
| | |
|
| | |
| | | return orderGoods;
|
| | | }
|
| | |
|
| | | public static CommonOrderGoods create(PDDGoodsDetail detail) {
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(detail.getGoodsId() + "");
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_PDD);
|
| | | goods.setPicture(detail.getGoodsImageUrl());
|
| | | goods.setPrice(MoneyBigDecimalUtil.div(new BigDecimal(detail.getMinNormalPrice()), new BigDecimal(100)));
|
| | | goods.setShopId(detail.getMallId());
|
| | | goods.setShopName(detail.getMallName());
|
| | | goods.setShopType(detail.getMerchantType() + "");
|
| | | goods.setState(0);
|
| | | goods.setTitle(detail.getGoodsName());
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static CommonOrderGoods create(JDGoods jdGoods) {
|
| | | CommonOrderGoods goods = new CommonOrderGoods();
|
| | | goods.setGoodsId(jdGoods.getSkuId() + "");
|
| | | goods.setCreateTime(new Date());
|
| | | goods.setGoodsType(Constant.SOURCE_TYPE_JD);
|
| | | if (jdGoods.getImageList() != null && jdGoods.getImageList().size() > 0)
|
| | | goods.setPicture(jdGoods.getImageList().get(0));
|
| | | goods.setPrice(jdGoods.getPrice());
|
| | | goods.setShopId((long) jdGoods.getShopInfo().getShopId());
|
| | | goods.setShopName(jdGoods.getShopInfo().getShopName());
|
| | | goods.setShopType(jdGoods.getOwner());
|
| | | goods.setState(0);
|
| | | goods.setTitle(jdGoods.getSkuName());
|
| | | return goods;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.factory.goods;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | public class CommonOrderFactory {
|
| | |
|
| | | public static CommonOrder create(PDDOrder order) {
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(order.getGoodsQuantity());
|
| | | commonOrder.setCreateTime(new Date());
|
| | | if (order.getOrderStatus() == 3) {
|
| | | commonOrder.seteIncome(
|
| | | MoneyBigDecimalUtil.div(new BigDecimal(order.getPromotionAmount()), new BigDecimal(100)));
|
| | | commonOrder.setSettlement(
|
| | | MoneyBigDecimalUtil.div(new BigDecimal(order.getOrderAmount()), new BigDecimal(100)));// 结算金额
|
| | | commonOrder.setSettleTime(new Date(order.getOrderVerifyTime() * 1000));
|
| | | } else {
|
| | | commonOrder.seteIncome(new BigDecimal(0));
|
| | | commonOrder.setSettlement(new BigDecimal(0));
|
| | | }
|
| | | commonOrder
|
| | | .setEstimate(MoneyBigDecimalUtil.div(new BigDecimal(order.getPromotionAmount()), new BigDecimal(100)));
|
| | | commonOrder.setOrderNo(order.getOrderSn());
|
| | | commonOrder.setPayment(MoneyBigDecimalUtil.div(new BigDecimal(order.getOrderAmount()), new BigDecimal(100)));
|
| | | commonOrder.setSourcePosition(order.getpId());
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_PDD);
|
| | | int state = 0;
|
| | |
|
| | | if (-1 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | } else if (0 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if (1 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if (2 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if (3 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if (4 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_WQ;
|
| | | } else if (5 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_JS;
|
| | | } else if (8 == order.getOrderStatus()) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | }
|
| | | commonOrder.setOrderBy(1);
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(new Date(order.getOrderCreateTime() * 1000));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(order.getOrderId());
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | public static CommonOrder create(JDOrderItem order) {
|
| | | if (order.getOrder() == null)
|
| | | return null;
|
| | | CommonOrder commonOrder = new CommonOrder();
|
| | | commonOrder.setCount(Integer.parseInt(order.getSkuNum() + ""));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | if (order.getValidCode() == 17) {
|
| | | commonOrder.seteIncome(order.getActualFee());
|
| | | commonOrder.setSettlement(order.getActualCosPrice());
|
| | | commonOrder.setSettleTime(new Date(order.getOrder().getFinishTime()));
|
| | | } else {
|
| | | commonOrder.seteIncome(order.getActualFee());
|
| | | commonOrder.setSettlement(order.getActualCosPrice());
|
| | | }
|
| | | commonOrder.setOrderNo(order.getOrderId() + "");
|
| | | commonOrder.setPayment(order.getEstimateCosPrice());
|
| | | commonOrder.setSourcePosition(order.getPositionId() + "");
|
| | | commonOrder.setSourceType(Constant.SOURCE_TYPE_JD);
|
| | | int state = 0;
|
| | | if (order.getValidCode() < 16) {
|
| | | state = CommonOrder.STATE_SX;
|
| | | } else if (order.getValidCode() == 16) {
|
| | | state = CommonOrder.STATE_FK;
|
| | | } else if (order.getValidCode() == 17) {
|
| | | state = CommonOrder.STATE_JS;
|
| | | }
|
| | | commonOrder.setOrderBy(order.getOrderBy());
|
| | | commonOrder.setState(state);
|
| | | commonOrder.setThirdCreateTime(new Date(order.getOrder().getOrderTime()));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(order.getTradeId());
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.jd;
|
| | |
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.lang.reflect.Type;
|
| | | 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.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.dto.jd.JDOrderResult;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class JDApiUtil {
|
| | | public static String APP_ID = "1774659094";
|
| | | public static String APP_KEY = "7ba8e06b7d6fde3d6bd5db4b0026ecd7";
|
| | | public static String SECRET_KEY = "fb49bc6ecac5458ba5394fc2969d7c56";
|
| | | private static String SERVER_URL = "https://router.jd.com/api";
|
| | |
|
| | | public static Long POSITION_FANLI = 1834339426L;
|
| | | public static Long POSITION_SHARE = 1834289924L;
|
| | |
|
| | | // 订单查询类型
|
| | | public static int ORDER_TYPE_CREATETIME = 1;// 下单时间
|
| | | public static int ORDER_TYPE_FINISHTIME = 2;// 完成时间
|
| | | public static int ORDER_TYPE_UPDATETIME = 3;// 更新时间
|
| | |
|
| | | private static String post(String url, Map<String, String> params) {
|
| | | String baseUrl = url;
|
| | | List<String> paramsList = new ArrayList<>();
|
| | | if (params != null)
|
| | | for (Iterator<String> its = params.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | try {
|
| | | paramsList.add(key + "=" + URLEncoder.encode(params.get(key), "UTF-8"));
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | baseUrl += "?" + StringUtil.concat(paramsList, "&");
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod pm = new PostMethod(baseUrl);
|
| | | try {
|
| | | client.executeMethod(pm);
|
| | | String result = pm.getResponseBodyAsString();
|
| | | return new String(result.getBytes("ISO-8859-1"), "UTF-8");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static String getSign(Map<String, String> params) {
|
| | | List<String> list = new ArrayList<>();
|
| | | Iterator<String> its = params.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String key = its.next();
|
| | | list.add(key + params.get(key));
|
| | | }
|
| | | String str = "";
|
| | | Collections.sort(list);
|
| | | for (String st : list) {
|
| | | str += st;
|
| | | }
|
| | | return StringUtil.Md5(SECRET_KEY + str + SECRET_KEY).toUpperCase();
|
| | | }
|
| | |
|
| | | private static String baseRequest(String method, String accessToken, JSONObject params) {
|
| | | Map<String, String> baseMap = new HashMap<String, String>();
|
| | | baseMap.put("param_json", params.toString());
|
| | | baseMap.put("app_key", APP_KEY);
|
| | | baseMap.put("method", method);
|
| | | if (accessToken != null)
|
| | | baseMap.put("access_token", accessToken);
|
| | | baseMap.put("timestamp", TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
|
| | | baseMap.put("format", "json");
|
| | | baseMap.put("v", "1.0");
|
| | | baseMap.put("sign_method", "md5");
|
| | | baseMap.put("sign", getSign(baseMap));
|
| | | String result = post(SERVER_URL, baseMap);
|
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 转链
|
| | | * |
| | | * @return
|
| | | */
|
| | | public static String convertLink(String materialId, String couponUrl, String pid) {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | | json.put("siteId", APP_ID);
|
| | | if (couponUrl != null)
|
| | | json.put("couponUrl", couponUrl);
|
| | | // json.put("ext1", "437032_12");
|
| | | json.put("pid", pid);
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("promotionCodeReq", json);
|
| | |
|
| | | String result = baseRequest("jd.union.open.promotion.common.get", null, json);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | result = resultJson.optJSONObject("jd_union_open_promotion_common_get_response").optString("result");
|
| | | resultJson = JSONObject.fromObject(result);
|
| | | return resultJson.optJSONObject("data").optString("clickURL");
|
| | | }
|
| | |
|
| | | public static List<JDGoods> getGoodsDetail(List<Long> skuIdList) {
|
| | | List<JDGoods> list = new ArrayList<>();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("skuIds", StringUtil.concat(skuIdList, ","));
|
| | | String result = baseRequest("jd.union.open.goods.promotiongoodsinfo.query", null, json);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | resultJson = resultJson.optJSONObject("jd_union_open_goods_promotiongoodsinfo_query_response");
|
| | | if (resultJson.optInt("code") == 0) {
|
| | | result = resultJson.optString("result");
|
| | | resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("data");
|
| | | if (array != null)
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | JDGoods goods = parseJDGoods(array.optJSONObject(i));
|
| | | if (goods != null)
|
| | | list.add(goods);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | private static JDGoods parseJDGoods(JSONObject json) {
|
| | | JDGoods goods = new JDGoods();
|
| | | // goods.setBrandCode(brandCode);
|
| | | // goods.setBrandName(brandName);
|
| | | // goods.setCategoryInfo(categoryInfo);
|
| | | // goods.setComments(comments);
|
| | | // goods.setCommissionInfo(commissionInfo);
|
| | | // goods.setCouponInfo(couponInfo);
|
| | | // goods.setGoodCommentsShare(goodCommentsShare);
|
| | | // goods.setImageList(imageList);
|
| | | // goods.setInOrderCount30Days(inOrderCount30Days);
|
| | | // goods.setIsHot(isHot);
|
| | | // goods.setMaterialUrl(materialUrl);
|
| | | // goods.setOwner(owner);
|
| | | // goods.setPinGouInfo(pinGouInfo);
|
| | | // goods.setPrice(price);
|
| | | // goods.setShopInfo(shopInfo);
|
| | | // goods.setSkuId(skuId);
|
| | | // goods.setSkuName(skuName);
|
| | | // goods.setSpuid(spuid);
|
| | | // goods.setTotalCount(totalCount);
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static JDGoods getGoodsDetail(Long skuId) {
|
| | | List<Long> skuIdList = new ArrayList<>();
|
| | | skuIdList.add(skuId);
|
| | | List<JDGoods> list = getGoodsDetail(skuIdList);
|
| | | if (list != null && list.size() > 0)
|
| | | return list.get(0);
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static JDOrderResult getOrder(int page, int pageSize, String time, int type) {
|
| | | JSONObject json = new JSONObject();
|
| | | JSONObject orderReq = new JSONObject();
|
| | | orderReq.put("pageNo", page);
|
| | | orderReq.put("pageSize", pageSize);
|
| | | orderReq.put("type", type);
|
| | | orderReq.put("time", time);
|
| | |
|
| | | json.put("orderReq", orderReq);
|
| | | String result = baseRequest("jd.union.open.order.query", null, json);
|
| | | JSONObject root = JSONObject.fromObject(result).optJSONObject("jd_union_open_order_query_response");
|
| | | if (root.optInt("code") == 0) {
|
| | | boolean hasMore = root.optBoolean("hasMore");
|
| | | root = JSONObject.fromObject(root.optString("result"));
|
| | | if (root.optInt("code") == 200) {
|
| | | String date = root.optJSONArray("data").toString();
|
| | | Type typeToken = new TypeToken<List<JDOrder>>() {
|
| | | }.getType();
|
| | | List<JDOrder> orderList = new Gson().fromJson(date, typeToken);
|
| | | if (orderList != null)
|
| | | for (JDOrder order : orderList) {
|
| | | for (int i = 0; i < order.getOrderItemList().size(); i++) {
|
| | | order.getOrderItemList().get(i)
|
| | | .setTradeId(order.getOrderId() + "-" + order.getOrderItemList().get(i).getSkuId());
|
| | | order.getOrderItemList().get(i).setOrderId(order.getOrderId());
|
| | | order.getOrderItemList().get(i).setOrderBy(i + 1);
|
| | | }
|
| | | }
|
| | | return new JDOrderResult(hasMore, orderList);
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return searchResult;
|
| | | }
|
| | |
|
| | | public static JDGoods getGoodsDetail(Long skuId) {
|
| | | JDSearchFilter sf = new JDSearchFilter();
|
| | | sf.setKey(skuId + "");
|
| | | sf.setPageNo(1);
|
| | | sf.setPageSize(20);
|
| | | JDSearchResult result = searchByKey(sf);
|
| | | if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0)
|
| | | return result.getGoodsList().get(0);
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static JDGoods parseGoods(String data) {
|
| | | JDGoods goods = new JDGoods();
|
| | | JSONObject json = JSONObject.fromObject(data);
|
| | |
| | | goods.setOwner("g");
|
| | | else
|
| | | goods.setOwner("p");
|
| | | goods.setMaterialUrl("http://img14.360buyimg.com/n1/"+json.optString("materialUrl"));
|
| | | goods.setMaterialUrl("http://img14.360buyimg.com/n1/" + json.optString("materialUrl"));
|
| | | JDCommissionInfo commission = new JDCommissionInfo();
|
| | | commission.setCommission(new BigDecimal(json.optString("wlCommission")));
|
| | | commission.setCommissionShare(new BigDecimal(json.optString("wlCommissionRatio")));
|
| | |
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取订单
|
| | | * |
| | | * @param page
|
| | | * -页码
|
| | | * @param pageSize-每页数量
|
| | | * @param startTime-开始时间
|
| | | * @param endTime-结束时间
|
| | | * 与开始时间不得大于24小时
|
| | | * @return
|
| | | */
|
| | | public static PDDOrderResult getOrders(int page, int pageSize, long startTime, long endTime) {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.order.list.increment.get");
|
| | |
| | | // 二级收益人-金额
|
| | | private String levelTwoMoney;
|
| | |
|
| | | private String weiQuanState;//维权状态
|
| | |
|
| | | private String weiQuanBackMoney;//维权资金
|
| | |
|
| | | public String getWeiQuanState() {
|
| | | return weiQuanState;
|
| | | }
|
| | |
|
| | | public void setWeiQuanState(String weiQuanState) {
|
| | | this.weiQuanState = weiQuanState;
|
| | | }
|
| | |
|
| | | public String getWeiQuanBackMoney() {
|
| | | return weiQuanBackMoney;
|
| | | }
|
| | |
|
| | | public void setWeiQuanBackMoney(String weiQuanBackMoney) {
|
| | | this.weiQuanBackMoney = weiQuanBackMoney;
|
| | | }
|
| | |
|
| | | public Date getAccountTime() {
|
| | | return accountTime;
|
| | | }
|