1.修改单据查询更新代码

master
x_z 3 years ago
parent efc758c860
commit d4069455dc

@ -18,6 +18,7 @@ import com.glxp.udi.admin.entity.basic.BussinessTypeEntity;
import com.glxp.udi.admin.entity.inout.*;
import com.glxp.udi.admin.entity.param.SystemParamConfigEntity;
import com.glxp.udi.admin.mongo.MongoDBName;
import com.glxp.udi.admin.mongo.dao.OrderDao;
import com.glxp.udi.admin.mongo.utils.MongoPageHelper;
import com.glxp.udi.admin.mongo.utils.PageResult;
import com.glxp.udi.admin.req.inout.DeleteRequest;
@ -73,57 +74,11 @@ public class OrderMdService {
private MongoPageHelper mongoPageHelper;
@Resource
private BussinessTypeDao bussinessTypeDao;
@Resource
private OrderDao orderDao;
public PageResult<OrderMdEntity> filterList(OrderFilterRequest orderFilterRequest) {
Query query = new Query();
if (StrUtil.isNotBlank(orderFilterRequest.getId())) {
query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getId()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getOrderId())) {
query.addCriteria(Criteria.where("orderId").is(orderFilterRequest.getOrderId()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getMainAction())) {
query.addCriteria(Criteria.where("mainAction").is(orderFilterRequest.getMainAction()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getAction())) {
query.addCriteria(Criteria.where("action").is(orderFilterRequest.getAction()));
}
if (StrUtil.isBlank(orderFilterRequest.getAction())) {
query.addCriteria(Criteria.where("action").ne("StockCheck"));
}
if (null != orderFilterRequest.getStatus()) {
query.addCriteria(Criteria.where("status").is(orderFilterRequest.getStatus()));
}
if (StrUtil.isNotBlank(orderFilterRequest.getExportStatus())) {
query.addCriteria(Criteria.where("exportStatus").is(orderFilterRequest.getExportStatus()));
}
if (CollUtil.isNotEmpty(orderFilterRequest.getInvCodes())) {
query.addCriteria(Criteria.where("locStorageCode").in(orderFilterRequest.getInvCodes()));
}
if (orderFilterRequest.getCustomerId() != null) {
if (orderFilterRequest.getStartTime() != null && !orderFilterRequest.getStartTime().isEmpty()
&& orderFilterRequest.getEndTime() != null && !orderFilterRequest.getEndTime().isEmpty()) {
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId())
.andOperator(Criteria.where("actDate").gte(orderFilterRequest.getStartTime() + " 00:00:00"),
Criteria.where("actDate").lte(orderFilterRequest.getEndTime() + " 23:59:59")));
} else {
query.addCriteria(Criteria.where("customerId").is(orderFilterRequest.getCustomerId()));
}
}
if (orderFilterRequest.getIsError() != null) {
query.addCriteria(Criteria.where("status").ne(orderFilterRequest.getIsError()));
}
if (orderFilterRequest.isCheckReceiveStatus()) {
if (orderFilterRequest.getReceiveStatus() == null) {
query.addCriteria(Criteria.where("receiveStatus").ne(0));
} else {
query.addCriteria(Criteria.where("receiveStatus").is(orderFilterRequest.getReceiveStatus()));
}
}
return mongoPageHelper.pageQuery(query, OrderMdEntity.class,
orderFilterRequest.getLimit(), orderFilterRequest.getPage(), orderFilterRequest.getLastId(), MongoDBName.NAME_ORDER);
return orderDao.pageQuery(null, orderFilterRequest, orderFilterRequest.getPage(), orderFilterRequest.getLimit());
}
@ -201,47 +156,7 @@ public class OrderMdService {
return;
}
Update update = new Update();
if (orderMdEntity.getId() != null) {
update.set("fromCorp", orderMdEntity.getFromCorp());
}
if (orderMdEntity.getFromCorp() != null) {
update.set("fromCorp", orderMdEntity.getFromCorp());
}
if (orderMdEntity.getFromCorpId() != null) {
update.set("fromCorpId", orderMdEntity.getFromCorpId());
}
if (orderMdEntity.getActDate() != null) {
update.set("actDate", orderMdEntity.getActDate());
}
if (orderMdEntity.getStatus() != null) {
update.set("status", orderMdEntity.getStatus());
}
if (orderMdEntity.getRemark() != null) {
update.set("remark", orderMdEntity.getRemark());
}
if (orderMdEntity.getExportStatus() != null) {
update.set("exportStatus", orderMdEntity.getExportStatus());
}
if (orderMdEntity.getContrastStatus() != null) {
update.set("contrastStatus", orderMdEntity.getContrastStatus());
}
if (orderMdEntity.getErpFk() != null) {
update.set("erpFk", orderMdEntity.getErpFk());
}
if (orderMdEntity.getUploadStatus() != null) {
update.set("uploadStatus", orderMdEntity.getUploadStatus());
}
if (StrUtil.isNotBlank(orderMdEntity.getLocStorageCode())) {
update.set("locStorageCode", orderMdEntity.getLocStorageCode());
}
if (StrUtil.isNotBlank(orderMdEntity.getSupplementNo())) {
update.set("supplementNo", orderMdEntity.getSupplementNo());
}
if (null != orderMdEntity.getReceiveStatus()) {
update.set("receiveStatus", orderMdEntity.getReceiveStatus());
}
mongoTemplate.updateMulti(query, update, MongoDBName.NAME_ORDER);
orderDao.update(query, null, orderMdEntity);
}
public void deleteOrder(DeleteRequest deleteRequest) {
@ -252,16 +167,12 @@ public class OrderMdService {
if (deleteRequest.getOrderId() != null) {
query.addCriteria(Criteria.where("orderId").is(deleteRequest.getOrderId()));
}
mongoTemplate.remove(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
orderDao.delete(query, null);
}
public void insertOrder(OrderMdEntity orderMdEntity) {
if (orderMdEntity != null) {
Collection<OrderMdEntity> orderMdEntities = new ArrayList<>();
orderMdEntities.add(orderMdEntity);
mongoTemplate.insert(orderMdEntities, MongoDBName.NAME_ORDER);
}
orderDao.insert(orderMdEntity);
}
/**
@ -274,7 +185,7 @@ public class OrderMdService {
Query query = new Query();
if (StrUtil.isNotBlank(action)) {
query.addCriteria(Criteria.where("action").is(action));
return mongoTemplate.count(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
return orderDao.count(query, null);
}
return 0;
}
@ -444,11 +355,15 @@ public class OrderMdService {
*/
public List<OrderMdEntity> findWaitUploadOrders(UnitMaintainEntity unitMaintainEntity) {
Query query = new Query();
query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS)); //查询已完成单据
query.addCriteria(Criteria.where("uploadStatus").ne("1")); //查询未上传单据
query.addCriteria(Criteria.where("customerId").is(Long.valueOf(unitMaintainEntity.getCustomerId()))); //客户ID
query.addCriteria(Criteria.where("action").is(unitMaintainEntity.getSourceAction())); //本地单据类型
return mongoTemplate.find(query, OrderMdEntity.class, MongoDBName.NAME_ORDER);
//查询已完成单据
query.addCriteria(Criteria.where("status").is(ConstantStatus.ORDER_STATUS_SUCCESS))
//查询未上传单据
.addCriteria(Criteria.where("uploadStatus").ne("1"))
//客户ID
.addCriteria(Criteria.where("customerId").is(Long.valueOf(unitMaintainEntity.getCustomerId())))
//本地单据类型
.addCriteria(Criteria.where("action").is(unitMaintainEntity.getSourceAction()));
return orderDao.findList(query, null);
}
public List<OrderMdEntity> filterForDelete(String orderId) {

Loading…
Cancel
Save