|
@@ -604,6 +604,7 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
List<QcsSubjectConfigDo> qcsSubjectConfigDos = qcsMainCostDao.getSubjectConfig("and COSTTYPE='" + costType + "'");//科目配置
|
|
|
List<QcsPartNoDo> allPartnos = slaveDao.getAllPartnos();//工号及图号信息
|
|
|
List<Map<String, Object>> typeResMap = qcsMainCostDao.getTypeRess();
|
|
|
+ List<QcsMdfFormDo> qcsMdfFormDos = qcsMainCostDao.getSubmitMdfDetal(unitId);//获取该单位已提交的修改单数据
|
|
|
|
|
|
Sheet sheet = new XSSFWorkbook(file.getInputStream()).getSheetAt(0);
|
|
|
int lastRowNum = sheet.getLastRowNum();
|
|
@@ -611,7 +612,9 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
String costId = SecurityUtil.getUUID();
|
|
|
List<String> hasThrSub = new ArrayList<>();//已存在的三级科目
|
|
|
Map<Integer, String> subIndex = new HashMap<>();//三级科目对应的字段位置
|
|
|
+ List<Map<String, String>> hasProTypeLossNos = new ArrayList<>();//已有的项目工号、类别、编号
|
|
|
QcsMainCostDo oldMainCostDo = null;//未提交的旧数据
|
|
|
+ Integer disSubIndex = 0;//设计变更损失所在列
|
|
|
for (int i = 0; i <= lastRowNum; i++) {
|
|
|
Row row = sheet.getRow(i);
|
|
|
if (ExcelUtils.isRowEmpty(row) || i == 1) {
|
|
@@ -659,6 +662,9 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
if (existSubDo == null) {
|
|
|
stringBuilder.append("第" + (thrSubIndex + 1) + "列" + thrSubStr + ",");
|
|
|
} else {
|
|
|
+ if (thrSubArr[0].equals("设计变更损失")) {
|
|
|
+ disSubIndex = thrSubIndex;
|
|
|
+ }
|
|
|
hasThrSub.add(thrSubArr[0]);
|
|
|
subIndex.put(thrSubIndex, "ubject" + existSubDo.getSort());
|
|
|
}
|
|
@@ -744,6 +750,19 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
qcsLossDetailDo.setLossno(lossno);
|
|
|
}
|
|
|
|
|
|
+ String finalLossno = lossno;
|
|
|
+ List<Map<String, String>> proTypeNos = hasProTypeLossNos.stream()
|
|
|
+ .filter(map -> {
|
|
|
+ Object proid = map.get("PROID");
|
|
|
+ Object loType = map.get("LOSSTYPE");
|
|
|
+ Object loNo = map.get("LOSSNO");
|
|
|
+ return proid.equals(qcsLossDetailDo.getProid()) && loType.equals(losstype) && loNo.equals(finalLossno);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (proTypeNos.size() > 0) {
|
|
|
+ stringBuilder.append("项目工号" + procode + "、类别" + losstype + "、编号" + lossno + "重复,");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
if (costType.equals("3")) {
|
|
|
//修改原因
|
|
|
String modifyreason = row.getCell(6).toString().replaceAll("\\s+", "");
|
|
@@ -773,25 +792,44 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
//三级科目
|
|
|
int thrSubIndex = 7;
|
|
|
for (QcsSubjectConfigDo subjectConfigDo : qcsSubjectConfigDos) {
|
|
|
- String amountStr = row.getCell(thrSubIndex).toString().replaceAll("\\s+", "");
|
|
|
BigDecimal amount = null;
|
|
|
- if (amountStr != null && StringUtils.isNotEmpty(amountStr)) {
|
|
|
- String toAmount = convertToTwoDecimalPlaces(amountStr);
|
|
|
- if (toAmount.equals("金额要为数字,")) {
|
|
|
- stringBuilder.append(toAmount);
|
|
|
+ //内部的设计变更损失
|
|
|
+ if (costType.equals("3") && thrSubIndex == disSubIndex) {
|
|
|
+ String finalYearMonth = yearMonth;
|
|
|
+ QcsMdfFormDo mdfFormDo = qcsMdfFormDos.stream().filter(m -> m.getProjectid().equals(qcsLossDetailDo.getProid()) && m.getSourcenumbercode().equals(qcsLossDetailDo.getLossno()) && m.getBasename().equals(finalYearMonth)).findAny().orElse(null);
|
|
|
+ if (mdfFormDo != null) {
|
|
|
+ amount = mdfFormDo.getActamount();
|
|
|
+ qcsLossDetailDo.setRoption("修改单同步");
|
|
|
} else {
|
|
|
- amount = new BigDecimal(toAmount);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String amountStr = row.getCell(thrSubIndex).toString().replaceAll("\\s+", "");
|
|
|
+ if (amountStr != null && StringUtils.isNotEmpty(amountStr)) {
|
|
|
+ String toAmount = convertToTwoDecimalPlaces(amountStr);
|
|
|
+ if (toAmount.equals("金额要为数字,")) {
|
|
|
+ stringBuilder.append(toAmount);
|
|
|
+ } else {
|
|
|
+ amount = new BigDecimal(toAmount);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
String columnName = "setS" + subIndex.get(thrSubIndex);
|
|
|
Method method = QcsLossDetailDo.class.getMethod(columnName, BigDecimal.class);
|
|
|
method.invoke(qcsLossDetailDo, amount);
|
|
|
+
|
|
|
thrSubIndex++;
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(stringBuilder.toString())) {
|
|
|
allStrBuilder.append("第").append(i + 1).append("行").append(stringBuilder.deleteCharAt(stringBuilder.length() - 1)).append("<br>");
|
|
|
} else {
|
|
|
+ Map<String, String> proTypeLossNo = new HashMap<>();
|
|
|
+ proTypeLossNo.put("PROID", qcsLossDetailDo.getProid());
|
|
|
+ proTypeLossNo.put("LOSSTYPE", qcsLossDetailDo.getLosstype());
|
|
|
+ proTypeLossNo.put("LOSSNO", qcsLossDetailDo.getLossno());
|
|
|
+ hasProTypeLossNos.add(proTypeLossNo);
|
|
|
qcsLossDetailDoList.add(qcsLossDetailDo);
|
|
|
}
|
|
|
}
|
|
@@ -810,6 +848,28 @@ public class QcsMainCostServiceImpl extends ServiceImpl<QcsMainCostDao, QcsMainC
|
|
|
qcsMainCostDao.delColConfig(oldMainCostDo.getId());
|
|
|
}
|
|
|
|
|
|
+ //同步修改单提交的数据
|
|
|
+ for (QcsMdfFormDo qcsMdfFormDo : qcsMdfFormDos) {
|
|
|
+ String finalYearMonth1 = yearMonth;
|
|
|
+ QcsLossDetailDo hasDetailDo = qcsLossDetailDoList.stream().filter(ld -> ld.getProid().equals(qcsMdfFormDo.getProjectid()) && ld.getLossno() != null && ld.getLossno().equals(qcsMdfFormDo.getSourcenumbercode()) && qcsMdfFormDo.getBasename().equals(finalYearMonth1)).findAny().orElse(null);
|
|
|
+ if (hasDetailDo == null && disSubIndex != 0) {
|
|
|
+ QcsLossDetailDo lossDetailDo = new QcsLossDetailDo();
|
|
|
+ lossDetailDo.setRoption("修改单同步");
|
|
|
+ lossDetailDo.setId(SecurityUtil.getUUID());
|
|
|
+ lossDetailDo.setMainid(costId);
|
|
|
+ lossDetailDo.setProid(qcsMdfFormDo.getProjectid());
|
|
|
+ lossDetailDo.setProcode(qcsMdfFormDo.getProjectdlprojid());
|
|
|
+ lossDetailDo.setProname(qcsMdfFormDo.getProjectdlprojname());
|
|
|
+ lossDetailDo.setLosstype("修改单");
|
|
|
+ lossDetailDo.setLossno(qcsMdfFormDo.getSourcenumbercode());
|
|
|
+ String columnName = "setS" + subIndex.get(disSubIndex);
|
|
|
+ Method method = QcsLossDetailDo.class.getMethod(columnName, BigDecimal.class);
|
|
|
+ method.invoke(lossDetailDo, qcsMdfFormDo.getActamount());
|
|
|
+ lossDetailDo.setTotalcost(qcsMdfFormDo.getActamount());
|
|
|
+ qcsLossDetailDoList.add(lossDetailDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
|
|
|
qcsMainCostDo.setId(costId);
|
|
|
qcsMainCostDo.setRoption("导入");
|