巡检加载超时优化

master
zhaoxiaolin 1 year ago
parent 2480f69d97
commit 738c21b07c

@ -62,4 +62,6 @@ public interface QcStaticTableMapper {
List<QcStaticTable> getLocList(); List<QcStaticTable> getLocList();
List<QcStaticTable> getWorkcenter(); List<QcStaticTable> getWorkcenter();
@MapKey("recordId")
Map<String, QcStaticTable> picsMap(QcStaticTable qcStaticTable);
} }

@ -166,202 +166,202 @@ public class QcStaticTableServiceImpl implements IQcStaticTableService {
public List<QcStaticTable> getXJCheckTableDetail(QcStaticTable qcStaticTable) { public List<QcStaticTable> getXJCheckTableDetail(QcStaticTable qcStaticTable) {
List<QcStaticTable> projects = qcStaticTableMapper.getXJProjects(qcStaticTable); List<QcStaticTable> projects = qcStaticTableMapper.getXJProjects(qcStaticTable);
Map<String,QcStaticTable> detailMap = qcStaticTableMapper.getProjectDetail(qcStaticTable); Map<String,QcStaticTable> detailMap = qcStaticTableMapper.getProjectDetail(qcStaticTable);
Map<String,QcStaticTable> picsMap = qcStaticTableMapper.picsMap(qcStaticTable);
for(QcStaticTable project:projects){ for(QcStaticTable project:projects){
this.getDataFromMap(detailMap,project); this.getDataFromMap(detailMap,project,picsMap);
} }
return projects; 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"; String keystr = project.getProjectId()+"08";
QcStaticTable detail = detailMap.get(keystr); QcStaticTable detail = detailMap.get(keystr);
if(detail!=null&&StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn080090(detail.getRemark()); if (StringUtils.isNotBlank(detail.getRemark())) {
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn080090(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { } else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn080090(detail.getStatus().equals("Y") ? "✓" : "✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn080090(project.getColumn080090()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){ project.setColumn080090(project.getColumn080090()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn080090(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn080090("-"); project.setColumn080090("-");
} }
keystr = project.getProjectId()+"09"; keystr = project.getProjectId()+"09";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null){
project.setColumn090100(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn090100(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn090100(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn090100(project.getColumn090100()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){ project.setColumn090100(project.getColumn090100()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn090100(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn090100("-"); project.setColumn090100("-");
} }
keystr = project.getProjectId()+"10"; keystr = project.getProjectId()+"10";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null){
project.setColumn100110(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn100110(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn100110(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn100110(project.getColumn100110()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){ project.setColumn100110(project.getColumn100110()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn100110(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn100110("-"); project.setColumn100110("-");
} }
keystr = project.getProjectId()+"11"; keystr = project.getProjectId()+"11";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null){
project.setColumn110120(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn110120(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null&&detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn110120(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn110120(project.getColumn110120()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null&&detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn110120(project.getColumn110120()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn110120(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn110120("-"); project.setColumn110120("-");
} }
keystr = project.getProjectId()+"12"; keystr = project.getProjectId()+"12";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn123133(detail.getRemark()); if (StringUtils.isNotBlank(detail.getRemark())) {
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn123133(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { } else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn123133(detail.getStatus().equals("Y") ? "✓" : "✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn123133(project.getColumn123133()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn123133(project.getColumn123133()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn123133(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn123133("-"); project.setColumn123133("-");
} }
keystr = project.getProjectId()+"13"; keystr = project.getProjectId()+"13";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null){
project.setColumn133143(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn133143(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn133143(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn133143(project.getColumn133143()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn133143(project.getColumn133143()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn133143(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn133143("-"); project.setColumn133143("-");
} }
keystr = project.getProjectId()+"14"; keystr = project.getProjectId()+"14";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn143153(detail.getRemark()); if (StringUtils.isNotBlank(detail.getRemark())) {
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn143153(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { } else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn143153(detail.getStatus().equals("Y") ? "✓" : "✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn143153(project.getColumn143153()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn143153(project.getColumn143153()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn143153(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn143153("-"); project.setColumn143153("-");
} }
keystr = project.getProjectId()+"15"; keystr = project.getProjectId()+"15";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn153163(detail.getRemark()); if (StringUtils.isNotBlank(detail.getRemark())) {
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn153163(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { } else if (detail != null && StringUtils.isNotBlank(detail.getStatus())) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn153163(detail.getStatus().equals("Y") ? "✓" : "✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn153163(project.getColumn153163()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn153163(project.getColumn153163()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn153163(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn153163("-"); project.setColumn153163("-");
} }
keystr = project.getProjectId()+"16"; keystr = project.getProjectId()+"16";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn163173(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn163173(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn163173(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn163173(project.getColumn163173()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn163173(project.getColumn163173()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn163173(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn163173("-"); project.setColumn163173("-");
} }
keystr = project.getProjectId()+"18"; keystr = project.getProjectId()+"18";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn180190(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn180190(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn180190(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn180190(project.getColumn180190()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn180190(project.getColumn180190()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn180190(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn180190("-"); project.setColumn180190("-");
} }
keystr = project.getProjectId()+"19"; keystr = project.getProjectId()+"19";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn190200(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn190200(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn190200(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn190200(project.getColumn190200()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn190200(project.getColumn190200()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn190200(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn190200("-"); project.setColumn190200("-");
} }
keystr = project.getProjectId()+"20"; keystr = project.getProjectId()+"20";
detail = detailMap.get(keystr); detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){ if(detail!=null) {
project.setColumn200210(detail.getRemark()); if(StringUtils.isNotBlank(detail.getRemark())){
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId()); project.setColumn200210(detail.getRemark());
if (!CollectionUtils.isEmpty(files)) { }else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList()); project.setColumn200210(detail.getStatus().equals("Y")?"✓":"✘");
String picurls = pics.stream().collect(Collectors.joining(",")); }
project.setColumn200210(project.getColumn200210()+","+picurls); QcStaticTable urlDTO = picsMap.get(detail.getRecordId());
} if(urlDTO!=null){
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){ project.setColumn200210(project.getColumn200210()+","+urlDTO.getProjectId());//projectId存的照片路径
project.setColumn200210(detail.getStatus().equals("Y")?"✓":"✘"); }
}else{ }else{
project.setColumn200210("-"); project.setColumn200210("-");
} }

@ -230,4 +230,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
factory_code supplierCode factory_code supplierCode
from sys_factory where f_type = 'c' from sys_factory where f_type = 'c'
</select> </select>
<select id="picsMap" resultType="com.op.quality.domain.QcStaticTable">
SELECT
t.source_id recordId,
STUFF(
(SELECT ',' + file_address
FROM (
select file_address,source_id from base_file where source_id in(
select record_id from qc_check_task_detail where beLong_to in (
select record_id from qc_check_task
where order_no = #{orderNo} and check_type = 'checkTypeSCXJ')
)
) t0
WHERE t.source_id = t0.source_id
FOR xml path('')
),1,1,''
) projectId
FROM (
select file_address,source_id from base_file where source_id in(
select record_id from qc_check_task_detail where beLong_to in (
select record_id from qc_check_task
where order_no = #{orderNo} and check_type = 'checkTypeSCXJ')
)
) t
GROUP by t.source_id
</select>
</mapper> </mapper>

Loading…
Cancel
Save