|
|
|
|
@ -18,6 +18,7 @@ import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.Year;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -350,73 +351,25 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<QcInterface> getMonthOfYearContrast(QcInterface qcInterface) {
|
|
|
|
|
|
|
|
|
|
List<QcInterface> dtos = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
QcInterface nowYM = new QcInterface();
|
|
|
|
|
QcInterface lastYM = new QcInterface();
|
|
|
|
|
String nowYMD = DateUtils.getDate();
|
|
|
|
|
String[] nowYMDs = nowYMD.split("-");
|
|
|
|
|
int nowYear = Integer.parseInt(nowYMDs[0]);
|
|
|
|
|
int lastYear = nowYear - 1;
|
|
|
|
|
List<String> daystr1 = new ArrayList<>();
|
|
|
|
|
List<String> daystr0 = new ArrayList<>();
|
|
|
|
|
for (int m = 1; m <= 12; m++) {
|
|
|
|
|
daystr0.add(lastYear + "-" + String.format("%02d", m));
|
|
|
|
|
daystr1.add(nowYear + "-" + String.format("%02d", m));
|
|
|
|
|
}
|
|
|
|
|
lastYM.setDayStr(daystr0);
|
|
|
|
|
nowYM.setDayStr(daystr1);
|
|
|
|
|
//生产打开
|
|
|
|
|
qcInterface.setYmd("'" + nowYear + "','" + lastYear + "'");
|
|
|
|
|
|
|
|
|
|
Map<String, QcInterface> noOkNum = qcInterfaceMapper.getMothNoOkNum(qcInterface);
|
|
|
|
|
if (noOkNum == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> dataBar0 = new ArrayList<>();//不合规数量
|
|
|
|
|
List<String> dataLine0 = new ArrayList<>();//不合格率
|
|
|
|
|
for (String day0 : daystr0) {
|
|
|
|
|
QcInterface last = noOkNum.get(day0);
|
|
|
|
|
if (last != null&& !"0.00".equals(last.getQuality())) {
|
|
|
|
|
dataBar0.add(last.getNoOkQuality());
|
|
|
|
|
BigDecimal norate0 = new BigDecimal(last.getNoOkQuality()).multiply(new BigDecimal(100))
|
|
|
|
|
.divide(new BigDecimal(last.getQuality()), 2, RoundingMode.HALF_UP);
|
|
|
|
|
dataLine0.add(norate0.toString());
|
|
|
|
|
} else {
|
|
|
|
|
dataBar0.add("0");
|
|
|
|
|
dataLine0.add("0.00");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> dataBar1 = new ArrayList<>();//不合规数量
|
|
|
|
|
List<String> dataLine1 = new ArrayList<>();//不合格率
|
|
|
|
|
for (String day1 : daystr1) {
|
|
|
|
|
QcInterface now = noOkNum.get(day1);
|
|
|
|
|
if (now != null && !"0.00".equals(now.getQuality())) {
|
|
|
|
|
dataBar1.add(now.getNoOkQuality());
|
|
|
|
|
BigDecimal norate0 = new BigDecimal(now.getNoOkQuality()).multiply(new BigDecimal(100))
|
|
|
|
|
.divide(new BigDecimal(now.getQuality()), 2, RoundingMode.HALF_UP);
|
|
|
|
|
dataLine1.add(norate0.toString());
|
|
|
|
|
} else {
|
|
|
|
|
dataBar1.add("0");
|
|
|
|
|
dataLine1.add("0.00");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lastYM.setDataBarArrays(dataBar0);
|
|
|
|
|
lastYM.setDataLineArrays(dataLine0);
|
|
|
|
|
|
|
|
|
|
nowYM.setDataBarArrays(dataBar1);
|
|
|
|
|
nowYM.setDataLineArrays(dataLine1);
|
|
|
|
|
|
|
|
|
|
dtos.add(lastYM);
|
|
|
|
|
dtos.add(nowYM);
|
|
|
|
|
|
|
|
|
|
return dtos;
|
|
|
|
|
public Map getMonthOfYearContrast(QcInterface qcInterface) {
|
|
|
|
|
Map map= new HashMap();
|
|
|
|
|
// DynamicDataSourceContextHolder.push("ds_1000");
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" + qcInterface.getFactoryCode());
|
|
|
|
|
try {
|
|
|
|
|
int currentYear = Year.now().getValue();
|
|
|
|
|
int previousYear = currentYear - 1;
|
|
|
|
|
//今年数据
|
|
|
|
|
List<Map> mapListCurrentYear = qcInterfaceMapper.NoncompliantProduct(currentYear);
|
|
|
|
|
//去年数据
|
|
|
|
|
List<Map> mapListPreviousYear= qcInterfaceMapper.NoncompliantProduct(previousYear);
|
|
|
|
|
map.put("mapListCurrentYear",mapListCurrentYear);
|
|
|
|
|
map.put("mapListPreviousYear",mapListPreviousYear);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}finally {
|
|
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
}
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -493,6 +446,4 @@ public class QcInterfaceServiceImpl implements IQcInterfaceService {
|
|
|
|
|
}
|
|
|
|
|
return days;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|