parent
bcc101718e
commit
5ec1c1be42
@ -0,0 +1,90 @@
|
||||
package com.glxp.udi.admin.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.glxp.udi.admin.dao.inout.UdiInfoDao;
|
||||
import com.glxp.udi.admin.entity.inout.*;
|
||||
import com.glxp.udi.admin.mongo.service.*;
|
||||
import com.glxp.udi.admin.req.inout.FilterErpOrderRequest;
|
||||
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
|
||||
import com.glxp.udi.admin.req.inventory.FilterInvProductRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class TestController {
|
||||
|
||||
@Resource
|
||||
private OrderMdService orderMdService;
|
||||
@Resource
|
||||
private OrderDetailMdService orderDetailMdService;
|
||||
@Resource
|
||||
private InvProductMdService invProductMdService;
|
||||
@Resource
|
||||
private InvProductDetailMdService invProductDetailMdService;
|
||||
@Resource
|
||||
private UdiInfoDao udiInfoDao;
|
||||
|
||||
@GetMapping("/test/refreshOrderData")
|
||||
private String refreshOrderData() {
|
||||
try {
|
||||
//刷新订单详情表的数据
|
||||
List<ErpOrderEntity> erpOrderEntities = orderDetailMdService.filterOrderDetails(new FilterErpOrderRequest());
|
||||
/*erpOrderEntities.forEach(orderDetail -> {
|
||||
String orderId = orderDetail.getOrderIdFk();
|
||||
if (StrUtil.isNotBlank(orderId)) {
|
||||
OrderMdEntity order = orderMdService.findByOne(orderId);
|
||||
if (null != order) {
|
||||
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(orderDetail.getUuidFk()), "uuid", orderDetail.getUuidFk())
|
||||
.eq(null != order.getCustomerId(), "customerId", order.getCustomerId())
|
||||
.eq(StrUtil.isNotBlank(orderDetail.getPackSpec()), "ggxh", orderDetail.getPackSpec())
|
||||
);
|
||||
if (udiInfoEntity != null) {
|
||||
orderDetail.setRelId(String.valueOf(udiInfoEntity.getId()));
|
||||
log.info("刷新单据详情");
|
||||
orderDetailMdService.updateOrderDetail(orderDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
});*/
|
||||
|
||||
//刷新库存表的数据
|
||||
List<InvProductEntity> invProductEntities = invProductMdService.filterInvProductList(new FilterInvProductRequest());
|
||||
invProductEntities.forEach(invProductEntity -> {
|
||||
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductEntity.getRelIdFk()), "uuid", invProductEntity.getRelIdFk())
|
||||
.eq(StrUtil.isNotBlank(invProductEntity.getCustomerId()), "customerId", invProductEntity.getCustomerId())
|
||||
.eq(StrUtil.isNotBlank(invProductEntity.getGgxh()), "ggxh", invProductEntity.getGgxh())
|
||||
);
|
||||
if (null != udiInfoEntity) {
|
||||
invProductEntity.setRelIdFk(String.valueOf(udiInfoEntity.getId()));
|
||||
log.info("刷新库存");
|
||||
invProductMdService.updateInvProduct(invProductEntity);
|
||||
}
|
||||
});
|
||||
|
||||
//刷新库存详情表数据
|
||||
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(new FilterInvProductDetailRequest());
|
||||
invProductDetailEntities.forEach(invProductDetailEntity -> {
|
||||
UdiInfoEntity udiInfoEntity = udiInfoDao.selectOne(new QueryWrapper<UdiInfoEntity>().eq(StrUtil.isNotBlank(invProductDetailEntity.getProductIdFk()), "uuid", invProductDetailEntity.getProductIdFk())
|
||||
.eq(StrUtil.isNotBlank(invProductDetailEntity.getCustomerId()), "customerId", invProductDetailEntity.getCustomerId())
|
||||
);
|
||||
if (null != udiInfoEntity) {
|
||||
invProductDetailEntity.setProductIdFk(String.valueOf(udiInfoEntity.getId()));
|
||||
log.info("刷新库存详情");
|
||||
invProductDetailMdService.updateInvProduct(invProductDetailEntity);
|
||||
}
|
||||
});
|
||||
return "success";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue