package com.chillax.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chillax.bean.Car;
import com.chillax.bean.Order;
import com.chillax.bean.OrderPart;
import com.chillax.bean.OrderWorker;
import com.chillax.bean.Part;
import com.chillax.bean.SStation;
import com.chillax.bean.User;
import com.chillax.bean.Worker;
import com.chillax.service.CarService;
import com.chillax.service.OrderPartService;
import com.chillax.service.OrderService;
import com.chillax.service.OrderWorkerService;
import com.chillax.service.PartService;
import com.chillax.service.StationService;
import com.chillax.service.WorkerService;
import com.chillax.utils.BaseController;
import com.chillax.utils.DateUtils;
import com.chillax.utils.StringUtil;
@Controller
@RequestMapping("/order")
public class OrderController extends BaseController {
private final Integer WARNING_COUNT=20;
@Resource
private CarService carService;
@Resource
private StationService stationService;
@Resource
private PartService partService;
@Resource
private OrderPartService orderPartService;
@Resource
private OrderWorkerService orderWorkerService;
@Resource
private WorkerService workerService;
@Resource
private OrderService orderService;
/** 页面跳转 预定页面 */
@RequestMapping("/toPreOrder")
public String toPreOrder(HttpServletRequest request, HttpSession session,
String carId) {
return "order/preOrder";
}
/** 订单预定 */
@RequestMapping("/preOrder")
@ResponseBody
public Integer preOrder(HttpServletRequest request, HttpSession session,
String imgurls, String arriveTime, String desc) {
// User user=(User)session.getAttribute("userOn");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date arrDate = null;
try {
arrDate = format.parse(arriveTime);
} catch (ParseException e) {
e.printStackTrace();
}
Car car = (Car) session.getAttribute("preCar");
car.setCarState(1);
int updateCar = carService.updateByPrimaryKeySelective(car);
Order order = new Order();
order.setOrderId(StringUtil.getStringId());
order.setCarId(car.getCarId());
order.setoDescribe(desc);
// 0 预约中 1预约成功 2正在执行 3完成 4拒绝
order.setoState("0");
order.setArriveTime(arrDate);
order.setOrdertime(new Date());
order.setImgUrls(imgurls);
int updateOrder = orderService.insertSelective(order);
return updateOrder+updateCar;
}
/** 订单操作 */
@RequestMapping("/manage")
public String manageOrder(HttpServletRequest request, HttpSession session,String orderId) {
Map<String, Object> paramMap=new HashMap<String, Object>();
paramMap.put("orderId", orderId);
//通过id查出只能是一条数据
List<Map<String, Object>> order = orderService.selectOrderByAttr(paramMap);
String[] imgurls = order.get(0).get("imgUrls").toString().split(",");
//查询所有待使用的机床
List<SStation> stations=stationService.selectAll(new HashMap<String, Object>(){{put("s_state", "完好待使用");}});
//查询所有空闲的工人 state=1空闲 2在忙 0离职
List<Worker> workers = workerService.selectWorkersByAttr(new Worker(){{setwState(1);}});
//查询所有可使用零件
List<Part> parts = partService.selectAll();
request.setAttribute("imgurls",imgurls);
request.setAttribute("dealOrder",order.get(0));
request.setAttribute("stations",stations);
request.setAttribute("workers",workers);
request.setAttribute("parts",parts);
return "order/manageOrder";
}
/** 页面跳转 */
@RequestMapping("/list")
public String workList(HttpServletRequest request, HttpSession session,String state) {
Map<String, Object> paramMap=new HashMap<String, Object>();
paramMap.put("state", state);
List<Map<String, Object>> order = orderService.selectOrderByAttr(paramMap);
session.setAttribute("order", order);
request.setAttribute("state", state);
return "order/order_list";
}
/** */
@RequestMapping("/accept")
@ResponseBody
public String acceptOrder(HttpServletResponse response,HttpServletRequest request,String orderId,
String remark,String stationId) {
String success="1";
//获取订单id 机床id 员工id集合 零件id num集合
String selectedWorker=request.getParameter("selectedWorker");
String[] workers = selectedWorker.split(",");
String selParts=request.getParameter("parts");
JSONArray parts=JSONArray.parseArray(selParts);
//修改订单状态 修改机床状态 更新order-worker order-part表
try {
Order order = orderService.selectByPrimaryKey(orderId);
order.setStationId(Integer.parseInt(stationId));
order.setoState("1");//1进行中
order.setRemark(remark);
order.setBegintime(new Date());
orderService.updateByPrimaryKeySelective(order);//更新order
SStation station = stationService.selectByPrimaryKey(Integer.parseInt(stationId));
station.setsState("完好在使用");
stationService.updateByPrimaryKeySelective(station);
for(int i=0;i<parts.size();i++){
JSONObject jo = parts.getJSONObject(i);
String pId = jo.get("id").toString();
int num = Integer.parseInt(jo.get("num").toString());
orderPartService.insert(new OrderPart(orderId, pId,num));
Part part = partService.selectByPrimaryKey(pId);
part.setPartNum(part.getPartNum()-num);
partService.updateByPrimaryKeySelective(part);
}
for(String id :workers){
orderWorkerService.insert(new OrderWorker(orderId,id));
Worker worker = workerService.selectByPrimaryKey(id);
worker.setwState(0);//忙碌
workerService.updateByPrimaryKeySelective(worker);
}
} catch (Exception e) {
success="0";
}
return success;
}
/** 修改订单*/
@RequestMapping("/edit")
public String edit(HttpServletRequest request,String orderId){
Map<String, Object> paramMap=new HashMap<String, Object>();
paramMap.put("orderId", orderId);
//通过id查出只能是一条数据
List<Map<String, Object>> order = orderService.selectOrderByAttr(paramMap);
String[] imgurls = order.get(0).get("imgUrls").toString().split(",");
//查询机床
SStation station = stationService.selectByPrimaryKey(Integer.parseInt(order.get(0).get("s_id").toString()));
//查询工人 0在忙 1 空闲
List<Map<String, Object>> selWorkers = orderWorkerService.selectByOrderId(order.get(0).get("o_id").toString());
//查询所有零件
List<Map<String, Object>> selParts = orderPartService.selectByOrderId(order.get(0).get("o_id").toString());
//查询所有待使用的机床
List<SStation> stations=stationService.selectAll(new HashMap<String, Object>(){{put("s_state", "完好待使用");}});
//查询所有空闲的工人 state=1空闲 2在忙 0离职
List<Worker> workers = workerService.selectWorkersByAttr(new Worker(){{setwState(1);}});
//查询所有可使用零件
List<Part> parts = partService.selectAll();
request.setAttribute("imgurls",imgurls);
request.setAttribute("dealOrder",order.get(0));
request.setAttribute("stations",stations);
request.setAttribute("workers",workers);
request.setAttribute("parts",parts);
request.setAttribute("station",station);//已选中station
request.setAttribute("selWorkers",selWor
没有合适的资源?快使用搜索试试~ 我知道了~
JavaWeb 基于SSM的汽车维修管理系统
共782个文件
svn-base:457个
gif:78个
class:55个
需积分: 21 114 下载量 17 浏览量
2018-07-09
19:43:58
上传
评论 22
收藏 3.38MB ZIP 举报
温馨提示
本科毕业设计--汽车维修管理系统终于有时间整理一下,同时将鄙人的本科毕业设计拿来与大家交流学习。用到jdk1.7 Tomcat maven 等技术,因为文件太大只上传代码和数据库,如有不懂或者需要可以私信我或者联系我wx: nohup-live,我会分享给你们。 中间还有很多不足之处,应为某些原因还未能及时改正,提供仅供参考,谢谢评价!
资源推荐
资源详情
资源评论
收起资源包目录
JavaWeb 基于SSM的汽车维修管理系统 (782个子文件)
OrderController.class 13KB
CarController.class 6KB
UserController.class 5KB
WorkerController.class 5KB
StationController.class 4KB
PartController.class 4KB
FileUploadController.class 3KB
TimeTest.class 3KB
Worker.class 3KB
Order.class 3KB
CommonInterceptor.class 2KB
Car.class 2KB
WorkerServiceImpl.class 2KB
CarServiceImpl.class 2KB
UserServiceImpl.class 2KB
Part.class 2KB
OrderServiceImpl.class 2KB
StationServiceImpl.class 2KB
SStation.class 2KB
User.class 2KB
PartServiceImpl.class 2KB
DateUtils.class 2KB
PictureServiceImpl.class 1KB
BaseController.class 1KB
Picture.class 1KB
OrderPart.class 1KB
TableData.class 1KB
OrderWorkerServiceImpl.class 1KB
OrderPartServiceImpl.class 1KB
StringUtil.class 1KB
OrderWorker.class 1KB
OrderController$5.class 904B
OrderController$1.class 878B
OrderController$3.class 839B
OrderController$2.class 809B
FrameController.class 805B
OrderController$4.class 770B
WorkerService.class 761B
WorkerDao.class 749B
CarService.class 731B
CarMapper.class 725B
UserService.class 713B
UserDao.class 701B
OrderService.class 607B
OrderMapper.class 601B
StationService.class 585B
SStationDao.class 575B
PartService.class 497B
PartMapper.class 491B
PictureService.class 402B
PictureMapper.class 396B
OrderWorkerService.class 395B
OrderWorkerMapper.class 389B
OrderPartService.class 389B
OrderPartMapper.class 383B
.classpath 2KB
org.eclipse.wst.common.component 662B
org.eclipse.wst.jsdt.ui.superType.container 49B
bootstrap.css 134KB
layui.css 68KB
font-awesome.min.css 26KB
spectrum.css 15KB
layer.css 14KB
layer.css 14KB
layui.mobile.css 10KB
docs.css 9KB
laydate.css 8KB
login.css 8KB
bootstrap-table.css 7KB
code.css 1KB
wc.db 300KB
entries 3B
iconfont.eot 40KB
format 3B
59.gif 10KB
22.gif 10KB
24.gif 8KB
13.gif 7KB
16.gif 7KB
39.gif 6KB
64.gif 6KB
63.gif 6KB
50.gif 6KB
loading-0.gif 6KB
loading-0.gif 6KB
4.gif 6KB
1.gif 5KB
42.gif 5KB
71.gif 5KB
21.gif 5KB
20.gif 5KB
29.gif 5KB
70.gif 4KB
5.gif 4KB
17.gif 4KB
27.gif 4KB
9.gif 4KB
44.gif 4KB
11.gif 4KB
8.gif 4KB
共 782 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
酒浓
- 粉丝: 4
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 注塑技术员试题及答案.doc
- 自学考试房地产开发和经营重点.doc
- 江苏镇江市2018年中考语文试题答案和解析.doc
- 精神病学试题与答案.doc
- 教育行动研究报告的写作.doc
- 老年人常见疾病的护理知识.doc
- 考试后激励学生的话.doc
- 廉洁文化主题教育课教学案.doc
- 贫困家庭申请书范文(精选多篇).doc
- 培训机构教学计划.doc
- 全新版大学英语综合教程3contentquestions答案.doc
- 全科医师转岗培训理论考试题和正确答案.doc
- 全国居民健康素养知识问卷80题及答案.doc
- 服装公司薪酬福利管理手册.docx
- 服装薪酬体系-KPI绩效考核指标.xls
- 各岗位KPI绩效考核指标——服装生产企业.xls
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功