From d88c167fc5973a2c15ff1539e4cdab36e4a7842c Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期三, 28 八月 2019 14:47:15 +0800 Subject: [PATCH] 奖励券使用区分订单下单三方日期 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java | 6 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java | 69 + fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml | 1773 ++++++++++++++++++++-------------------- fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java | 13 fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java | 9 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java | 11 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 100 ++ fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 37 fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml | 38 fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java | 14 fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java | 553 ++++++------ fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java | 10 14 files changed, 1,433 insertions(+), 1,204 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java index a227f4a..30209f2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserCouponController.java @@ -119,13 +119,11 @@ changeJump = true; } - long count = 0; + long count = UserSystemCouponService.countCouponOld(uid); List<UserSystemCouponVO> resultList = UserSystemCouponService .getUserCouponVOList((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, changeJump); - if (resultList != null && resultList.size() > 0) { - count = UserSystemCouponService.countUserCouponList(uid); - } else if (resultList == null) { + if (resultList == null) { resultList = new ArrayList<UserSystemCouponVO>(); } diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java index 9b29dea..e0305c6 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCouponControllerV2.java @@ -2,6 +2,7 @@ import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -15,6 +16,7 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture; import com.yeshi.fanli.entity.bus.user.UserInfoExtra; +import com.yeshi.fanli.entity.order.CommonOrder; import com.yeshi.fanli.exception.user.UserInfoExtraException; import com.yeshi.fanli.exception.user.UserSystemCouponException; import com.yeshi.fanli.log.LogHelper; @@ -27,6 +29,8 @@ import com.yeshi.fanli.service.inter.user.UserLotteryRecordService; import com.yeshi.fanli.service.inter.user.UserSystemCouponService; import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.vo.user.UserSystemCouponVO; import net.sf.json.JSONObject; @@ -169,5 +173,70 @@ out.print(JsonUtil.loadFalseResult(1, e.getMsg())); } } + + + /** + * 鐢ㄦ埛濂栧姳鍒� + * + * @param acceptData + * @param page + * @param uid + * @param out + */ + @RequestMapping(value = "getOrderCouponList", method = RequestMethod.POST) + public void getOrderCouponList(AcceptData acceptData, Long uid, String orderNo, PrintWriter out) { + + if (uid == null || StringUtil.isNullOrEmpty(orderNo)) { + out.print(JsonUtil.loadFalseResult("浼犻�掑弬鏁颁俊鎭笉瀹屾暣")); + return; + } + + + List<CommonOrder> listOrder = commonOrderService.getByOrderNo(uid, orderNo); + if (listOrder == null || listOrder.size() == 0) { + out.print(JsonUtil.loadFalseResult("璁㈠崟鍙蜂笉瀛樺湪")); + return; + } + + boolean valid = false; + long limitDate = TimeUtil.convertDateToTemp("2019-09-01"); + for (CommonOrder commonOrder: listOrder) { + Integer wholeOrder = commonOrder.getStateWholeOrder(); + if (wholeOrder != null && CommonOrder.STATE_WHOLE_ORDER_SHIXIAO == wholeOrder) { + out.print(JsonUtil.loadFalseResult("鏁翠釜璁㈠崟宸插け鏁�")); + return; + } + + Date thirdCreateTime = commonOrder.getThirdCreateTime(); + if (thirdCreateTime != null && thirdCreateTime.getTime() > limitDate) { + valid = true; // 1.6.5涓婄嚎涔嬪悗涓嬪崟 + } + } + + try { + + List<UserSystemCouponVO> resultList = null; + if (valid) { + resultList = UserSystemCouponService.getOrderCouponList(uid); + } else { + resultList = UserSystemCouponService.listIncludeNotExchange(uid); + } + + if (resultList == null) { + resultList = new ArrayList<UserSystemCouponVO>(); + } + + JSONObject data = new JSONObject(); + data.put("helpLink", configService.get("reward_coupon_help")); + data.put("count", resultList.size()); + data.put("result_list", JsonUtil.getApiCommonGson().toJson(resultList)); + out.print(JsonUtil.loadTrueResult(data)); + } catch (UserSystemCouponException e) { + out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg())); + } catch (Exception e) { + out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触")); + LogHelper.errorDetailInfo(e); + } + } } diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java index b276c2e..6198ab8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/CommonOrderMapper.java @@ -1,273 +1,282 @@ -package com.yeshi.fanli.dao.mybatis.order; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -import com.yeshi.fanli.dao.BaseMapper; -import com.yeshi.fanli.entity.order.CommonOrder; -import com.yeshi.fanli.vo.order.CommonOrderVO; - -public interface CommonOrderMapper extends BaseMapper<CommonOrder> { - - /** - * 鏌ヨ鐢ㄦ埛璁㈠崟 骞惰鍗曞彿鍒嗙粍 - * - * @param start - * @param count - * @param uid - * @return - */ - - List<CommonOrderVO> listUserOrder(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid, - @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, - @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime, - @Param("day") Integer day, @Param("source") Integer source); - - /** - * 缁熻鐢ㄦ埛璁㈠崟 骞惰鍗曞彿鍒嗙粍 - * - * @param start - * @param count - * @param uid - * @return - */ - long countUserOrder(@Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, - @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day, - @Param("source") Integer source); - - /** - * 鍒ゆ柇閮ㄥ垎澶辨晥鐘舵�� - * - * @param uid - * @param orderNo - * @return - */ - CommonOrderVO getBuFenOrderState(@Param("uid") Long uid, @Param("orderNo") String orderNo); - - /** - * 鏍规嵁鐢ㄦ埛ID锛岃鍗曠姸鎬佸拰璁㈠崟缁撶畻鏃堕棿缁熻璁㈠崟鐨勬暟閲� - * - * @param uid - * @param state - * @param minDate - * @param maxDate - * @return - */ - long countByUidAndOrderStateWithOrderBalanceTime(@Param("uid") Long uid, @Param("state") int state, - @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); - - /** - * 鏍规嵁璁㈠崟鍙枫�佽鍗曠被鍨嬫煡璇㈠晢鍝� - * - * @param list - * 璁㈠崟瀵硅薄 - * @return - */ - List<CommonOrderVO> listOrderGoodsInfo(List<CommonOrderVO> list); - - /** - * 缁熻鍘嗗彶璁㈠崟鏁伴噺 - * - * @param uid - * @return - */ - Map<String, BigDecimal> countHistoryOrder(@Param("uid") Long uid, @Param("day") Integer day, - @Param("source") Integer source); - - /** - * 鏄ㄦ棩鎬昏鍗�-鏍规嵁绾㈠寘绫诲瀷 鑷喘 閭�璇� 鍒嗕韩 - * - * @param uid - * @return - */ - Map<String, BigDecimal> countByUidAndOrderState(@Param("uid") Long uid, @Param("type") Integer type, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day, - @Param("source") Integer source); - - /** - * 濂栭噾璁㈠崟鏁伴噺 - * - * @param uid - * @return - */ - long countBonusOrderNumber(@Param("uid") Long uid, @Param("type") Integer type, @Param("day") Integer day, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); - - /** - * 濂栭噾缁熻 - * - * @param uid - * @return - */ - BigDecimal countBonusOrderMoney(@Param("uid") Long uid, @Param("type") Integer type, @Param("day") Integer day, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); - - /** - * 濂栭噾缁熻 - * - * @param uid - * @return - */ - Map<String, Object> countBonusOrderMoneyAndNumber(@Param("uid") Long uid, @Param("type") Integer type, - @Param("day") Integer day, @Param("startTime") String startTime, @Param("endTime") String endTime, - @Param("source") Integer source); - - int countByOrderNOAndOrderType(@Param("orderNO") String orderNO, @Param("orderType") int orderType); - - /** - * 鏍规嵁璁㈠崟鍙蜂笌璁㈠崟鎺掑簭鍊艰幏鍙栬鎯� - * - * @param orderNo - * -璁㈠崟鍙� - * @param orderBy - * -璁㈠崟鎺掑簭鍊� - * @param orderType - * -璁㈠崟绫诲瀷 - * @return - */ - CommonOrder selectByOrderNoAndOrderTypeAndOrderBy(@Param("orderNo") String orderNo, - @Param("orderType") int orderType, @Param("orderBy") int orderBy); - - /** - * 璁㈠崟鍒楄〃鏌ヨ - * - * @param start - * @param count - * @param uid - * @param state - * @param type - * @param orderState - * @param startTime - * @param endTime - * @return - */ - List<CommonOrderVO> listQueryByUid(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid, - @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, - @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime, - @Param("day") Integer day); - - /** - * 缁熻 - */ - long countQueryByUid(@Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, - @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day); - - /** - * 璁㈠崟鍒楄〃鏌ヨ - * - * @param start - * @param count - * @param uid - * @param state - * @param type - * @param orderState - * @param startTime - * @param endTime - * @return - */ - List<CommonOrderVO> listQuery(@Param("start") long start, @Param("count") int count, - @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, - @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, - @Param("endTime") String endTime, @Param("source") Integer source); - - /** - * 璁㈠崟鍒楄〃鏌ヨ(涓嶅寘鍚瓙璁㈠崟) - * - * @param start - * @param count - * @param keyType - * @param key - * @param state - * @param type - * @param orderState - * @param startTime - * @param endTime - * @param source - * @return - */ - List<CommonOrderVO> listQueryWithNoChild(@Param("start") long start, @Param("count") int count, - @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, - @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, - @Param("endTime") String endTime, @Param("source") Integer source); - - /** - * 缁熻 - */ - long countQuery(@Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, - @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, - @Param("endTime") String endTime, @Param("source") Integer source); - - long countQueryWithNoChild(@Param("keyType") Integer keyType, @Param("key") String key, - @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, - @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); - - /** - * 鏍规嵁鏉ユ簮绫诲瀷涓庤鍗曞彿鏌ヨ鍒楄〃 - * - * @param sourceType - * @param orderNo - * @return - */ - List<CommonOrder> listBySourceTypeAndOrderNo(@Param("sourceType") int sourceType, @Param("orderNo") String orderNo); - - /** - * 鏌ヨ鍒稿鍔遍噾棰濅互鍙婅鍗曚俊鎭� - * - * @param uid - * @param state - * @param orderNo - * @return - */ - List<CommonOrderVO> getCouponHongbaoByOrderNo(@Param("uid") Long uid, @Param("hongBaoState") Integer hongBaoState, - @Param("orderNo") String orderNo); - - /** - * 鏌ヨ鍒稿鍔遍噾棰濅互鍙婅鍗曚俊鎭� - * - * @param uid - * @param state - * @param orderNo - * @return - */ - CommonOrderVO getCommonOrderByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo, - @Param("orderState") Integer orderState, @Param("sourceType") Integer sourceType); - - /** - * 鏍规嵁鏉ユ簮鍜屼氦鏄揑D鑾峰彇璁㈠崟璇︽儏 - * - * @param sourceType - * @param tradeId - * @return - */ - - CommonOrder selectBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); - - /** - * 鏍规嵁鏉ユ簮鍜屼氦鏄揑D鑾峰彇璁㈠崟鍒楄〃 - * - * @param sourceType - * @param tradeId - * @return - */ - List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); - - /** - * - * @param sourceType - * @param state - * @param minTime - * -鏈�澶у垱寤烘椂闂� - * @param maxTime - * -鏈�灏忓垱寤烘椂闂� - * @return - */ - List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(@Param("sourceType") int sourceType, - @Param("state") Integer state, @Param("minTime") Long minTime, @Param("maxTime") Long maxTime, - @Param("start") long start, @Param("count") int count); +package com.yeshi.fanli.dao.mybatis.order; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.yeshi.fanli.dao.BaseMapper; +import com.yeshi.fanli.entity.order.CommonOrder; +import com.yeshi.fanli.vo.order.CommonOrderVO; + +public interface CommonOrderMapper extends BaseMapper<CommonOrder> { + + /** + * 鏌ヨ鐢ㄦ埛璁㈠崟 骞惰鍗曞彿鍒嗙粍 + * + * @param start + * @param count + * @param uid + * @return + */ + + List<CommonOrderVO> listUserOrder(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid, + @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, + @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("day") Integer day, @Param("source") Integer source); + + /** + * 缁熻鐢ㄦ埛璁㈠崟 骞惰鍗曞彿鍒嗙粍 + * + * @param start + * @param count + * @param uid + * @return + */ + long countUserOrder(@Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, + @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day, + @Param("source") Integer source); + + /** + * 鍒ゆ柇閮ㄥ垎澶辨晥鐘舵�� + * + * @param uid + * @param orderNo + * @return + */ + CommonOrderVO getBuFenOrderState(@Param("uid") Long uid, @Param("orderNo") String orderNo); + + /** + * 鏍规嵁鐢ㄦ埛ID锛岃鍗曠姸鎬佸拰璁㈠崟缁撶畻鏃堕棿缁熻璁㈠崟鐨勬暟閲� + * + * @param uid + * @param state + * @param minDate + * @param maxDate + * @return + */ + long countByUidAndOrderStateWithOrderBalanceTime(@Param("uid") Long uid, @Param("state") int state, + @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); + + /** + * 鏍规嵁璁㈠崟鍙枫�佽鍗曠被鍨嬫煡璇㈠晢鍝� + * + * @param list + * 璁㈠崟瀵硅薄 + * @return + */ + List<CommonOrderVO> listOrderGoodsInfo(List<CommonOrderVO> list); + + /** + * 缁熻鍘嗗彶璁㈠崟鏁伴噺 + * + * @param uid + * @return + */ + Map<String, BigDecimal> countHistoryOrder(@Param("uid") Long uid, @Param("day") Integer day, + @Param("source") Integer source); + + /** + * 鏄ㄦ棩鎬昏鍗�-鏍规嵁绾㈠寘绫诲瀷 鑷喘 閭�璇� 鍒嗕韩 + * + * @param uid + * @return + */ + Map<String, BigDecimal> countByUidAndOrderState(@Param("uid") Long uid, @Param("type") Integer type, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day, + @Param("source") Integer source); + + /** + * 濂栭噾璁㈠崟鏁伴噺 + * + * @param uid + * @return + */ + long countBonusOrderNumber(@Param("uid") Long uid, @Param("type") Integer type, @Param("day") Integer day, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); + + /** + * 濂栭噾缁熻 + * + * @param uid + * @return + */ + BigDecimal countBonusOrderMoney(@Param("uid") Long uid, @Param("type") Integer type, @Param("day") Integer day, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); + + /** + * 濂栭噾缁熻 + * + * @param uid + * @return + */ + Map<String, Object> countBonusOrderMoneyAndNumber(@Param("uid") Long uid, @Param("type") Integer type, + @Param("day") Integer day, @Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("source") Integer source); + + int countByOrderNOAndOrderType(@Param("orderNO") String orderNO, @Param("orderType") int orderType); + + /** + * 鏍规嵁璁㈠崟鍙蜂笌璁㈠崟鎺掑簭鍊艰幏鍙栬鎯� + * + * @param orderNo + * -璁㈠崟鍙� + * @param orderBy + * -璁㈠崟鎺掑簭鍊� + * @param orderType + * -璁㈠崟绫诲瀷 + * @return + */ + CommonOrder selectByOrderNoAndOrderTypeAndOrderBy(@Param("orderNo") String orderNo, + @Param("orderType") int orderType, @Param("orderBy") int orderBy); + + /** + * 璁㈠崟鍒楄〃鏌ヨ + * + * @param start + * @param count + * @param uid + * @param state + * @param type + * @param orderState + * @param startTime + * @param endTime + * @return + */ + List<CommonOrderVO> listQueryByUid(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid, + @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, + @Param("orderNo") String orderNo, @Param("startTime") String startTime, @Param("endTime") String endTime, + @Param("day") Integer day); + + /** + * 缁熻 + */ + long countQueryByUid(@Param("uid") Long uid, @Param("state") Integer state, @Param("type") Integer type, + @Param("orderState") Integer orderState, @Param("orderNo") String orderNo, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("day") Integer day); + + /** + * 璁㈠崟鍒楄〃鏌ヨ + * + * @param start + * @param count + * @param uid + * @param state + * @param type + * @param orderState + * @param startTime + * @param endTime + * @return + */ + List<CommonOrderVO> listQuery(@Param("start") long start, @Param("count") int count, + @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, + @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, + @Param("endTime") String endTime, @Param("source") Integer source); + + /** + * 璁㈠崟鍒楄〃鏌ヨ(涓嶅寘鍚瓙璁㈠崟) + * + * @param start + * @param count + * @param keyType + * @param key + * @param state + * @param type + * @param orderState + * @param startTime + * @param endTime + * @param source + * @return + */ + List<CommonOrderVO> listQueryWithNoChild(@Param("start") long start, @Param("count") int count, + @Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, + @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, + @Param("endTime") String endTime, @Param("source") Integer source); + + /** + * 缁熻 + */ + long countQuery(@Param("keyType") Integer keyType, @Param("key") String key, @Param("state") Integer state, + @Param("type") Integer type, @Param("orderState") Integer orderState, @Param("startTime") String startTime, + @Param("endTime") String endTime, @Param("source") Integer source); + + long countQueryWithNoChild(@Param("keyType") Integer keyType, @Param("key") String key, + @Param("state") Integer state, @Param("type") Integer type, @Param("orderState") Integer orderState, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("source") Integer source); + + /** + * 鏍规嵁鏉ユ簮绫诲瀷涓庤鍗曞彿鏌ヨ鍒楄〃 + * + * @param sourceType + * @param orderNo + * @return + */ + List<CommonOrder> listBySourceTypeAndOrderNo(@Param("sourceType") int sourceType, @Param("orderNo") String orderNo); + + /** + * 鏌ヨ鍒稿鍔遍噾棰濅互鍙婅鍗曚俊鎭� + * + * @param uid + * @param state + * @param orderNo + * @return + */ + List<CommonOrderVO> getCouponHongbaoByOrderNo(@Param("uid") Long uid, @Param("hongBaoState") Integer hongBaoState, + @Param("orderNo") String orderNo); + + /** + * 鏌ヨ鍒稿鍔遍噾棰濅互鍙婅鍗曚俊鎭� + * + * @param uid + * @param state + * @param orderNo + * @return + */ + CommonOrderVO getCommonOrderByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo, + @Param("orderState") Integer orderState, @Param("sourceType") Integer sourceType); + + /** + * 鏍规嵁鏉ユ簮鍜屼氦鏄揑D鑾峰彇璁㈠崟璇︽儏 + * + * @param sourceType + * @param tradeId + * @return + */ + + CommonOrder selectBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); + + /** + * 鏍规嵁鏉ユ簮鍜屼氦鏄揑D鑾峰彇璁㈠崟鍒楄〃 + * + * @param sourceType + * @param tradeId + * @return + */ + List<CommonOrder> listBySourceTypeAndTradeId(@Param("sourceType") int sourceType, @Param("tradeId") String tradeId); + + /** + * + * @param sourceType + * @param state + * @param minTime + * -鏈�澶у垱寤烘椂闂� + * @param maxTime + * -鏈�灏忓垱寤烘椂闂� + * @return + */ + List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(@Param("sourceType") int sourceType, + @Param("state") Integer state, @Param("minTime") Long minTime, @Param("maxTime") Long maxTime, + @Param("start") long start, @Param("count") int count); + + + /** + * 鏍规嵁璁㈠崟鍙锋煡璇� + * @param orderNO + * @return + */ + List<CommonOrder> getByOrderNo(@Param("uid") Long uid, @Param("orderNo") String orderNo); + } \ No newline at end of file diff --git a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java index de5369c..a0ebf86 100644 --- a/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java +++ b/fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponMapper.java @@ -14,6 +14,13 @@ List<UserSystemCoupon> getUserCouponList(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid); + + List<UserSystemCouponVO> getCouponListOld(@Param("start") long start, @Param("count") int count, + @Param("uid") Long uid); + + long countCouponOld(@Param("uid") Long uid); + + List<UserSystemCouponVO> getUserCouponVOList(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid); @@ -71,7 +78,7 @@ * @param source * @return */ - List<UserSystemCoupon> getIncludeExchange(@Param("uid") Long uid, @Param("list") List<String> list); + List<UserSystemCoupon> getIncludeExchange(@Param("uid") Long uid, @Param("num") int num, @Param("type") String type); /** @@ -80,6 +87,6 @@ * @param source * @return */ - List<UserSystemCoupon> getIncludeNotExchange(@Param("uid") Long uid,@Param("list") List<String> list); + List<UserSystemCouponVO> getIncludeNotExchange(@Param("uid") Long uid,@Param("num") int num, @Param("type") String type); } \ No newline at end of file diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml index 38fb849..7e1fceb 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml @@ -1,884 +1,889 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper"> - <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> - <id column="co_id" property="id" jdbcType="BIGINT" /> - <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> - <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> - <result column="co_source_position" property="sourcePosition" - jdbcType="VARCHAR" /> - <result column="co_count" property="count" jdbcType="INTEGER" /> - <result column="co_state" property="state" jdbcType="INTEGER" /> - <result column="co_state_whole_order" property="stateWholeOrder" - jdbcType="INTEGER" /> - <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> - <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> - <result column="co_payment" property="payment" jdbcType="DECIMAL" /> - <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> - <result column="co_third_create_time" property="thirdCreateTime" - jdbcType="TIMESTAMP" /> - <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> - <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> - <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> - <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> - <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> - <association property="userInfo" column="co_uid" - javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> - <id column="co_uid" property="id" jdbcType="BIGINT" /> - </association> - <association property="commonOrderGoods" column="co_order_goods_id" - javaType="com.yeshi.fanli.entity.order.CommonOrderGoods"> - <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> - </association> - - </resultMap> - <resultMap id="BaseDetailResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> - <id column="co_id" property="id" jdbcType="BIGINT" /> - <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> - <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> - <result column="co_source_position" property="sourcePosition" - jdbcType="VARCHAR" /> - <result column="co_count" property="count" jdbcType="INTEGER" /> - <result column="co_state" property="state" jdbcType="INTEGER" /> - <result column="co_state_whole_order" property="stateWholeOrder" - jdbcType="INTEGER" /> - <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> - <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> - <result column="co_payment" property="payment" jdbcType="DECIMAL" /> - <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> - <result column="co_third_create_time" property="thirdCreateTime" - jdbcType="TIMESTAMP" /> - <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> - <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> - <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> - <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> - <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> - <association property="userInfo" column="co_uid" - javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> - <id column="co_uid" property="id" jdbcType="BIGINT" /> - </association> - <association property="commonOrderGoods" - resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> - </resultMap> - <resultMap id="ResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> - <id column="co_id" property="id" jdbcType="BIGINT" /> - <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> - <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> - <result column="co_source_position" property="sourcePosition" - jdbcType="VARCHAR" /> - <result column="co_count" property="count" jdbcType="INTEGER" /> - <result column="co_state" property="state" jdbcType="INTEGER" /> - <result column="co_state_whole_order" property="stateWholeOrder" - jdbcType="INTEGER" /> - <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> - <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> - <result column="co_payment" property="payment" jdbcType="DECIMAL" /> - <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> - <result column="co_third_create_time" property="thirdCreateTime" - jdbcType="TIMESTAMP" /> - <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> - <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> - <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> - <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> - <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> - <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" /> - <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> - <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> - <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> - <result column="preAccountTime" property="preAccountTime" - jdbcType="TIMESTAMP" /> - <result column="totalCount" property="totalCount" jdbcType="INTEGER" /> - <result column="totalSettlement" property="totalSettlement" - jdbcType="DECIMAL" /> - <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" /> - <result column="userId" property="userId" jdbcType="VARCHAR" /> - <result column="userName" property="userName" jdbcType="VARCHAR" /> - <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> - - <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> - - <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> - - <association property="userInfo" column="co_uid" - resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> - - <association property="commonOrderGoods" column="co_order_goods_id" - resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> - - </resultMap> - - - <resultMap id="ThreeResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> - <id column="co_id" property="id" jdbcType="BIGINT" /> - <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> - <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> - <result column="co_source_position" property="sourcePosition" - jdbcType="VARCHAR" /> - <result column="co_count" property="count" jdbcType="INTEGER" /> - <result column="co_state" property="state" jdbcType="INTEGER" /> - <result column="co_state_whole_order" property="stateWholeOrder" - jdbcType="INTEGER" /> - <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> - <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> - <result column="co_payment" property="payment" jdbcType="DECIMAL" /> - <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> - <result column="co_third_create_time" property="thirdCreateTime" - jdbcType="TIMESTAMP" /> - <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> - <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> - <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> - <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> - <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> - <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" /> - <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> - <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> - <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> - <result column="preAccountTime" property="preAccountTime" - jdbcType="TIMESTAMP" /> - <result column="totalCount" property="totalCount" jdbcType="INTEGER" /> - <result column="totalSettlement" property="totalSettlement" - jdbcType="DECIMAL" /> - <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" /> - <result column="userId" property="userId" jdbcType="VARCHAR" /> - <result column="userName" property="userName" jdbcType="VARCHAR" /> - <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> - <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> - <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> - - <association property="userInfo" column="co_uid" - select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey"/> - - <association property="commonOrderGoods" column="co_order_goods_id" - select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey"/> - </resultMap> - - <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id - </sql> - <select id="selectByPrimaryKey" resultMap="BaseResultMap" - parameterType="java.lang.Long"> - select - <include refid="Base_Column_List" /> - from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} - </select> - <select id="countByOrderNOAndOrderType" resultType="java.lang.Integer">select - count(co_id) from yeshi_ec_common_order where co_order_no=#{orderNO} - and co_source_type=#{orderType} - </select> - <select id="selectByOrderNoAndOrderTypeAndOrderBy" resultMap="BaseResultMap">select - * from yeshi_ec_common_order where co_order_no=#{orderNo} and - co_source_type=#{orderType} and co_order_by=#{orderBy} - </select> - <select id="countByUidAndOrderStateWithOrderBalanceTime" - resultType="java.lang.Long">SELECT COUNT(*) FROM yeshi_ec_common_order co WHERE - co.`co_state`=#{state} and co.`co_uid`=#{uid} and co.`co_settle_time` - is not null and co.`co_settle_time`>=#{minDate} and - #{maxDate}>co.`co_settle_time`</select> - <select id="listBySourceTypeAndOrderNo" resultMap="BaseResultMap">SELECT * FROM - yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and - co_order_no=#{orderNo} - </select> - - - <select id="selectBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * - FROM - yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and - co_trade_id=#{tradeId} limit 1 - </select> - - <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * - FROM - yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and - co_trade_id=#{tradeId} - </select> - - - - <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap">SELECT * - FROM - yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} - - <if test="state!=null"> - and co_state=#{state} - </if> - - <if test="minTime!=null"> - and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime} - </if> - - - <if test="maxTime!=null"> - and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000 - </if> - - order by co_id desc - limit #{start},#{count} - </select> - - - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from - yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} - </delete> - <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" - useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order - (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id) - values - (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR}) - </insert> - <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" - useGeneratedKeys="true" keyProperty="id"> - insert into yeshi_ec_common_order - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null">co_id,</if> - <if test="userInfo != null">co_uid,</if> - <if test="orderNo != null">co_order_no,</if> - <if test="sourceType != null">co_source_type,</if> - <if test="sourcePosition != null">co_source_position,</if> - <if test="commonOrderGoods != null">co_order_goods_id,</if> - <if test="count != null">co_count,</if> - <if test="state != null">co_state,</if> - <if test="stateWholeOrder != null">co_state_whole_order,</if> - <if test="estimate != null">co_estimate,</if> - <if test="eIncome != null">co_eIncome,</if> - <if test="payment != null">co_payment,</if> - <if test="settlement != null">co_settlement,</if> - <if test="thirdCreateTime != null">co_third_create_time,</if> - <if test="settleTime != null">co_settle_time,</if> - <if test="orderBy != null">co_order_by,</if> - <if test="createTime != null">co_create_time,</if> - <if test="updateTime != null">co_update_time,</if> - <if test="tradeId != null">co_trade_id,</if> - </trim> - values - <trim prefix="(" suffix=")" suffixOverrides=","> - <if test="id != null">#{id,jdbcType=BIGINT},</if> - <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> - <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> - <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> - <if test="sourcePosition != null">#{sourcePosition,jdbcType=VARCHAR},</if> - <if test="commonOrderGoods != null">#{commonOrderGoods.id,jdbcType=BIGINT},</if> - <if test="count != null">#{count,jdbcType=INTEGER},</if> - <if test="state != null">#{state,jdbcType=INTEGER},</if> - <if test="stateWholeOrder != null">#{stateWholeOrder,jdbcType=INTEGER},</if> - <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if> - <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if> - <if test="payment != null">#{payment,jdbcType=DECIMAL},</if> - <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if> - <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> - <if test="settleTime != null">#{settleTime,jdbcType=TIMESTAMP},</if> - <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> - <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> - <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> - <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if> - </trim> - </insert> - <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update - yeshi_ec_common_order set co_uid = - #{userInfo.id,jdbcType=BIGINT},co_order_no = - #{orderNo,jdbcType=VARCHAR},co_source_type = - #{sourceType,jdbcType=INTEGER},co_source_position = - #{sourcePosition,jdbcType=VARCHAR},co_order_goods_id = - #{commonOrderGoods.id,jdbcType=BIGINT},co_count = - #{count,jdbcType=INTEGER},co_state = - #{state,jdbcType=INTEGER},co_state_whole_order = - #{stateWholeOrder,jdbcType=INTEGER},co_estimate = - #{estimate,jdbcType=DECIMAL},co_eIncome = - #{eIncome,jdbcType=DECIMAL},co_payment = - #{payment,jdbcType=DECIMAL},co_settlement = - #{settlement,jdbcType=DECIMAL},co_third_create_time = - #{thirdCreateTime,jdbcType=TIMESTAMP},co_settle_time = - #{settleTime,jdbcType=TIMESTAMP},co_order_by = - #{orderBy,jdbcType=INTEGER},co_create_time = - #{createTime,jdbcType=TIMESTAMP},co_update_time = - #{updateTime,jdbcType=TIMESTAMP} ,co_trade_id - =#{tradeId,jdbcType=VARCHAR} where co_id = #{id,jdbcType=BIGINT} - </update> - <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"> - update yeshi_ec_common_order - <set> - <if test="userInfo != null">co_uid=#{userInfo.id,jdbcType=BIGINT},</if> - <if test="orderNo != null">co_order_no=#{orderNo,jdbcType=VARCHAR},</if> - <if test="sourceType != null">co_source_type=#{sourceType,jdbcType=INTEGER},</if> - <if test="sourcePosition != null">co_source_position=#{sourcePosition,jdbcType=VARCHAR}, - </if> - <if test="commonOrderGoods != null">co_order_goods_id=#{commonOrderGoods.id,jdbcType=BIGINT}, - </if> - <if test="count != null">co_count=#{count,jdbcType=INTEGER},</if> - <if test="state != null">co_state=#{state,jdbcType=INTEGER},</if> - <if test="stateWholeOrder != null">co_state_whole_order=#{stateWholeOrder,jdbcType=INTEGER}, - </if> - <if test="estimate != null">co_estimate=#{estimate,jdbcType=DECIMAL},</if> - <if test="eIncome != null">co_eIncome=#{eIncome,jdbcType=DECIMAL},</if> - <if test="payment != null">co_payment=#{payment,jdbcType=DECIMAL},</if> - <if test="settlement != null">co_settlement=#{settlement,jdbcType=DECIMAL},</if> - <if test="thirdCreateTime != null">co_third_create_time=#{thirdCreateTime,jdbcType=TIMESTAMP}, - </if> - <if test="settleTime != null">co_settle_time=#{settleTime,jdbcType=TIMESTAMP},</if> - <if test="orderBy != null">co_order_by=#{orderBy,jdbcType=INTEGER},</if> - <if test="createTime != null">co_create_time=#{createTime,jdbcType=TIMESTAMP},</if> - <if test="updateTime != null">co_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> - <if test="id !=null">co_id =#{id,jdbcType=BIGINT},</if> - <if test="tradeId !=null">co_trade_id =#{tradeId,jdbcType=VARCHAR},</if> - </set> - where co_id = #{id,jdbcType=BIGINT} - </update> - <sql id="SELECT_PARAM_ORDER_STATE"> - <if test="orderState != null and orderState == 1"> - <!-- 鏈夋晥璁㈠崟: 鏁翠釜璁㈠崟鏈夋晥 --> - AND <![CDATA[co.`co_state` <> 3]]> - AND (co.co_state_whole_order = 1 or co.co_state_whole_order = 2) - </if> - <if test="orderState != null and orderState == 2"> - AND co.co_state = 3 - <!-- 缁存潈璁㈠崟 --> - </if> - <if test="orderState != null and orderState == 3"> - <!-- 鏁翠釜璁㈠崟澶辨晥 --> - AND co.co_state_whole_order = 3 - </if> - <if test="orderState != null and orderState == 4"> - <!-- 宸叉敹璐ц鍗� --> - AND co.co_state = 2 - </if> - </sql> - <sql id="SELECT_PARAM_ORDER_CREATE_TIME"> - <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> - </if> - <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> - </if> - <if test="day != null and day == 1"> - <!-- 浠婂ぉ --> - 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_third_create_time`) = 1 - </if> - <if test="day != null and day == 3"> - <!-- 鏈湀 --> - 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_settle_time`, '%Y%m')) = 1 - </if> - </sql> - <sql id="SELECT_PARAM_HONGBAO_TYPE"> - <if test="type != null and type == 1"> - <!-- 鑷喘璁㈠崟 --> - AND (v2.hb_type =1 or v2.hb_type =2) - </if> - <if test="type != null and type == 2"> - <!-- 鍒嗕韩璁㈠崟 --> - AND v2.`hb_type` = 20 - </if> - <if test="type != null and type == 3"> - <!-- 閭�璇疯鍗� --> - AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR - v2.`hb_type` = 21 OR v2.`hb_type` = 22) - </if> - </sql> - <sql id="SELECT_PARAM_HONGBAO_STATE"> - <if test="state != null and state == 1"> - <!-- 鏈埌璐� --> - AND (hb.hb_state = 1 or hb.hb_state = 2) - </if> - <if test="state != null and state == 2"> - <!-- 宸插埌璐� --> - AND hb.hb_state = 3 - </if> - <if test="state != null and state == 3"> - <!-- 绾㈠寘宸插け鏁堛�佹暣涓鍗曞け鏁� --> - AND hb.hb_state =4 AND co.co_state_whole_order = 3 - </if> - </sql> - <sql id="Hongbao_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_type,hb_state,hb_pre_get_time,hb_get_time,hb_version, - IF(v2.`hb_state` = 4, 0, v2.hb_money)AS hb_money - </sql> - <sql id="Order_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position, - co_order_goods_id,co_count,co_state,co_state_whole_order, - co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time, - MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time, - co_update_time - </sql> - - <select id="listUserOrder" resultMap="ResultMap"> - <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> - SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS - hongBaoState, hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS - accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, - <include refid="Order_Column_List" /> - FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT - <include refid="Hongbao_Column_List" /> - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏃堕棿 --> - <include refid="SELECT_PARAM_HONGBAO_STATE" /> - <!-- 璁㈠崟鍙锋煡璇� --> - <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - - GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY - co.co_third_create_time DESC LIMIT ${start},${count} - </select> - - <select id="countUserOrder" resultType="java.lang.Long"> - <!-- 缁熻鐢ㄦ埛璁㈠崟鏁伴噺 --> - SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM - yeshi_ec_hongbao_order ho LEFT JOIN (SELECT - <include refid="Hongbao_Column_List" /> - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏃堕棿 --> - <include refid="SELECT_PARAM_HONGBAO_STATE" /> - <!-- 璁㈠崟鍙锋煡璇� --> - <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - - GROUP BY co.`co_order_no`, co.`co_source_type` )A - </select> - <select id="listOrderGoodsInfo" resultMap="ResultMap" - parameterType="java.util.List"> - <!-- 鏌ヨ鐢ㄦ埛璁㈠崟鍟嗗搧淇℃伅 --> - SELECT COALESCE(SUM(tc.`co_payment`),0)AS - totalPayment,COALESCE(SUM(tc.`co_settlement`),0)AS totalSettlement, - COALESCE(SUM(tc.`co_count`),0)AS - totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.*,tc.co_id FROM - yeshi_ec_common_order_goods tg LEFT JOIN yeshi_ec_common_order tc ON - tc.`co_order_goods_id` = tg.`cog_id` WHERE - <foreach collection="list" item="item" separator=" OR ">(tc.`co_source_type` - = #{item.sourceType,jdbcType=INTEGER} AND tc.`co_order_no` = - #{item.orderNo,jdbcType=VARCHAR}) - </foreach> - GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` - </select> - - - <select id="countHistoryOrder" resultType="java.util.HashMap"> - <!-- 缁熻鍘嗗彶璁㈠崟鏁伴噺 --> - SELECT SUM(A.self)AS totalSelf,SUM(A.shared)AS - totalShared,SUM(A.invite)AS totalInvite FROM ( - <!-- 杩斿埄璁㈠崟 --> - SELECT IFNULL(COUNT(ho_id),0) AS self,0 AS shared,0 AS invite FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND - (v2.`hb_type` = 1 OR v2.`hb_type` = 2) ) hb ON - hb.hb_id=ho.`ho_hongbao_id` - <!-- 鑷喘璁㈠崟 --> - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 - <if test="day != null and day == 1"> - <!-- 浠婂ぉ --> - 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_third_create_time) = 1 - </if> - <if test="day != null and day == 3"> - <!-- 鏈湀 --> - 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_settle_time`, '%Y%m')) = 1 - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - - GROUP BY co.`co_order_no`, co.`co_source_type`)YX - - UNION ALL - - <!-- 鍒嗕韩璁㈠崟 --> - SELECT 0 AS self,IFNULL(COUNT(ho_id),0) AS shared,0 AS invite FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` - = 20 ) hb ON hb.hb_id=ho.`ho_hongbao_id` - <!-- 鍒嗕韩璁㈠崟 --> - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 - <if test="day != null and day == 1"> - <!-- 浠婂ぉ --> - 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_third_create_time`) = 1 - </if> - <if test="day != null and day == 3"> - <!-- 鏈湀 --> - 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_settle_time`, '%Y%m')) = 1 - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - - GROUP BY co.`co_order_no`, co.`co_source_type`)WQ - - UNION ALL - - <!-- 閭�璇疯鍗� --> - SELECT 0 AS self,0 AS shared,IFNULL(COUNT(ho_id),0) AS invite FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND - (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR - v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) ) hbp ON - hbp.hb_pid=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON - co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL and hbp.hb_state!=4 - <if test="day != null and day == 1"> - <!-- 浠婂ぉ --> - 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_third_create_time`) = 1 - </if> - <if test="day != null and day == 3"> - <!-- 鏈湀 --> - 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_settle_time`, '%Y%m')) = 1 - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - - GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A - </select> - - - <select id="countByUidAndOrderState" resultType="java.util.HashMap"> - SELECT SUM(A.valid)AS totalValid, SUM(A.proces)AS - totalProces,SUM(A.Invalid)AS totalInvite FROM ( - <!-- 鏈夋晥璁㈠崟 --> - SELECT IFNULL(COUNT(ho_id),0) AS valid,0 AS proces,0 AS Invalid FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL <![CDATA[AND co.`co_state` <> 3]]> - AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - GROUP BY co.`co_order_no`, co.`co_source_type`)YX - - UNION ALL - - <!-- 缁存潈璁㈠崟 --> - SELECT 0 AS valid,IFNULL(COUNT(ho_id),0) AS proces,0 AS Invalid FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL AND co.`co_state` = 3 - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - GROUP BY co.`co_order_no`, co.`co_source_type`)WQ - - UNION ALL - - <!-- 澶辨晥璁㈠崟 --> - SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(ho_id),0) AS Invalid FROM - (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL AND co.`co_state_whole_order` = 3 - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A - </select> - <select id="countBonusOrderNumber" resultType="java.lang.Long"> - <!-- 濂栭噾缁熻锛氳鍗曟暟閲� --> - SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.`ho_id` FROM - yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * FROM - yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - GROUP BY co.`co_order_no`, co.`co_source_type` )A - </select> - <select id="countBonusOrderMoney" resultType="java.math.BigDecimal"> - <!-- 濂栭噾缁熻锛氳鍗曟�昏繑鍒╅噾棰� 鍘绘帀宸插け鏁� --> - SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalmoney FROM - yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT - <include refid="Hongbao_Column_List" /> - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) ) hb ON - IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN - yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE hb.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> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - </select> - <select id="countBonusOrderMoneyAndNumber" resultType="java.util.HashMap"> - SELECT COUNT(*) AS totalNum, CAST(SUM(moneys) AS DECIMAL(19,2)) AS - totalmoney FROM (SELECT CAST(SUM(hb.`hb_money`) AS DECIMAL(19,2))AS - moneys FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT - <include refid="Hongbao_Column_List" /> - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) ) hb ON - IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN - yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE hb.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> <!-- 涓婃湀 :缁熻宸叉敹璐� --> - <if test="source != null">AND co.co_source_type = #{source}</if> - GROUP BY co.`co_order_no`, co.`co_source_type` )A - </select> - <sql id="SELECT_HONGBAO_STATE"> - <if test="state != null and state == 1"> - <!-- 鏈埌璐� --> - AND (v2.hb_state = 1 or v2.hb_state = 2) - </if> - <if test="state != null and state == 2"> - <!-- 宸插埌璐� --> - AND v2.hb_state = 3 - </if> - <if test="state != null and state == 3"> - <!-- 绾㈠寘宸插け鏁� --> - AND v2.hb_state =4 - </if> - </sql> - <select id="listQueryByUid" resultMap="ResultMap"> - <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> - SELECT hb.`hb_money` AS totalMoney, hb.hb_state AS hongBaoState, - hb.`hb_type` AS hongBaoType, hb.`hb_get_time` AS accountTime, - hb.`hb_pre_get_time` AS preAccountTime, co.*,cog.* FROM - yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 - v2 WHERE v2.`hb_uid`= #{uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` LEFT - JOIN yeshi_ec_common_order_goods cog ON cog.`cog_id`= - co.`co_order_goods_id` WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏃堕棿 --> - <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> - ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} - </select> - <select id="countQueryByUid" resultType="java.lang.Long"> - <!-- 缁熻鐢ㄦ埛璁㈠崟鏁伴噺 --> - SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM - yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 - v2 WHERE v2.`hb_uid`= #{uid} - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> - <!-- 璁㈠崟鏃堕棿 --> - <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> - )A - </select> - <select id="getBuFenOrderState" resultMap="ResultMap">SELECT - co.co_state,v2.`hb_state` AS hongBaoState FROM `yeshi_ec_common_order` - co LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` - LEFT JOIN yeshi_ec_hongbao_v2 v2 ON IF(v2.hb_pid IS - NULL,v2.hb_id,v2.hb_pid)=ho.`ho_hongbao_id` WHERE co.`co_order_no` = - #{orderNo} AND co.co_state<![CDATA[<>]]> - 4 AND v2.hb_uid = #{uid} ORDER BY co.`co_state` DESC LIMIT 1 - </select> - <select id="listQuery" resultMap="ThreeResultMap"> - SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS - userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS - totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, - hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS - preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN - (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> - </if> - <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> - </if> - <if test="key != null and key != '' "> - <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> - <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT - JOIN yeshi_ec_user u ON u.id = A.hb_uid - </select> - - - <select id="listQueryWithNoChild" resultMap="ThreeResultMap"> - SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS - userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS - totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, - hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS - preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN - (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON hb.hb_id=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> - </if> - <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> - </if> - <if test="key != null and key != '' "> - <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> - <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT - JOIN yeshi_ec_user u ON u.id = A.hb_uid - </select> - - - <select id="countQuery" resultType="java.lang.Long"> - SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN - (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> - </if> - <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> - </if> - <if test="key != null and key != '' "> - <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> - <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - </select> - - - <select id="countQueryWithNoChild" resultType="java.lang.Long"> - SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN - (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 - <include refid="SELECT_PARAM_HONGBAO_TYPE" /> - <!-- 绾㈠寘绫诲瀷 --> - <include refid="SELECT_HONGBAO_STATE" /> - <!-- 绾㈠寘鐘舵�� --> - )hb ON hb.hb_id=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL - <include refid="SELECT_PARAM_ORDER_STATE" /> - <!-- 璁㈠崟鐘舵�� --> - <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> - </if> - <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> - </if> - <if test="key != null and key != '' "> - <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> - <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> - </if> - <!-- 璁㈠崟鏉ユ簮 --> - <if test="source != null">AND co.co_source_type = #{source}</if> - </select> - - - - - <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap"> - SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney, - COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney, - hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS accountTime, - MAX(hb.`hb_pre_get_time`) AS preAccountTime, hb.hb_state AS - hongBaoState, - <include refid="Order_Column_List" /> - FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM - yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} - <if test="hongBaoState != null">AND v2.`hb_state` = #{hongBaoState}</if> - )hb ON hb.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order - co ON co.`co_id`=ho.`ho_order_id` WHERE hb.hb_id IS NOT NULL AND - co.co_order_no = #{orderNo} - </select> - <select id="getCommonOrderByOrderNo" resultMap="ResultMap"> - <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> - SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, - COALESCE(SUM(co.`co_payment`),0)AS totalPayment, hb.hb_state AS - hongBaoState, hb.`hb_type` AS hongBaoType, - <include refid="Order_Column_List" /> - FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT - <include refid="Hongbao_Column_List" /> - FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> - )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` - LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` - WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} AND co.`co_source_type` = #{sourceType} - <if test="orderState != null"> - AND co.co_state = #{orderState} - <!-- 宸叉敹璐� --> - </if> - GROUP BY co.`co_order_no`, co.`co_source_type` - </select> -</mapper> +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper"> + <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> + <id column="co_id" property="id" jdbcType="BIGINT" /> + <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> + <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> + <result column="co_source_position" property="sourcePosition" + jdbcType="VARCHAR" /> + <result column="co_count" property="count" jdbcType="INTEGER" /> + <result column="co_state" property="state" jdbcType="INTEGER" /> + <result column="co_state_whole_order" property="stateWholeOrder" + jdbcType="INTEGER" /> + <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> + <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> + <result column="co_payment" property="payment" jdbcType="DECIMAL" /> + <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> + <result column="co_third_create_time" property="thirdCreateTime" + jdbcType="TIMESTAMP" /> + <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> + <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> + <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> + <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> + <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> + <association property="userInfo" column="co_uid" + javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> + <id column="co_uid" property="id" jdbcType="BIGINT" /> + </association> + <association property="commonOrderGoods" column="co_order_goods_id" + javaType="com.yeshi.fanli.entity.order.CommonOrderGoods"> + <id column="co_order_goods_id" property="id" jdbcType="BIGINT" /> + </association> + + </resultMap> + <resultMap id="BaseDetailResultMap" type="com.yeshi.fanli.entity.order.CommonOrder"> + <id column="co_id" property="id" jdbcType="BIGINT" /> + <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> + <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> + <result column="co_source_position" property="sourcePosition" + jdbcType="VARCHAR" /> + <result column="co_count" property="count" jdbcType="INTEGER" /> + <result column="co_state" property="state" jdbcType="INTEGER" /> + <result column="co_state_whole_order" property="stateWholeOrder" + jdbcType="INTEGER" /> + <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> + <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> + <result column="co_payment" property="payment" jdbcType="DECIMAL" /> + <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> + <result column="co_third_create_time" property="thirdCreateTime" + jdbcType="TIMESTAMP" /> + <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> + <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> + <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> + <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> + <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> + <association property="userInfo" column="co_uid" + javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> + <id column="co_uid" property="id" jdbcType="BIGINT" /> + </association> + <association property="commonOrderGoods" + resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> + </resultMap> + <resultMap id="ResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> + <id column="co_id" property="id" jdbcType="BIGINT" /> + <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> + <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> + <result column="co_source_position" property="sourcePosition" + jdbcType="VARCHAR" /> + <result column="co_count" property="count" jdbcType="INTEGER" /> + <result column="co_state" property="state" jdbcType="INTEGER" /> + <result column="co_state_whole_order" property="stateWholeOrder" + jdbcType="INTEGER" /> + <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> + <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> + <result column="co_payment" property="payment" jdbcType="DECIMAL" /> + <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> + <result column="co_third_create_time" property="thirdCreateTime" + jdbcType="TIMESTAMP" /> + <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> + <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> + <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> + <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> + <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> + <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" /> + <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> + <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> + <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> + <result column="preAccountTime" property="preAccountTime" + jdbcType="TIMESTAMP" /> + <result column="totalCount" property="totalCount" jdbcType="INTEGER" /> + <result column="totalSettlement" property="totalSettlement" + jdbcType="DECIMAL" /> + <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" /> + <result column="userId" property="userId" jdbcType="VARCHAR" /> + <result column="userName" property="userName" jdbcType="VARCHAR" /> + <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> + + <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> + + <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> + + <association property="userInfo" column="co_uid" + resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap" /> + + <association property="commonOrderGoods" column="co_order_goods_id" + resultMap="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.BaseResultMap" /> + + </resultMap> + + + <resultMap id="ThreeResultMap" type="com.yeshi.fanli.vo.order.CommonOrderVO"> + <id column="co_id" property="id" jdbcType="BIGINT" /> + <result column="co_order_no" property="orderNo" jdbcType="VARCHAR" /> + <result column="co_source_type" property="sourceType" jdbcType="INTEGER" /> + <result column="co_source_position" property="sourcePosition" + jdbcType="VARCHAR" /> + <result column="co_count" property="count" jdbcType="INTEGER" /> + <result column="co_state" property="state" jdbcType="INTEGER" /> + <result column="co_state_whole_order" property="stateWholeOrder" + jdbcType="INTEGER" /> + <result column="co_estimate" property="estimate" jdbcType="DECIMAL" /> + <result column="co_eIncome" property="eIncome" jdbcType="DECIMAL" /> + <result column="co_payment" property="payment" jdbcType="DECIMAL" /> + <result column="co_settlement" property="settlement" jdbcType="DECIMAL" /> + <result column="co_third_create_time" property="thirdCreateTime" + jdbcType="TIMESTAMP" /> + <result column="co_settle_time" property="settleTime" jdbcType="TIMESTAMP" /> + <result column="co_order_by" property="orderBy" jdbcType="INTEGER" /> + <result column="co_create_time" property="createTime" jdbcType="TIMESTAMP" /> + <result column="co_update_time" property="updateTime" jdbcType="TIMESTAMP" /> + <result column="totalMoney" property="hongBao" jdbcType="DECIMAL" /> + <result column="couponMoney" property="couponMoney" jdbcType="DECIMAL" /> + <result column="hongBaoState" property="hongBaoState" jdbcType="INTEGER" /> + <result column="hongBaoType" property="hongBaoType" jdbcType="INTEGER" /> + <result column="accountTime" property="accountTime" jdbcType="TIMESTAMP" /> + <result column="preAccountTime" property="preAccountTime" + jdbcType="TIMESTAMP" /> + <result column="totalCount" property="totalCount" jdbcType="INTEGER" /> + <result column="totalSettlement" property="totalSettlement" + jdbcType="DECIMAL" /> + <result column="totalPayment" property="totalPayment" jdbcType="DECIMAL" /> + <result column="userId" property="userId" jdbcType="VARCHAR" /> + <result column="userName" property="userName" jdbcType="VARCHAR" /> + <result column="userPortrait" property="userPortrait" jdbcType="VARCHAR" /> + <result column="hb_id" property="hongbaoId" jdbcType="BIGINT" /> + <result column="co_trade_id" property="tradeId" jdbcType="VARCHAR" /> + + <association property="userInfo" column="co_uid" + select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey"/> + + <association property="commonOrderGoods" column="co_order_goods_id" + select="com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper.selectByPrimaryKey"/> + </resultMap> + + <sql id="Base_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_state_whole_order,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_order_by,co_create_time,co_update_time,co_trade_id + </sql> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" + parameterType="java.lang.Long"> + select + <include refid="Base_Column_List" /> + from yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} + </select> + <select id="countByOrderNOAndOrderType" resultType="java.lang.Integer">select + count(co_id) from yeshi_ec_common_order where co_order_no=#{orderNO} + and co_source_type=#{orderType} + </select> + <select id="selectByOrderNoAndOrderTypeAndOrderBy" resultMap="BaseResultMap">select + * from yeshi_ec_common_order where co_order_no=#{orderNo} and + co_source_type=#{orderType} and co_order_by=#{orderBy} + </select> + <select id="countByUidAndOrderStateWithOrderBalanceTime" + resultType="java.lang.Long">SELECT COUNT(*) FROM yeshi_ec_common_order co WHERE + co.`co_state`=#{state} and co.`co_uid`=#{uid} and co.`co_settle_time` + is not null and co.`co_settle_time`>=#{minDate} and + #{maxDate}>co.`co_settle_time`</select> + <select id="listBySourceTypeAndOrderNo" resultMap="BaseResultMap">SELECT * FROM + yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and + co_order_no=#{orderNo} + </select> + + + <select id="selectBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * + FROM + yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and + co_trade_id=#{tradeId} limit 1 + </select> + + <select id="listBySourceTypeAndTradeId" resultMap="BaseResultMap">SELECT * + FROM + yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} and + co_trade_id=#{tradeId} + </select> + + + + <select id="listBySourceTypeAndStateAndThirdCrateTime" resultMap="BaseResultMap">SELECT * + FROM + yeshi_ec_common_order co WHERE co.co_source_type=#{sourceType} + + <if test="state!=null"> + and co_state=#{state} + </if> + + <if test="minTime!=null"> + and UNIX_TIMESTAMP(co_third_create_time)*1000>=#{minTime} + </if> + + + <if test="maxTime!=null"> + and #{maxTime}> UNIX_TIMESTAMP(co_third_create_time)*1000 + </if> + + order by co_id desc + limit #{start},#{count} + </select> + + + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from + yeshi_ec_common_order where co_id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.yeshi.fanli.entity.order.CommonOrder" + useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_order + (co_id,co_uid,co_order_no,co_source_type,co_source_position,co_order_goods_id,co_count,co_state,co_estimate,co_eIncome,co_payment,co_settlement,co_third_create_time,co_settle_time,co_create_time,co_update_time,co_state_whole_order,co_order_by,co_trade_id) + values + (#{id,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{orderNo,jdbcType=VARCHAR},#{sourceType,jdbcType=INTEGER},#{sourcePosition,jdbcType=VARCHAR},#{commonOrderGoods.id,jdbcType=BIGINT},#{count,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{estimate,jdbcType=DECIMAL},#{eIncome,jdbcType=DECIMAL},#{payment,jdbcType=DECIMAL},#{settlement,jdbcType=DECIMAL},#{thirdCreateTime,jdbcType=TIMESTAMP},#{settleTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{stateWholeOrder,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder" + useGeneratedKeys="true" keyProperty="id"> + insert into yeshi_ec_common_order + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">co_id,</if> + <if test="userInfo != null">co_uid,</if> + <if test="orderNo != null">co_order_no,</if> + <if test="sourceType != null">co_source_type,</if> + <if test="sourcePosition != null">co_source_position,</if> + <if test="commonOrderGoods != null">co_order_goods_id,</if> + <if test="count != null">co_count,</if> + <if test="state != null">co_state,</if> + <if test="stateWholeOrder != null">co_state_whole_order,</if> + <if test="estimate != null">co_estimate,</if> + <if test="eIncome != null">co_eIncome,</if> + <if test="payment != null">co_payment,</if> + <if test="settlement != null">co_settlement,</if> + <if test="thirdCreateTime != null">co_third_create_time,</if> + <if test="settleTime != null">co_settle_time,</if> + <if test="orderBy != null">co_order_by,</if> + <if test="createTime != null">co_create_time,</if> + <if test="updateTime != null">co_update_time,</if> + <if test="tradeId != null">co_trade_id,</if> + </trim> + values + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null">#{id,jdbcType=BIGINT},</if> + <if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if> + <if test="orderNo != null">#{orderNo,jdbcType=VARCHAR},</if> + <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> + <if test="sourcePosition != null">#{sourcePosition,jdbcType=VARCHAR},</if> + <if test="commonOrderGoods != null">#{commonOrderGoods.id,jdbcType=BIGINT},</if> + <if test="count != null">#{count,jdbcType=INTEGER},</if> + <if test="state != null">#{state,jdbcType=INTEGER},</if> + <if test="stateWholeOrder != null">#{stateWholeOrder,jdbcType=INTEGER},</if> + <if test="estimate != null">#{estimate,jdbcType=DECIMAL},</if> + <if test="eIncome != null">#{eIncome,jdbcType=DECIMAL},</if> + <if test="payment != null">#{payment,jdbcType=DECIMAL},</if> + <if test="settlement != null">#{settlement,jdbcType=DECIMAL},</if> + <if test="thirdCreateTime != null">#{thirdCreateTime,jdbcType=TIMESTAMP},</if> + <if test="settleTime != null">#{settleTime,jdbcType=TIMESTAMP},</if> + <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> + <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> + <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> + <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR}</if> + </trim> + </insert> + <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.CommonOrder">update + yeshi_ec_common_order set co_uid = + #{userInfo.id,jdbcType=BIGINT},co_order_no = + #{orderNo,jdbcType=VARCHAR},co_source_type = + #{sourceType,jdbcType=INTEGER},co_source_position = + #{sourcePosition,jdbcType=VARCHAR},co_order_goods_id = + #{commonOrderGoods.id,jdbcType=BIGINT},co_count = + #{count,jdbcType=INTEGER},co_state = + #{state,jdbcType=INTEGER},co_state_whole_order = + #{stateWholeOrder,jdbcType=INTEGER},co_estimate = + #{estimate,jdbcType=DECIMAL},co_eIncome = + #{eIncome,jdbcType=DECIMAL},co_payment = + #{payment,jdbcType=DECIMAL},co_settlement = + #{settlement,jdbcType=DECIMAL},co_third_create_time = + #{thirdCreateTime,jdbcType=TIMESTAMP},co_settle_time = + #{settleTime,jdbcType=TIMESTAMP},co_order_by = + #{orderBy,jdbcType=INTEGER},co_create_time = + #{createTime,jdbcType=TIMESTAMP},co_update_time = + #{updateTime,jdbcType=TIMESTAMP} ,co_trade_id + =#{tradeId,jdbcType=VARCHAR} where co_id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.CommonOrder"> + update yeshi_ec_common_order + <set> + <if test="userInfo != null">co_uid=#{userInfo.id,jdbcType=BIGINT},</if> + <if test="orderNo != null">co_order_no=#{orderNo,jdbcType=VARCHAR},</if> + <if test="sourceType != null">co_source_type=#{sourceType,jdbcType=INTEGER},</if> + <if test="sourcePosition != null">co_source_position=#{sourcePosition,jdbcType=VARCHAR}, + </if> + <if test="commonOrderGoods != null">co_order_goods_id=#{commonOrderGoods.id,jdbcType=BIGINT}, + </if> + <if test="count != null">co_count=#{count,jdbcType=INTEGER},</if> + <if test="state != null">co_state=#{state,jdbcType=INTEGER},</if> + <if test="stateWholeOrder != null">co_state_whole_order=#{stateWholeOrder,jdbcType=INTEGER}, + </if> + <if test="estimate != null">co_estimate=#{estimate,jdbcType=DECIMAL},</if> + <if test="eIncome != null">co_eIncome=#{eIncome,jdbcType=DECIMAL},</if> + <if test="payment != null">co_payment=#{payment,jdbcType=DECIMAL},</if> + <if test="settlement != null">co_settlement=#{settlement,jdbcType=DECIMAL},</if> + <if test="thirdCreateTime != null">co_third_create_time=#{thirdCreateTime,jdbcType=TIMESTAMP}, + </if> + <if test="settleTime != null">co_settle_time=#{settleTime,jdbcType=TIMESTAMP},</if> + <if test="orderBy != null">co_order_by=#{orderBy,jdbcType=INTEGER},</if> + <if test="createTime != null">co_create_time=#{createTime,jdbcType=TIMESTAMP},</if> + <if test="updateTime != null">co_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> + <if test="id !=null">co_id =#{id,jdbcType=BIGINT},</if> + <if test="tradeId !=null">co_trade_id =#{tradeId,jdbcType=VARCHAR},</if> + </set> + where co_id = #{id,jdbcType=BIGINT} + </update> + <sql id="SELECT_PARAM_ORDER_STATE"> + <if test="orderState != null and orderState == 1"> + <!-- 鏈夋晥璁㈠崟: 鏁翠釜璁㈠崟鏈夋晥 --> + AND <![CDATA[co.`co_state` <> 3]]> + AND (co.co_state_whole_order = 1 or co.co_state_whole_order = 2) + </if> + <if test="orderState != null and orderState == 2"> + AND co.co_state = 3 + <!-- 缁存潈璁㈠崟 --> + </if> + <if test="orderState != null and orderState == 3"> + <!-- 鏁翠釜璁㈠崟澶辨晥 --> + AND co.co_state_whole_order = 3 + </if> + <if test="orderState != null and orderState == 4"> + <!-- 宸叉敹璐ц鍗� --> + AND co.co_state = 2 + </if> + </sql> + <sql id="SELECT_PARAM_ORDER_CREATE_TIME"> + <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> + </if> + <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> + </if> + <if test="day != null and day == 1"> + <!-- 浠婂ぉ --> + 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_third_create_time`) = 1 + </if> + <if test="day != null and day == 3"> + <!-- 鏈湀 --> + 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_settle_time`, '%Y%m')) = 1 + </if> + </sql> + <sql id="SELECT_PARAM_HONGBAO_TYPE"> + <if test="type != null and type == 1"> + <!-- 鑷喘璁㈠崟 --> + AND (v2.hb_type =1 or v2.hb_type =2) + </if> + <if test="type != null and type == 2"> + <!-- 鍒嗕韩璁㈠崟 --> + AND v2.`hb_type` = 20 + </if> + <if test="type != null and type == 3"> + <!-- 閭�璇疯鍗� --> + AND (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR + v2.`hb_type` = 21 OR v2.`hb_type` = 22) + </if> + </sql> + <sql id="SELECT_PARAM_HONGBAO_STATE"> + <if test="state != null and state == 1"> + <!-- 鏈埌璐� --> + AND (hb.hb_state = 1 or hb.hb_state = 2) + </if> + <if test="state != null and state == 2"> + <!-- 宸插埌璐� --> + AND hb.hb_state = 3 + </if> + <if test="state != null and state == 3"> + <!-- 绾㈠寘宸插け鏁堛�佹暣涓鍗曞け鏁� --> + AND hb.hb_state =4 AND co.co_state_whole_order = 3 + </if> + </sql> + <sql id="Hongbao_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_type,hb_state,hb_pre_get_time,hb_get_time,hb_version, + IF(v2.`hb_state` = 4, 0, v2.hb_money)AS hb_money + </sql> + <sql id="Order_Column_List">co_id,co_uid,co_order_no,co_source_type,co_source_position, + co_order_goods_id,co_count,co_state,co_state_whole_order, + co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time, + MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time, + co_update_time + </sql> + + <select id="listUserOrder" resultMap="ResultMap"> + <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> + SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, hb.hb_state AS + hongBaoState, hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS + accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, + <include refid="Order_Column_List" /> + FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT + <include refid="Hongbao_Column_List" /> + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏃堕棿 --> + <include refid="SELECT_PARAM_HONGBAO_STATE" /> + <!-- 璁㈠崟鍙锋煡璇� --> + <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + + GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY + co.co_third_create_time DESC LIMIT ${start},${count} + </select> + + <select id="countUserOrder" resultType="java.lang.Long"> + <!-- 缁熻鐢ㄦ埛璁㈠崟鏁伴噺 --> + SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM + yeshi_ec_hongbao_order ho LEFT JOIN (SELECT + <include refid="Hongbao_Column_List" /> + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏃堕棿 --> + <include refid="SELECT_PARAM_HONGBAO_STATE" /> + <!-- 璁㈠崟鍙锋煡璇� --> + <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + + GROUP BY co.`co_order_no`, co.`co_source_type` )A + </select> + <select id="listOrderGoodsInfo" resultMap="ResultMap" + parameterType="java.util.List"> + <!-- 鏌ヨ鐢ㄦ埛璁㈠崟鍟嗗搧淇℃伅 --> + SELECT COALESCE(SUM(tc.`co_payment`),0)AS + totalPayment,COALESCE(SUM(tc.`co_settlement`),0)AS totalSettlement, + COALESCE(SUM(tc.`co_count`),0)AS + totalCount,tc.`co_source_type`,tc.`co_order_no`,tg.*,tc.co_id FROM + yeshi_ec_common_order_goods tg LEFT JOIN yeshi_ec_common_order tc ON + tc.`co_order_goods_id` = tg.`cog_id` WHERE + <foreach collection="list" item="item" separator=" OR ">(tc.`co_source_type` + = #{item.sourceType,jdbcType=INTEGER} AND tc.`co_order_no` = + #{item.orderNo,jdbcType=VARCHAR}) + </foreach> + GROUP BY tc.`co_order_no`,tc.`co_order_goods_id` + </select> + + + <select id="countHistoryOrder" resultType="java.util.HashMap"> + <!-- 缁熻鍘嗗彶璁㈠崟鏁伴噺 --> + SELECT SUM(A.self)AS totalSelf,SUM(A.shared)AS + totalShared,SUM(A.invite)AS totalInvite FROM ( + <!-- 杩斿埄璁㈠崟 --> + SELECT IFNULL(COUNT(ho_id),0) AS self,0 AS shared,0 AS invite FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND + (v2.`hb_type` = 1 OR v2.`hb_type` = 2) ) hb ON + hb.hb_id=ho.`ho_hongbao_id` + <!-- 鑷喘璁㈠崟 --> + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 + <if test="day != null and day == 1"> + <!-- 浠婂ぉ --> + 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_third_create_time) = 1 + </if> + <if test="day != null and day == 3"> + <!-- 鏈湀 --> + 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_settle_time`, '%Y%m')) = 1 + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + + GROUP BY co.`co_order_no`, co.`co_source_type`)YX + + UNION ALL + + <!-- 鍒嗕韩璁㈠崟 --> + SELECT 0 AS self,IFNULL(COUNT(ho_id),0) AS shared,0 AS invite FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND v2.`hb_type` + = 20 ) hb ON hb.hb_id=ho.`ho_hongbao_id` + <!-- 鍒嗕韩璁㈠崟 --> + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL and hb.hb_state!=4 + <if test="day != null and day == 1"> + <!-- 浠婂ぉ --> + 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_third_create_time`) = 1 + </if> + <if test="day != null and day == 3"> + <!-- 鏈湀 --> + 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_settle_time`, '%Y%m')) = 1 + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + + GROUP BY co.`co_order_no`, co.`co_source_type`)WQ + + UNION ALL + + <!-- 閭�璇疯鍗� --> + SELECT 0 AS self,0 AS shared,IFNULL(COUNT(ho_id),0) AS invite FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= ${uid} AND + (v2.`hb_type` = 5 OR v2.`hb_type` = 6 OR v2.`hb_type` = 7 OR + v2.`hb_type` = 21 OR v2.`hb_type` = 22 ) ) hbp ON + hbp.hb_pid=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order co ON + co.`co_id`=ho.`ho_order_id` WHERE hbp.hb_id IS NOT NULL and hbp.hb_state!=4 + <if test="day != null and day == 1"> + <!-- 浠婂ぉ --> + 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_third_create_time`) = 1 + </if> + <if test="day != null and day == 3"> + <!-- 鏈湀 --> + 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_settle_time`, '%Y%m')) = 1 + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + + GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A + </select> + + + <select id="countByUidAndOrderState" resultType="java.util.HashMap"> + SELECT SUM(A.valid)AS totalValid, SUM(A.proces)AS + totalProces,SUM(A.Invalid)AS totalInvite FROM ( + <!-- 鏈夋晥璁㈠崟 --> + SELECT IFNULL(COUNT(ho_id),0) AS valid,0 AS proces,0 AS Invalid FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL <![CDATA[AND co.`co_state` <> 3]]> + AND (co.`co_state_whole_order` =1 OR co.`co_state_whole_order` = 2) + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + GROUP BY co.`co_order_no`, co.`co_source_type`)YX + + UNION ALL + + <!-- 缁存潈璁㈠崟 --> + SELECT 0 AS valid,IFNULL(COUNT(ho_id),0) AS proces,0 AS Invalid FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL AND co.`co_state` = 3 + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + GROUP BY co.`co_order_no`, co.`co_source_type`)WQ + + UNION ALL + + <!-- 澶辨晥璁㈠崟 --> + SELECT 0 AS valid,0 AS proces,IFNULL(COUNT(ho_id),0) AS Invalid FROM + (SELECT ho.`ho_id` FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL AND co.`co_state_whole_order` = 3 + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + GROUP BY co.`co_order_no`, co.`co_source_type`)SX )A + </select> + <select id="countBonusOrderNumber" resultType="java.lang.Long"> + <!-- 濂栭噾缁熻锛氳鍗曟暟閲� --> + SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.`ho_id` FROM + yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT * FROM + yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + ) hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + GROUP BY co.`co_order_no`, co.`co_source_type` )A + </select> + <select id="countBonusOrderMoney" resultType="java.math.BigDecimal"> + <!-- 濂栭噾缁熻锛氳鍗曟�昏繑鍒╅噾棰� 鍘绘帀宸插け鏁� --> + SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalmoney FROM + yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT + <include refid="Hongbao_Column_List" /> + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) ) hb ON + IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN + yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE hb.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> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + </select> + <select id="countBonusOrderMoneyAndNumber" resultType="java.util.HashMap"> + SELECT COUNT(*) AS totalNum, CAST(SUM(moneys) AS DECIMAL(19,2)) AS + totalmoney FROM (SELECT CAST(SUM(hb.`hb_money`) AS DECIMAL(19,2))AS + moneys FROM yeshi_ec_hongbao_order ho LEFT JOIN ( SELECT + <include refid="Hongbao_Column_List" /> + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`=${uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + AND (v2.hb_state = 1 or v2.hb_state = 2 or v2.hb_state = 3) ) hb ON + IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` LEFT JOIN + yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE hb.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> <!-- 涓婃湀 :缁熻宸叉敹璐� --> + <if test="source != null">AND co.co_source_type = #{source}</if> + GROUP BY co.`co_order_no`, co.`co_source_type` )A + </select> + <sql id="SELECT_HONGBAO_STATE"> + <if test="state != null and state == 1"> + <!-- 鏈埌璐� --> + AND (v2.hb_state = 1 or v2.hb_state = 2) + </if> + <if test="state != null and state == 2"> + <!-- 宸插埌璐� --> + AND v2.hb_state = 3 + </if> + <if test="state != null and state == 3"> + <!-- 绾㈠寘宸插け鏁� --> + AND v2.hb_state =4 + </if> + </sql> + <select id="listQueryByUid" resultMap="ResultMap"> + <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> + SELECT hb.`hb_money` AS totalMoney, hb.hb_state AS hongBaoState, + hb.`hb_type` AS hongBaoType, hb.`hb_get_time` AS accountTime, + hb.`hb_pre_get_time` AS preAccountTime, co.*,cog.* FROM + yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 + v2 WHERE v2.`hb_uid`= #{uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` LEFT + JOIN yeshi_ec_common_order_goods cog ON cog.`cog_id`= + co.`co_order_goods_id` WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏃堕棿 --> + <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> + ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} + </select> + <select id="countQueryByUid" resultType="java.lang.Long"> + <!-- 缁熻鐢ㄦ埛璁㈠崟鏁伴噺 --> + SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM + yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM yeshi_ec_hongbao_v2 + v2 WHERE v2.`hb_uid`= #{uid} + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> + <!-- 璁㈠崟鏃堕棿 --> + <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> + )A + </select> + <select id="getBuFenOrderState" resultMap="ResultMap">SELECT + co.co_state,v2.`hb_state` AS hongBaoState FROM `yeshi_ec_common_order` + co LEFT JOIN yeshi_ec_hongbao_order ho ON co.`co_id`=ho.`ho_order_id` + LEFT JOIN yeshi_ec_hongbao_v2 v2 ON IF(v2.hb_pid IS + NULL,v2.hb_id,v2.hb_pid)=ho.`ho_hongbao_id` WHERE co.`co_order_no` = + #{orderNo} AND co.co_state<![CDATA[<>]]> + 4 AND v2.hb_uid = #{uid} ORDER BY co.`co_state` DESC LIMIT 1 + </select> + <select id="listQuery" resultMap="ThreeResultMap"> + SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS + userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS + totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, + hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS + preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN + (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> + </if> + <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> + </if> + <if test="key != null and key != '' "> + <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> + <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT + JOIN yeshi_ec_user u ON u.id = A.hb_uid + </select> + + + <select id="listQueryWithNoChild" resultMap="ThreeResultMap"> + SELECT A.*,u.id AS userId,u.`nick_name` AS userName,u.`portrait` AS + userPortrait FROM (SELECT hb.hb_id,hb.hb_uid,hb.`hb_money` AS + totalMoney, hb.hb_state AS hongBaoState, hb.`hb_type` AS hongBaoType, + hb.`hb_get_time` AS accountTime, hb.`hb_pre_get_time` AS + preAccountTime, co.* FROM yeshi_ec_hongbao_order ho LEFT JOIN + (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON hb.hb_id=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> + </if> + <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> + </if> + <if test="key != null and key != '' "> + <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> + <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT + JOIN yeshi_ec_user u ON u.id = A.hb_uid + </select> + + + <select id="countQuery" resultType="java.lang.Long"> + SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN + (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> + </if> + <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> + </if> + <if test="key != null and key != '' "> + <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> + <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + </select> + + + <select id="countQueryWithNoChild" resultType="java.lang.Long"> + SELECT count(ho.ho_id) FROM yeshi_ec_hongbao_order ho LEFT JOIN + (SELECT * FROM yeshi_ec_hongbao_v2 v2 WHERE 1=1 + <include refid="SELECT_PARAM_HONGBAO_TYPE" /> + <!-- 绾㈠寘绫诲瀷 --> + <include refid="SELECT_HONGBAO_STATE" /> + <!-- 绾㈠寘鐘舵�� --> + )hb ON hb.hb_id=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL + <include refid="SELECT_PARAM_ORDER_STATE" /> + <!-- 璁㈠崟鐘舵�� --> + <if test="startTime != null and startTime != '' ">AND <![CDATA[co.co_third_create_time >= #{startTime}]]> + </if> + <if test="endTime != null and endTime != '' ">AND <![CDATA[co.co_third_create_time <= #{endTime}]]> + </if> + <if test="key != null and key != '' "> + <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> + <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> + </if> + <!-- 璁㈠崟鏉ユ簮 --> + <if test="source != null">AND co.co_source_type = #{source}</if> + </select> + + + + + <select id="getCouponHongbaoByOrderNo" resultMap="ResultMap"> + SELECT COALESCE(SUM(IF(hb.hb_type=1,hb.`hb_money`,0)),0)AS totalMoney, + COALESCE(SUM(IF(hb.hb_type=10,hb.`hb_money`,0)),0)AS couponMoney, + hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS accountTime, + MAX(hb.`hb_pre_get_time`) AS preAccountTime, hb.hb_state AS + hongBaoState, + <include refid="Order_Column_List" /> + FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT * FROM + yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} + <if test="hongBaoState != null">AND v2.`hb_state` = #{hongBaoState}</if> + )hb ON hb.hb_id = ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order + co ON co.`co_id`=ho.`ho_order_id` WHERE hb.hb_id IS NOT NULL AND + co.co_order_no = #{orderNo} + </select> + <select id="getCommonOrderByOrderNo" resultMap="ResultMap"> + <!-- 鏌ヨ鐢ㄦ埛璁㈠崟 --> + SELECT COALESCE(SUM(hb.`hb_money`),0)AS totalMoney, + COALESCE(SUM(co.`co_payment`),0)AS totalPayment, hb.hb_state AS + hongBaoState, hb.`hb_type` AS hongBaoType, + <include refid="Order_Column_List" /> + FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT + <include refid="Hongbao_Column_List" /> + FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> + )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` + LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` + WHERE hb.hb_id IS NOT NULL AND co.co_order_no = #{orderNo} AND co.`co_source_type` = #{sourceType} + <if test="orderState != null"> + AND co.co_state = #{orderState} + <!-- 宸叉敹璐� --> + </if> + GROUP BY co.`co_order_no`, co.`co_source_type` + </select> + + <select id="getByOrderNo" resultMap="BaseResultMap"> + SELECT * FROM yeshi_ec_common_order co + WHERE co_uid = #{uid} AND co_order_no=#{orderNo} + </select> +</mapper> diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml index e94ec4f..41cedb2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml +++ b/fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponMapper.xml @@ -113,6 +113,24 @@ AND TO_DAYS(uc.`usc_create_time`) = TO_DAYS(NOW()) </select> + + <select id="getCouponListOld" resultMap="ResultVOMap"> + SELECT * FROM `yeshi_ec_user_system_coupon` uc + LEFT JOIN `yeshi_ec_system_coupon` c ON uc.`usc_coupon_id` = c.`sc_id` + WHERE uc.`usc_uid`= #{uid} AND DATEDIFF(NOW(), uc.`usc_end_time`)<![CDATA[<=]]> 30 + AND (uc.`usc_give` IS NULL OR uc.`usc_give` = 0) AND c.`sc_type` NOT IN ('freeCoupon','freeCouponBuy','freeCouponGive') + ORDER BY uc.`usc_state`,uc.`usc_create_time` DESC + LIMIT #{start},#{count} + </select> + + <select id="countCouponOld" resultType="java.lang.Long"> + SELECT IFNULL(count(uc.`usc_id`),0) FROM `yeshi_ec_user_system_coupon` uc + LEFT JOIN `yeshi_ec_system_coupon` c ON uc.`usc_coupon_id` = c.`sc_id` + WHERE uc.`usc_uid`= #{uid} AND DATEDIFF(NOW(), uc.`usc_end_time`)<![CDATA[<=]]> 30 + AND (uc.`usc_give` IS NULL OR uc.`usc_give` = 0) AND c.`sc_type` NOT IN ('freeCoupon','freeCouponBuy','freeCouponGive') + </select> + + <select id="getUserCouponVOList" resultMap="ResultVOMap"> SELECT * FROM `yeshi_ec_user_system_coupon` uc WHERE uc.`usc_uid`= #{uid} AND DATEDIFF(NOW(), uc.`usc_end_time`)<![CDATA[ <= ]]> 30 @@ -158,18 +176,16 @@ </select> <select id="getIncludeExchange" resultMap="BaseResultMap"> - SELECT * FROM yeshi_ec_user_system_coupon - WHERE usc_state_activate = 1 AND usc_state = 1 - AND usc_uid = #{uid} AND usc_source in - <foreach collection="list" item="item" open="(" close=")" - separator=",">#{item}</foreach> + SELECT * FROM `yeshi_ec_user_system_coupon` t + LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` + WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid} + AND c.`sc_percent` = #{num} AND c.`sc_type`= #{type} </select> - <select id="getIncludeNotExchange" resultMap="BaseResultMap"> - SELECT * FROM yeshi_ec_user_system_coupon - WHERE usc_state_activate = 1 AND usc_state = 1 - AND usc_uid = #{uid} AND usc_source not in - <foreach collection="list" item="item" open="(" close=")" - separator=",">#{item}</foreach> + <select id="getIncludeNotExchange" resultMap="ResultVOMap"> + SELECT * FROM `yeshi_ec_user_system_coupon` t + LEFT JOIN `yeshi_ec_system_coupon` c ON t.`usc_coupon_id` = c.`sc_id` + WHERE t.usc_state = 1 AND t.usc_state_activate = 1 AND t.usc_uid = #{uid} + AND c.`sc_percent` <![CDATA[<>]]> #{num} AND c.`sc_type`= #{type} </select> </mapper> diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java index a7d15d5..e41be32 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java @@ -417,10 +417,6 @@ @Override public void addRebateOrder(Long uid) { try { - UserInfo boss = getBossByUid(uid); - if (boss != null) - addInviteOrderLevelOne(boss.getId()); - addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); @@ -434,12 +430,9 @@ */ @IntegralGetVersionLimit(uid = "#uid") @Async() - private void addInviteOrderLevelOne(Long uid) { + @Override + public void addInviteOrderLevelOne(Long uid) { try { - UserInfo boss = getBossByUid(uid); - if (boss != null) - addInviteOrderLevelTwo(boss.getId()); - addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); @@ -453,7 +446,8 @@ */ @IntegralGetVersionLimit(uid = "#uid") @Async() - private void addInviteOrderLevelTwo(Long uid) { + @Override + public void addInviteOrderLevelTwo(Long uid) { try { addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name()); } catch (Exception e) { diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java index 2fcb36b..d53ff3a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java @@ -290,7 +290,7 @@ if (num <= 0) num = 1; - String title = taskClass.getName() + "-" + integralTask.getName() + "-" + num + "娆�"; + String title = taskClass.getName() + "-" + integralTask.getName() + "-绗�" + num + "娆�"; detail.setTitle(title); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java index efc5294..34f6049 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java @@ -148,7 +148,7 @@ coupon.getSource(), coupon.getStartTime(), coupon.getEndTime()); try { msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(), - coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "鍙湪棣栭〉-鍏嶅崟鍟嗗搧-閫夋嫨鍟嗗搧-浣跨敤")); + coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "棣栭〉-鍏嶅崟-閫夋嫨鍟嗗搧-浣跨敤")); } catch (MsgOtherDetailException e) { e.printStackTrace(); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java index d1dfd74..d17a644 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java @@ -329,7 +329,9 @@ SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); // 鏄惁瀛樺湪濂栧姳鍒� - boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid); + //boolean hasRewardCoupon = userSystemCouponService.hasRewardCoupon(uid); + boolean hasRewardCoupon = userSystemCouponService.getIncludeNotExchange(uid); + boolean exchangeCoupon = userSystemCouponService.getIncludeExchange(uid); // 2019.8.1寮�濮嬭繑鍥炵淮鏉冧俊鎭� Date august = null; @@ -548,13 +550,13 @@ } else { // 濂栧姳璁㈠崟銆佸厤鍗� 浣跨敤璁板綍 if (sourceType == null) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, null, signList, acceptData); + setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, null, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_TAOBAO) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordTB, signList, acceptData); + setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordTB, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_JD) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordJD, signList, acceptData); + setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordJD, signList, acceptData); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { - setSystemCouponRecord(order, hasRewardCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, acceptData); + setSystemCouponRecord(order, hasRewardCoupon, exchangeCoupon, hongBaoState, hongBaoType, listRecordPDD, signList, acceptData); } } @@ -576,7 +578,7 @@ * @param list * @param signList */ - public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, + public void setSystemCouponRecord(CommonOrderVO order, boolean hasRewardCoupon, boolean exchangeCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, List<String> signList, AcceptData acceptData) { // 鏄惁鍏嶅崟鍟嗗搧 @@ -624,6 +626,21 @@ // 璁㈠崟鏍囪瘑 order.setSignList(signList); + // 1.6.5 鏄惁瀛樺湪鏂板厬鎹㈢殑鍒� + if (!hasRewardCoupon && exchangeCoupon) { + try { + String downTime = order.getDownTime(); + if (!StringUtil.isNullOrEmpty(downTime)) { + long downOrderTime = TimeUtil.convertDateToTemp2(downTime); + long limitDate = TimeUtil.convertDateToTemp("2019-09-01"); + if (downOrderTime > limitDate ) + hasRewardCoupon = true; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + boolean rewardOrder = false; int type = 1; // 1 甯歌璺宠浆椤甸潰 2寮瑰嚭閫夐」锛堝鍔卞埜锛� @@ -635,7 +652,7 @@ // 鏈夊彲鐢ㄧ殑濂栧姳鍒� 銆侀潪鍏嶅崟璁㈠崟 銆佷笖宸插埌璐︾殑 銆佽繑鍒╄鍗� type = 2; rewardOrder = true; - } + } if (rewardOrder) { ClientTextStyleVO rewardStyleVO = new ClientTextStyleVO(); @@ -1412,4 +1429,10 @@ return commonOrderMapper.listBySourceTypeAndStateAndThirdCrateTime(sourceType, state, minTime, maxTime, (page - 1) * pageSize, pageSize); } + + @Override + public List<CommonOrder> getByOrderNo(Long uid, String orderNO) { + return commonOrderMapper.getByOrderNo(uid, orderNO); + } + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java index 5a7cf37..43f8117 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java @@ -185,6 +185,11 @@ } @Override + public long countCouponOld(Long uid) { + return userSystemCouponMapper.countCouponOld(uid); + } + + @Override public long countUserCouponList(Long uid) { return userSystemCouponMapper.countUserCouponList(uid); } @@ -308,7 +313,7 @@ // 閫�鍥炲埜 sendBackTimeOutCoupon(uid); - List<UserSystemCouponVO> listVO = userSystemCouponMapper.getUserCouponVOList(start, count, uid); + List<UserSystemCouponVO> listVO = userSystemCouponMapper.getCouponListOld(start, count, uid); if (listVO == null || listVO.size() == 0) { return listVO; } @@ -1834,11 +1839,12 @@ // 鍙娇鐢ㄣ�� 鍙禒閫� userCouponVO.setState(UserSystemCoupon.STATE_USE_GIVE); - // 杩斿埄濂栧姳鍒�- 璺宠浆鑷宠鍗曞埌璐︾晫闈� + // 杩斿埄濂栧姳鍒�- 璺宠浆鑷冲凡鍒拌处-宸叉敹璐� jumpLink.put("state", "2"); + jumpLink.put("type", "1"); jumpBtn = new HashMap<String, Object>(); jumpBtn.put("params", jumpLink); - jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("orderList")); + jumpBtn.put("jumpDetail", jumpDetailV2Service.getByTypeCache("order_screen_list")); } } else if (UserSystemCoupon.STATE_IN_USE == state && give) { userCouponVO.setCouponEffect("璧犻�佷腑"); @@ -2142,10 +2148,10 @@ @Override public boolean getIncludeExchange(Long uid) { - List<String> list = new ArrayList<String>(); - list.add(UserSystemCoupon.SOURCE_EXCHANGE); - list.add(UserSystemCoupon.SOURCE_GIVE); - List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, list); + String percent = configService.get("exchange_rebate_percent"); + if (StringUtil.isNullOrEmpty(percent)) + percent = "35"; + List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name()); if (listCoupon == null || listCoupon.size() == 0) return false; return true; @@ -2154,13 +2160,85 @@ @Override public boolean getIncludeNotExchange(Long uid) { - List<String> list = new ArrayList<String>(); - list.add(UserSystemCoupon.SOURCE_EXCHANGE); - list.add(UserSystemCoupon.SOURCE_GIVE); - List<UserSystemCoupon> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, list); + String percent = configService.get("exchange_rebate_percent"); + if (StringUtil.isNullOrEmpty(percent)) + percent = "35"; + List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name()); if (listCoupon == null || listCoupon.size() == 0) return false; return true; } + + @Override + public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception{ + sendBackTimeOutCoupon(uid); + + String percent = configService.get("exchange_rebate_percent"); + if (StringUtil.isNullOrEmpty(percent)) + percent = "35"; + + List<UserSystemCouponVO> listCoupon = userSystemCouponMapper.getIncludeNotExchange(uid, Integer.parseInt(percent), CouponTypeEnum.rebatePercentCoupon.name()); + if (listCoupon == null || listCoupon.size() == 0) + return null; + + for (UserSystemCouponVO userCouponVO : listCoupon) { + String source = userCouponVO.getSource(); + if (source != null && "濂栧姳鍒稿ぉ澶╂娊".equals(source)) { + source = "澶╁ぉ鎶�"; + } + + SystemCoupon systemCoupon = userCouponVO.getSystemCoupon(); + if (systemCoupon == null) { + continue; // 鍒镐俊鎭笉瀹屾暣 + } + + systemCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId()); + + userCouponVO.setSource("鏉ユ簮锛�" + source); + userCouponVO.setCouponName(systemCoupon.getName()); + userCouponVO.setCouponEffect(systemCoupon.getEffect()); + userCouponVO.setCouponRule(systemCoupon.getRule()); + userCouponVO.setCouponRuleLink(systemCoupon.getRuleLink()); + userCouponVO.setCouponPicture(systemCoupon.getPicture()); + userCouponVO.setCouponPictureInvalid(systemCoupon.getPictureInvalid()); + + int differentDays = 0; + String couponTerm = "鏈夋晥鏈燂細"; + Date startTime = userCouponVO.getStartTime(); + Date endTime = userCouponVO.getEndTime(); + if (endTime != null && startTime != null) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); + couponTerm = couponTerm + sdf.format(startTime) + "-" + sdf.format(endTime); + + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd"); + differentDays = DateUtil.daysBetween(sdf2.format(new Date()), sdf2.format(endTime)) + 1; + if (differentDays < 0) { + differentDays = 0; + } + } + userCouponVO.setCouponTerm(couponTerm); + + // 鍓╀綑澶╂暟 + Map<String, Object> remainDays = new HashMap<String, Object>(); + remainDays.put("content", "杩樺墿" + differentDays + "澶╄繃鏈�"); + String remainDaysFontColor = ""; + + Integer stateActivated = userCouponVO.getStateActivated(); + if (stateActivated == null || stateActivated == 0) { + userCouponVO.setState(0); + userCouponVO.setCouponEffect("寰呮縺娲�"); + userCouponVO.setCouponPicture(systemCoupon.getPictureInvalid()); + remainDaysFontColor = "#CCCCCC"; + } else { + userCouponVO.setCouponPicture(systemCoupon.getPicture()); + remainDaysFontColor = "#F14242"; + } + + remainDays.put("fontColor", remainDaysFontColor); + userCouponVO.setRemainDays(remainDays); + } + + return listCoupon; + } } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java index c0534aa..9c022bd 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java @@ -162,6 +162,19 @@ public void addRebateOrder(Long uid); /** + * 涓�绾ч個璇疯鍗� + * @param uid + */ + public void addInviteOrderLevelOne(Long uid); + + /** + * 浜岀骇閭�璇疯鍗� + * @param uid + */ + public void addInviteOrderLevelTwo(Long uid); + + + /** * 鍒嗕韩璁㈠崟 * @param uid */ diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java index bf71268..04fcc46 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/order/CommonOrderService.java @@ -278,7 +278,15 @@ * @param pageSize * @return */ - List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(int sourceType, Integer state, Long minTime, + public List<CommonOrder> listBySourceTypeAndStateAndThirdCrateTime(int sourceType, Integer state, Long minTime, Long maxTime, int page, int pageSize); + /** + * 鏌ヨ璁㈠崟 -鏍规嵁璁㈠崟鍙� + * @param uid + * @param orderNO + * @return + */ + public List<CommonOrder> getByOrderNo(Long uid, String orderNO); + } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java index 7c756f8..b0c56aa 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java @@ -267,4 +267,13 @@ */ public boolean getIncludeNotExchange(Long uid); + /** + * 鏌ヨ1.6.5涔嬪墠鐨� 涓嶇瓑浜�35% + * @param uid + * @return + */ + public List<UserSystemCouponVO> listIncludeNotExchange(Long uid) throws Exception; + + public long countCouponOld(Long uid); + } -- Gitblit v1.8.0