guoyujie
7 天以前 8fbb9414ac41fd267691356147757602f3b6371c
north-glass-erp/src/main/java/com/example/erp/service/sd/DeliveryService.java
@@ -10,6 +10,8 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.example.erp.dto.sd.DeliveryDetailDTO;
import com.example.erp.dto.sd.DeliveryDetailProductDTO;
import com.example.erp.dto.sd.DeliverySearchDTO;
import com.example.erp.dto.sd.OrderSearchDTO;
import com.example.erp.entity.mm.FinishedOperateLog;
import com.example.erp.entity.sd.*;
import com.example.erp.entity.userInfo.Log;
@@ -28,6 +30,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@@ -59,7 +62,7 @@
    FinishedGoodsInventoryService finishedGoodsInventoryService;
    public Map<String, Object> getSelectShippingOrder(Integer pageNum, Integer pageSize,List<String> selectDate, Delivery delivery) throws JsonProcessingException {
    public Map<String, Object> getSelectShippingOrder(Integer pageNum, Integer pageSize,List<String> selectDate, Map<String,Object> config) throws JsonProcessingException {
        Integer offset = (pageNum - 1) * pageSize;
        String endDate = LocalDate.now().toString();
        String startDate = LocalDate.now().minusDays(15).toString();
@@ -71,8 +74,14 @@
                endDate = selectDate.get(1);
            }
        }
        JSONObject orderJson = new JSONObject(config);
        DeliverySearchDTO delivery = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("filter")), DeliverySearchDTO.class);
        Map<String,String> sortDate = (Map<String, String>) config.get("sort");
        String field = sortDate.get("field").replaceAll("(?<!^)([A-Z])", "_$1").toLowerCase();
        String orderBy = sortDate.get("order");
        Map<String, Object> map = new HashMap<>();
        map.put("data", deliveryMapper.getSelectShippingOrder(offset, pageSize,startDate,endDate, delivery));
        map.put("data", deliveryMapper.getSelectShippingOrder(offset, pageSize,startDate,endDate, delivery,field, orderBy));
        map.put("total", deliveryMapper.getSelectShippingOrderPageTotal(offset, pageSize,startDate,endDate, delivery));
        List<String> list = new ArrayList<>();
        list.add(startDate);
@@ -968,4 +977,42 @@
    }
    public Object appGetDeliveryList(List<String> dates) {
        //设置当前时间
        String endDate = LocalDate.now().toString();
        String startDate = LocalDate.now().minusDays(30).toString();
        if(dates !=null && dates.size()==2){
            if(dates.get(0) != null){
                startDate = String.valueOf(dates.get(0));
            }
            if(dates.get(1) != null){
                endDate = String.valueOf(dates.get(1));
            }
        }
        List<String> date = new ArrayList<>();
        date.add(startDate);
        date.add(endDate);
        List<Delivery> deliveryList = deliveryMapper.selectByDate(startDate, endDate);
        Integer quantity = 0;
        Double area = 0.00;
        Double money = 0.00;
        for(Delivery delivery:deliveryList){
            quantity += Integer.parseInt(String.valueOf(delivery.getQuantity()));
            area += Double.parseDouble(String.valueOf(delivery.getArea()));
            money += delivery.getMoney();
        }
        Map<String, Object> totalSum  = new HashMap<>();
        DecimalFormat df = new DecimalFormat("#.00");
        totalSum.put("quantity",quantity);
        totalSum.put("area", df.format(area));
        totalSum.put("perimeter", df.format(money));
        totalSum.put("count", deliveryList.size());
        Map<String,Object> map = new HashMap<>();
        map.put("data",deliveryList);
        map.put("date",date);
        map.put("totalSum",totalSum);
        return map;
    }
}