|
|
|
@ -2,6 +2,7 @@ package com.glxp.udi.admin.mongo.dao;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.OrderMdEntity;
|
|
|
|
|
import com.glxp.udi.admin.mongo.MongoDBName;
|
|
|
|
|
import com.glxp.udi.admin.mongo.dao.base.MongoBaseDao;
|
|
|
|
@ -35,7 +36,7 @@ public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest>
|
|
|
|
|
if (null == query && orderFilterRequest != null) {
|
|
|
|
|
query = buildQuery(orderFilterRequest);
|
|
|
|
|
}
|
|
|
|
|
return mongoPageHelper.pageQuery(query, OrderMdEntity.class, page, size, MongoDBName.NAME_ORDER);
|
|
|
|
|
return mongoPageHelper.pageQuery(query, OrderMdEntity.class, size, page, MongoDBName.NAME_ORDER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -101,22 +102,36 @@ public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest>
|
|
|
|
|
Query query = new Query();
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(OrderFilterRequest.class);
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(orderFilterRequest, field);
|
|
|
|
|
if (ObjectUtil.isNotNull(fieldValue)) {
|
|
|
|
|
if ("id".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("orderId").is(fieldValue));
|
|
|
|
|
} else if ("invCodes".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("locStorageCode").in(fieldValue));
|
|
|
|
|
} else if ("actDate".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("actDate").gte(fieldValue + " 00:00:00").andOperator(Criteria.where("actDate").lte(fieldValue + " 23:59:59")));
|
|
|
|
|
} else if ("isError".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("status").ne(fieldValue));
|
|
|
|
|
if (field.getName() != "page" && field.getName() != "limit") {
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(orderFilterRequest, field);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(fieldValue) && StrUtil.isNotBlank(String.valueOf(fieldValue))) {
|
|
|
|
|
if ("id".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("orderId").is(fieldValue));
|
|
|
|
|
} else if ("invCodes".equals(field.getName())) {
|
|
|
|
|
List invCodes = (List) fieldValue;
|
|
|
|
|
query.addCriteria(Criteria.where("locStorageCode").in(invCodes.toArray()));
|
|
|
|
|
} else if ("actDate".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("actDate").gte(fieldValue + " 00:00:00").andOperator(Criteria.where("actDate").lte(fieldValue + " 23:59:59")));
|
|
|
|
|
} else if ("isError".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("status").ne(fieldValue));
|
|
|
|
|
} else if ("receiveStatus".equals(field.getName())) {
|
|
|
|
|
break;
|
|
|
|
|
} else if ("checkReceiveStatus".equals(field.getName())) {
|
|
|
|
|
if ("true".equals(String.valueOf(fieldValue))) {
|
|
|
|
|
Object receiveStatus = ReflectUtil.getFieldValue(orderFilterRequest, "receiveStatus");
|
|
|
|
|
if (null != receiveStatus) {
|
|
|
|
|
query.addCriteria(Criteria.where("receiveStatus").is(fieldValue));
|
|
|
|
|
} else {
|
|
|
|
|
query.addCriteria(Criteria.where("receiveStatus").ne(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
query.addCriteria(Criteria.where(field.getName()).is(fieldValue));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
query.addCriteria(Criteria.where(field.getName()).is(fieldValue));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ("receiveStatus".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("receiveStatus").ne(0));
|
|
|
|
|
if ("action".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("action").ne("StockCheck"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -134,7 +149,7 @@ public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest>
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(OrderMdEntity.class);
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(orderMdEntity, field);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(fieldValue)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(fieldValue) && StrUtil.isNotBlank(String.valueOf(fieldValue))) {
|
|
|
|
|
if ("id".equals(field.getName())) {
|
|
|
|
|
query.addCriteria(Criteria.where("_id").is(fieldValue));
|
|
|
|
|
}
|
|
|
|
@ -154,7 +169,7 @@ public class OrderDao implements MongoBaseDao<OrderMdEntity, OrderFilterRequest>
|
|
|
|
|
Field[] fields = ReflectUtil.getFields(OrderMdEntity.class);
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
Object fieldValue = ReflectUtil.getFieldValue(orderMdEntity, field);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(fieldValue)) {
|
|
|
|
|
if (ObjectUtil.isNotEmpty(fieldValue) && StrUtil.isNotBlank(String.valueOf(fieldValue))) {
|
|
|
|
|
if (!field.getName().equals("id") && !field.getName().equals("orderId")) {
|
|
|
|
|
update.set(field.getName(), fieldValue);
|
|
|
|
|
}
|
|
|
|
|