|
@@ -4,6 +4,7 @@
|
|
package com.jeeplus.modules.sg.managementcenter.constructionProject.web;
|
|
package com.jeeplus.modules.sg.managementcenter.constructionProject.web;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Maps;
|
|
import com.jeeplus.common.json.AjaxJson;
|
|
import com.jeeplus.common.json.AjaxJson;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.core.persistence.Page;
|
|
import com.jeeplus.core.persistence.Page;
|
|
@@ -12,7 +13,11 @@ import com.jeeplus.modules.sg.managementcenter.constructionProject.entity.Constr
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.service.ConstructionProjectService;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.service.ConstructionProjectService;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.ImportProUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.ImportProUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.ImportUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.ImportUtil;
|
|
|
|
+import com.jeeplus.modules.sg.managementcenter.constructionProject.util.Result;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.TreeTableUtil;
|
|
import com.jeeplus.modules.sg.managementcenter.constructionProject.util.TreeTableUtil;
|
|
|
|
+import com.jeeplus.modules.test.tree.dialog.entity.TestTree1;
|
|
|
|
+import com.jeeplus.modules.test.treetable.dialog.entity.CarKind1;
|
|
|
|
+import com.jeeplus.modules.test.treetable.dialog.service.CarKind1Service;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -25,7 +30,10 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.text.ParsePosition;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -36,6 +44,8 @@ public class ConstructionProjectController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ConstructionProjectService constructionProjectService;
|
|
private ConstructionProjectService constructionProjectService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CarKind1Service carKind1Service;
|
|
|
|
|
|
@ModelAttribute
|
|
@ModelAttribute
|
|
public ConstructionProject get(@RequestParam(required=false) String id) {
|
|
public ConstructionProject get(@RequestParam(required=false) String id) {
|
|
@@ -63,10 +73,33 @@ public class ConstructionProjectController extends BaseController {
|
|
@RequestMapping(value = "bootstrapTreeTable")
|
|
@RequestMapping(value = "bootstrapTreeTable")
|
|
public List<Map<String,Object>> getBootstrapTreeTable(ConstructionProject constructionProject){
|
|
public List<Map<String,Object>> getBootstrapTreeTable(ConstructionProject constructionProject){
|
|
List<Map<String,Object>> objects = Lists.newArrayList();
|
|
List<Map<String,Object>> objects = Lists.newArrayList();
|
|
|
|
+ constructionProject.setProjectStatus("0");
|
|
List<ConstructionProject> constructionProjects = constructionProjectService.findList(constructionProject);
|
|
List<ConstructionProject> constructionProjects = constructionProjectService.findList(constructionProject);
|
|
List<Map<String, Object>> bootstrapTreeTables = TreeTableUtil.getBootstrapTreeTable(objects, constructionProjects);
|
|
List<Map<String, Object>> bootstrapTreeTables = TreeTableUtil.getBootstrapTreeTable(objects, constructionProjects);
|
|
return bootstrapTreeTables;
|
|
return bootstrapTreeTables;
|
|
}
|
|
}
|
|
|
|
+ //右侧列表
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping(value = "treeData")
|
|
|
|
+ public List<Map<String, Object>> treeData(ConstructionProject constructionProject) {
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ List<Map<String, Object>> parentConstructionMap = getMapListRight(constructionProject);
|
|
|
|
+ return parentConstructionMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping(value = "treeDataAjax")
|
|
|
|
+ public Result treeDataAjax(ConstructionProject constructionProject) {
|
|
|
|
+ Result result = new Result();
|
|
|
|
+ List<Map<String,Object>> mapList = Lists.newArrayList();
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ List<Map<String, Object>> parentConstructionMap = getMapListRight(constructionProject);
|
|
|
|
+ result.setMapList(parentConstructionMap);
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setMessage("成功");
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 列表数据
|
|
* 列表数据
|
|
*/
|
|
*/
|
|
@@ -85,7 +118,7 @@ public class ConstructionProjectController extends BaseController {
|
|
@RequestMapping(value = "form")
|
|
@RequestMapping(value = "form")
|
|
public String form(ConstructionProject constructionProject, Model model) {
|
|
public String form(ConstructionProject constructionProject, Model model) {
|
|
model.addAttribute("constructionProject", constructionProject);
|
|
model.addAttribute("constructionProject", constructionProject);
|
|
- return "modules/sg/managementcenter/materialproject/materialProjectForm";
|
|
|
|
|
|
+ return "modules/sg/managementcenter/constructionProject/constructionForm";
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -163,4 +196,121 @@ public class ConstructionProjectController extends BaseController {
|
|
}
|
|
}
|
|
return j;
|
|
return j;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 安排计划
|
|
|
|
+ * @return ajax
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping(value = "unplanned")
|
|
|
|
+ public Result getUnplanned(String ids, ConstructionProject constructionProject,String time){
|
|
|
|
+ Result result = new Result();
|
|
|
|
+ try{
|
|
|
|
+ String idArray[] =ids.split(",");
|
|
|
|
+ String str ="";
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM");
|
|
|
|
+ Date date = formatter.parse(time);
|
|
|
|
+ constructionProject.setArrangeTime(date);
|
|
|
|
+ for(String id : idArray){
|
|
|
|
+ str = id.substring(id.length()-4);
|
|
|
|
+ if (!str.equals("line")){
|
|
|
|
+ constructionProject.setId(id);
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ constructionProjectService.updateStatus(constructionProject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ constructionProject.setId("");
|
|
|
|
+ List<Map<String, Object>> parentConstructionMap = getMapListRight(constructionProject);
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setMapList(parentConstructionMap);
|
|
|
|
+ result.setMessage("安排计划成功");
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ result.setSuccess(false);
|
|
|
|
+ result.setMessage("安排计划失败");
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * 安排计划
|
|
|
|
+ * @return ajax
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping(value = "unplannedMinus")
|
|
|
|
+ public Result getUnplannedMinus(String ids,ConstructionProject constructionProject,String time){
|
|
|
|
+ Result result = new Result();
|
|
|
|
+ try {
|
|
|
|
+ String idArray[] =ids.split(",");
|
|
|
|
+ String str ="";
|
|
|
|
+ for(String id : idArray){
|
|
|
|
+ str = id.substring(id.length()-4);
|
|
|
|
+ if (!str.equals("line")){
|
|
|
|
+ constructionProject.setId(id);
|
|
|
|
+ constructionProject.setProjectStatus("0");
|
|
|
|
+ constructionProjectService.updateStatus(constructionProject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ constructionProject.setId("");
|
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM");
|
|
|
|
+ Date date = formatter.parse(time);
|
|
|
|
+ constructionProject.setArrangeTime(date);
|
|
|
|
+ List<Map<String, Object>> parentConstructionMap = getMapListRight(constructionProject);
|
|
|
|
+ result.setSuccess(true);
|
|
|
|
+ result.setMapList(parentConstructionMap);
|
|
|
|
+ result.setMessage("取消计划成功");
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ result.setSuccess(false);
|
|
|
|
+ result.setMessage("取消计划失败");
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // @RequiresPermissions(value={"managementcenter:materialproject:view","managementcenter:materialproject:add","managementcenter:materialproject:edit"},logical=Logical.OR)
|
|
|
|
+ @RequestMapping(value = "formPlan")
|
|
|
|
+ public String formPlan(ConstructionProject constructionProject, Model model) {
|
|
|
|
+ String originalId = constructionProject.getId();
|
|
|
|
+ constructionProject.setProjectStatus("2");
|
|
|
|
+ String constructionId = TreeTableUtil.getConstructionId(constructionProject);
|
|
|
|
+ if ("".equals(constructionId)){
|
|
|
|
+ model.addAttribute("constructionId","0");//项目
|
|
|
|
+ }
|
|
|
|
+ if ("line".equals(constructionId)){
|
|
|
|
+ model.addAttribute("constructionId","1");
|
|
|
|
+ }
|
|
|
|
+ constructionProject = get(constructionProject.getId());
|
|
|
|
+ constructionProject.setId(originalId);
|
|
|
|
+ model.addAttribute("constructionProject", constructionProject);
|
|
|
|
+ return "modules/sg/managementcenter/constructionProject/constructionPlanForm";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 计划安排时间修改
|
|
|
|
+ * @param constructionProject
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @RequestMapping(value = "unplannedPlan")
|
|
|
|
+ public AjaxJson getUnplannedPlan(ConstructionProject constructionProject,Date historyTime){
|
|
|
|
+ AjaxJson j = new AjaxJson();
|
|
|
|
+ constructionProject.setProjectStatus("1");
|
|
|
|
+ constructionProjectService.updateSpecificTime(constructionProject,historyTime);
|
|
|
|
+ j.setMsg("设置时间成功");
|
|
|
|
+ return j;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<Map<String,Object>> getMapListRight(ConstructionProject constructionProject){
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
|
+ String time = "";
|
|
|
|
+ if (null!=constructionProject.getArrangeTime()){
|
|
|
|
+ time = sdf.format(constructionProject.getArrangeTime());
|
|
|
|
+ constructionProject.setArrangeTime(null);
|
|
|
|
+ }else {
|
|
|
|
+ time = sdf.format(new Date());
|
|
|
|
+ }
|
|
|
|
+ List<Map<String,Object>> mapList = Lists.newArrayList();
|
|
|
|
+ List<ConstructionProject> constructionProjects = constructionProjectService.findList(constructionProject);
|
|
|
|
+ List<ConstructionProject> constructionProjectList = TreeTableUtil.getMonths(constructionProjects, time);
|
|
|
|
+ return TreeTableUtil.getBootstrapTreeTable(mapList, constructionProjectList);
|
|
|
|
+ }
|
|
}
|
|
}
|