巡检加载超时优化

master
zhaoxiaolin 1 year ago
parent 2480f69d97
commit 738c21b07c

@ -62,4 +62,6 @@ public interface QcStaticTableMapper {
List<QcStaticTable> getLocList();
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) {
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.getRemark())){
project.setColumn080090(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn080090(project.getColumn080090()+","+picurls);
}
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
project.setColumn080090(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn080090("-");
}
keystr = project.getProjectId()+"09";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn090100(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn090100(project.getColumn090100()+","+picurls);
}
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
project.setColumn090100(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn090100("-");
}
keystr = project.getProjectId()+"10";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn100110(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn100110(project.getColumn100110()+","+picurls);
}
}else if(detail!=null&&StringUtils.isNotBlank(detail.getStatus())){
project.setColumn100110(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn100110("-");
}
keystr = project.getProjectId()+"11";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn110120(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn110120(project.getColumn110120()+","+picurls);
}
}else if(detail!=null&&detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn110120(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn110120("-");
}
keystr = project.getProjectId()+"12";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn123133(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn123133(project.getColumn123133()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn123133(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn123133("-");
}
keystr = project.getProjectId()+"13";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn133143(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn133143(project.getColumn133143()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn133143(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn133143("-");
}
keystr = project.getProjectId()+"14";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn143153(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn143153(project.getColumn143153()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn143153(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn143153("-");
}
keystr = project.getProjectId()+"15";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn153163(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn153163(project.getColumn153163()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn153163(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn153163("-");
}
keystr = project.getProjectId()+"16";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn163173(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn163173(project.getColumn163173()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn163173(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn163173("-");
}
keystr = project.getProjectId()+"18";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn180190(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn180190(project.getColumn180190()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn180190(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn180190("-");
}
keystr = project.getProjectId()+"19";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn190200(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn190200(project.getColumn190200()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn190200(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn190200("-");
}
keystr = project.getProjectId()+"20";
detail = detailMap.get(keystr);
if(detail!=null && StringUtils.isNotBlank(detail.getRemark())){
project.setColumn200210(detail.getRemark());
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(detail.getRecordId());
if (!CollectionUtils.isEmpty(files)) {
List<String> pics = files.stream().map(BaseFile::getFileAddress).collect(Collectors.toList());
String picurls = pics.stream().collect(Collectors.joining(","));
project.setColumn200210(project.getColumn200210()+","+picurls);
}
}else if(detail!=null && StringUtils.isNotBlank(detail.getStatus())){
project.setColumn200210(detail.getStatus().equals("Y")?"✓":"✘");
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());//projectId存的照片路径
}
}else{
project.setColumn200210("-");
}

@ -230,4 +230,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
factory_code supplierCode
from sys_factory where f_type = 'c'
</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>

Loading…
Cancel
Save