From f87850bb6c6109a3bda06ab474575631407bbf09 Mon Sep 17 00:00:00 2001 From: chenjiahe <763432473@qq.com> Date: 星期五, 01 三月 2024 19:09:12 +0800 Subject: [PATCH] 爆款活动-退款处理 --- phi_platform_common/src/main/java/com/hx/phip/tool/order/OrderTool.java | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 44 insertions(+), 4 deletions(-) diff --git a/phi_platform_common/src/main/java/com/hx/phip/tool/order/OrderTool.java b/phi_platform_common/src/main/java/com/hx/phip/tool/order/OrderTool.java index 8c37ebe..3c74c7f 100644 --- a/phi_platform_common/src/main/java/com/hx/phip/tool/order/OrderTool.java +++ b/phi_platform_common/src/main/java/com/hx/phip/tool/order/OrderTool.java @@ -2,11 +2,13 @@ import com.hx.common.service.CommonService; import com.hx.mybatisTool.SqlSentence; +import com.hx.phiappt.common.OrderTotalConstants; import com.hx.phiappt.model.consume.ConsumePayItem; import com.hx.phiappt.model.order.OrdersTotal; import com.hx.phiappt.model.userMoney.UserMoneyUnclaimed; import com.hx.phip.dao.mapper.ConsumePayItemMapper; import com.hx.phip.dao.mapper.UserMoneyUnclaimedMapper; +import com.hx.util.StringUtils; import java.util.HashMap; import java.util.List; @@ -44,17 +46,55 @@ } /**鑾峰彇鐢ㄦ埛娲诲姩璧犻�佽祫閲戝鍔辫褰�-鏈夋晥*/ - public static List<UserMoneyUnclaimed> getActivityGive(String userId,String commonId, CommonService commonService){ + public static List<UserMoneyUnclaimed> getActivityGive(String userId,String commonId,Integer isValid, CommonService commonService){ //鏌ユ壘棰嗗彇璁板綍閲婃斁瀛樺湪 //棰嗗彇璁板綍鏄惁宸查鍙� SqlSentence sqlSentence = new SqlSentence(); Map<String,Object> values = new HashMap<>(); + StringBuilder sql = new StringBuilder(); - values.put("userId",userId); - values.put("commonId",commonId); - sqlSentence.sqlSentence("SELECT * FROM user_money_unclaimed WHERE isDel = 0 AND isValid = 1 AND userId = #{m.userId} AND commonId = #{m.commonId}",values); + sql.append("SELECT * FROM user_money_unclaimed WHERE isDel = 0"); + if(isValid != null){ + values.put("isValid",isValid); + sql.append(" AND isValid = #{m.isValid}"); + } + if(StringUtils.noNull(userId)){ + values.put("userId",userId); + sql.append(" AND userId = #{m.userId}"); + } + if(StringUtils.noNull(commonId)){ + values.put("commonId",commonId); + sql.append(" AND commonId = #{m.commonId}"); + } + sqlSentence.sqlSentence(sql.toString(),values); return commonService.selectList(UserMoneyUnclaimedMapper.class,sqlSentence); } + /**鑾峰彇鐢ㄦ埛娲诲姩璧犻�佽祫閲戝鍔辫褰�-鑾峰彇涓�鏉�*/ + public static UserMoneyUnclaimed getActivityGiveByOrder(OrdersTotal ordersTotal,Integer isValid, CommonService commonService){ + //鏍规嵁褰撳墠鐢ㄦ埛锛岃幏鍙栧埌鎵�鏈夌殑璁板綍 + //棰嗗彇璁板綍鏄惁宸查鍙� + SqlSentence sqlSentence = new SqlSentence(); + Map<String,Object> values = new HashMap<>(); + StringBuilder sql = new StringBuilder(); + + values.put("commonId",ordersTotal.getActivityPageCode()); + values.put("userId",ordersTotal.getUserId()); + values.put("payStatus", OrderTotalConstants.PAY_STATUS_SUC); + values.put("activityPageType", ordersTotal.getActivityPageType()); + values.put("activityPageCode", ordersTotal.getActivityPageCode()); + sql.append("SELECT umu.* FROM orders_total ot "); + sql.append(" JOIN user_money_unclaimed umu ON umu.orderId = ot.id AND umu.isDel = 0 AND umu.commonId = #{m.commonId}"); + if(isValid != null){ + values.put("isValid",isValid); + sql.append(" AND umu.isValid = #{m.isValid}"); + } + sql.append(" WHERE ot.isDel = 0 AND ot.activityPageType = #{m.activityPageType} AND ot.activityPageCode = #{m.activityPageCode}" + + " AND ot.userId = #{m.userId} AND ot.payStatus = #{m.payStatus} ORDER BY umu.createTime ASC LIMIT 1"); + + sqlSentence.sqlSentence(sql.toString(),values); + return commonService.selectOne(UserMoneyUnclaimedMapper.class,sqlSentence); + } + } -- Gitblit v1.8.0