|
@@ -1,6 +1,7 @@
|
|
package com.jeeplus.modules.supply.projectInformation.service;
|
|
package com.jeeplus.modules.supply.projectInformation.service;
|
|
|
|
|
|
import com.jeeplus.common.config.Global;
|
|
import com.jeeplus.common.config.Global;
|
|
|
|
+import com.jeeplus.common.utils.IdGen;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.core.service.CrudService;
|
|
@@ -42,13 +43,29 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 物流库信息导入处理
|
|
|
|
|
|
+ * 项目信息导入处理
|
|
* @param list
|
|
* @param list
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
public LinkedHashMap disposeImportProjectInformation(List<ProjectInformation> list, MultipartFile file, String repeat) throws Exception{
|
|
public LinkedHashMap disposeImportProjectInformation(List<ProjectInformation> list, MultipartFile file, String repeat) throws Exception{
|
|
LinkedHashMap returnMap = new LinkedHashMap();
|
|
LinkedHashMap returnMap = new LinkedHashMap();
|
|
|
|
+
|
|
|
|
+ Iterator<ProjectInformation> its = list.iterator();
|
|
|
|
+ while(its.hasNext()){
|
|
|
|
+ ProjectInformation info = its.next();
|
|
|
|
+ if(StringUtils.isBlank(info.getSubmissionFormId())){
|
|
|
|
+ returnMap.put("success",false);
|
|
|
|
+ returnMap.put("msg","存在审定单id为空的数据,请重新提交");
|
|
|
|
+ return returnMap;
|
|
|
|
+// its.remove(); //根据主键 送审单id做判断,防止空值
|
|
|
|
+ }else if(StringUtils.isBlank(info.getProjectDefinitionNumber())){
|
|
|
|
+ returnMap.put("success",false);
|
|
|
|
+ returnMap.put("msg","存在项目定义号为空的数据,请重新提交");
|
|
|
|
+ return returnMap;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
Set<String> submissionFormIdSet = new HashSet<>();
|
|
Set<String> submissionFormIdSet = new HashSet<>();
|
|
for (ProjectInformation importInfo : list){
|
|
for (ProjectInformation importInfo : list){
|
|
//将审定单id放入set中
|
|
//将审定单id放入set中
|
|
@@ -60,6 +77,7 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
//判断物流编码list长度和导入数据的list长度是否一样,不一样则说明导入数据中项目名存在重复数据
|
|
//判断物流编码list长度和导入数据的list长度是否一样,不一样则说明导入数据中项目名存在重复数据
|
|
if(submissionFormIdList.size() != list.size()){
|
|
if(submissionFormIdList.size() != list.size()){
|
|
returnMap.keySet().removeIf(key -> key == "msg");
|
|
returnMap.keySet().removeIf(key -> key == "msg");
|
|
|
|
+ returnMap.put("success",false);
|
|
returnMap.put("msg","数据中存在重复审定单id");
|
|
returnMap.put("msg","数据中存在重复审定单id");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -91,6 +109,8 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
//将文件存到服务器
|
|
//将文件存到服务器
|
|
String filePath = saveFile(copyFile);
|
|
String filePath = saveFile(copyFile);
|
|
returnMap.put("filePath",filePath);
|
|
returnMap.put("filePath",filePath);
|
|
|
|
+ returnMap.keySet().removeIf(key -> key == "repeat");
|
|
|
|
+ returnMap.put("repeat","3");
|
|
returnMap.keySet().removeIf(key -> key == "msg");
|
|
returnMap.keySet().removeIf(key -> key == "msg");
|
|
returnMap.put("msg","已存在物料数据,是否覆盖?");
|
|
returnMap.put("msg","已存在物料数据,是否覆盖?");
|
|
return returnMap;
|
|
return returnMap;
|
|
@@ -145,14 +165,26 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
for (int i = 0; i < part; i++) {
|
|
for (int i = 0; i < part; i++) {
|
|
//100条
|
|
//100条
|
|
List<ProjectInformation> listPage = projectBasicsList.subList(0, pointsDataLimit);
|
|
List<ProjectInformation> listPage = projectBasicsList.subList(0, pointsDataLimit);
|
|
|
|
+ for(ProjectInformation info:listPage){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertSubmissionFormList(listPage);
|
|
projectInformationMapper.insertSubmissionFormList(listPage);
|
|
//剔除
|
|
//剔除
|
|
projectBasicsList.subList(0, pointsDataLimit).clear();
|
|
projectBasicsList.subList(0, pointsDataLimit).clear();
|
|
}
|
|
}
|
|
if(!projectBasicsList.isEmpty()){
|
|
if(!projectBasicsList.isEmpty()){
|
|
|
|
+ for(ProjectInformation info:projectBasicsList){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertSubmissionFormList(projectBasicsList);
|
|
projectInformationMapper.insertSubmissionFormList(projectBasicsList);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
|
|
+ for(ProjectInformation info:projectBasicsList){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertSubmissionFormList(projectBasicsList);
|
|
projectInformationMapper.insertSubmissionFormList(projectBasicsList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -160,7 +192,7 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 批量修改手工上传数据信息
|
|
|
|
|
|
+ * 批量修改手工上传数据信息 删除
|
|
* @param projectBasicsList
|
|
* @param projectBasicsList
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -177,14 +209,26 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
for (int i = 0; i < part; i++) {
|
|
for (int i = 0; i < part; i++) {
|
|
//100条
|
|
//100条
|
|
List<ProjectInformation> listPage = projectBasicsList.subList(0, pointsDataLimit);
|
|
List<ProjectInformation> listPage = projectBasicsList.subList(0, pointsDataLimit);
|
|
|
|
+ for(ProjectInformation info:listPage){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertProjectInformationList(listPage);
|
|
projectInformationMapper.insertProjectInformationList(listPage);
|
|
//剔除
|
|
//剔除
|
|
projectBasicsList.subList(0, pointsDataLimit).clear();
|
|
projectBasicsList.subList(0, pointsDataLimit).clear();
|
|
}
|
|
}
|
|
if(!projectBasicsList.isEmpty()){
|
|
if(!projectBasicsList.isEmpty()){
|
|
|
|
+ for(ProjectInformation info:projectBasicsList){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertProjectInformationList(projectBasicsList);
|
|
projectInformationMapper.insertProjectInformationList(projectBasicsList);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
|
|
+ for(ProjectInformation info:projectBasicsList){
|
|
|
|
+ info.setId(IdGen.uuid());
|
|
|
|
+ info.preInsert();
|
|
|
|
+ }
|
|
projectInformationMapper.insertProjectInformationList(projectBasicsList);
|
|
projectInformationMapper.insertProjectInformationList(projectBasicsList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -330,9 +374,10 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
}
|
|
}
|
|
|
|
|
|
//定时任务删除前两天数据
|
|
//定时任务删除前两天数据
|
|
- @Scheduled(cron = "0 */2 * * * ?")
|
|
|
|
|
|
+ @Scheduled(cron = "0 2 * * * ?")
|
|
public void deleteFileByCron(){
|
|
public void deleteFileByCron(){
|
|
try{
|
|
try{
|
|
|
|
+ System.out.println("开始了!");
|
|
if(StringUtils.isNotBlank(host) && ("127.0.0.1".equals(host) || "localhost".equals(host))){
|
|
if(StringUtils.isNotBlank(host) && ("127.0.0.1".equals(host) || "localhost".equals(host))){
|
|
String path = null;
|
|
String path = null;
|
|
if(System.getProperty("os.name").toLowerCase().contains("win")){
|
|
if(System.getProperty("os.name").toLowerCase().contains("win")){
|
|
@@ -359,13 +404,14 @@ public class ProjectInformationService extends CrudService<ProjectInformationMap
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ System.out.println("结束了!");
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public void delete(String id){
|
|
|
|
- projectInformationMapper.deletex(id);
|
|
|
|
- }
|
|
|
|
|
|
+// public void delete(String id){
|
|
|
|
+// projectInformationMapper.deletex(id);
|
|
|
|
+// }
|
|
|
|
|
|
}
|
|
}
|