package com.zy.asrs.service.impl;
|
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.zy.asrs.entity.PlaQty;
|
import com.zy.asrs.mapper.PlaQtyMapper;
|
import com.zy.asrs.service.PlaQtyService;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Calendar;
|
import java.util.List;
|
|
@Service("plaQtyService")
|
public class PlaQtyServiceImpl extends ServiceImpl<PlaQtyMapper, PlaQty> implements PlaQtyService {
|
|
@Override
|
public JSONArray getDeliveryDate() {
|
|
JSONArray jsonArray = new JSONArray();
|
|
for (int i=0; i<8; i++){
|
Calendar calendar = Calendar.getInstance();
|
calendar.add(Calendar.DAY_OF_YEAR, i/2);
|
int month = calendar.get(Calendar.MONTH) + 1;
|
int day = calendar.get(Calendar.DAY_OF_MONTH);
|
|
String isAm = i % 2 == 0 ? "上午" : "下午";
|
|
String pakoutTimeQuery = month + "月" + day + "日" + isAm;
|
List<PlaQty> plaQties = this.selectList(new EntityWrapper<PlaQty>().eq("pakout_time", pakoutTimeQuery));
|
|
Double daysOutWeight = 0.0;
|
String handlerBy = "";
|
for (PlaQty plaQty : plaQties){
|
daysOutWeight += plaQty.getOrderWeight();
|
if(!handlerBy.contains(plaQty.getHandlerBy())){{
|
handlerBy += "、" + plaQty.getHandlerBy();
|
}}
|
}
|
|
JSONObject object = new JSONObject();
|
String text = daysOutWeight > 0 ? pakoutTimeQuery + "(" + daysOutWeight/1000 + "吨)" : pakoutTimeQuery;
|
|
object.put("text",text);
|
object.put("user",handlerBy);
|
|
jsonArray.add(object);
|
}
|
|
return jsonArray;
|
}
|
|
@Override
|
public List<String> selectOrderNo(String orderNo) {
|
return this.baseMapper.selectOrderNo(orderNo);
|
}
|
|
public static void main(String[] args) {
|
String str = "aaaa";
|
|
|
System.out.println(str.split("\\(" )[0]);
|
}
|
}
|