Skip to content

Commit

Permalink
修复部分查询,时间查询问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Jan 4, 2022
1 parent 0c4aef3 commit e8d9556
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
"iv",
"mail",
"sell",
"id",
"price",
"prop",
"reply",
"profile",
"privateKey",
"wechatpay",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public RestHighLevelClient elasticsearchClient() {
restBuilder.setRequestConfigCallback(requestConfigBuilder ->
requestConfigBuilder.setConnectTimeout(1000) //time until a connection with the server is established.
.setSocketTimeout(12 * 1000) //time of inactivity to wait for packets[data] to receive.
.setConnectionRequestTimeout(2 * 1000)); //time to fetch a connection from the connection pool 0 for infinite.
.setConnectionRequestTimeout(-1)); //time to fetch a connection from the connection pool 0 for infinite.

client = new RestHighLevelClient(restBuilder);
return client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ private <T> void betweenWrapper(QueryWrapper<T> queryWrapper) {
if (CharSequenceUtil.isNotEmpty(price)) {
String[] s = price.split("_");
if (s.length > 1) {
queryWrapper.ge("price", s[1]);
queryWrapper.between("price", s[0], s[1]);
} else {
queryWrapper.le("price", s[0]);
queryWrapper.ge("price", s[0]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package cn.lili.modules.order.aftersale.entity.vo;

import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums;
import cn.lili.common.utils.StringUtils;
import cn.lili.common.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
Expand All @@ -17,6 +18,7 @@
* @author paulG
* @since 2020/12/4
**/
@EqualsAndHashCode(callSuper = true)
@Data
public class AfterSaleSearchParams extends PageVO {

Expand Down Expand Up @@ -44,6 +46,9 @@ public class AfterSaleSearchParams extends PageVO {
@ApiModelProperty(value = "实际退款金额,可以为范围,如10_1000")
private String actualRefundPrice;

@ApiModelProperty(value = "总价格,可以为范围,如10_1000")
private String flowPrice;

/**
* @see cn.lili.modules.order.trade.entity.enums.AfterSaleTypeEnum
*/
Expand All @@ -66,33 +71,33 @@ public class AfterSaleSearchParams extends PageVO {

public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotEmpty(sn)) {
if (CharSequenceUtil.isNotEmpty(sn)) {
queryWrapper.like("sn", sn);
}
if (StringUtils.isNotEmpty(orderSn)) {
if (CharSequenceUtil.isNotEmpty(orderSn)) {
queryWrapper.like("order_sn", orderSn);
}
//按买家查询
if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MEMBER.name())) {
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MEMBER.name())) {
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
}
//按卖家查询
if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name())) {
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.STORE.name())) {
queryWrapper.eq("store_id", UserContext.getCurrentUser().getStoreId());
}

if (StringUtils.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MANAGER.name())
&& StringUtils.isNotEmpty(storeId)
if (CharSequenceUtil.equals(UserContext.getCurrentUser().getRole().name(), UserEnums.MANAGER.name())
&& CharSequenceUtil.isNotEmpty(storeId)
) {
queryWrapper.eq("store_id", storeId);
}
if (StringUtils.isNotEmpty(memberName)) {
if (CharSequenceUtil.isNotEmpty(memberName)) {
queryWrapper.like("member_name", memberName);
}
if (StringUtils.isNotEmpty(storeName)) {
if (CharSequenceUtil.isNotEmpty(storeName)) {
queryWrapper.like("store_name", storeName);
}
if (StringUtils.isNotEmpty(goodsName)) {
if (CharSequenceUtil.isNotEmpty(goodsName)) {
queryWrapper.like("goods_name", goodsName);
}
//按时间查询
Expand All @@ -102,10 +107,10 @@ public <T> QueryWrapper<T> queryWrapper() {
if (endDate != null) {
queryWrapper.le("create_time", endDate);
}
if (StringUtils.isNotEmpty(serviceStatus)) {
if (CharSequenceUtil.isNotEmpty(serviceStatus)) {
queryWrapper.eq("service_status", serviceStatus);
}
if (StringUtils.isNotEmpty(serviceType)) {
if (CharSequenceUtil.isNotEmpty(serviceType)) {
queryWrapper.eq("service_type", serviceType);
}
this.betweenWrapper(queryWrapper);
Expand All @@ -114,20 +119,28 @@ public <T> QueryWrapper<T> queryWrapper() {
}

private <T> void betweenWrapper(QueryWrapper<T> queryWrapper) {
if (StringUtils.isNotEmpty(applyRefundPrice)) {
if (CharSequenceUtil.isNotEmpty(applyRefundPrice)) {
String[] s = applyRefundPrice.split("_");
if (s.length > 1) {
queryWrapper.ge("apply_refund_price", s[1]);
queryWrapper.between("apply_refund_price", s[0], s[1]);
} else {
queryWrapper.le("apply_refund_price", s[0]);
queryWrapper.ge("apply_refund_price", s[0]);
}
}
if (StringUtils.isNotEmpty(actualRefundPrice)) {
if (CharSequenceUtil.isNotEmpty(actualRefundPrice)) {
String[] s = actualRefundPrice.split("_");
if (s.length > 1) {
queryWrapper.ge("actual_refund_price", s[1]);
queryWrapper.between("actual_refund_price", s[0], s[1]);
} else {
queryWrapper.ge("actual_refund_price", s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(flowPrice)) {
String[] s = flowPrice.split("_");
if (s.length > 1) {
queryWrapper.between("flow_price", s[0], s[1]);
} else {
queryWrapper.le("actual_refund_price", s[0]);
queryWrapper.ge("flow_price", s[0]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public class OrderSearchParams extends PageVO {
@ApiModelProperty(value = "是否为某订单类型的订单,如果是则为订单类型的id,否则为空")
private String promotionId;

@ApiModelProperty(value = "总价格,可以为范围,如10_1000")
private String flowPrice;

/**
* @see OrderPromotionTypeEnum
*/
Expand Down Expand Up @@ -209,6 +212,14 @@ public <T> QueryWrapper<T> queryWrapper() {

wrapper.eq(CharSequenceUtil.isNotEmpty(orderPromotionType), "o.order_promotion_type", orderPromotionType);

if (CharSequenceUtil.isNotEmpty(flowPrice)) {
String[] s = flowPrice.split("_");
if (s.length > 1) {
wrapper.between("o.flow_price", s[0], s[1]);
} else {
wrapper.ge("o.flow_price", s[0]);
}
}
wrapper.eq("o.delete_flag", false);
return wrapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,7 @@ private void checkPintuanOrder(String pintuanId, String parentOrderSn) {
if (count == 1) {
//如果为开团订单,则发布一个一小时的延时任务,时间到达后,如果未成团则自动结束(未开启虚拟成团的情况下)
PintuanOrderMessage pintuanOrderMessage = new PintuanOrderMessage();
// long startTime = DateUtil.offsetHour(new Date(), 1).getTime();
long startTime = DateUtil.offsetMinute(new Date(), 2).getTime();
long startTime = DateUtil.offsetHour(new Date(), 1).getTime();
pintuanOrderMessage.setOrderSn(parentOrderSn);
pintuanOrderMessage.setPintuanId(pintuanId);
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.PROMOTION_EXECUTOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,25 @@ private <T> void betweenWrapper(QueryWrapper<T> queryWrapper) {
if (CharSequenceUtil.isNotEmpty(publishNum)) {
String[] s = publishNum.split("_");
if (s.length > 1) {
queryWrapper.ge("publish_num", s[1]);
queryWrapper.between("publish_num", s[0], s[1]);
} else {
queryWrapper.le("publish_num", publishNum);
queryWrapper.ge("publish_num", s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(price)) {
String[] s = price.split("_");
if (s.length > 1) {
queryWrapper.ge(PRICE_COLUMN, s[1]);
queryWrapper.between(PRICE_COLUMN, s[0], s[1]);
} else {
queryWrapper.le(PRICE_COLUMN, s[0]);
queryWrapper.ge(PRICE_COLUMN, s[0]);
}
}
if (CharSequenceUtil.isNotEmpty(receivedNum)) {
String[] s = receivedNum.split("_");
if (s.length > 1) {
queryWrapper.ge("received_num", s[1]);
queryWrapper.between("received_num", s[0], s[1]);
} else {
queryWrapper.le("received_num", s[0]);
queryWrapper.ge("received_num", s[0]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public <T> QueryWrapper<T> queryWrapper() {
if (CharSequenceUtil.isNotEmpty(price)) {
String[] s = price.split("_");
if (s.length > 1) {
queryWrapper.ge(PRICE_COLUMN, s[1]);
queryWrapper.between(PRICE_COLUMN, s[0], s[1]);
} else {
queryWrapper.le(PRICE_COLUMN, s[0]);
queryWrapper.ge(PRICE_COLUMN, s[0]);
}
}
if (this.getStartTime() != null) {
Expand Down

0 comments on commit e8d9556

Please sign in to comment.