|
|
|
@ -4,13 +4,17 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.productionboard.entity.BaseLocationInfo;
|
|
|
|
|
import com.productionboard.entity.RecordTask;
|
|
|
|
|
import com.productionboard.mapper.BaseLocationInfoMapper;
|
|
|
|
|
import com.productionboard.mapper.RecordTaskMapper;
|
|
|
|
|
import com.productionboard.service.IBaseLocationService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -28,6 +32,8 @@ public class BaseLocationServiceImpl implements IBaseLocationService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private RecordTaskMapper recordTaskMapper;
|
|
|
|
|
|
|
|
|
|
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getStoreStatistics(String ids) {
|
|
|
|
|
QueryWrapper<BaseLocationInfo> wrapper = new QueryWrapper<>();
|
|
|
|
@ -60,23 +66,83 @@ public class BaseLocationServiceImpl implements IBaseLocationService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getParamJson(String ids) {
|
|
|
|
|
String[] result =new String[12];
|
|
|
|
|
|
|
|
|
|
QueryWrapper<BaseLocationInfo> wrapper = new QueryWrapper<>();
|
|
|
|
|
try{
|
|
|
|
|
QueryWrapper<BaseLocationInfo> locationWrapper = new QueryWrapper<BaseLocationInfo>();
|
|
|
|
|
QueryWrapper<RecordTask> taskWrapper = new QueryWrapper<>();
|
|
|
|
|
switch (ids) {
|
|
|
|
|
case"0":
|
|
|
|
|
wrapper.eq("STORE_CODE","B");
|
|
|
|
|
locationWrapper.eq("STORE_CODE","B");
|
|
|
|
|
taskWrapper.eq("STORE_CODE","B");
|
|
|
|
|
break;
|
|
|
|
|
case"1":
|
|
|
|
|
wrapper.eq("STORE_CODE","A");
|
|
|
|
|
locationWrapper.eq("STORE_CODE","A");
|
|
|
|
|
taskWrapper.eq("STORE_CODE","A");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
taskWrapper.like("RECORD_TIME",simpleDateFormat.format(new Date()));
|
|
|
|
|
|
|
|
|
|
List<RecordTask> recordTasks = recordTaskMapper.selectList(taskWrapper);
|
|
|
|
|
|
|
|
|
|
if(recordTasks.size()>0){
|
|
|
|
|
//1号库入库数量、出库数量:1入库2出库
|
|
|
|
|
int inAmount1 = recordTasks.stream().filter(x -> x.getLocationArea().equals("1") && x.getTaskType().equals("1")).collect(Collectors.toList()).size();
|
|
|
|
|
int outAmount1 = recordTasks.stream().filter(x -> x.getLocationArea().equals("1") && x.getTaskType().equals("2")).collect(Collectors.toList()).size();
|
|
|
|
|
//2号库入库数量、出库数量:1入库2出库
|
|
|
|
|
int inAmount2 = recordTasks.stream().filter(x -> x.getLocationArea().equals("2") && x.getTaskType().equals("1")).collect(Collectors.toList()).size();
|
|
|
|
|
int outAmount2 = recordTasks.stream().filter(x -> x.getLocationArea().equals("2") && x.getTaskType().equals("2")).collect(Collectors.toList()).size();
|
|
|
|
|
result[0] = inAmount1+"";
|
|
|
|
|
result[1] = outAmount1+"";
|
|
|
|
|
result[2] = inAmount2+"";
|
|
|
|
|
result[3] = outAmount2+"";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<BaseLocationInfo> baseLocationInfos = lcoationMapper.selectList(locationWrapper);
|
|
|
|
|
if(baseLocationInfos.size() > 0){
|
|
|
|
|
|
|
|
|
|
//正在使用
|
|
|
|
|
int inUse = baseLocationInfos.stream().filter(x -> x.getLocationStatus() == 1L).collect(Collectors.toList()).size();
|
|
|
|
|
System.out.println("正在使用:"+inUse);
|
|
|
|
|
//未使用
|
|
|
|
|
int unUse = baseLocationInfos.size() - inUse;
|
|
|
|
|
|
|
|
|
|
//1#正在使用
|
|
|
|
|
int size1 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("1")).collect(Collectors.toList()).size();
|
|
|
|
|
int size2 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("2")).collect(Collectors.toList()).size();
|
|
|
|
|
int inUse1 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("1") && x.getLocationStatus().equals("1")).collect(Collectors.toList()).size();
|
|
|
|
|
int inUse2 = baseLocationInfos.stream().filter(x -> x.getLocationArea().equals("2") && x.getLocationStatus().equals("1")).collect(Collectors.toList()).size();
|
|
|
|
|
int unUse1 = size1 - inUse1;
|
|
|
|
|
int unUse2 = size2 - inUse2;
|
|
|
|
|
|
|
|
|
|
//1号库入库数量、出库数量
|
|
|
|
|
result[4] = inUse1+"";
|
|
|
|
|
result[5] = unUse1+"";
|
|
|
|
|
result[6] = inUse2+"";
|
|
|
|
|
result[7] = unUse2+"";
|
|
|
|
|
result[8] = unUse+"";
|
|
|
|
|
|
|
|
|
|
//2
|
|
|
|
|
// 创建一个数值格式化对象
|
|
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance();
|
|
|
|
|
// 设置精确到小数点后2位
|
|
|
|
|
numberFormat.setMaximumFractionDigits(2);
|
|
|
|
|
String unUsePercentage = numberFormat.format((float)unUse/(float)baseLocationInfos.size()*100);
|
|
|
|
|
System.out.println("diliverNum和queryMailNum的百分比为:" + result + "%");
|
|
|
|
|
result[9] = unUsePercentage+"%";
|
|
|
|
|
result[10] = inUse+"";
|
|
|
|
|
String inUsePercentage = numberFormat.format((float)inUse/(float)baseLocationInfos.size()*100);
|
|
|
|
|
result[11] = inUsePercentage+"%";
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
System.out.println("门体库参数统计getParamJson异常:"+e.getMessage());
|
|
|
|
|
for (int i = 0; i < 12; i++) {
|
|
|
|
|
//
|
|
|
|
|
result[i] = i+"";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
return JSONArray.toJSONString(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|