¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flow.controller; |
| | | |
| | | import com.flow.pojo.Duanxinlog; |
| | | import com.flow.pojo.Manager; |
| | | import com.flow.pojo.TbFuwuqi; |
| | | import com.flow.service.ManagerService; |
| | | import com.flow.util.result; |
| | | import com.flow.util.resultutil; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping({"/hxzk"}) |
| | | public class ManagerController { |
| | | |
| | | @Autowired |
| | | ManagerService managerService; |
| | | |
| | | @GetMapping({"findManager"}) |
| | | result<List<Manager>> findManager(Integer page, Integer limit) { |
| | | PageInfo<Manager> cz = this.managerService.FindManager(page, limit); |
| | | return resultutil.returnSuccess(cz.getTotal(), cz.getList()); |
| | | } |
| | | |
| | | @PostMapping({"addManager"}) |
| | | public ModelAndView addManager(Manager manager) throws Exception { |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | manager.setId(null); |
| | | this.managerService.addManager(manager); |
| | | // modelAndView.addObject("suoshu", this.managerService.findSuoShu()); |
| | | modelAndView.setViewName("/page/manager.jsp"); |
| | | return modelAndView; |
| | | } |
| | | |
| | | @PostMapping({"UpdateManager"}) |
| | | public ModelAndView UpdateManager(Manager manager) { |
| | | this.managerService.UpdateManager(manager); |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("/page/manager.jsp"); |
| | | return modelAndView; |
| | | } |
| | | |
| | | @PostMapping({"DeleteManager"}) |
| | | public ModelAndView DeleteManager(String num,String caozuoname) { |
| | | this.managerService.DeleteManager(num,caozuoname); |
| | | ModelAndView modelAndView = new ModelAndView(); |
| | | modelAndView.setViewName("/page/manager.jsp"); |
| | | return modelAndView; |
| | | |
| | | } |
| | | |
| | | @PostMapping({"ManagerSearch"}) |
| | | public result<List<Manager>> tableSearch(Manager manager, int page, int limit) throws Exception { |
| | | PageInfo<Manager> cz = this.managerService.tableSearch(manager, page, limit); |
| | | // for(int i = 0; i < cz.getSize(); ++i) { |
| | | // if (((Manager)cz.getList().get(i)).getCompany() != null) { |
| | | // SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // Date date = new Date(); |
| | | // Date endDay = date2.parse(cz.getList().get(i).getEnddate());//ç»ææ¶é´ |
| | | // Long starTime = date.getTime(); |
| | | // Long endTime = endDay.getTime(); |
| | | // Long num11 = endTime - starTime;//æ¶é´æ³ |
| | | // |
| | | //// if ((num11/24/60/60/1000)<0){ |
| | | //// ((Manager)cz.getList().get(i)).setRemainingdays("0天"); |
| | | //// }else{ |
| | | //// ((Manager)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"天"); |
| | | //// } |
| | | //// this.cardService.UpdateCard((Card)cz.getList().get(i)); |
| | | //// this.cardService.UpdateCard((Card)cz.getList().get(i)); |
| | | // } |
| | | // } |
| | | return resultutil.returnSuccess(cz.getTotal(), cz.getList()); |
| | | } |
| | | |
| | | @PostMapping({"ifManager"}) |
| | | public List<Manager> ifManager(Manager manager) { |
| | | return this.managerService.ifManager(manager); |
| | | } |
| | | |
| | | } |