|
|
|
@ -8,7 +8,10 @@ import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
|
import com.op.common.core.utils.StringUtils;
|
|
|
|
|
import com.op.quality.domain.BaseFile;
|
|
|
|
|
import com.op.quality.domain.QcCheckTaskDetail;
|
|
|
|
|
import com.op.quality.domain.QcCheckType;
|
|
|
|
|
import com.op.quality.mapper.QMSFileMapper;
|
|
|
|
|
import com.op.system.api.domain.quality.ChartDTO;
|
|
|
|
|
import com.op.system.api.domain.quality.ChartSeriesDTO;
|
|
|
|
|
import com.op.system.api.domain.quality.FactoryDto;
|
|
|
|
@ -29,7 +32,8 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private QcStaticTableMapper qcStaticTableMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QMSFileMapper qmsFileMapper;
|
|
|
|
|
/**
|
|
|
|
|
* 查询质量系统报列表
|
|
|
|
|
*
|
|
|
|
@ -162,106 +166,202 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
public List<QcStaticTable> getXJCheckTableDetail(QcStaticTable qcStaticTable) {
|
|
|
|
|
List<QcStaticTable> projects = qcStaticTableMapper.getXJProjects(qcStaticTable);
|
|
|
|
|
Map<String,QcStaticTable> detailMap = qcStaticTableMapper.getProjectDetail(qcStaticTable);
|
|
|
|
|
Map<String,QcStaticTable> picsMap = qcStaticTableMapper.picsMap(qcStaticTable);
|
|
|
|
|
for(QcStaticTable project:projects){
|
|
|
|
|
this.getDataFromMap(detailMap,project);
|
|
|
|
|
this.getDataFromMap(detailMap,project,picsMap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return projects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getDataFromMap(Map<String,QcStaticTable> detailMap,QcStaticTable project){
|
|
|
|
|
private void getDataFromMap(Map<String,QcStaticTable> detailMap,QcStaticTable project,Map<String,QcStaticTable> picsMap){
|
|
|
|
|
String keystr = project.getProjectId()+"08";
|
|
|
|
|
QcStaticTable detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn080090(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if (StringUtils.isNotBlank(detail.getRemark())) {
|
|
|
|
|
project.setColumn080090(detail.getRemark());
|
|
|
|
|
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
|
|
|
|
|
project.setColumn080090(detail.getStatus().equals("Y") ? "✓" : "✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn080090(project.getColumn080090()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn080090("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"09";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn090100(detail.getStatus());
|
|
|
|
|
if(detail!=null){
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn090100(detail.getRemark());
|
|
|
|
|
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn090100(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn090100(project.getColumn090100()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn090100("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"10";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn100110(detail.getStatus());
|
|
|
|
|
if(detail!=null){
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn100110(detail.getRemark());
|
|
|
|
|
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn100110(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn100110(project.getColumn100110()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn100110("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"11";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn110120(detail.getStatus());
|
|
|
|
|
if(detail!=null){
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn110120(detail.getRemark());
|
|
|
|
|
}else if(detail!=null&&detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn110120(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn110120(project.getColumn110120()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn110120("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"12";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn123133(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if (StringUtils.isNotBlank(detail.getRemark())) {
|
|
|
|
|
project.setColumn123133(detail.getRemark());
|
|
|
|
|
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
|
|
|
|
|
project.setColumn123133(detail.getStatus().equals("Y") ? "✓" : "✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn123133(project.getColumn123133()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn123133("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"13";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn133143(detail.getStatus());
|
|
|
|
|
if(detail!=null){
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn133143(detail.getRemark());
|
|
|
|
|
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn133143(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn133143(project.getColumn133143()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn133143("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"14";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn143153(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if (StringUtils.isNotBlank(detail.getRemark())) {
|
|
|
|
|
project.setColumn143153(detail.getRemark());
|
|
|
|
|
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
|
|
|
|
|
project.setColumn143153(detail.getStatus().equals("Y") ? "✓" : "✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn143153(project.getColumn143153()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn143153("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"15";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn153163(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if (StringUtils.isNotBlank(detail.getRemark())) {
|
|
|
|
|
project.setColumn153163(detail.getRemark());
|
|
|
|
|
} else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
|
|
|
|
|
project.setColumn153163(detail.getStatus().equals("Y") ? "✓" : "✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn153163(project.getColumn153163()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn153163("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"16";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn163173(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn163173(detail.getRemark());
|
|
|
|
|
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn163173(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn163173(project.getColumn163173()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn163173("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"18";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn180190(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn180190(detail.getRemark());
|
|
|
|
|
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn180190(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn180190(project.getColumn180190()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn180190("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"19";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn190200(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn190200(detail.getRemark());
|
|
|
|
|
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn190200(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn190200(project.getColumn190200()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn190200("-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
keystr = project.getProjectId()+"20";
|
|
|
|
|
detail = detailMap.get(keystr);
|
|
|
|
|
if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn200210(detail.getStatus());
|
|
|
|
|
if(detail!=null) {
|
|
|
|
|
if(StringUtils.isNotBlank(detail.getRemark())){
|
|
|
|
|
project.setColumn200210(detail.getRemark());
|
|
|
|
|
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
|
|
|
|
|
project.setColumn200210(detail.getStatus().equals("Y")?"✓":"✘");
|
|
|
|
|
}
|
|
|
|
|
QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
|
|
|
|
|
if(urlDTO!=null){
|
|
|
|
|
project.setColumn200210(project.getColumn200210()+","+urlDTO.getProjectId().replace("&","&"));//projectId存的照片路径
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
project.setColumn200210("-");
|
|
|
|
|
}
|
|
|
|
@ -371,6 +471,71 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
return dtos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public QcStaticTable getDLTableAvgInfo(QcStaticTable qcStaticTable) {
|
|
|
|
|
QcStaticTable dto = new QcStaticTable();
|
|
|
|
|
//第一列日期
|
|
|
|
|
List<String> days = this.getDays(qcStaticTable.getYmArrayStart(),
|
|
|
|
|
qcStaticTable.getYmArrayEnd(),"ymd");
|
|
|
|
|
qcStaticTable.setDataType("ymd");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<QcStaticTable> titleList = qcStaticTableMapper.getDLTableTitle(qcStaticTable);
|
|
|
|
|
Map<String, QcStaticTable> titleMap = titleList.stream().collect(Collectors.toMap(QcStaticTable::getYearMonth, (a) -> a));
|
|
|
|
|
//表头:第一行
|
|
|
|
|
List<String> colName1 = titleList.stream().map(QcStaticTable::getMaterialName).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> colCode1 = titleList.stream().map(QcStaticTable::getMaterialCode).distinct().collect(Collectors.toList());
|
|
|
|
|
dto.setTitleCol1(colName1);
|
|
|
|
|
//表头:第二行
|
|
|
|
|
List<String> colName2 = titleList.stream().map(QcStaticTable::getRuleName).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> colCode2 = titleList.stream().map(QcStaticTable::getProjectNo).distinct().collect(Collectors.toList());
|
|
|
|
|
dto.setTitleCol2(colName2);
|
|
|
|
|
//均值列表
|
|
|
|
|
List<HashMap> dxData = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
for(String day:days){
|
|
|
|
|
HashMap result = new HashMap();
|
|
|
|
|
List<HashMap> detailsData = new ArrayList<>();
|
|
|
|
|
HashMap detailResult = new HashMap();
|
|
|
|
|
result.put("ymdms",day+"均值");
|
|
|
|
|
int i=0,j=0;
|
|
|
|
|
for(int m=0;m<colCode1.size();m++){
|
|
|
|
|
for(int n=0;n<colCode2.size();n++){
|
|
|
|
|
String key = colCode1.get(m)+"-"+colCode2.get(n)+"-"+day;
|
|
|
|
|
QcStaticTable avgdto = titleMap.get(key);
|
|
|
|
|
if(avgdto!=null){
|
|
|
|
|
String avgArrayStr = avgdto.getQuality().replace("[","")
|
|
|
|
|
.replace("]","")
|
|
|
|
|
.replace("\"","");
|
|
|
|
|
List<String> avgArray = Arrays.asList(avgArrayStr.split(","));
|
|
|
|
|
BigDecimal addVal = new BigDecimal("0.00");
|
|
|
|
|
for(String avgVal:avgArray){
|
|
|
|
|
addVal = addVal.add(new BigDecimal(avgVal));
|
|
|
|
|
}
|
|
|
|
|
BigDecimal avg = addVal.divide(new BigDecimal(avgArray.size()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
result.put("mcode"+m+"Pcode"+n,avg);
|
|
|
|
|
detailResult.put("mcode"+m+"Pcode"+n+"Detail",avgArrayStr.replace(",","\n"));
|
|
|
|
|
}else{
|
|
|
|
|
result.put("mcode"+m+"Pcode"+n,"0.00");
|
|
|
|
|
detailResult.put("mcode"+m+"Pcode"+n+"Detail","");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
detailsData.add(detailResult);
|
|
|
|
|
result.put("details",detailsData);
|
|
|
|
|
dxData.add(result);
|
|
|
|
|
}
|
|
|
|
|
dto.setDxData(dxData);
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<QcStaticTable> getDLDetailList(QcStaticTable qcStaticTable) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> getHourProductionTitle(QcStaticTable qcStaticTable) {
|
|
|
|
|
|
|
|
|
|
// 返回的日期集合
|
|
|
|
@ -401,6 +566,50 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
|
|
|
|
|
|
|
|
|
|
return dayHours;
|
|
|
|
|
}
|
|
|
|
|
public List<String> getDays(String startMonth,String endMonth,String type){
|
|
|
|
|
// 返回的日期集合
|
|
|
|
|
List<String> days = new ArrayList<String>();
|
|
|
|
|
DateFormat dateFormat = null;
|
|
|
|
|
try {
|
|
|
|
|
Calendar tempStart = null;
|
|
|
|
|
Calendar tempEnd = null;
|
|
|
|
|
if("ymd".equals(type)){
|
|
|
|
|
dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Date start = dateFormat.parse(startMonth);//开始
|
|
|
|
|
Date end = dateFormat.parse(endMonth);//结束
|
|
|
|
|
|
|
|
|
|
tempStart = Calendar.getInstance();
|
|
|
|
|
tempStart.setTime(start);
|
|
|
|
|
|
|
|
|
|
tempEnd = Calendar.getInstance();
|
|
|
|
|
tempEnd.setTime(end);
|
|
|
|
|
tempEnd.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
}else{
|
|
|
|
|
dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
Date start = dateFormat.parse(startMonth);//开始
|
|
|
|
|
Date end = dateFormat.parse(endMonth);//结束
|
|
|
|
|
|
|
|
|
|
tempStart = Calendar.getInstance();
|
|
|
|
|
tempStart.setTime(start);
|
|
|
|
|
|
|
|
|
|
tempEnd = Calendar.getInstance();
|
|
|
|
|
tempEnd.setTime(end);
|
|
|
|
|
tempEnd.add(Calendar.MONTH, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (tempStart.before(tempEnd)) {
|
|
|
|
|
days.add(dateFormat.format(tempStart.getTime()));
|
|
|
|
|
if("ymd".equals(type)) {
|
|
|
|
|
tempStart.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
|
|
}else{
|
|
|
|
|
tempStart.add(Calendar.MONTH, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return days;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|