|
|
|
@ -245,15 +245,6 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List selectFirstInspectionLeftList(MesInspectionReport mesInspectionReport) {
|
|
|
|
|
//0.时间处理
|
|
|
|
|
// if(mesInspectionReport.getCheckDate() != null){
|
|
|
|
|
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//设置格式
|
|
|
|
|
// Calendar calendar = Calendar.getInstance();
|
|
|
|
|
// calendar.add(Integer.valueOf(mesInspectionReport.getCheckDate()), -1); //当前时间减去一天,即一天前的时间
|
|
|
|
|
// String checkDate = simpleDateFormat.format(calendar.getTime());
|
|
|
|
|
// mesInspectionReport.setCheckDate(checkDate);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 1.报表名
|
|
|
|
|
mesInspectionReport.setReportName("ConversionReportLeft");
|
|
|
|
|
List<MesInspectionReport> list = mesInspectionReportMapper.selectSelfMutualInspectionList(mesInspectionReport);
|
|
|
|
@ -381,19 +372,42 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
|
|
|
|
|
|
|
|
|
|
List<String> teamArray = mesInspectionReportMapper.selectTeamArray(mesInspectionReport);
|
|
|
|
|
List<Object> listDTO = new ArrayList<>();
|
|
|
|
|
MesInspectionReport buildDTO = new MesInspectionReport();
|
|
|
|
|
buildDTO.setId("");
|
|
|
|
|
buildDTO.setRemark("");
|
|
|
|
|
buildDTO.setCheckResult("");
|
|
|
|
|
buildDTO.setBelongTo(mesInspectionReport.getId());
|
|
|
|
|
buildDTO.setWhetherOpenLine(null);
|
|
|
|
|
|
|
|
|
|
for(MesInspectionReport project : projectList){
|
|
|
|
|
Map<String,String> dynamicRow = new LinkedHashMap<>();
|
|
|
|
|
dynamicRow.put("序号",project.getTableLine() + "");
|
|
|
|
|
dynamicRow.put("点检项目",project.getProjectName());
|
|
|
|
|
dynamicRow.put("点检内容",project.getInfoName());
|
|
|
|
|
Map<String,MesInspectionReport> dynamicRow = new LinkedHashMap<>();
|
|
|
|
|
|
|
|
|
|
MesInspectionReport buildDTO1 = new MesInspectionReport();
|
|
|
|
|
buildDTO1.setData(project.getTableLine() + "");
|
|
|
|
|
dynamicRow.put("序号",buildDTO1);
|
|
|
|
|
|
|
|
|
|
MesInspectionReport buildDTO2 = new MesInspectionReport();
|
|
|
|
|
buildDTO2.setData(project.getProjectName());
|
|
|
|
|
dynamicRow.put("点检项目",buildDTO2);
|
|
|
|
|
|
|
|
|
|
MesInspectionReport buildDTO3 = new MesInspectionReport();
|
|
|
|
|
buildDTO3.setData(project.getInfoName());
|
|
|
|
|
dynamicRow.put("点检内容",buildDTO3);
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(teamArray)){
|
|
|
|
|
dynamicRow.put("", "");
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(1);
|
|
|
|
|
dynamicRow.put("第1列", buildDTO);
|
|
|
|
|
buildDTO.setTableLine(2);
|
|
|
|
|
dynamicRow.put("第2列", buildDTO);
|
|
|
|
|
buildDTO.setTableLine(3);
|
|
|
|
|
dynamicRow.put("第3列", buildDTO);
|
|
|
|
|
buildDTO.setTableLine(4);
|
|
|
|
|
dynamicRow.put("第4列", buildDTO);
|
|
|
|
|
buildDTO.setTableLine(5);
|
|
|
|
|
dynamicRow.put("第5列", buildDTO);
|
|
|
|
|
buildDTO.setTableLine(6);
|
|
|
|
|
dynamicRow.put("第6列", buildDTO);
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
for(String team : teamArray){
|
|
|
|
|
List<MesInspectionReport> result = list.stream()
|
|
|
|
@ -402,32 +416,40 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
|
|
|
|
|
.collect(Collectors.toList()); // 收集结果
|
|
|
|
|
if(!CollectionUtils.isEmpty(result)){
|
|
|
|
|
if(StringUtils.isNotBlank(result.get(0).getCheckResult())){
|
|
|
|
|
dynamicRow.put(team, result.get(0).getCheckResult());
|
|
|
|
|
result.get(0).setWhetherOpenLine( result.get(0).getBz().equals("1") ? true : false);
|
|
|
|
|
dynamicRow.put(team, result.get(0));
|
|
|
|
|
}else{
|
|
|
|
|
dynamicRow.put(team, "");
|
|
|
|
|
result.get(0).setWhetherOpenLine( result.get(0).getBz().equals("1") ? true : false);
|
|
|
|
|
dynamicRow.put(team, result.get(0));
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
dynamicRow.put(team, "");
|
|
|
|
|
dynamicRow.put(team, buildDTO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(teamArray.size() < 6){
|
|
|
|
|
for(int i = 0 ; i < 6-(teamArray.size()) ; i++){
|
|
|
|
|
for(int i = 0 ; i < 6 - (teamArray.size()) ; i++){
|
|
|
|
|
|
|
|
|
|
if(i == 0){
|
|
|
|
|
dynamicRow.put("", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 1);
|
|
|
|
|
dynamicRow.put("第"+ (teamArray.size()+1)+"列", buildDTO);
|
|
|
|
|
}else if(i == 1){
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 2);
|
|
|
|
|
dynamicRow.put("第"+(teamArray.size()+2)+"列", buildDTO);
|
|
|
|
|
}else if(i == 2){
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 3);
|
|
|
|
|
dynamicRow.put("第"+(teamArray.size()+3)+"列", buildDTO);
|
|
|
|
|
}else if(i == 3){
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 4);
|
|
|
|
|
dynamicRow.put("第"+(teamArray.size()+4)+"列", buildDTO);
|
|
|
|
|
}else if(i == 4){
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 5);
|
|
|
|
|
dynamicRow.put("第"+(teamArray.size()+5)+"列", buildDTO);
|
|
|
|
|
}else if(i == 5){
|
|
|
|
|
dynamicRow.put(" ", "");
|
|
|
|
|
buildDTO.setTableLine(teamArray.size() + 6);
|
|
|
|
|
dynamicRow.put("第"+(teamArray.size() + 6)+"列", buildDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -440,101 +462,74 @@ public class MesInspectionReportServiceImpl implements IMesInspectionReportServi
|
|
|
|
|
return listDTO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//点检上半部分数据
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List selectCheckBoxList(MesInspectionReport mesInspectionReport) {
|
|
|
|
|
List<Object> listDTO = new ArrayList<>();
|
|
|
|
|
//1.报表名
|
|
|
|
|
mesInspectionReport.setReportName("CheckReport");
|
|
|
|
|
List<MesInspectionReport> lists = mesInspectionReportMapper.selectCheckBoxList(mesInspectionReport);
|
|
|
|
|
|
|
|
|
|
Map<String,Map<String,Boolean>> dynamicRow1 = new LinkedHashMap<>();
|
|
|
|
|
Map<String,String> dynamicRow2 = new LinkedHashMap<>();
|
|
|
|
|
String str = "str";
|
|
|
|
|
int i = 0;
|
|
|
|
|
for(MesInspectionReport list :lists){
|
|
|
|
|
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
|
|
|
|
|
if(list.getBz().equals("1")){
|
|
|
|
|
dynamicRow10.put("openLine",Boolean.TRUE);
|
|
|
|
|
dynamicRow10.put("clearLine",Boolean.FALSE);
|
|
|
|
|
dynamicRow1.put(str + i + "",dynamicRow10);
|
|
|
|
|
}else{
|
|
|
|
|
dynamicRow10.put("clearLine",Boolean.TRUE);
|
|
|
|
|
dynamicRow10.put("openLine",Boolean.FALSE);
|
|
|
|
|
dynamicRow1.put(str + i + "",dynamicRow10);
|
|
|
|
|
}
|
|
|
|
|
//修改表头部和表尾部
|
|
|
|
|
public AjaxResult updatePointInspectionTable(MesInspectionReport mesInspectionReport) {
|
|
|
|
|
mesInspectionReport.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
mesInspectionReport.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
mesInspectionReportMapper.updateHeaderFooter(mesInspectionReport);//修改主表
|
|
|
|
|
|
|
|
|
|
dynamicRow2.put(str + i + "","班次:" + list.getRemark());
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
if(lists == null){
|
|
|
|
|
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
|
|
|
|
|
dynamicRow10.put("openLine",Boolean.FALSE);
|
|
|
|
|
dynamicRow10.put("clearLine",Boolean.FALSE);
|
|
|
|
|
dynamicRow1.put(str + 0 + "", dynamicRow10);
|
|
|
|
|
dynamicRow1.put(str + 1 + "", dynamicRow10);
|
|
|
|
|
dynamicRow1.put(str + 2 + "", dynamicRow10);
|
|
|
|
|
dynamicRow1.put(str + 3 + "", dynamicRow10);
|
|
|
|
|
dynamicRow1.put(str + 4 + "", dynamicRow10);
|
|
|
|
|
dynamicRow1.put(str + 5 + "", dynamicRow10);
|
|
|
|
|
|
|
|
|
|
dynamicRow2.put(str + 0 + "", "班次:");
|
|
|
|
|
dynamicRow2.put(str + 1 + "", "班次:");
|
|
|
|
|
dynamicRow2.put(str + 2 + "", "班次:");
|
|
|
|
|
dynamicRow2.put(str + 3 + "", "班次:");
|
|
|
|
|
dynamicRow2.put(str + 4 + "", "班次:");
|
|
|
|
|
dynamicRow2.put(str + 5 + "", "班次:");
|
|
|
|
|
}
|
|
|
|
|
//需要新增的
|
|
|
|
|
List<MesInspectionReport> addList = new ArrayList<>();
|
|
|
|
|
//需要修改的
|
|
|
|
|
List<MesInspectionReport> updateList = new ArrayList<>();
|
|
|
|
|
ArrayList<LinkedHashMap<String, LinkedHashMap<String, Object>>> tableData = mesInspectionReport.getTableData();
|
|
|
|
|
if (tableData!= null) {
|
|
|
|
|
for (LinkedHashMap<String, LinkedHashMap<String, Object>> item : tableData) {
|
|
|
|
|
//提取出来开始结束那一行数据的 项目名字
|
|
|
|
|
String infoName = (String) item.get("点检内容").get("data");
|
|
|
|
|
|
|
|
|
|
if(dynamicRow1.size() < 6){
|
|
|
|
|
for(int j = 0 ; j < 6-(lists.size()) ; j++){
|
|
|
|
|
Map<String,Boolean> dynamicRow10 = new LinkedHashMap<>();
|
|
|
|
|
dynamicRow10.put("openLine",Boolean.FALSE);
|
|
|
|
|
dynamicRow10.put("clearLine",Boolean.FALSE);
|
|
|
|
|
if(j == 0){
|
|
|
|
|
dynamicRow1.put(str + 5 +"", dynamicRow10);
|
|
|
|
|
}else if(j == 1){
|
|
|
|
|
dynamicRow1.put(str + 4 +"", dynamicRow10);
|
|
|
|
|
}else if(j == 2){
|
|
|
|
|
dynamicRow1.put(str + 3 +"", dynamicRow10);
|
|
|
|
|
}else if(j == 3){
|
|
|
|
|
dynamicRow1.put(str + 2 +"", dynamicRow10);
|
|
|
|
|
}else if(j == 4){
|
|
|
|
|
dynamicRow1.put(str + 1 +"", dynamicRow10);
|
|
|
|
|
}else if(j == 5){
|
|
|
|
|
dynamicRow1.put(str + 0 +"", dynamicRow10);
|
|
|
|
|
for (Map.Entry<String, LinkedHashMap<String, Object>> entry : item.entrySet()) {
|
|
|
|
|
if(!entry.getKey().equals("序号") && !entry.getKey().equals("点检内容") && !entry.getKey().equals("点检项目")){
|
|
|
|
|
LinkedHashMap<String, Object> innerMap = entry.getValue();
|
|
|
|
|
|
|
|
|
|
String id = (String) innerMap.get("id");
|
|
|
|
|
String checkResult = (String) innerMap.get("checkResult");
|
|
|
|
|
Boolean whetherOpenLine = (Boolean) innerMap.get("whetherOpenLine");
|
|
|
|
|
String remark = (String) innerMap.get("remark");
|
|
|
|
|
String belongTo = (String) innerMap.get("belongTo");
|
|
|
|
|
Integer tableLine = (Integer) innerMap.get("tableLine");
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(id) && StringUtils.isNotBlank(checkResult)){
|
|
|
|
|
MesInspectionReport updateDto = new MesInspectionReport();
|
|
|
|
|
updateDto.setId(id);
|
|
|
|
|
updateDto.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
updateDto.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
updateDto.setCheckResult(checkResult);
|
|
|
|
|
updateDto.setBz(whetherOpenLine == true ? "1": "0");
|
|
|
|
|
updateDto.setRemark(remark);
|
|
|
|
|
updateList.add(updateDto);
|
|
|
|
|
}else if(StringUtils.isBlank(id) && StringUtils.isNotBlank(checkResult)){
|
|
|
|
|
MesInspectionReport addDto = new MesInspectionReport();
|
|
|
|
|
addDto.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
addDto.setBelongTo(StringUtils.isNotBlank(belongTo)? belongTo: mesInspectionReport.getId());
|
|
|
|
|
addDto.setCreateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
addDto.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
addDto.setUpdateBy(SecurityContextHolder.getUserName());
|
|
|
|
|
addDto.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
addDto.setCheckResult(checkResult);
|
|
|
|
|
addDto.setBz(whetherOpenLine == true ? "1": "0");
|
|
|
|
|
addDto.setDelFlag("0");
|
|
|
|
|
addDto.setRemark(remark);
|
|
|
|
|
addDto.setInfoName(infoName);
|
|
|
|
|
addDto.setTableLine(tableLine);
|
|
|
|
|
addList.add(addDto);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(dynamicRow2.size() < 6){
|
|
|
|
|
for(int j = 0 ; j < 6-(lists.size()) ; j++){
|
|
|
|
|
if(j == 0){
|
|
|
|
|
dynamicRow2.put(str + 5 +"", "班次:");
|
|
|
|
|
}else if(j == 1){
|
|
|
|
|
dynamicRow2.put(str + 4 +"", "班次:");
|
|
|
|
|
}else if(j == 2){
|
|
|
|
|
dynamicRow2.put(str + 3 +"", "班次:");
|
|
|
|
|
}else if(j == 3){
|
|
|
|
|
dynamicRow2.put(str + 2 +"", "班次:");
|
|
|
|
|
}else if(j == 4){
|
|
|
|
|
dynamicRow2.put(str + 1 +"", "班次:");
|
|
|
|
|
}else if(j == 5){
|
|
|
|
|
dynamicRow2.put(str + 0 +"", "班次:");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//更新表的主体部分 也就是数据库的子表
|
|
|
|
|
if(updateList.size() > 0 ){
|
|
|
|
|
mesInspectionReportMapper.updateBatch(updateList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String s1 = JSON.toJSONString(dynamicRow1);
|
|
|
|
|
String s2 = JSON.toJSONString(dynamicRow2);
|
|
|
|
|
JSONObject object1 = JSONObject.parseObject(s1, Feature.OrderedField);
|
|
|
|
|
JSONObject object2 = JSONObject.parseObject(s2, Feature.OrderedField);
|
|
|
|
|
log.info("点检动态添加属性: = {}",object1);
|
|
|
|
|
log.info("点检动态添加属性: = {}",object2);
|
|
|
|
|
listDTO.add(object1);
|
|
|
|
|
listDTO.add(object2);
|
|
|
|
|
log.info("点检动态添加属性: = {}", JSON.toJSONString(listDTO));
|
|
|
|
|
return listDTO;
|
|
|
|
|
if(addList.size() >0){
|
|
|
|
|
mesInspectionReportMapper.addBatch(addList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|