|
|
@@ -15,11 +15,11 @@ import platform.common.Constant;
|
|
|
import platform.common.annotation.OperationLog;
|
|
|
import platform.common.base.controller.BaseController;
|
|
|
import platform.common.base.model.DictionaryItem;
|
|
|
+import platform.common.base.model.Template;
|
|
|
import platform.common.base.service.DictionaryItemService;
|
|
|
+import platform.common.base.service.TemplateService;
|
|
|
import platform.common.exception.BaseException;
|
|
|
-import platform.common.util.ExportExcel;
|
|
|
-import platform.common.util.MathHepler;
|
|
|
-import platform.common.util.ShiroUtils;
|
|
|
+import platform.common.util.*;
|
|
|
import platform.modules.build.DTO.CompanyDto;
|
|
|
import platform.modules.build.entity.BuildInfo;
|
|
|
import platform.modules.build.entity.Company;
|
|
|
@@ -27,17 +27,21 @@ import platform.modules.build.service.BuildInfoService;
|
|
|
import platform.modules.build.service.CompanyService;
|
|
|
import platform.modules.company.dto.ProjectApprovalDto;
|
|
|
import platform.modules.company.entity.ProjectApplication;
|
|
|
+import platform.modules.company.entity.ProjectMaterial;
|
|
|
import platform.modules.company.service.ProjectApplicationApproveService;
|
|
|
import platform.modules.company.service.ProjectApplicationService;
|
|
|
+import platform.modules.company.service.ProjectMaterialService;
|
|
|
import platform.modules.government.dto.*;
|
|
|
import platform.modules.government.entity.*;
|
|
|
import platform.modules.government.service.ProjectDeclarationService;
|
|
|
+import platform.modules.government.service.ProjectService;
|
|
|
import platform.modules.government.service.ProjectTypeService;
|
|
|
import platform.modules.government.service.StreetService;
|
|
|
import platform.modules.sys.entity.NoticesAccept;
|
|
|
import platform.modules.sys.report.ProjectApplicationExports;
|
|
|
import platform.modules.sys.service.NoticesAcceptService;
|
|
|
import platform.modules.sys.web.ResponseMessage;
|
|
|
+import tk.mybatis.mapper.entity.Example;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
@@ -972,4 +976,82 @@ public class ProjectDeclarationController extends BaseController {
|
|
|
return ResponseMessage.error(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectService projectService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProjectMaterialService projectMaterialService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TemplateService templateService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 纠正项目小类 附件等
|
|
|
+ */
|
|
|
+ @OperationLog(value = "纠正项目小类 附件等")
|
|
|
+ @ResponseBody
|
|
|
+ @GetMapping(value = "/correctApplicationType")
|
|
|
+ public ResponseMessage importCompanyInfo(){
|
|
|
+ String year = DateUtil.getCurrentDateString("yyyy");
|
|
|
+ Example example = new Example(ProjectApplication.class);
|
|
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
+ criteria.andLike("apply_no", "%GY" + year + "%");
|
|
|
+ List<ProjectApplication> projectApplicationList = projectApplicationService.selectByExample(example);
|
|
|
+
|
|
|
+ example = new Example(Project.class);
|
|
|
+ criteria = example.createCriteria();
|
|
|
+ criteria.andEqualTo("project_year", year);
|
|
|
+ List<Project> projectList = projectService.selectByExample(example);
|
|
|
+
|
|
|
+ if (CommonUtils.isNotNull(projectApplicationList) && CommonUtils.isNotNull(projectList)) {
|
|
|
+ for (ProjectApplication projectApplication : projectApplicationList) {
|
|
|
+ for (Project project : projectList) {
|
|
|
+ if (
|
|
|
+ Objects.equals(projectApplication.getProject_name(), project.getProject_name())
|
|
|
+ && projectApplication.getProject_id() != project.getId()
|
|
|
+ ) {
|
|
|
+// System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
|
|
+// System.out.println(projectApplication.toString());
|
|
|
+// System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
|
|
+ projectApplication.setProject_id(project.getId());
|
|
|
+ projectApplicationService.updateSelective(projectApplication);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProjectMaterial> newProjectMaterialList = new ArrayList<>();
|
|
|
+ List<Template> templateList = new ArrayList<>();
|
|
|
+
|
|
|
+ example = new Example(ProjectMaterial.class);
|
|
|
+ criteria = example.createCriteria();
|
|
|
+ criteria.andEqualTo("apply_id", projectApplication.getId());
|
|
|
+ List<ProjectMaterial> projectMaterialList = projectMaterialService.selectByExample(example);
|
|
|
+ if (CommonUtils.isNotNull(projectMaterialList)) {
|
|
|
+ for (ProjectMaterial projectMaterial : projectMaterialList) {
|
|
|
+ if (CommonUtils.isNull(projectMaterial.getContent())) {
|
|
|
+ newProjectMaterialList.add(projectMaterial);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Project project = projectService.findById(projectApplication.getProject_id());
|
|
|
+ if (null != project) {
|
|
|
+ Integer itemId = dictionaryItemService.findIdByTypeAndNameActive(Constant.DictionaryType.PROJECT_NAME, project.getProject_name());
|
|
|
+ example = new Example(Template.class);
|
|
|
+ criteria = example.createCriteria();
|
|
|
+ criteria.andEqualTo("item_id", itemId);
|
|
|
+ templateList = templateService.selectByExample(example);
|
|
|
+ }
|
|
|
+ if (templateList.size() == newProjectMaterialList.size()) {
|
|
|
+ for (int i = 0; i < newProjectMaterialList.size(); i++) {
|
|
|
+ if (!Objects.equals(newProjectMaterialList.get(i).getTemplate_id(), templateList.get(i).getId())) {
|
|
|
+ newProjectMaterialList.get(i).setTemplate_id(templateList.get(i).getId());
|
|
|
+ projectMaterialService.updateSelective(newProjectMaterialList.get(i));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseMessage.success("同步完成");
|
|
|
+ }
|
|
|
}
|