|
@@ -35,6 +35,7 @@ public class ImportInformation {
|
|
List<Material> materials = new ArrayList<Material>();
|
|
List<Material> materials = new ArrayList<Material>();
|
|
User user = UserUtils.getUser();
|
|
User user = UserUtils.getUser();
|
|
Double difference = 0.0;
|
|
Double difference = 0.0;
|
|
|
|
+ List<Material> status = materialService.findStatus();
|
|
for (int i = 1; i < lastDataRowNum; i++) {
|
|
for (int i = 1; i < lastDataRowNum; i++) {
|
|
Material material = new Material();
|
|
Material material = new Material();
|
|
try {
|
|
try {
|
|
@@ -51,10 +52,8 @@ public class ImportInformation {
|
|
Object materialSmall = ei.getCellValue(row, 13);
|
|
Object materialSmall = ei.getCellValue(row, 13);
|
|
Object materialMid = ei.getCellValue(row, 14);
|
|
Object materialMid = ei.getCellValue(row, 14);
|
|
Object materialBig = ei.getCellValue(row, 15);
|
|
Object materialBig = ei.getCellValue(row, 15);
|
|
-
|
|
|
|
String isBack = "";
|
|
String isBack = "";
|
|
|
|
|
|
-
|
|
|
|
if (outboundAmount.equals("")) {
|
|
if (outboundAmount.equals("")) {
|
|
outboundAmount = "0.0";
|
|
outboundAmount = "0.0";
|
|
}
|
|
}
|
|
@@ -71,7 +70,6 @@ public class ImportInformation {
|
|
price = "0.0";
|
|
price = "0.0";
|
|
}
|
|
}
|
|
difference = Double.parseDouble(outboundNumber.toString()) - Double.parseDouble(authorizedNumber.toString());
|
|
difference = Double.parseDouble(outboundNumber.toString()) - Double.parseDouble(authorizedNumber.toString());
|
|
-
|
|
|
|
if (difference == 0.0) {
|
|
if (difference == 0.0) {
|
|
isBack = "是";
|
|
isBack = "是";
|
|
isBackNo = 0;
|
|
isBackNo = 0;
|
|
@@ -79,6 +77,26 @@ public class ImportInformation {
|
|
isBack = "否";
|
|
isBack = "否";
|
|
isBackNo = 1;
|
|
isBackNo = 1;
|
|
}
|
|
}
|
|
|
|
+ if (status.size() > 0) {
|
|
|
|
+ for (Material list : status) {
|
|
|
|
+ if (list.getProjectId().equals(projectId.toString()) && list.getInforId().equals(inforId.toString()) && list.getAfterNumber().equals(outboundNumber)) {
|
|
|
|
+ material.setIsBack(list.getIsBack());
|
|
|
|
+ material.setIsBackNo(list.getIsBackNo());
|
|
|
|
+ material.setStatus(list.getStatus());
|
|
|
|
+ material.setInfo(list.getInfo());
|
|
|
|
+ material.setAfterNumber(list.getAfterNumber());
|
|
|
|
+ }else {
|
|
|
|
+ material.setIsBack(isBack);
|
|
|
|
+ material.setIsBackNo(isBackNo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ material.setIsBack(isBack);
|
|
|
|
+ material.setIsBackNo(isBackNo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
material.setInforId(inforId.toString());
|
|
material.setInforId(inforId.toString());
|
|
material.setProjectId(projectId.toString());
|
|
material.setProjectId(projectId.toString());
|
|
@@ -94,8 +112,6 @@ public class ImportInformation {
|
|
material.setMaterialMid(materialMid.toString());
|
|
material.setMaterialMid(materialMid.toString());
|
|
material.setMaterialBig(materialBig.toString());
|
|
material.setMaterialBig(materialBig.toString());
|
|
material.preInsert();
|
|
material.preInsert();
|
|
- material.setIsBack(isBack);
|
|
|
|
- material.setIsBackNo(isBackNo);
|
|
|
|
material.setCreateBy(user);
|
|
material.setCreateBy(user);
|
|
material.setCreateDate(new Date());
|
|
material.setCreateDate(new Date());
|
|
material.setUpdateBy(user);
|
|
material.setUpdateBy(user);
|
|
@@ -103,27 +119,31 @@ public class ImportInformation {
|
|
materials.add(material);
|
|
materials.add(material);
|
|
successNum++;
|
|
successNum++;
|
|
|
|
|
|
- if (materials.size() == 500) {
|
|
|
|
|
|
+ if (materials.size() == 1000) {
|
|
materialService.saveMater(materials);
|
|
materialService.saveMater(materials);
|
|
List<Material> information = materialService.findInformation(materials);
|
|
List<Material> information = materialService.findInformation(materials);
|
|
materials.clear();
|
|
materials.clear();
|
|
for (Material maInfor:information) {
|
|
for (Material maInfor:information) {
|
|
Information upInfor = new Information();
|
|
Information upInfor = new Information();
|
|
Information needInfor = materialService.findNeedInfor(maInfor);
|
|
Information needInfor = materialService.findNeedInfor(maInfor);
|
|
- if (maInfor.getDifference().equals(0.0)) {
|
|
|
|
- if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null) {
|
|
|
|
- upInfor.setFirstFinish("是");
|
|
|
|
- upInfor.setFirstFinishDate(new Date());
|
|
|
|
- } else {
|
|
|
|
- upInfor.setSecondFinish("是");
|
|
|
|
- upInfor.setSecondFinishDate(new Date());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null) {
|
|
|
|
- upInfor.setFirstFinish("否");
|
|
|
|
|
|
+ if (needInfor != null) {
|
|
|
|
+ upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
+ if (maInfor.getIsBackNo() == 0) {
|
|
|
|
+ if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
|
|
|
|
+ upInfor.setFirstFinish("是");
|
|
|
|
+ upInfor.setFirstFinishDate(new Date());
|
|
|
|
+ } else if (("否").equals(needInfor.getSecondFinish())) {
|
|
|
|
+ upInfor.setSecondFinish("是");
|
|
|
|
+ upInfor.setSecondFinishDate(new Date());
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- upInfor.setSecondFinish("否");
|
|
|
|
|
|
+ if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
|
|
|
|
+ upInfor.setFirstFinish("否");
|
|
|
|
+ } else {
|
|
|
|
+ upInfor.setSecondFinish("否");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ materialService.updateNeed(upInfor);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -139,29 +159,25 @@ public class ImportInformation {
|
|
for (Material maInfor:information) {
|
|
for (Material maInfor:information) {
|
|
Information upInfor = new Information();
|
|
Information upInfor = new Information();
|
|
Information needInfor = materialService.findNeedInfor(maInfor);
|
|
Information needInfor = materialService.findNeedInfor(maInfor);
|
|
- if (maInfor.getDifference().equals(0.0)) {
|
|
|
|
- if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || needInfor.getFirstFinish().equals("否")) {
|
|
|
|
- upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
- upInfor.setFirstFinish("是");
|
|
|
|
- upInfor.setFirstFinishDate(new Date());
|
|
|
|
- }
|
|
|
|
- if (needInfor.getSecondFinish().equals("否")) {
|
|
|
|
- upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
- upInfor.setSecondFinish("是");
|
|
|
|
- upInfor.setSecondFinishDate(new Date());
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null) {
|
|
|
|
- upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
- upInfor.setFirstFinish("否");
|
|
|
|
- upInfor.setSecondFinishDate(null);
|
|
|
|
- } else if (needInfor.getFirstFinish().equals("是")){
|
|
|
|
- upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
- upInfor.setSecondFinish("否");
|
|
|
|
- upInfor.setSecondFinishDate(null);
|
|
|
|
|
|
+ if (needInfor != null) {
|
|
|
|
+ upInfor.setProjectId(needInfor.getProjectId());
|
|
|
|
+ if (maInfor.getIsBackNo() == 0) {
|
|
|
|
+ if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
|
|
|
|
+ upInfor.setFirstFinish("是");
|
|
|
|
+ upInfor.setFirstFinishDate(new Date());
|
|
|
|
+ } else if (("否").equals(needInfor.getSecondFinish())) {
|
|
|
|
+ upInfor.setSecondFinish("是");
|
|
|
|
+ upInfor.setSecondFinishDate(new Date());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (needInfor.getFirstFinish() == "" || needInfor.getFirstFinish() == null || ("否").equals(needInfor.getFirstFinish())) {
|
|
|
|
+ upInfor.setFirstFinish("否");
|
|
|
|
+ } else {
|
|
|
|
+ upInfor.setSecondFinish("否");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ materialService.updateNeed(upInfor);
|
|
}
|
|
}
|
|
- materialService.updateNeed(upInfor);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -181,7 +197,7 @@ public class ImportInformation {
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
List<Information> informationList = new ArrayList<>();
|
|
List<Information> informationList = new ArrayList<>();
|
|
User user = UserUtils.getUser();
|
|
User user = UserUtils.getUser();
|
|
- String firstFinish = "";
|
|
|
|
|
|
+ String firstFinish = "否";
|
|
for (int i = 2; i < lastDataRowNum; i++) {
|
|
for (int i = 2; i < lastDataRowNum; i++) {
|
|
Information information = new Information();
|
|
Information information = new Information();
|
|
try {
|
|
try {
|
|
@@ -189,69 +205,82 @@ public class ImportInformation {
|
|
Object projectId = ei.getCellValue(row, 1);
|
|
Object projectId = ei.getCellValue(row, 1);
|
|
Object projectName = ei.getCellValue(row, 2);
|
|
Object projectName = ei.getCellValue(row, 2);
|
|
Object projectType = ei.getCellValue(row, 3);
|
|
Object projectType = ei.getCellValue(row, 3);
|
|
- if (projectType.equals("配网建设改造项目")||projectType.equals("配网专项成本")){
|
|
|
|
- Object projectGrade = ei.getCellValue(row, 4);
|
|
|
|
- Object projectYear = ei.getCellValue(row, 6);
|
|
|
|
- Object projectTotal = ei.getCellValue(row, 7);
|
|
|
|
- Object projectStart = ei.getCellValue(row, 14);
|
|
|
|
- Object projectStop = ei.getCellValue(row, 15);
|
|
|
|
- Object department = ei.getCellValue(row, 16);
|
|
|
|
- Object projectFirm = ei.getCellValue(row, 38);
|
|
|
|
- Object subDate = ei.getCellValue(row, 40);
|
|
|
|
- Object releaseDate = ei.getCellValue(row, 41);
|
|
|
|
- Object endDate = ei.getCellValue(row, 42);
|
|
|
|
- Object resultDate = ei.getCellValue(row, 43);
|
|
|
|
- Object approvalDate = ei.getCellValue(row, 44);
|
|
|
|
- Object secondUnits = ei.getCellValue(row, 53);
|
|
|
|
- Object firstUnits = ei.getCellValue(row, 54);
|
|
|
|
- firstFinish = "否";
|
|
|
|
|
|
|
|
- if (projectTotal.equals("")) {
|
|
|
|
- projectTotal = "0.0";
|
|
|
|
- }
|
|
|
|
if (projectId.equals("")) {
|
|
if (projectId.equals("")) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- information.setProjectId(projectId.toString());
|
|
|
|
- information.setProjectName(projectName.toString());
|
|
|
|
- information.setProjectType(projectType.toString());
|
|
|
|
- information.setProjectGrade(projectGrade.toString());
|
|
|
|
- information.setProjectYear(projectYear.toString());
|
|
|
|
- information.setProjectTotal(Double.parseDouble(projectTotal.toString()));
|
|
|
|
- if (!projectStart.equals("")&&projectStart!=null) {
|
|
|
|
- information.setProjectStart(simpleDateFormat.parse(projectStart.toString()));
|
|
|
|
- }
|
|
|
|
- if (!projectStop.equals("")&&projectStop!=null) {
|
|
|
|
- information.setProjectStop(simpleDateFormat.parse(projectStop.toString()));
|
|
|
|
- }
|
|
|
|
- information.setDepartment(department.toString());
|
|
|
|
- information.setProjectFirm(projectFirm.toString());
|
|
|
|
- if (!subDate.equals("")&&subDate!=null) {
|
|
|
|
- information.setSubDate(simpleDateFormat.parse(subDate.toString()));
|
|
|
|
- }
|
|
|
|
- if (!releaseDate.equals("")&&releaseDate!=null) {
|
|
|
|
- information.setReleaseDate(simpleDateFormat.parse(releaseDate.toString()));
|
|
|
|
- }
|
|
|
|
- if (!endDate.equals("")&&endDate!=null) {
|
|
|
|
- information.setEndDate(simpleDateFormat.parse(endDate.toString()));
|
|
|
|
- }
|
|
|
|
- if (!resultDate.equals("")&&resultDate!=null) {
|
|
|
|
- information.setResultDate(simpleDateFormat.parse(resultDate.toString()));
|
|
|
|
- }
|
|
|
|
- if (!approvalDate.equals("")&&approvalDate!=null) {
|
|
|
|
- information.setApprovalDate(simpleDateFormat.parse(approvalDate.toString()));
|
|
|
|
- }
|
|
|
|
- information.setSecondUnits(secondUnits.toString());
|
|
|
|
- information.setFirstUnits(firstUnits.toString());
|
|
|
|
- information.setFirstFinish(firstFinish);
|
|
|
|
- information.preInsert();
|
|
|
|
- information.setCreateBy(user);
|
|
|
|
- information.setCreateDate(new Date());
|
|
|
|
- information.setUpdateBy(user);
|
|
|
|
- information.setUpdateDate(new Date());
|
|
|
|
- informationList.add(information);
|
|
|
|
- successNum++;
|
|
|
|
- }
|
|
|
|
|
|
+ if (projectType.equals("配网建设改造项目")||projectType.equals("配网专项成本")){
|
|
|
|
+ Information inforById = informationService.findListById(projectId.toString());
|
|
|
|
+ if (inforById.getFirstFinish() != null || inforById.getFirstFinish()!="") {
|
|
|
|
+ information.setFirstFinish(inforById.getFirstFinish());
|
|
|
|
+ }else{
|
|
|
|
+ information.setFirstFinish(firstFinish);
|
|
|
|
+ }
|
|
|
|
+ if (inforById.getFirstFinishDate() != null) {
|
|
|
|
+ information.setFirstFinishDate(inforById.getFirstFinishDate());
|
|
|
|
+ }
|
|
|
|
+ if (inforById.getSecondFinish() != null || inforById.getSecondFinish()!="") {
|
|
|
|
+ information.setSecondFinish(inforById.getSecondFinish());
|
|
|
|
+ }
|
|
|
|
+ if (inforById.getSecondFinishDate() != null) {
|
|
|
|
+ information.setSecondFinishDate(inforById.getSecondFinishDate());
|
|
|
|
+ }
|
|
|
|
+ Object projectGrade = ei.getCellValue(row, 4);
|
|
|
|
+ Object projectYear = ei.getCellValue(row, 6);
|
|
|
|
+ Object projectTotal = ei.getCellValue(row, 7);
|
|
|
|
+ Object projectStart = ei.getCellValue(row, 14);
|
|
|
|
+ Object projectStop = ei.getCellValue(row, 15);
|
|
|
|
+ Object department = ei.getCellValue(row, 16);
|
|
|
|
+ Object projectFirm = ei.getCellValue(row, 38);
|
|
|
|
+ Object subDate = ei.getCellValue(row, 40);
|
|
|
|
+ Object releaseDate = ei.getCellValue(row, 41);
|
|
|
|
+ Object endDate = ei.getCellValue(row, 42);
|
|
|
|
+ Object resultDate = ei.getCellValue(row, 43);
|
|
|
|
+ Object approvalDate = ei.getCellValue(row, 44);
|
|
|
|
+ Object secondUnits = ei.getCellValue(row, 53);
|
|
|
|
+ Object firstUnits = ei.getCellValue(row, 54);
|
|
|
|
+ if (projectTotal.equals("")) {
|
|
|
|
+ projectTotal = "0.0";
|
|
|
|
+ }
|
|
|
|
+ information.setProjectId(projectId.toString());
|
|
|
|
+ information.setProjectName(projectName.toString());
|
|
|
|
+ information.setProjectType(projectType.toString());
|
|
|
|
+ information.setProjectGrade(projectGrade.toString());
|
|
|
|
+ information.setProjectYear(projectYear.toString());
|
|
|
|
+ information.setProjectTotal(projectTotal.toString());
|
|
|
|
+ if (!projectStart.equals("")&&projectStart!=null) {
|
|
|
|
+ information.setProjectStart(simpleDateFormat.parse(projectStart.toString()));
|
|
|
|
+ }
|
|
|
|
+ if (!projectStop.equals("")&&projectStop!=null) {
|
|
|
|
+ information.setProjectStop(simpleDateFormat.parse(projectStop.toString()));
|
|
|
|
+ }
|
|
|
|
+ information.setDepartment(department.toString());
|
|
|
|
+ information.setProjectFirm(projectFirm.toString());
|
|
|
|
+ if (!subDate.equals("")&&subDate!=null) {
|
|
|
|
+ information.setSubDate(simpleDateFormat.parse(subDate.toString()));
|
|
|
|
+ }
|
|
|
|
+ if (!releaseDate.equals("")&&releaseDate!=null) {
|
|
|
|
+ information.setReleaseDate(simpleDateFormat.parse(releaseDate.toString()));
|
|
|
|
+ }
|
|
|
|
+ if (!endDate.equals("")&&endDate!=null) {
|
|
|
|
+ information.setEndDate(simpleDateFormat.parse(endDate.toString()));
|
|
|
|
+ }
|
|
|
|
+ if (!resultDate.equals("")&&resultDate!=null) {
|
|
|
|
+ information.setResultDate(simpleDateFormat.parse(resultDate.toString()));
|
|
|
|
+ }
|
|
|
|
+ if (!approvalDate.equals("")&&approvalDate!=null) {
|
|
|
|
+ information.setApprovalDate(simpleDateFormat.parse(approvalDate.toString()));
|
|
|
|
+ }
|
|
|
|
+ information.setSecondUnits(secondUnits.toString());
|
|
|
|
+ information.setFirstUnits(firstUnits.toString());
|
|
|
|
+ information.preInsert();
|
|
|
|
+ information.setCreateBy(user);
|
|
|
|
+ information.setCreateDate(new Date());
|
|
|
|
+ information.setUpdateBy(user);
|
|
|
|
+ information.setUpdateDate(new Date());
|
|
|
|
+ informationList.add(information);
|
|
|
|
+ successNum++;
|
|
|
|
+ }
|
|
if (informationList.size() == 1000) {
|
|
if (informationList.size() == 1000) {
|
|
informationService.saveInfo(informationList);
|
|
informationService.saveInfo(informationList);
|
|
informationList.clear();
|
|
informationList.clear();
|
|
@@ -307,6 +336,8 @@ public class ImportInformation {
|
|
}
|
|
}
|
|
material.setInfo(infoW);
|
|
material.setInfo(infoW);
|
|
material.setIsBackNo(0);
|
|
material.setIsBackNo(0);
|
|
|
|
+ Double outboundNumber1 = myProIn.getOutboundNumber();
|
|
|
|
+ material.setAfterNumber(outboundNumber1);
|
|
materialList.add(material);
|
|
materialList.add(material);
|
|
}
|
|
}
|
|
|
|
|