| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 百川推送 -(新后台)
|
| | | * |
| | | * @param uId
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "pushBaiChuan")
|
| | | public void pushBaiChuan(String callback, Long uid, String title, String content, String url, |
| | | PrintWriter out) {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | pushService.pushBaiChuanUrl(uid, title, content, url);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | |
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | @Controller
|
| | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @RequestMapping(value = "queryJoinHongBao")
|
| | | public void queryJoinHongBao(String callback, Integer pageIndex, Integer pageSize, String key, String startTime, String endTime, Integer type, Integer goodstype, Integer days, PrintWriter out) {
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, Integer keyType,
|
| | | String key, String startTime, String endTime, Integer state, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | if (pageSize == null)
|
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | if (pageIndex == null)
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | | pageIndex = 1;
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(endTime)) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date enddate = sdf.parse(endTime);
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTime(enddate);
|
| | | c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
|
| | | endTime = sdf.format(c.getTime());
|
| | | }
|
| | |
|
| | | List<ReslutOrder> reslutOrders = taoBaoOrderService.queryJoinHongBao((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime, type, days);
|
| | |
|
| | | /* 暂无数据显示 返回消息 */
|
| | | if (reslutOrders == null || reslutOrders.size() == 0) {
|
| | | List<TaoBaoOrderVO> listQuery = taoBaoOrderService.listQuery((pageIndex - 1) * pageSize, pageSize, keyType, key, startTime, endTime, state);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 验证网络: */
|
| | | StringBuffer auctionIdBuf = new StringBuffer();
|
| | | for (ReslutOrder reslutOrder : reslutOrders) {
|
| | | Long auctionId = reslutOrder.getAuctionId();
|
| | | if (auctionId != null) {
|
| | | auctionIdBuf.append(auctionId + ",");
|
| | | }
|
| | | }
|
| | |
|
| | | /* 验证网络: 获取商品链接 图片链接 */
|
| | | List<TaoBaoGoodsBrief> goodsBriefList = null;
|
| | | if (auctionIdBuf != null && auctionIdBuf.length() > 0) {
|
| | | String auctionIds = auctionIdBuf.toString();
|
| | |
|
| | | String ids = auctionIds.substring(0, auctionIds.length() - 1);
|
| | | goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | }
|
| | |
|
| | | for (ReslutOrder reslutOrder : reslutOrders) {
|
| | |
|
| | | String orderId = reslutOrder.getOrderId();
|
| | | BigDecimal payment = reslutOrder.getPayment();
|
| | |
|
| | | String orderState = reslutOrder.getOrderState();
|
| | | if ("订单结算".equals(orderState)) {
|
| | | reslutOrder.setOrderStateAdmin("1");
|
| | | } else if ("订单付款".equals(orderState)) {
|
| | | reslutOrder.setOrderStateAdmin("2");
|
| | | } else if ("订单失效".equals(orderState)) {
|
| | | reslutOrder.setOrderStateAdmin("3");
|
| | | }
|
| | |
|
| | | /* 网上爬取商品 图片、链接 */
|
| | | Long auctionId = reslutOrder.getAuctionId();
|
| | |
|
| | | if (goodsBriefList != null && goodsBriefList.size() > 0) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsBriefList) {
|
| | | Long auctionIdTB = taoBaoGoodsBrief.getAuctionId();
|
| | | if (auctionId.equals(auctionIdTB)) {
|
| | | reslutOrder.setGoodsStae("0");// 在售
|
| | | String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | String shopTitle = taoBaoGoodsBrief.getShopTitle();
|
| | | reslutOrder.setShopTitle(shopTitle);
|
| | | reslutOrder.setAuctionUrl(auctionUrl);
|
| | | reslutOrder.setPictUrl(pictUrl);
|
| | | }
|
| | | }
|
| | | } else {
|
| | | reslutOrder.setGoodsStae("1");// 停售
|
| | | }
|
| | |
|
| | | String goodsStae = reslutOrder.getGoodsStae();
|
| | | if (StringUtil.isNullOrEmpty(goodsStae)) {
|
| | | reslutOrder.setGoodsStae("1");// 停售
|
| | | }
|
| | |
|
| | | UserInfo userInfo = reslutOrder.getUserInfo();
|
| | | if (userInfo == null) {
|
| | | userInfo = new UserInfo();
|
| | | reslutOrder.setUserInfo(userInfo);
|
| | | } else {
|
| | | Long uid = userInfo.getId();
|
| | | if (uid != null) {
|
| | | UserInfo currtUser = userInfoService.selectByPKey(uid);
|
| | | if (currtUser != null) {
|
| | | reslutOrder.setUserInfo(currtUser);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /* 订单号为空 则不进行查询红包 */
|
| | | if (StringUtil.isNullOrEmpty(orderId)) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | /* 根据订单号 + 付款金额 进行匹配红包 */
|
| | |
|
| | | List<HongBao> listHB = hongBaoService.queryByOrderIDAndPayMoney(Long.parseLong(orderId), payment);
|
| | |
|
| | | /* 无红包 */
|
| | | if (listHB == null || listHB.size() == 0) {
|
| | | Long uid = userInfo.getId();
|
| | | if (uid != null) {
|
| | | listHB = hongBaoService.queryByOrderIDAndUid(Long.parseLong(orderId), uid);
|
| | | }
|
| | |
|
| | | if (listHB == null || listHB.size() == 0) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | HongBao hongBao = listHB.get(0);
|
| | |
|
| | | reslutOrder.setHongbaoId(hongBao.getId());
|
| | | reslutOrder.setGetTime(hongBao.getGetTime());
|
| | | reslutOrder.setMoney(hongBao.getMoney());
|
| | | reslutOrder.setType(hongBao.getType());
|
| | | // reslutOrder.setState(hongBao.getState());
|
| | | reslutOrder.setCreatetime(hongBao.getCreatetime());
|
| | | reslutOrder.setPreGettime(hongBao.getPreGettime());
|
| | |
|
| | | /* 查询间接收益 红包id */
|
| | | Long pid = reslutOrder.getHongbaoId();
|
| | |
|
| | | if (pid != null) {
|
| | |
|
| | | List<HongBao> childHongBaoList = hongBaoService.findChildHongBaoList(pid);
|
| | |
|
| | | if (childHongBaoList != null && childHongBaoList.size() > 0) {
|
| | |
|
| | | for (HongBao hb : childHongBaoList) {
|
| | |
|
| | | BigDecimal money = hb.getMoney();
|
| | | Integer childType = hb.getType();
|
| | | Long uid = null;
|
| | | String nickName = null;
|
| | |
|
| | | UserInfo user = hb.getUserInfo();
|
| | | if (user != null) {
|
| | | uid = user.getId();
|
| | | UserInfo cuent = userInfoService.getUserByIdWithMybatis(uid);
|
| | | if (cuent != null)
|
| | | nickName = cuent.getNickName();
|
| | | }
|
| | |
|
| | | if (childType != null) {
|
| | | if (childType == HongBao.TYPE_YIJI || childType == HongBao.TYPE_SHARE_YIJI) {
|
| | | // 一级
|
| | | reslutOrder.setLevelOne(uid);
|
| | | reslutOrder.setLevelOneMoney(money);
|
| | | reslutOrder.setLevelOneName(nickName);
|
| | | } else if (childType == HongBao.TYPE_ERJI || childType == HongBao.TYPE_SHARE_ERJI) {
|
| | | reslutOrder.setLevelTwo(uid);
|
| | | reslutOrder.setLevelTwoMoney(money);
|
| | | reslutOrder.setLevelTwoName(nickName);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | DateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置格式
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
|
| | |
|
| | | String createTime = reslutOrder.getCreateTime();
|
| | | if (!StringUtil.isNullOrEmpty(createTime)) {
|
| | | Date d = f.parse(createTime);
|
| | | reslutOrder.setCreateTime(format.format(d));
|
| | | }
|
| | |
|
| | | String settlementTime = reslutOrder.getSettlementTime();
|
| | | if (!StringUtil.isNullOrEmpty(settlementTime)) {
|
| | | Date d = f.parse(settlementTime);
|
| | | reslutOrder.setSettlementTime(format.format(d));
|
| | | }
|
| | |
|
| | | /* 到账状态 */
|
| | | int state = hongBao.getState();
|
| | |
|
| | | if (HongBao.STATE_YILINGQU == state) {
|
| | | reslutOrder.setMoneyState("3"); // 已到账
|
| | | } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) {
|
| | | reslutOrder.setMoneyState("2"); // 未到账
|
| | | } else {
|
| | | reslutOrder.setMoneyState("4"); // 已失效
|
| | | }
|
| | |
|
| | | String rebateSource = null;
|
| | | Integer typeHongBao = reslutOrder.getType();
|
| | | if (typeHongBao != null) {
|
| | |
|
| | | if (typeHongBao == HongBao.TYPE_HUODONG || typeHongBao == HongBao.TYPE_XINREN) {
|
| | | /* 3-活动红包 4-新人红包 */
|
| | | rebateSource = "1";
|
| | |
|
| | | } else if (typeHongBao == HongBao.TYPE_JINGDONG || typeHongBao == HongBao.TYPE_TAOBAO || typeHongBao == HongBao.TYPE_YAOQING) {
|
| | | /* 自购订单 */
|
| | | rebateSource = "2";
|
| | | } else if (typeHongBao == HongBao.TYPE_YIJI || typeHongBao == HongBao.TYPE_ERJI || typeHongBao == HongBao.TYPE_SHARE_YIJI || typeHongBao == HongBao.TYPE_SHARE_ERJI) {
|
| | | /* 邀请订单 分销红包对应的最上级红包 */
|
| | | rebateSource = "3";
|
| | | } else if (typeHongBao == HongBao.TYPE_SHARE_GOODS) {
|
| | | /* 分享订单 */
|
| | | rebateSource = "4";
|
| | | }
|
| | | reslutOrder.setRebateSource(rebateSource);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | int count = taoBaoOrderService.countQueryJoinHongBao(key, startTime, endTime, type, days);
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | |
| | | long count= taoBaoOrderService.countQuery(keyType, key, startTime, endTime, state);
|
| | | |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("list", gson.toJson(reslutOrders));
|
| | |
|
| | | data.put("result_list", gson.toJson(listQuery));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @RequestMapping(value = "countByType")
|
| | | public void countByType(String callback, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | //double sumMoney = userInfoService.querySumMoney(key, userType, days, startTime, endTime);
|
| | | |
| | | long count = userInfoService.queryCount(key, userType, days, startTime, endTime);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | |
| | | // 需要统计筛选信息 :未失效的总金额 以及订单
|
| | | if (needCount && page == 1) {
|
| | |
|
| | | Map<String, Object> shareMap = commonOrderService.countBonusOrderMoneyAndNumber(uid, type,
|
| | | dateType, startTime, endTime);
|
| | | todayMoney = commonOrderService.countBonusOrderMoney(uid, type, dateType, startTime, endTime);
|
| | |
|
| | | if (shareMap != null) {
|
| | | Object totalNum = shareMap.get("totalNum");
|
| | | if (totalNum != null) {
|
| | | todayTotal = (long) totalNum;
|
| | | }
|
| | | |
| | | Object totalmoney = shareMap.get("totalmoney");
|
| | | if (totalmoney != null) {
|
| | | todayMoney = (BigDecimal) totalmoney;
|
| | | }
|
| | | }
|
| | | todayTotal = commonOrderService.countBonusOrderNumber(uid, type, dateType, startTime, endTime);
|
| | |
|
| | |
|
| | | // 统计有效的订单数量 、 失效订单数量 、维权订单数量
|
| | |
| | | Object totalmoney = shareMap.get("totalmoney");
|
| | | if (totalmoney != null) {
|
| | | sharemoney = (BigDecimal) totalmoney;
|
| | | sharemoney = sharemoney.setScale(2, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Object totalmoney = inviteMap.get("totalmoney");
|
| | | if (totalmoney != null) {
|
| | | inviteMoney = (BigDecimal) totalmoney;
|
| | | inviteMoney = inviteMoney.setScale(2, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("shareCount", shareCount);
|
| | | data.put("sharemoney", sharemoney);
|
| | | data.put("sharemoney", sharemoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("inviteCount", inviteCount);
|
| | | data.put("inviteMoney", inviteMoney);
|
| | | data.put("inviteMoney", inviteMoney.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | |
|
| | | data.put("showTiCheng", hongBaoV2CountService.getTotalTiChengCount(uid) > 0);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | // 累计提成订单数量(包含无效订单) |
| | | int getTotalTiChengCount(Long uid); |
| | | |
| | | /** |
| | | * 统计未失效订单数量 |
| | | * @param uid |
| | | * @param dateType |
| | | * @return |
| | | */ |
| | | long countValidNumberByUid(@Param("uid") Long uid, @Param("dateType")Integer dateType); |
| | | |
| | | /** |
| | | * 统计未到账 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal countWillGetMoneyByUid(@Param("uid") Long uid); |
| | | |
| | | |
| | | Date getLastHongBaoTime(@Param("uid") Long uid); |
| | | |
| | | } |
| | |
| | | |
| | | import com.yeshi.fanli.entity.admin.ReslutOrder; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder; |
| | | import com.yeshi.fanli.vo.order.TaoBaoOrderVO; |
| | | |
| | | public interface TaoBaoOrderMapper { |
| | | |
| | |
| | | List<Map<String, Object>> countOrderNumber( @Param("dateType") Integer dateType, @Param("year") String year, |
| | | @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | |
| | | |
| | | List<TaoBaoOrderVO> listQuery(@Param("start")long start, @Param("count") int count, |
| | | @Param("keyType")Integer keyType, @Param("key") String key, |
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, |
| | | @Param("state")Integer state); |
| | | |
| | | long countQuery(@Param("keyType")Integer keyType, @Param("key") String key, |
| | | @Param("startTime") String startTime,@Param("endTime") String endTime, |
| | | @Param("state")Integer state); |
| | | |
| | | } |
| | |
| | | private String contentChange;
|
| | |
|
| | | // 未入账
|
| | | private double unaccountedMoney;
|
| | | private String unaccountedMoney;
|
| | | // 历史总收益
|
| | | private double totalMoneyHistory;
|
| | | private String totalMoneyHistory;
|
| | | // 累计提现
|
| | | private double totalExtract;
|
| | |
|
| | |
| | | this.contentChange = contentChange;
|
| | | }
|
| | |
|
| | | public double getUnaccountedMoney() {
|
| | | return unaccountedMoney;
|
| | | }
|
| | |
|
| | | public void setUnaccountedMoney(double unaccountedMoney) {
|
| | | this.unaccountedMoney = unaccountedMoney;
|
| | | }
|
| | |
|
| | | public double getTotalExtract() {
|
| | | return totalExtract;
|
| | |
| | | this.phoneState = phoneState;
|
| | | }
|
| | |
|
| | | public double getTotalMoneyHistory() {
|
| | | return totalMoneyHistory;
|
| | | }
|
| | |
|
| | | public void setTotalMoneyHistory(double totalMoneyHistory) {
|
| | | this.totalMoneyHistory = totalMoneyHistory;
|
| | | }
|
| | |
|
| | | public long getCountUserShares() {
|
| | | return countUserShares;
|
| | |
| | | this.accountBindIdWX = accountBindIdWX;
|
| | | }
|
| | |
|
| | | public String getUnaccountedMoney() {
|
| | | return unaccountedMoney;
|
| | | }
|
| | |
|
| | | public void setUnaccountedMoney(String unaccountedMoney) {
|
| | | this.unaccountedMoney = unaccountedMoney;
|
| | | }
|
| | |
|
| | | public String getTotalMoneyHistory() {
|
| | | return totalMoneyHistory;
|
| | | }
|
| | |
|
| | | public void setTotalMoneyHistory(String totalMoneyHistory) {
|
| | | this.totalMoneyHistory = totalMoneyHistory;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <select id="query" resultMap="BaseResultMap"> |
| | | SELECT u.* |
| | | <if test="orderField != null and orderField != 5 and orderField != 6"> |
| | | ,(SELECT COUNT(hb.id) FROM `yeshi_ec_hongbao` hb |
| | | WHERE hb.uid = u.id AND TYPE IN (1,2) |
| | | ,(SELECT COUNT(hb.hb_id) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid = u.id AND (hb.hb_type = 1 or hb.hb_type = 2) |
| | | <if test="orderMode == 2"> |
| | | <!-- AND TO_DAYS(FROM_UNIXTIME(hb.`createtime`/1000)) = TO_DAYS(NOW()) --> |
| | | AND DATE_FORMAT( FROM_UNIXTIME(hb.`createtime`/1000), '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) |
| | | AND DATE_FORMAT(hb.`hb_create_time`,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | )AS total |
| | | </if> |
| | |
| | | AND (h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22 OR h.`hb_type`=6 OR h.`hb_type`=7) |
| | | </select> |
| | | |
| | | <select id="countValidNumberByUid" resultType="java.lang.Long"> |
| | | <!--统计有效订单数量 --> |
| | | SELECT COALESCE(count(hb.hb_id),0) FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.hb_uid =#{uid} |
| | | AND hb.hb_type not in (3,4) |
| | | AND <![CDATA[hb.hb_state <> 4]]> |
| | | |
| | | <if test="dateType != null and dateType == 1"> |
| | | AND TO_DAYS(FROM_UNIXTIME(hb.`hb_create_time`/1000)) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="dateType != null and dateType == 2"> |
| | | AND DATE_FORMAT( FROM_UNIXTIME(hb.`hb_create_time`/1000),'%Y%m' ) = |
| | | DATE_FORMAT( CURDATE( ) , '%Y%m' ) |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countWillGetMoneyByUid" resultType="java.math.BigDecimal"> |
| | | SELECT CAST(SUM(hb.`hb_money`)AS DECIMAL(19,2)) |
| | | FROM `yeshi_ec_hongbao_v2` hb |
| | | WHERE hb.`hb_uid` = #{uid} AND hb.`hb_state` in (1,2) |
| | | </select> |
| | | |
| | | <select id="getLastHongBaoTime" resultType="java.util.Date"> |
| | | <!-- 最近一次下单时间 --> |
| | | SELECT h.`hb_create_time` FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_type` IN(1,2) <![CDATA[AND h.hb_state <>4]]> |
| | | AND h.`hb_uid` = #{uid} |
| | | ORDER BY h.`hb_create_time` DESC |
| | | LIMIT 1; |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <sql id="SELECT_PARAM_ORDER_CREATE_TIME"> |
| | | <if test="startTime != null and startTime != '' "> |
| | | AND <![CDATA[co.co_create_time >= #{startTime}]]> |
| | | AND <![CDATA[co.co_third_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test="endTime != null and endTime != '' "> |
| | | AND <![CDATA[co.co_create_time <= #{endTime}]]> |
| | | AND <![CDATA[co.co_third_create_time <= #{endTime}]]> |
| | | </if> |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_create_time`) = TO_DAYS(NOW()) |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_create_time`) = 1 |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = |
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 |
| | | DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | </sql> |
| | | |
| | |
| | | AND co.co_order_no = #{orderNo} |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | ORDER BY co.co_create_time DESC |
| | | ORDER BY co.co_third_create_time DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_create_time`) = TO_DAYS(NOW()) |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_create_time`) = 1 |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.co_third_create_time) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = |
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 |
| | | DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)YX |
| | | |
| | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_create_time`) = TO_DAYS(NOW()) |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_create_time`) = 1 |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = |
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 |
| | | DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)WQ |
| | | |
| | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <if test="day != null and day == 1"> <!-- 今天 --> |
| | | AND TO_DAYS(co.`co_create_time`) = TO_DAYS(NOW()) |
| | | AND TO_DAYS(co.`co_third_create_time`) = TO_DAYS(NOW()) |
| | | </if> |
| | | <if test="day != null and day == 2"> <!-- 昨天 --> |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_create_time`) = 1 |
| | | AND TO_DAYS(NOW()) - TO_DAYS(co.`co_third_create_time`) = 1 |
| | | </if> |
| | | <if test="day != null and day == 3"> <!-- 本月 --> |
| | | AND DATE_FORMAT(co.`co_create_time`,'%Y%m') = |
| | | AND DATE_FORMAT(co.`co_third_create_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="day != null and day == 4"> <!-- 上月 --> |
| | | AND PERIOD_DIFF(DATE_FORMAT(NOW(), '%Y%m'), |
| | | DATE_FORMAT(co.`co_create_time`, '%Y%m')) = 1 |
| | | DATE_FORMAT(co.`co_third_create_time`, '%Y%m')) = 1 |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type`)SX |
| | | )A |
| | |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | )A |
| | | </select> |
| | |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="countBonusOrderMoneyAndNumber" resultType="java.util.HashMap"> |
| | | <!-- 奖金统计:订单总返利金额 去掉已失效 --> |
| | | <!-- 奖金统计有效订单:订单总金额 / 总订单数 --> |
| | | SELECT COUNT(ho.`ho_id`) AS totalNum, |
| | | CAST(SUM(IF(hb.hb_id IS NULL,hbp.`hb_money`,hb.`hb_money`))AS DECIMAL(19,2)) AS totalmoney |
| | | FROM yeshi_ec_hongbao_order ho |
| | |
| | | WHERE (hb.hb_id IS NOT NULL OR hbp.hb_id IS NOT NULL) |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <if test="day != null and day == 4"> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | AND co.`co_state` = 2 <!-- 上月 :统计已收货 --> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` |
| | | </select> |
| | | |
| | | <select id="listQueryByUid" resultMap="ResultMap"> |
| | |
| | | <if test="orderNo != null and orderNo !='' "> |
| | | AND co.co_order_no = #{orderNo} |
| | | </if> |
| | | ORDER BY co.co_create_time DESC |
| | | ORDER BY co.co_third_create_time DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | |
| | | |
| | | <result column="to_orderby" property="orderBy" jdbcType="INTEGER" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="VoResultMap" type="com.yeshi.fanli.vo.order.TaoBaoOrderVO"> |
| | | <id column="to_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="to_create_time" property="createTime" jdbcType="VARCHAR" /> |
| | | <result column="to_click_time" property="clickTime" jdbcType="VARCHAR" /> |
| | | <result column="to_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="to_auction_id" property="auctionId" jdbcType="BIGINT" /> |
| | | <result column="to_manager_wangwang" property="managerWangWang" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_shop" property="shop" jdbcType="VARCHAR" /> |
| | | <result column="to_count" property="count" jdbcType="INTEGER" /> |
| | | <result column="to_price" property="price" jdbcType="DECIMAL" /> |
| | | <result column="to_order_state" property="orderState" jdbcType="VARCHAR" /> |
| | | <result column="to_order_type" property="orderType" jdbcType="VARCHAR" /> |
| | | <result column="to_iratio" property="iRatio" jdbcType="DECIMAL" /> |
| | | <result column="to_sratio" property="sRatio" jdbcType="DECIMAL" /> |
| | | <result column="to_payment" property="payment" jdbcType="DECIMAL" /> |
| | | <result column="to_estimate" property="estimate" jdbcType="DECIMAL" /> |
| | | <result column="to_settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | <result column="to_eIncome" property="eIncome" jdbcType="DECIMAL" /> |
| | | <result column="to_settlement_time" property="settlementTime" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_tk_rate" property="tkRate" jdbcType="DECIMAL" /> |
| | | <result column="to_tk_money" property="tkMoney" jdbcType="DECIMAL" /> |
| | | <result column="to_technology_support_percent" property="technologySupportPercent" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="to_subsidy_ratio" property="subsidyRatio" |
| | | jdbcType="DECIMAL" /> |
| | | <result column="to_subsidy" property="subsidy" jdbcType="DECIMAL" /> |
| | | <result column="to_subsidy_type" property="subsidyType" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_transaction_platform" property="transactionPlatform" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_third_service" property="thirdService" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_order_id" property="orderId" jdbcType="VARCHAR" /> |
| | | <result column="to_class_name" property="className" jdbcType="VARCHAR" /> |
| | | <result column="to_source_media_id" property="sourceMediaId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_source_media_name" property="sourceMediaName" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_ad_position_id" property="adPositionId" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_ad_position_name" property="adPositionName" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="to_latest_updatetime" property="latestUpdateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="to_orderby" property="orderBy" jdbcType="INTEGER" /> |
| | | <result column="picture" property="picture" jdbcType="VARCHAR" /> |
| | | <result column="userId" property="userId" jdbcType="VARCHAR" /> |
| | | <result column="userName" property="userName" jdbcType="VARCHAR" /> |
| | | <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> |
| | | <result column="userMoney" property="userMoney" jdbcType="VARCHAR" /> |
| | | <result column="userMoneyState" property="userMoneyState" jdbcType="VARCHAR" /> |
| | | <result column="userMoneyDate" property="userMoneyDate" jdbcType="VARCHAR" /> |
| | | <result column="userHongBaoType" property="userHongBaoType" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="levelOneId" property="levelOneId" jdbcType="VARCHAR" /> |
| | | <result column="levelOneMoney" property="levelOneMoney" jdbcType="VARCHAR" /> |
| | | <result column="levelTwoId" property="levelTwoId" jdbcType="VARCHAR" /> |
| | | <result column="levelTwoMoney" property="levelTwoMoney" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">to_id,to_create_time,to_click_time,to_title,to_auction_id,to_manager_wangwang,to_shop,to_count,to_price,to_order_state,to_order_type,to_iratio,to_sratio,to_payment,to_estimate,to_settlement,to_eIncome,to_settlement_time,to_tk_rate,to_tk_money,to_technology_support_percent,to_subsidy_ratio,to_subsidy,to_subsidy_type,to_transaction_platform,to_third_service,to_order_id,to_class_name,to_source_media_id,to_source_media_name,to_ad_position_id,to_ad_position_name,to_latest_updatetime,to_orderby |
| | | </sql> |
| | |
| | | |
| | | <select id="queryJoinHongBao" resultMap="ResultMapExtral"> |
| | | |
| | | SELECT * FROM (SELECT DISTINCT(to_id)AS id,hb.uid FROM |
| | | `yeshi_ec_taobao_order` td |
| | | LEFT JOIN `yeshi_ec_hongbao` hb ON |
| | | td.`to_order_id`= hb.`order_id` |
| | | WHERE hb.`version` = 2 AND hb.`type` IN |
| | | (1,2,20) |
| | | <if test='key != null and key != ""'> |
| | | AND (td.`to_order_id` like '%${key}%' OR hb.uid like |
| | | '%${key}%') |
| | | </if> |
| | | <if test="days != null"> |
| | | <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= td.`to_create_time` ]]> |
| | | </if> |
| | | <if test='startTime != null and startTime != ""'> |
| | | <![CDATA[ |
| | | AND td.to_create_time >= #{startTime} |
| | | ]]> |
| | | </if> |
| | | |
| | | <if test='endTime != null and endTime != ""'> |
| | | <![CDATA[ |
| | | AND td.to_create_time < #{endTime} |
| | | ]]> |
| | | </if> |
| | | |
| | | <if test='type == 1'> |
| | | AND (td.`to_order_state` = '订单结算' or td.`to_order_state` = |
| | | '订单成功') |
| | | </if> |
| | | <if test='type == 2'> |
| | | AND td.`to_order_state` = '订单付款' |
| | | </if> |
| | | <if test='type == 3'> |
| | | AND td.`to_order_state` = '订单失效' |
| | | </if> |
| | | SELECT * |
| | | FROM (SELECT DISTINCT(to_id)AS id,hb.uid FROM `yeshi_ec_taobao_order` td |
| | | LEFT JOIN `yeshi_ec_hongbao` hb ON td.`to_order_id`= hb.`order_id` |
| | | |
| | | WHERE hb.`version` = 2 AND hb.`type` IN (1,2,20) |
| | | |
| | | <if test='key != null and key != ""'> |
| | | AND (td.`to_order_id` like '%${key}%' OR hb.uid like '%${key}%') |
| | | </if> |
| | | |
| | | <if test="days != null"> |
| | | <![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= td.`to_create_time` ]]> |
| | | </if> |
| | | |
| | | <if test='startTime != null and startTime != ""'> |
| | | <![CDATA[AND td.to_create_time >= #{startTime}]]> |
| | | </if> |
| | | <if test='endTime != null and endTime != ""'> |
| | | <![CDATA[AND td.to_create_time < #{endTime}]]> |
| | | </if> |
| | | |
| | | <if test='type == 1'> |
| | | AND (td.`to_order_state` = '订单结算' or td.`to_order_state` = '订单成功') |
| | | </if> |
| | | <if test='type == 2'> |
| | | AND td.`to_order_state` = '订单付款' |
| | | </if> |
| | | <if test='type == 3'> |
| | | AND td.`to_order_state` = '订单失效' |
| | | </if> |
| | | |
| | | ORDER BY td.`to_create_time` DESC LIMIT ${start},${count} )A |
| | | LEFT JOIN |
| | | yeshi_ec_taobao_order tt ON A.id = tt.to_id |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listQuery" resultMap="VoResultMap"> |
| | | SELECT tb.*,cg.`cog_picture` AS picture, |
| | | co.`co_uid` AS userId,u.`nick_name` AS userName,u.`portrait` AS userPortrait, |
| | | v2.`hb_money` AS userMoney,v2.`hb_state` AS userMoneyState,v2.`hb_get_time` AS userMoneyDate, |
| | | V2.hb_type AS userHongBaoType, |
| | | pv2.`hb_uid` AS levelOneId, pv2.`hb_money` AS levelOneMoney, |
| | | ppv2.`hb_uid` AS levelTwoId, ppv2.`hb_money` AS levelTwoMoney |
| | | |
| | | FROM `yeshi_ec_taobao_order` tb |
| | | LEFT JOIN `yeshi_ec_common_order` co ON (tb.`to_order_id` = co.`co_order_no` AND tb.`to_orderby` = co.`co_order_by`) |
| | | LEFT JOIN yeshi_ec_common_order_goods cg ON cg.`cog_id` = co.`co_order_goods_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_order` ho ON ho.`ho_order_id` = co.`co_id` |
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON v2.`hb_id` = ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 pv2 ON v2.`hb_id` = pv2.`hb_pid` |
| | | LEFT JOIN yeshi_ec_hongbao_v2 ppv2 ON pv2.`hb_id` = ppv2.`hb_pid` |
| | | LEFT JOIN `yeshi_ec_user` u ON u.`id` = co.`co_uid` |
| | | |
| | | WHERE 1=1 |
| | | <!-- 搜索条件 --> |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 1'> |
| | | AND tb.`to_order_id` like '%${key}%' <!-- 订单号 --> |
| | | </if> |
| | | <if test='keyType == 2'> |
| | | AND co.`co_uid` like '%${key}%' <!-- 用户id --> |
| | | </if> |
| | | </if> |
| | | |
| | | <if test='startTime != null and startTime != ""'> |
| | | <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') >= #{startTime}]]> |
| | | |
| | | </if> |
| | | <if test='endTime != null and endTime != ""'> |
| | | <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') <= #{endTime}]]> |
| | | </if> |
| | | |
| | | <if test='state == 1'> |
| | | AND tb.`to_order_state` = '订单付款' |
| | | </if> |
| | | <if test='state == 2'> |
| | | AND (tb.`to_order_state` = '订单结算' or tb.`to_order_state` = '订单成功') |
| | | </if> |
| | | <if test='state == 3'> |
| | | AND tb.`to_order_state` = '订单失效' |
| | | </if> |
| | | ORDER BY tb.`to_create_time` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countQuery" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(tb.to_id),0) |
| | | FROM `yeshi_ec_taobao_order` tb |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 2'> |
| | | LEFT JOIN `yeshi_ec_common_order` co |
| | | ON (tb.`to_order_id` = co.`co_order_no` AND tb.`to_orderby` = co.`co_order_by`) |
| | | </if> |
| | | </if> |
| | | WHERE 1=1 |
| | | <!-- 搜索条件 --> |
| | | <if test='key != null and key != ""'> |
| | | <if test='keyType == 1'> |
| | | AND tb.`to_order_id` like '%${key}%' <!-- 订单号 --> |
| | | </if> |
| | | <if test='keyType == 2'> |
| | | AND co.`co_uid` like '%${key}%' <!-- 用户id --> |
| | | </if> |
| | | </if> |
| | | |
| | | <if test='startTime != null and startTime != ""'> |
| | | <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') >= #{startTime}]]> |
| | | |
| | | </if> |
| | | <if test='endTime != null and endTime != ""'> |
| | | <![CDATA[AND DATE_FORMAT(tb.to_create_time,'%Y-%m-%d') <= #{endTime}]]> |
| | | </if> |
| | | |
| | | <if test='state == 1'> |
| | | AND tb.`to_order_state` = '订单付款' |
| | | </if> |
| | | <if test='state == 2'> |
| | | AND (tb.`to_order_state` = '订单结算' or tb.`to_order_state` = '订单成功') |
| | | </if> |
| | | <if test='state == 3'> |
| | | AND tb.`to_order_state` = '订单失效' |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | return hongBaoV2CountMapper.getTotalTiChengCount(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countValidNumberByUid(Long uid, Integer dateType) {
|
| | | return hongBaoV2CountMapper.countValidNumberByUid(uid, dateType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal countWillGetMoneyByUid(Long uid) {
|
| | | return hongBaoV2CountMapper.countWillGetMoneyByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Date getLastHongBaoTime(Long uid) {
|
| | | return hongBaoV2CountMapper.getLastHongBaoTime(uid);
|
| | | }
|
| | | }
|
| | |
| | | SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd");
|
| | |
|
| | | for (CommonOrderVO order : listOrder) {
|
| | | Date createTime = order.getCreateTime();
|
| | | if (createTime != null) {
|
| | | order.setObtainTime(createTime.getTime());
|
| | | }
|
| | |
|
| | | Date thirdCreateTime = order.getThirdCreateTime();
|
| | | if (thirdCreateTime != null) {
|
| | | order.setDownTime("下单时间:" + format.format(thirdCreateTime));
|
| | | order.setObtainTime(thirdCreateTime.getTime());
|
| | | }
|
| | |
|
| | | Date settleTime = order.getSettleTime();
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.entity.admin.ReslutOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoOrderServiceImpl implements TaoBaoOrderService {
|
| | |
| | | return taoBaoOrderMapper.getStateByOrderIdAndPayment(orderId, payment);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<TaoBaoOrderVO> listQuery(int start, int count,Integer keyType, String key, |
| | | String startTime, String endTime, Integer state) throws Exception {
|
| | | |
| | | List<TaoBaoOrderVO> listData = taoBaoOrderMapper.listQuery(start, count, keyType, key, startTime, endTime, state);
|
| | | |
| | | for (TaoBaoOrderVO taoBaoOrderVO : listData) {
|
| | | |
| | | String orderState = taoBaoOrderVO.getOrderState();
|
| | | if ("订单付款".equals(orderState)) {
|
| | | taoBaoOrderVO.setOrderState("1");
|
| | | }else if ("订单结算".equals(orderState) || "订单成功".equals(orderState)) {
|
| | | taoBaoOrderVO.setOrderState("2");
|
| | | } else if ("订单失效".equals(orderState)) {
|
| | | taoBaoOrderVO.setOrderState("3");
|
| | | }
|
| | | |
| | | /* 到账状态 */
|
| | | String moneyState = taoBaoOrderVO.getUserMoneyState();
|
| | | if ((HongBaoV2.STATE_BUKELINGQU+"").equals(moneyState) |
| | | || (HongBaoV2.STATE_KELINGQU+"").equals(moneyState)) {
|
| | | taoBaoOrderVO.setUserMoneyState("1"); // 未到账
|
| | | } else if ((HongBaoV2.STATE_YILINGQU + "").equals(moneyState)) {
|
| | | taoBaoOrderVO.setUserMoneyState("2"); // 已到账
|
| | | } else {
|
| | | taoBaoOrderVO.setUserMoneyState("3"); // 已失效
|
| | | }
|
| | | |
| | | String userHongBaoType = taoBaoOrderVO.getUserHongBaoType();
|
| | | if ((HongBaoV2.TYPE_ZIGOU+"").equals(userHongBaoType)) {
|
| | | taoBaoOrderVO.setUserHongBaoType("1"); // 自购
|
| | | } else if ((HongBaoV2.TYPE_SHARE_GOODS + "").equals(userHongBaoType)) {
|
| | | taoBaoOrderVO.setUserHongBaoType("2"); // 分享
|
| | | } else {
|
| | | taoBaoOrderVO.setUserHongBaoType("3"); // 邀请
|
| | | }
|
| | | }
|
| | | |
| | | return listData;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countQuery(Integer keyType, String key, String startTime, String endTime, |
| | | Integer state) throws Exception {
|
| | | return taoBaoOrderMapper.countQuery(keyType, key, startTime, endTime, state);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.admin.UserInfoAdmin;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.InviteUser;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.WeiXinUser;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.exception.ThreeSaleException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareMapper shareMapper;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | public UserInfo getUserByLoginTypeAndOpenId(int loginType, String openid, String appid) {
|
| | | List<UserInfo> list = null;
|
| | |
| | | }
|
| | |
|
| | | // 最后一次下单时间
|
| | | Long lastOrderTime = hongBaoService.getLastOrderTime(uid);
|
| | | Date lastOrderTime = hongBaoV2CountService.getLastHongBaoTime(uid);
|
| | | if (lastOrderTime == null) {
|
| | | userInfoAdmin.setLastOrderTime(0);
|
| | | } else {
|
| | | userInfoAdmin.setLastOrderTime(lastOrderTime);
|
| | | userInfoAdmin.setLastOrderTime(lastOrderTime.getTime());
|
| | | }
|
| | |
|
| | | // 历史总订单
|
| | | long totalOrder = hongBaoService.countByUidSelf(uid, null, null);
|
| | | long totalOrder = hongBaoV2CountService.countValidNumberByUid(uid, null);
|
| | | |
| | | // 今日总订单
|
| | | long todayOrder = hongBaoService.countByUidSelf(uid, 1, null);
|
| | | long todayOrder = hongBaoV2CountService.countValidNumberByUid(uid, 1);
|
| | | // 本月总订单
|
| | | long monthOrder = hongBaoService.countByUidSelf(uid, null, 1);
|
| | | long monthOrder = hongBaoV2CountService.countValidNumberByUid(uid, 2);
|
| | |
|
| | | userInfoAdmin.setTotalOrder(totalOrder);
|
| | | userInfoAdmin.setTodayOrder(todayOrder);
|
| | | userInfoAdmin.setMonthOrder(monthOrder);
|
| | | |
| | | |
| | | // 未领取红包 待入账金额
|
| | | BigDecimal unaccountedMoney = hongBaoV2CountService.countWillGetMoneyByUid(uid);
|
| | | if (unaccountedMoney ==null) {
|
| | | unaccountedMoney = new BigDecimal(0);
|
| | | }
|
| | | userInfoAdmin.setUnaccountedMoney(unaccountedMoney.toString());
|
| | |
|
| | | // 历史总收益
|
| | | BigDecimal totalMoneyHistory = hongBaoV2CountService.countMoneyByUidAndState(uid,3);
|
| | | if (totalMoneyHistory ==null) {
|
| | | totalMoneyHistory = new BigDecimal(0);
|
| | | }
|
| | | userInfoAdmin.setTotalMoneyHistory(totalMoneyHistory.toString());
|
| | | |
| | | |
| | | |
| | |
|
| | | // 支付宝账号 累计转账总金额
|
| | | double totalMoney = payInfoMapper.sumMoneyByUid(uid);
|
| | |
| | |
|
| | | // 累计提现 (暂未计入微信)
|
| | | userInfoAdmin.setTotalExtract(totalMoney);
|
| | |
|
| | | // 未领取红包 待入账金额
|
| | | double unaccountedMoney = hongBaoService.countForecastMoneysByUid(uid);
|
| | | userInfoAdmin.setUnaccountedMoney(unaccountedMoney);
|
| | |
|
| | | // 历史总收益
|
| | | double totalMoneyHistory = hongBaoService.countReceiveMoneysByUid(uid);
|
| | | userInfoAdmin.setTotalMoneyHistory(totalMoneyHistory);
|
| | |
|
| | | // 统计分享个数
|
| | | long countUserShares = userShareGoodsHistoryMapper.countUserShares(uid);
|
| | |
| | | package com.yeshi.fanli.service.inter.count;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public int getTotalTiChengCount(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 统计未失效订单数量
|
| | | * @param uid
|
| | | * @param dateType
|
| | | * @return
|
| | | */
|
| | | public long countValidNumberByUid(Long uid, Integer dateType);
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 统计未到账金额
|
| | | * @param uid
|
| | | * @param dateType
|
| | | * @return
|
| | | */
|
| | | public BigDecimal countWillGetMoneyByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 最后一次下单时间
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public Date getLastHongBaoTime(Long uid);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.ReslutOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.vo.order.TaoBaoOrderVO;
|
| | |
|
| | | /**
|
| | | * 淘宝订单服务
|
| | |
| | | */
|
| | | public List<TaoBaoOrder> getStateByOrderIdAndPayment(String orderId, String payment) throws Exception;
|
| | |
|
| | | |
| | | /**
|
| | | * 后端查询商品列表
|
| | | * @param start
|
| | | * @param count
|
| | | * @param keyType
|
| | | * @param key
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param state
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public List<TaoBaoOrderVO> listQuery(int start, int count, Integer keyType, String key, String startTime, String endTime,
|
| | | Integer state) throws Exception;
|
| | |
|
| | | public long countQuery(Integer keyType, String key, String startTime, String endTime, Integer state) throws Exception;
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.order;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | |
|
| | | public class TaoBaoOrderVO extends TaoBaoOrder implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 商品图片
|
| | | private String picture;
|
| | |
|
| | | // 直接受益人-ID
|
| | | private String userId;
|
| | | // 直接受益人-名称
|
| | | private String userName;
|
| | | // 直接受益人-头像
|
| | | private String userPortrait;
|
| | | // 直接受益人-金额
|
| | | private String userMoney;
|
| | | // 直接受益人-金额状态
|
| | | private String userMoneyState;
|
| | | // 直接受益人-到账时间
|
| | | private String userMoneyDate;
|
| | | // 直接受益人-红包类型
|
| | | private String userHongBaoType;
|
| | |
|
| | | // 一级收益人-ID
|
| | | private String levelOneId;
|
| | | // 一级收益人-金额
|
| | | private String levelOneMoney;
|
| | |
|
| | | // 二级收益人-ID
|
| | | private String levelTwoId;
|
| | | // 二级收益人-金额
|
| | | private String levelTwoMoney;
|
| | |
|
| | | public String getPicture() {
|
| | | return picture;
|
| | | }
|
| | |
|
| | | public void setPicture(String picture) {
|
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public String getUserId() {
|
| | | return userId;
|
| | | }
|
| | |
|
| | | public void setUserId(String userId) {
|
| | | this.userId = userId;
|
| | | }
|
| | |
|
| | | public String getUserName() {
|
| | | return userName;
|
| | | }
|
| | |
|
| | | public void setUserName(String userName) {
|
| | | this.userName = userName;
|
| | | }
|
| | |
|
| | | public String getUserPortrait() {
|
| | | return userPortrait;
|
| | | }
|
| | |
|
| | | public void setUserPortrait(String userPortrait) {
|
| | | this.userPortrait = userPortrait;
|
| | | }
|
| | |
|
| | | public String getUserMoney() {
|
| | | return userMoney;
|
| | | }
|
| | |
|
| | | public void setUserMoney(String userMoney) {
|
| | | this.userMoney = userMoney;
|
| | | }
|
| | |
|
| | | public String getUserMoneyState() {
|
| | | return userMoneyState;
|
| | | }
|
| | |
|
| | | public void setUserMoneyState(String userMoneyState) {
|
| | | this.userMoneyState = userMoneyState;
|
| | | }
|
| | |
|
| | | public String getUserMoneyDate() {
|
| | | return userMoneyDate;
|
| | | }
|
| | |
|
| | | public void setUserMoneyDate(String userMoneyDate) {
|
| | | this.userMoneyDate = userMoneyDate;
|
| | | }
|
| | |
|
| | | public String getLevelOneId() {
|
| | | return levelOneId;
|
| | | }
|
| | |
|
| | | public void setLevelOneId(String levelOneId) {
|
| | | this.levelOneId = levelOneId;
|
| | | }
|
| | |
|
| | | public String getLevelOneMoney() {
|
| | | return levelOneMoney;
|
| | | }
|
| | |
|
| | | public void setLevelOneMoney(String levelOneMoney) {
|
| | | this.levelOneMoney = levelOneMoney;
|
| | | }
|
| | |
|
| | | public String getLevelTwoId() {
|
| | | return levelTwoId;
|
| | | }
|
| | |
|
| | | public void setLevelTwoId(String levelTwoId) {
|
| | | this.levelTwoId = levelTwoId;
|
| | | }
|
| | |
|
| | | public String getLevelTwoMoney() {
|
| | | return levelTwoMoney;
|
| | | }
|
| | |
|
| | | public void setLevelTwoMoney(String levelTwoMoney) {
|
| | | this.levelTwoMoney = levelTwoMoney;
|
| | | }
|
| | |
|
| | | public String getUserHongBaoType() {
|
| | | return userHongBaoType;
|
| | | }
|
| | |
|
| | | public void setUserHongBaoType(String userHongBaoType) {
|
| | | this.userHongBaoType = userHongBaoType;
|
| | | }
|
| | |
|
| | | }
|