|
@@ -1,23 +1,27 @@
|
|
package com.jeeplus.modules.sg.managementcenter.reserveManagement.service;
|
|
package com.jeeplus.modules.sg.managementcenter.reserveManagement.service;
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
|
+import com.jeeplus.common.config.Global;
|
|
|
|
+import com.jeeplus.common.utils.PropertiesLoader;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.excel.ImportExcel;
|
|
import com.jeeplus.common.utils.excel.ImportExcel;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.modules.act.entity.Act;
|
|
import com.jeeplus.modules.act.entity.Act;
|
|
|
|
+import com.jeeplus.modules.filing.approvalStage.entity.EarlyStage;
|
|
import com.jeeplus.modules.filing.basicInformation.entity.BasicInformationChild;
|
|
import com.jeeplus.modules.filing.basicInformation.entity.BasicInformationChild;
|
|
|
|
+import com.jeeplus.modules.filing.filingImages.entity.FilingImages;
|
|
|
|
+import com.jeeplus.modules.filing.filingImages.utils.ZipCompressUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
|
|
import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
|
|
import com.jeeplus.modules.sg.managementcenter.materialinfo.entity.MaterialInfo;
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialinfo.mapper.MaterialInfoMapper;
|
|
import com.jeeplus.modules.sg.managementcenter.materialinfo.util.MaterialInfoUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.materialinfo.util.MaterialInfoUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
|
|
import com.jeeplus.modules.sg.managementcenter.materialproject.entity.MaterialProject;
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.materialproject.mapper.MaterialProjectMapper;
|
|
import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
|
|
import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
|
|
-import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.PersonnelTurnover;
|
|
|
|
-import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ProgressSchedule;
|
|
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.*;
|
|
import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveProcess;
|
|
import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveProcess;
|
|
-import com.jeeplus.modules.sg.managementcenter.reserveManagement.entity.ReserveProcess;
|
|
|
|
-import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.ProgressScheduleMapper;
|
|
|
|
-import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.ReserveProcessMapper;
|
|
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.*;
|
|
import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.ReserveProcessMapper;
|
|
import com.jeeplus.modules.sg.managementcenter.reserveManagement.mapper.ReserveProcessMapper;
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
import org.activiti.engine.TaskService;
|
|
import org.activiti.engine.TaskService;
|
|
@@ -28,12 +32,13 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
-import java.util.Collection;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+
|
|
|
|
+import static com.jeeplus.common.config.Global.SYS_TYPE;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 人员流转 Service
|
|
* 人员流转 Service
|
|
@@ -51,6 +56,29 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
@Autowired
|
|
@Autowired
|
|
private ProgressScheduleMapper scheduleMapper;
|
|
private ProgressScheduleMapper scheduleMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private StandardMapper standardMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ReserveManagementMapper reserveManagementMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ScaleDetailsMapper detailsMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private PersonnelTurnoverMapper personnelTurnoverMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private MaterialInfoMapper materialInfoMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private MaterialProjectMapper projectMapper;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 属性文件加载对象
|
|
|
|
+ */
|
|
|
|
+ private static PropertiesLoader loader = new PropertiesLoader("/properties/jeeplus.properties");
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public ReserveProcess get(ReserveProcess entity) {
|
|
public ReserveProcess get(ReserveProcess entity) {
|
|
String projectId = mapper.findProjectId(entity);
|
|
String projectId = mapper.findProjectId(entity);
|
|
@@ -121,6 +149,13 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 通过项目名称导出符合条件的数据
|
|
|
|
+ */
|
|
|
|
+ public List<MaterialInfo> findMaterialExport(List<String> projectName) {
|
|
|
|
+ return mapper.findMaterialExport(projectName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 通过流程定义号修改项目的金额数据
|
|
* 通过流程定义号修改项目的金额数据
|
|
*/
|
|
*/
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
@@ -129,6 +164,20 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 通过id查询符合条件的项目名称
|
|
|
|
+ * */
|
|
|
|
+ public List<String> findByIds(String[] ids){
|
|
|
|
+ return mapper.findByIds(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询出所有的项目名称
|
|
|
|
+ */
|
|
|
|
+ public List<String> findAllName() {
|
|
|
|
+ return mapper.findAllName();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 修改项目设计单位信息
|
|
* 修改项目设计单位信息
|
|
*/
|
|
*/
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
@@ -164,6 +213,8 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
} else {
|
|
} else {
|
|
//结束项目流程,修改项目开始流程状态,清空人员流转信息,清空
|
|
//结束项目流程,修改项目开始流程状态,清空人员流转信息,清空
|
|
//删除对应的流程数据
|
|
//删除对应的流程数据
|
|
|
|
+ //删除对应甲供材信息
|
|
|
|
+ mapper.deleteMaterial(reserveProcess.getProjectName());
|
|
mapper.deleteAct(reserveProcess.getProjectReserveId());
|
|
mapper.deleteAct(reserveProcess.getProjectReserveId());
|
|
personnelTurnoverService.deletePerson(reserveProcess.getProjectReserveId());
|
|
personnelTurnoverService.deletePerson(reserveProcess.getProjectReserveId());
|
|
vars.put("manager", UserUtils.getUser().getLoginName());
|
|
vars.put("manager", UserUtils.getUser().getLoginName());
|
|
@@ -195,7 +246,7 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
} else {
|
|
} else {
|
|
vars.put("manager", UserUtils.getByUserName(user.getDesignUnit()).getLoginName());
|
|
vars.put("manager", UserUtils.getByUserName(user.getDesignUnit()).getLoginName());
|
|
- schedule.setDesignUpload("");
|
|
|
|
|
|
+ schedule.setDesignUpload("-");
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
}
|
|
}
|
|
@@ -226,7 +277,8 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
} else {
|
|
} else {
|
|
vars.put("manager", UserUtils.getByUserName(user.getOperationUnit()).getLoginName());
|
|
vars.put("manager", UserUtils.getByUserName(user.getOperationUnit()).getLoginName());
|
|
- schedule.setDrawingReview(format);
|
|
|
|
|
|
+ schedule.setDrawingReview("-");
|
|
|
|
+ schedule.setDesignUpload("-");
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
}
|
|
}
|
|
@@ -256,9 +308,30 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
schedule.setJointDrawing(format);
|
|
schedule.setJointDrawing(format);
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
|
|
+ //审核通过修改项目状态,将物料信息导入年度物资上报统计
|
|
|
|
+ //根据流程定义号查询项目编码
|
|
|
|
+ ReserveManagement byProcInsId = reserveManagementMapper.findByProcInsId(act.getProcInsId());
|
|
|
|
+ String projectReserveId = byProcInsId.getProjectReserveId();
|
|
|
|
+ String projectName = byProcInsId.getProjectName();
|
|
|
|
+ //修改项目甲供材清册状态
|
|
|
|
+ personnelTurnoverMapper.updateMaterialStatus(projectReserveId, "2");
|
|
|
|
+ //获取所有的物料信息-导入年度物资上报统计
|
|
|
|
+ List<MaterialInfo> materialByName = mapper.findMaterialByName(projectName);
|
|
|
|
+ for (MaterialInfo m :
|
|
|
|
+ materialByName) {
|
|
|
|
+ m.preInsert();
|
|
|
|
+ }
|
|
|
|
+ materialInfoMapper.insertList(materialByName);
|
|
|
|
+ MaterialProject materialProject = new MaterialProject();
|
|
|
|
+ materialProject.preInsert();
|
|
|
|
+ materialProject.setReserveCode(projectReserveId);
|
|
|
|
+ materialProject.setReserveProjectName(projectName);
|
|
|
|
+ projectMapper.insert(materialProject);
|
|
} else {
|
|
} else {
|
|
vars.put("manager", UserUtils.getByUserName(user.getDesignUnit()).getLoginName());
|
|
vars.put("manager", UserUtils.getByUserName(user.getDesignUnit()).getLoginName());
|
|
- schedule.setDrawingReview("");
|
|
|
|
|
|
+ schedule.setDrawingReview("-");
|
|
|
|
+ schedule.setEstimate("-");
|
|
|
|
+ schedule.setDesignUpload("-");
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
schedule.setProjectReserveId(mapper.findByProcInsId(act.getProcInsId()));
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
scheduleMapper.updateTimeNode(schedule);
|
|
}
|
|
}
|
|
@@ -318,12 +391,174 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
String projectName = ((String) obj).trim();
|
|
String projectName = ((String) obj).trim();
|
|
//删除对应项目名称的甲供材信息
|
|
//删除对应项目名称的甲供材信息
|
|
mapper.deleteMaterial(projectName);
|
|
mapper.deleteMaterial(projectName);
|
|
- ImportExcel pick = new ImportExcel(file,5,"领料清单");
|
|
|
|
- List<MaterialInfo> materialInfos = MaterialInfoUtil.getData(pick,projectName); //获取领料清单数据
|
|
|
|
|
|
+ ImportExcel pick = new ImportExcel(file,7,"领料清单");
|
|
|
|
+ List<MaterialInfo> materialInfos = MaterialInfoUtil.getCbData(pick,projectName); //获取领料清单数据
|
|
List<MaterialInfo> list = MaterialInfoUtil.combineData(materialInfos); //合并数据
|
|
List<MaterialInfo> list = MaterialInfoUtil.combineData(materialInfos); //合并数据
|
|
//通过甲供材信息比对物料规范获得项目建设规模
|
|
//通过甲供材信息比对物料规范获得项目建设规模
|
|
|
|
|
|
saveList(list);
|
|
saveList(list);
|
|
|
|
+ //将领料清单保存后,获取所有物料规范详细信息,循环领料清单数据,将符合条件的
|
|
|
|
+ List<Standard> standardList = standardMapper.findALl();
|
|
|
|
+ //通过项目名称获取项目编号及名称
|
|
|
|
+ ReserveManagement byName = reserveManagementMapper.findByName(projectName);
|
|
|
|
+ //删除对应的项目规模数据
|
|
|
|
+ detailsMapper.deleteName(projectName);
|
|
|
|
+ ScaleDetails details = new ScaleDetails();
|
|
|
|
+ //开关柜
|
|
|
|
+ BigDecimal switchCabinet = BigDecimal.valueOf(0.0);
|
|
|
|
+ //架空线路
|
|
|
|
+ BigDecimal overheadLines = BigDecimal.valueOf(0.0);
|
|
|
|
+ //电力电缆
|
|
|
|
+ BigDecimal powerCable = BigDecimal.valueOf(0.0);
|
|
|
|
+ //10千伏电缆分接箱
|
|
|
|
+ BigDecimal cableBox =BigDecimal.valueOf(0.0);
|
|
|
|
+ //环网箱/室
|
|
|
|
+ BigDecimal ringCare =BigDecimal.valueOf(0.0);
|
|
|
|
+ //开关站
|
|
|
|
+ BigDecimal switchYard = BigDecimal.valueOf(0.0);
|
|
|
|
+ //柱上开关
|
|
|
|
+ BigDecimal postSwitch = BigDecimal.valueOf(0.0);
|
|
|
|
+ //配电室kva
|
|
|
|
+ StringBuilder distributionKva = new StringBuilder("");
|
|
|
|
+ //配电室
|
|
|
|
+ BigDecimal distribution = BigDecimal.valueOf(0.0);
|
|
|
|
+ //箱变kva
|
|
|
|
+ StringBuilder boxTransformerKva = new StringBuilder("");
|
|
|
|
+ //箱变
|
|
|
|
+ BigDecimal boxTransformer = BigDecimal.valueOf(0.0);
|
|
|
|
+ //配电变压器kva
|
|
|
|
+ StringBuilder disTransformerKva = new StringBuilder("");
|
|
|
|
+ //配电变压器
|
|
|
|
+ BigDecimal disTransformer = BigDecimal.valueOf(0.0);
|
|
|
|
+ //低压线路
|
|
|
|
+ BigDecimal lowVoltageLine = BigDecimal.valueOf(0.0);
|
|
|
|
+ //低压电缆
|
|
|
|
+ BigDecimal lowVoltageCable = BigDecimal.valueOf(0.0);
|
|
|
|
+ //低压电缆分接箱
|
|
|
|
+ BigDecimal lowDistributionBox = BigDecimal.valueOf(0.0);
|
|
|
|
+ //低压配电箱(柜)
|
|
|
|
+ BigDecimal lowBoxCabinet = BigDecimal.valueOf(0.0);
|
|
|
|
+ //配电自动化终端(DTU)
|
|
|
|
+ BigDecimal distributionTerminal = BigDecimal.valueOf(0.0);
|
|
|
|
+ //电缆通道
|
|
|
|
+ BigDecimal cableChannel = BigDecimal.valueOf(0.0);
|
|
|
|
+ List<ScaleDetails> scaleDetails = new ArrayList<>();
|
|
|
|
+ for (MaterialInfo m :
|
|
|
|
+ list) {
|
|
|
|
+ BigDecimal totalCount = BigDecimal.valueOf(m.getTotalCount());
|
|
|
|
+ for (Standard s :
|
|
|
|
+ standardList) {
|
|
|
|
+ if (m.getMaterialCode().equals(s.getMaterialCode()) && m.getMaterialName().equals(s.getMaterialDescription())) {
|
|
|
|
+ String projectCategory = s.getProjectCategory();
|
|
|
|
+
|
|
|
|
+ if ("开关柜".equals(projectCategory)) {
|
|
|
|
+ switchCabinet = switchCabinet.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("架空线路".equals(projectCategory)) {
|
|
|
|
+ overheadLines = overheadLines.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("电力电缆".equals(projectCategory)) {
|
|
|
|
+ powerCable = powerCable.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("10千伏电缆分接箱".equals(projectCategory)) {
|
|
|
|
+ cableBox = cableBox.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("环网箱/室".equals(projectCategory)) {
|
|
|
|
+ ringCare = ringCare.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("开关站".equals(projectCategory)) {
|
|
|
|
+ switchYard = switchYard.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("柱上开关".equals(projectCategory)) {
|
|
|
|
+ postSwitch = postSwitch.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("配电室".equals(projectCategory)) {
|
|
|
|
+ int i = m.getTotalCount().compareTo(0.0);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ String materialDescription = s.getMaterialDescription();
|
|
|
|
+ String s1 = returnKva(materialDescription);
|
|
|
|
+ distributionKva.append(s1);
|
|
|
|
+ }
|
|
|
|
+ distribution = distribution.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("箱变".equals(projectCategory)) {
|
|
|
|
+ int i = m.getTotalCount().compareTo(0.0);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ String materialDescription = s.getMaterialDescription();
|
|
|
|
+ String s1 = returnKva(materialDescription);
|
|
|
|
+ boxTransformerKva.append(s1);
|
|
|
|
+ }
|
|
|
|
+ boxTransformer = boxTransformer.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ("配电变压器".equals(projectCategory)) {
|
|
|
|
+ int i = m.getTotalCount().compareTo(0.0);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ String materialDescription = s.getMaterialDescription();
|
|
|
|
+ String s1 = returnKva(materialDescription);
|
|
|
|
+ disTransformerKva.append(s1);
|
|
|
|
+ }
|
|
|
|
+ disTransformer = disTransformer.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("低压线路".equals(projectCategory)) {
|
|
|
|
+ lowVoltageLine = lowVoltageLine.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("低压电缆".equals(projectCategory)) {
|
|
|
|
+ lowVoltageCable = lowVoltageCable.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("低压电缆分接箱".equals(projectCategory)) {
|
|
|
|
+ lowDistributionBox = lowDistributionBox.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("低压配电箱(柜)".equals(projectCategory)) {
|
|
|
|
+ lowBoxCabinet = lowBoxCabinet.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("配电自动化终端(DTU)".equals(projectCategory)) {
|
|
|
|
+ distributionTerminal = distributionTerminal.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ if ("电缆通道".equals(projectCategory)) {
|
|
|
|
+ cableChannel = cableChannel.add(totalCount);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ details.setProjectName(byName.getProjectName());
|
|
|
|
+ details.setProjectReserveId(byName.getProjectReserveId());
|
|
|
|
+ details.setSwitchCabinet(switchCabinet.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setOverheadLines(overheadLines.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setPowerCable(powerCable.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setCableBox(cableBox.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setRingCare(ringCare.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setSwitchYard(switchYard.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setPostSwitch(postSwitch.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setDistributionKva(distributionKva.toString());
|
|
|
|
+ details.setDistribution(distribution.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setBoxTransformerKva(boxTransformerKva.toString());
|
|
|
|
+ details.setBoxTransformer(boxTransformer.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setDisTransformerKva(disTransformerKva.toString());
|
|
|
|
+ details.setDisTransformer(disTransformer.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setLowVoltageLine(lowVoltageLine.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setLowVoltageCable(lowVoltageCable.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setLowDistributionBox(lowDistributionBox.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setLowBoxCabinet(lowBoxCabinet.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setDistributionTerminal(distributionTerminal.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.setCableChannel(cableChannel.setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
|
|
|
+ details.preInsert();
|
|
|
|
+ detailsMapper.insert(details);
|
|
|
|
+ personnelTurnoverMapper.updateMaterialStatus(byName.getProjectReserveId(), "1");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private String returnKva(String materialDescription) {
|
|
|
|
+ if (null != materialDescription && !"".equals(materialDescription)) {
|
|
|
|
+ boolean kVA = materialDescription.contains("kVA");
|
|
|
|
+ if (kVA) {
|
|
|
|
+ int kVA1 = materialDescription.lastIndexOf("kVA");
|
|
|
|
+ String substring = materialDescription.substring(kVA1 - 3, kVA1+3);
|
|
|
|
+ return substring;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
@@ -333,4 +568,159 @@ public class ReserveProcessService extends CrudService<ReserveProcessMapper, Res
|
|
}
|
|
}
|
|
mapper.insertList(list);
|
|
mapper.insertList(list);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过id查询符合条件的储备项目编码
|
|
|
|
+ */
|
|
|
|
+ public List<String> findIds(String[] ids) {
|
|
|
|
+ return mapper.findIds(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询出所有的储备项目编码
|
|
|
|
+ */
|
|
|
|
+ public List<String> findAllId() {
|
|
|
|
+ return mapper.findAllId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通过项目名称导出储备项目的所有附件
|
|
|
|
+ *
|
|
|
|
+ * @param idList
|
|
|
|
+ */
|
|
|
|
+ public String exportFiles(List<String> idList) throws Exception {
|
|
|
|
+ //设置下载的压缩包名(固定字符+时间戳)
|
|
|
|
+ long timeMillis = System.currentTimeMillis();
|
|
|
|
+ String fileLocality = "项目附件_" + timeMillis;
|
|
|
|
+ //判定当前系统
|
|
|
|
+ String path = Global.getPath();
|
|
|
|
+ path = path + "/" + fileLocality;
|
|
|
|
+ //检查该路径对应的目录是否存在. 如果不存在则创建目录
|
|
|
|
+ File dir = new File(path);
|
|
|
|
+ if (!dir.exists()) {
|
|
|
|
+ dir.mkdirs();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //通过id查询出所有的项目信息
|
|
|
|
+ List<ReserveProcess> allList = mapper.findReserveById(idList);
|
|
|
|
+
|
|
|
|
+ //循环遍历,判断项目是否存在
|
|
|
|
+ for (ReserveProcess a :
|
|
|
|
+ allList) {
|
|
|
|
+ File dirFile = null;
|
|
|
|
+ File dirFile2 = null;
|
|
|
|
+ File dirFile3 = null;
|
|
|
|
+ File dirFile4 = null;
|
|
|
|
+ List<FilingImages> filingImagesList = null;
|
|
|
|
+ List<FilingImages> exportList = new ArrayList<>();
|
|
|
|
+ List<FilingImages> exportList2 = new ArrayList<>();
|
|
|
|
+ List<FilingImages> exportList3 = new ArrayList<>();
|
|
|
|
+ List<FilingImages> exportList4 = new ArrayList<>();
|
|
|
|
+ String downloadPath = path + "/" + a.getProjectReserveId();
|
|
|
|
+ String budgetStatement = a.getBudgetStatement();
|
|
|
|
+ if (null!=budgetStatement && !"".equals(budgetStatement)) {
|
|
|
|
+ dirFile = new File(downloadPath + "/预算书");
|
|
|
|
+ if (budgetStatement.contains("|")) {
|
|
|
|
+ String[] split = budgetStatement.split("\\|");
|
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(split[i]);
|
|
|
|
+ exportList.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(budgetStatement);
|
|
|
|
+ exportList.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String projectProposal = a.getProjectProposal();
|
|
|
|
+ if (null!=projectProposal && !"".equals(projectProposal)) {
|
|
|
|
+ dirFile2 = new File(downloadPath + "/项目建议书");
|
|
|
|
+ if (projectProposal.contains("|")) {
|
|
|
|
+ String[] split = projectProposal.split("\\|");
|
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(split[i]);
|
|
|
|
+ exportList2.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(projectProposal);
|
|
|
|
+ exportList2.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String drawings = a.getDrawings();
|
|
|
|
+ if (null!=drawings && !"".equals(drawings)) {
|
|
|
|
+ dirFile3 = new File(downloadPath + "/图纸");
|
|
|
|
+ if (drawings.contains("|")) {
|
|
|
|
+ String[] split = drawings.split("\\|");
|
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(split[i]);
|
|
|
|
+ exportList3.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(drawings);
|
|
|
|
+ exportList3.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ String drawingSpecification = a.getDrawingSpecification();
|
|
|
|
+ if (null!=drawingSpecification && !"".equals(drawingSpecification)) {
|
|
|
|
+ dirFile4 = new File(downloadPath + "/施工图设计说明书");
|
|
|
|
+ if (drawingSpecification.contains("|")) {
|
|
|
|
+ String[] split = drawingSpecification.split("\\|");
|
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(split[i]);
|
|
|
|
+ exportList4.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ FilingImages filingImages = new FilingImages();
|
|
|
|
+ filingImages.setImgPath(drawingSpecification);
|
|
|
|
+ exportList4.add(filingImages);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (exportList.size() > 0) {
|
|
|
|
+ this.disposeFileList(exportList, dirFile.getPath());
|
|
|
|
+ }
|
|
|
|
+ if (exportList2.size() > 0) {
|
|
|
|
+ this.disposeFileList(exportList2, dirFile2.getPath());
|
|
|
|
+ }
|
|
|
|
+ if (exportList3.size() > 0) {
|
|
|
|
+ this.disposeFileList(exportList3, dirFile3.getPath());
|
|
|
|
+ }
|
|
|
|
+ if (exportList4.size() > 0) {
|
|
|
|
+ this.disposeFileList(exportList4, dirFile4.getPath());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //处理完之后进行打包压缩并删除之前的文件
|
|
|
|
+ ZipCompressUtil zipUtil = new ZipCompressUtil();
|
|
|
|
+ File resultFile = new File(path);
|
|
|
|
+ File file = zipUtil.zipCompress(resultFile, true);
|
|
|
|
+ return file.getPath();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理文件信息
|
|
|
|
+ *
|
|
|
|
+ * @param downloadPath
|
|
|
|
+ */
|
|
|
|
+ public void disposeFileList(List<FilingImages> filingImages, String downloadPath) throws IOException {
|
|
|
|
+ ZipCompressUtil zipCompressUtil = new ZipCompressUtil();
|
|
|
|
+ String FILE_PREFIX = loader.getProperty("linux.file.store.prefix");
|
|
|
|
+ if (SYS_TYPE.equals("1")) {
|
|
|
|
+ for (FilingImages info : filingImages) {
|
|
|
|
+ zipCompressUtil.downloadRuralProject(info.getImgPath().substring(0, info.getImgPath().lastIndexOf("/")), info.getImgPath().substring(info.getImgPath().lastIndexOf("/") + 1, info.getImgPath().length()), downloadPath);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (FilingImages info : filingImages) {
|
|
|
|
+ zipCompressUtil.downloadRuralProject(FILE_PREFIX+info.getImgPath().substring(0, info.getImgPath().lastIndexOf("/")), info.getImgPath().substring(info.getImgPath().lastIndexOf("/") + 1, info.getImgPath().length()), downloadPath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|