springboot+thymeleaf+mybatis实现甘特图的详细过程

网友投稿 659 2022-12-27

springboot+thymeleaf+mybatis实现甘特图的详细过程

springboot+thymeleaf+mybatis实现甘特图的详细过程

首先我们要明白:这个甘特图需要哪些动态数据

(1)需要:ID,tName,number,计划开始时间,开始时间,计划结束时间,结束时间,项目负责人,参与人,知情人ID,计划时长(可以计算得出的,不必在数据库中);前置任务;项目进度,该任务属于哪个任务

(2)然后利用easycode插件生成实体类,映射类,服务类,ontCroller等

(3)利用bootstrap框架做出甘特图的样式,写好js

(4)在Controller层中利用Http请求传参

@RequestMapping(value = "/gantee",method = RequestMethod.GET)

public String gantee(Model model) throws JSONException {

Renwu renwu = renwuService.queryById(new Integer("1"));

Map jsonData = new HashMap();

List jsonArray = new ArrayList<>();

Map jsonObject = new HashMap();

Integer id = renwu.getProjectid();

Integer pid = renwu.getPid();

String projectName = renwu.getProjectname();

String projectCode = renwu.getProjectcode();

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");

Date planStartDate = renwu.getPlanstartat();

Date planEndDate = renwu.getPlanendat();

Date startDate = renwu.getStartat();

Date endDate = renwu.getEndat();

String planStartStr = dateFormat.format(planStartDate);

String planEndStr = dateFormat.format(planEndDate);

String startStr = dateFormat.format(startDate);

String endStr = dateFormat.format(endDate);

String persent = renwu.getPersent();

String resps = renwu.getResps();

String actors = renwu.getActors();

String insiders = renwu.getInsiders();

Integer dur = renwu.getDur();

Integer before = renwu.getBefore();

jsonObject.put("id",id);

jsonObject.put("pid",pid);

jsonObject.put("projectName",projectName);

jsonObject.put("projectCode",projectCode);

jsonObject.put("planStartAt",planStartStr);

jsonObject.put("planEndAt",planEndStr);

jsonObject.put("startAt",startStr);

jsonObject.put("endAt",endStr);

jsonObject.put("persent",persent);

jsonObject.put("resps",resps);

jsonObject.put("actors",actors);

jsonObject.put("insiders",insiders);

jsonObject.put("dur",dur);

jsonObject.put("before",new Object[]{before});

jsonArray.add(jsonObject);

jsonData.put("data",jsonArray);

model.addAttribute("lyhGanttuData",jsonData);

return "ganttu";

}

(5)直接启动SpringBoot项目即可。

这个是Springboot项目,自然也是可以转到SpringCloud的子项目中。

注意:HTML并不是我原创没我只是在其基础上改了一下JS。在这个开放的时代,我觉得大家应该把学到的东西开放出来,不管多好或是很差。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:哪些app有小程序(哪个app有小程序)
下一篇:广州省一体化政务服务平台(广州省一体化政务服务平台app)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~