|
|
@@ -29,7 +29,10 @@ import com.uas.platform.b2c.trade.support.ResultMap;
|
|
|
import com.uas.platform.b2c.trade.util.Preconditions;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.model.*;
|
|
|
+import com.uas.platform.core.persistence.criteria.CriterionExpression;
|
|
|
+import com.uas.platform.core.persistence.criteria.LogicalExpression;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
+import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
@@ -449,8 +452,8 @@ public class BankTransferServiceImpl implements BankTransferService {
|
|
|
* @return Page<BankTransfer>
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResultMap getVendorBankTransferByMall(PageParams params, Integer type) {
|
|
|
- if(type == null || (type != Type.SUP.value() && type != Type.MALL.value()&&type != Type.MALL.value()) || params == null) {
|
|
|
+ public ResultMap getVendorBankTransferByMall(PageParams params, Integer type, String keyword, Long fromDate, Long toDate) {
|
|
|
+ if(type == null || (type != Type.SUP.value() && type != Type.MALL.value()) || params == null) {
|
|
|
return new ResultMap(CodeType.NO_INFO, "参数信息丢失");
|
|
|
}
|
|
|
final PageInfo info = new PageInfo(params);
|
|
|
@@ -458,6 +461,8 @@ public class BankTransferServiceImpl implements BankTransferService {
|
|
|
info.filter("operateType", type);
|
|
|
info.filter("collectenuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
}
|
|
|
+ filterPageInfo(info, keyword, fromDate, toDate);
|
|
|
+
|
|
|
Page<BankTransfer> pageBankTran = bankTransferDao.findAll(new Specification<BankTransfer>() {
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<BankTransfer> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
@@ -474,4 +479,41 @@ public class BankTransferServiceImpl implements BankTransferService {
|
|
|
}
|
|
|
return ResultMap.success(pageBankTran);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<BankTransfer> getExportData(Integer type, String keyword, Long fromDate, Long toDate) {
|
|
|
+ if(type == null || (type != Type.SUP.value() && type != Type.MALL.value())) {
|
|
|
+ throw new IllegalOperatorException("参数丢失,刷新后重试");
|
|
|
+ }
|
|
|
+ final PageInfo info = new PageInfo();
|
|
|
+ if(type == Type.SUP.value()) {
|
|
|
+ info.filter("operateType", type);
|
|
|
+ info.filter("collectenuu", SystemSession.getUser().getEnterprise().getUu());
|
|
|
+ }
|
|
|
+ filterPageInfo(info, keyword, fromDate, toDate);
|
|
|
+ List<BankTransfer> list = bankTransferDao.findAll(new Specification<BankTransfer>() {
|
|
|
+ @Override
|
|
|
+ public Predicate toPredicate(Root<BankTransfer> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
|
|
|
+ criteriaQuery.where(info.getPredicates(root, criteriaQuery, criteriaBuilder));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void filterPageInfo(PageInfo info, String keyword, Long fromDate, Long toDate){
|
|
|
+ if (StringUtils.hasText(keyword)){
|
|
|
+ SimpleExpression[] simpArrs = new SimpleExpression[2];
|
|
|
+ simpArrs[0] = new SimpleExpression("orderid", keyword, CriterionExpression.Operator.LIKE, true);
|
|
|
+ simpArrs[1] = new SimpleExpression("buyerentername", keyword, CriterionExpression.Operator.LIKE, true);
|
|
|
+ LogicalExpression logical = new LogicalExpression(simpArrs, CriterionExpression.Operator.OR);
|
|
|
+ info.expression(logical);
|
|
|
+ }
|
|
|
+ if (fromDate != null) {
|
|
|
+ info.expression(PredicateUtils.gte("paytime", new Date(fromDate), false));
|
|
|
+ }
|
|
|
+ if (toDate != null) {
|
|
|
+ info.expression(PredicateUtils.lte("paytime", new Date(toDate), false));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|