|
|
@@ -0,0 +1,104 @@
|
|
|
+package com.zhongshu.card.server.core.dao.payment.impl;
|
|
|
+
|
|
|
+import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
|
|
|
+import com.zhongshu.card.client.model.payment.WalletRechargeSearch;
|
|
|
+import com.zhongshu.card.client.model.school.BookInfoSearch;
|
|
|
+import com.zhongshu.card.server.core.dao.BaseImpl;
|
|
|
+import com.zhongshu.card.server.core.dao.payment.extend.WalletRechargeExtend;
|
|
|
+import com.zhongshu.card.server.core.dao.school.extend.BookInfoDaoExtend;
|
|
|
+import com.zhongshu.card.server.core.domain.org.Department;
|
|
|
+import com.zhongshu.card.server.core.domain.payment.WalletRecharge;
|
|
|
+import com.zhongshu.card.server.core.domain.school.BookInfo;
|
|
|
+import com.zhongshu.card.server.core.util.CommonUtil;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author TRX
|
|
|
+ * @CreateDate: 2023/4/12
|
|
|
+ * @Version: 1.0
|
|
|
+ */
|
|
|
+public class WalletRechargeDaoImpl extends BaseImpl implements WalletRechargeExtend {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MongoTemplate mongoTemplate;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DBHelper dbHelper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<WalletRecharge> page(Pageable pageable, WalletRechargeSearch param) {
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
+
|
|
|
+ //
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getUserId())) {
|
|
|
+ criteria.and("userId").is(param.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 充值类型
|
|
|
+ if (param.getRechargeType() != null) {
|
|
|
+ criteria.and("rechargeType").is(param.getRechargeType());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(param.getAboutDataId())) {
|
|
|
+ criteria.and("aboutDataId").is(param.getAboutDataId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(param.getYear())) {
|
|
|
+ criteria.and("year").is(param.getYear());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(param.getMonth())) {
|
|
|
+ criteria.and("month").is(param.getMonth());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CommonUtil.longIsEmpty(param.getStartTime()) && !CommonUtil.longIsEmpty(param.getEndTime())) {
|
|
|
+ criteria.and("createTime").gte(param.getStartTime()).and("createTime").lte(param.getEndTime());
|
|
|
+ }
|
|
|
+
|
|
|
+// // 模糊搜索
|
|
|
+// List<Criteria> criterias = new ArrayList<>();
|
|
|
+// if (StringUtils.isNotEmpty(param.getName())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getName() + ".*$");
|
|
|
+// criterias.add(Criteria.where("name").is(pattern));
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(param.getPhone())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getPhone() + ".*$");
|
|
|
+// criterias.add(Criteria.where("phone").is(pattern));
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(param.getIdCard())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getIdCard() + ".*$");
|
|
|
+// criterias.add(Criteria.where("idCard").is(pattern));
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(param.getCode())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getCode() + ".*$");
|
|
|
+// criterias.add(Criteria.where("code").is(pattern));
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (StringUtils.isNotEmpty(param.getClassName())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getClassName() + ".*$");
|
|
|
+// criterias.add(Criteria.where("className").is(pattern));
|
|
|
+// }
|
|
|
+// if (!CollectionUtils.isEmpty(criterias)) {
|
|
|
+// criteria.andOperator(criterias.toArray(new Criteria[]{}));
|
|
|
+// }
|
|
|
+ criteria.and("isDelete").is(Boolean.FALSE);
|
|
|
+ Sort sort = buildSort(param);
|
|
|
+ Query query = Query.query(criteria);
|
|
|
+ query.with(sort);
|
|
|
+ return dbHelper.pages(query, pageable, WalletRecharge.class);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|