| | |
| | | package com.example.erp.service.mm; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import java.util.List; |
| | | import java.util.ArrayList; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @DS("mm") |
| | |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", materialInventoryMapper.getSelectMaterialInventory(offset, pageSize, materialInventory)); |
| | | map.put("total", materialInventoryMapper.getSelectMaterialInventoryPageTotal(offset, pageSize, materialInventory)); |
| | | List<Long> ids=new ArrayList<>();; |
| | | if(materialInventory.getStockId()!=null && !materialInventory.getStockId().isEmpty()){ |
| | | List<String> result = StrUtil.split(materialInventory.getStockId(), '|'); |
| | | ids=result.stream().map(Long::valueOf).collect(Collectors.toList()); |
| | | } |
| | | map.put("data", materialInventoryMapper.getSelectMaterialInventory(offset, pageSize, materialInventory,ids)); |
| | | map.put("total", materialInventoryMapper.getSelectMaterialInventoryPageTotal(offset, pageSize, materialInventory,ids)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectMaterialInventoryEngineering(Integer pageNum, Integer pageSize, OptimizeUse optimizeUse) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", materialInventoryMapper.getSelectMaterialInventoryEngineering(offset, pageSize, optimizeUse)); |
| | | map.put("total", materialInventoryMapper.getSelectMaterialInventoryEngineeringPageTotal(offset, pageSize, optimizeUse)); |
| | | List<Long> ids=new ArrayList<>();; |
| | | if(optimizeUse.getRawStockCode()!=null && !optimizeUse.getRawStockCode().isEmpty()){ |
| | | List<String> result = StrUtil.split(optimizeUse.getRawStockCode(), '|'); |
| | | ids=result.stream().map(Long::valueOf).collect(Collectors.toList()); |
| | | } |
| | | map.put("data", materialInventoryMapper.getSelectMaterialInventoryEngineering(offset, pageSize, optimizeUse,ids)); |
| | | map.put("total", materialInventoryMapper.getSelectMaterialInventoryEngineeringPageTotal(offset, pageSize, optimizeUse,ids)); |
| | | return map; |
| | | } |
| | | |