|
@@ -3,19 +3,31 @@ package com.factory.web.service.impl.ini;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
+import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
+import com.alibaba.excel.write.metadata.fill.FillConfig;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.factory.base.entity.aggregates.PageBean;
|
|
|
import com.factory.base.entity.aggregates.ResponseBean;
|
|
|
-import com.factory.base.entity.enumPo.*;
|
|
|
+import com.factory.base.entity.enumPo.CheckStatus;
|
|
|
+import com.factory.base.entity.enumPo.CheckTypeSubmit;
|
|
|
+import com.factory.base.entity.enumPo.PlanType;
|
|
|
+import com.factory.base.entity.enumPo.ReviewStatus;
|
|
|
import com.factory.base.entity.po.benteler.*;
|
|
|
import com.factory.base.entity.vo.req.BaseIdReq;
|
|
|
import com.factory.base.entity.vo.req.BasePageIdReq;
|
|
|
import com.factory.base.entity.vo.req.BaseTypeReq;
|
|
|
+import com.factory.base.util.file.FileUtils;
|
|
|
import com.factory.base.util.res.ResponseBeanBuilder;
|
|
|
+import com.factory.user.entity.vo.res.FileRes;
|
|
|
import com.factory.user.service.CommonService;
|
|
|
import com.factory.user.service.UserInfoService;
|
|
|
+import com.factory.web.entity.excel.ExcelFillCellMergeStrategy;
|
|
|
+import com.factory.web.entity.excel.FillData;
|
|
|
+import com.factory.web.entity.excel.TestFileUtil;
|
|
|
import com.factory.web.entity.vo.req.pad.GetVersionCheckItemReq;
|
|
|
import com.factory.web.entity.vo.req.pad.submitCheckReq;
|
|
|
import com.factory.web.entity.vo.req.pad.workDetailsReq;
|
|
@@ -24,10 +36,7 @@ import com.factory.web.entity.vo.res.pad.ini.getNowCheckStatusRes;
|
|
|
import com.factory.web.entity.vo.res.pad.ini.planlistRes;
|
|
|
import com.factory.web.entity.vo.res.pad.ini.workDetailsRes;
|
|
|
import com.factory.web.entity.vo.res.pad.ini.workTypeDetailsRes;
|
|
|
-import com.factory.web.entity.vo.res.web.ini.GetVersionBaseRes;
|
|
|
-import com.factory.web.entity.vo.res.web.ini.GetVersionHistoryRes;
|
|
|
-import com.factory.web.entity.vo.res.web.ini.PagePlanRes;
|
|
|
-import com.factory.web.entity.vo.res.web.ini.unAuditListRes;
|
|
|
+import com.factory.web.entity.vo.res.web.ini.*;
|
|
|
import com.factory.web.mapper.ini.BentelerIniVersionMapper;
|
|
|
import com.factory.web.service.BentelerPlanService;
|
|
|
import com.factory.web.service.ini.*;
|
|
@@ -37,6 +46,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
@@ -450,7 +460,7 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
.eq(BentelerIniCheckItem::getCheckType, checkType)
|
|
|
.like(BentelerIniCheckItem::getCreatedTime, LocalDate.now())
|
|
|
);
|
|
|
- checkItems.forEach(item->{
|
|
|
+ checkItems.forEach(item -> {
|
|
|
BentelerIniVersionItem versionItem = versionItemService.getById(item.getVersionItemId());
|
|
|
|
|
|
List<IniGread> iniGreads = item.getIniGreads();
|
|
@@ -462,7 +472,7 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
return gread.isPassResult();
|
|
|
}
|
|
|
});
|
|
|
- if (!allPass){
|
|
|
+ if (!allPass) {
|
|
|
//todo
|
|
|
}
|
|
|
});
|
|
@@ -474,10 +484,10 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
@Override
|
|
|
public BentelerIniCheckType getResult_checkType(Long resultId, Integer checkType, LocalDate now) {
|
|
|
return checkTypeService.getOne(Wrappers.<BentelerIniCheckType>lambdaQuery()
|
|
|
- .eq(BentelerIniCheckType::getCheckResultId, resultId)
|
|
|
- .eq(BentelerIniCheckType::getCheckType, checkType)
|
|
|
- .like(BentelerIniCheckType::getCreatedTime, now)
|
|
|
- );
|
|
|
+ .eq(BentelerIniCheckType::getCheckResultId, resultId)
|
|
|
+ .eq(BentelerIniCheckType::getCheckType, checkType)
|
|
|
+ .like(BentelerIniCheckType::getCreatedTime, now)
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
|
|
@@ -495,6 +505,7 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void assemblerCheckItem_iniGread(List<BentelerIniCheckItem> checkItems) {
|
|
|
checkItems.forEach(checkItem -> {
|
|
@@ -670,6 +681,7 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
.versionWorks(workReq)
|
|
|
.build();
|
|
|
}
|
|
|
+
|
|
|
//计划名称是否重复
|
|
|
@Override
|
|
|
public boolean planNameRepetition(String name) {
|
|
@@ -680,4 +692,79 @@ public class BentelerIniVersionServiceImpl extends ServiceImpl<BentelerIniVersio
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseBean<FileRes> exportInitialPlan(exportInitialPlanReq req) {
|
|
|
+ Long versionId = req.getId();
|
|
|
+ getCheckResutGreadReq resutGreadReq = getCheckResutGreadReq.builder()
|
|
|
+ .localDate(req.getChooseDate())
|
|
|
+ .versionId(versionId)
|
|
|
+ .build();
|
|
|
+
|
|
|
+ List<getCheckResutGreadRes> checkResutGread = getCheckResutGread(resutGreadReq);
|
|
|
+ BentelerIniVersion version = versionService.getById(versionId);
|
|
|
+ Map<String, String> baseMap = Convert.toMap(String.class, String.class, version.getBaseMap());
|
|
|
+
|
|
|
+ // 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
|
|
|
+ String templateFileName = "systemLib/template/首件计划表.xlsx";
|
|
|
+
|
|
|
+ // 方案1 根据对象填充
|
|
|
+ File tempFile = FileUtils.createTempPdf(".xlsx");
|
|
|
+
|
|
|
+ String fileName = TestFileUtil.getPath() + "simpleFill" + System.currentTimeMillis() + ".xlsx";
|
|
|
+ // 这里 会填充到第一个sheet, 然后文件流会自动关闭
|
|
|
+ int[] a = {6};
|
|
|
+ ExcelWriter excelWriter = EasyExcel.write(tempFile, FillData.class)
|
|
|
+ .registerWriteHandler(new ExcelFillCellMergeStrategy(5, a))
|
|
|
+ .withTemplate(templateFileName).build();
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
+ //新一行
|
|
|
+ FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
|
|
+
|
|
|
+ //Map<String, String> map = new HashMap<String, String>();
|
|
|
+ //map.put("title", plan.getName());
|
|
|
+ //map.put("Project", version.getProject());
|
|
|
+ //map.put("GPIN", version.getGpin());
|
|
|
+ //
|
|
|
+ //List<FillData> arrayList = new ArrayList<>();
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //for (int i = 0; i < versionSubList.size(); i++) {
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // arrayList.add(FillData.builder()
|
|
|
+ // .no(Convert.toStr(i + 1))
|
|
|
+ // .characteristics(versionSub.getInspectionItem())
|
|
|
+ // .measuringRange(scope)
|
|
|
+ // .method(method)
|
|
|
+ // .frequency(frequency)
|
|
|
+ // .clazz(versionSub.getLevel())
|
|
|
+ // .tool(versionSub.getTool())
|
|
|
+ // .releaseRecord(releaseRecord)
|
|
|
+ // .workstation(versionSub.getWorkstation())
|
|
|
+ // .inistation(work)
|
|
|
+ // .inigread(firgreadStr)
|
|
|
+ // .twoStation(work)
|
|
|
+ // .twoGread(twogreadStr)
|
|
|
+ // .breakOffstation(work)
|
|
|
+ // .breakOffgread(bregreadStr)
|
|
|
+ // .firOrder(firOrder)
|
|
|
+ // .towOrder(twoOrder)
|
|
|
+ // .breOrder(briOrder)
|
|
|
+ // .build());
|
|
|
+ //
|
|
|
+ //}
|
|
|
+ //excelWriter.fill(arrayList, fillConfig, writeSheet);
|
|
|
+ //excelWriter.fill(map, writeSheet);
|
|
|
+ //excelWriter.finish();
|
|
|
+ return commonService.exportExcel(FileUtils.createTempPdf(".xlsx"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<getCheckResutGreadRes> getCheckResutGread(getCheckResutGreadReq req) {
|
|
|
+ Long versionId = req.getVersionId();
|
|
|
+ LocalDate localDate = req.getLocalDate();
|
|
|
+ List<getCheckResutGreadRes> version_checkResutGread = versionMapper.getVersion_CheckResutGread(versionId, localDate);
|
|
|
+ return version_checkResutGread;
|
|
|
+ }
|
|
|
}
|