package com.hxzk.controller; import com.github.pagehelper.PageInfo; import com.hxzk.pojo.TbZypFireSafety; import com.hxzk.pojo.TbZypHandel; import com.hxzk.service.TbZypFireSafetyService; import com.hxzk.service.UserService; import com.hxzk.util.result; import com.hxzk.util.resultutil; 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 javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /** *

* 动火安全作业证 前端控制器 *

* * @author wangfei * @since 2024-04-17 */ @RestController @RequestMapping("/") public class TbZypFireSafetyController { @Autowired TbZypFireSafetyService tbZypFireSafetyService; @Autowired UserService userService; @GetMapping("findDongHuo") result> findDongHuo(Integer page, Integer limit) { PageInfo cz = tbZypFireSafetyService.findAll(page, limit); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } @PostMapping("findFireSafetySearch") result> findFireSafetySearch(Integer page, Integer limit, String applicant, String code) { PageInfo cz = tbZypFireSafetyService.findSearch(page, limit, applicant, code); return resultutil.returnSuccess(cz.getTotal(), cz.getList()); } @GetMapping("findtIdFireSafety") public TbZypFireSafety findtIdFireSafety(Integer id) { return tbZypFireSafetyService.findtagidFireSafety(id); } @PostMapping("addDH") public void addDH(TbZypFireSafety tbZypFireSafety, HttpServletResponse response) throws IOException { if (tbZypFireSafety.getStartDate() != "" && tbZypFireSafety.getEndDate() != "") { tbZypFireSafety.setHottime("自" + tbZypFireSafety.getStartDate() + "至" + tbZypFireSafety.getEndDate() + "止"); } if (tbZypFireSafety.getId() != null) { tbZypFireSafetyService.updateFireSafety(tbZypFireSafety); } else { tbZypFireSafetyService.addDH(tbZypFireSafety); } // Calendar calendar = Calendar.getInstance(); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // String dateStr = sdf.format(calendar.getTime()); // company.setAddtime(dateStr); // TbScreenSettings screenSettings = new TbScreenSettings(); // screenSettings.setCompanyname(company.getCompanyname()); // screenService.AddScreen(screenSettings); // TbSystemOperationLog systemOperationLog = new TbSystemOperationLog(); // systemOperationLog.setName(UserController.username); // systemOperationLog.setTime(gettime()); // systemOperationLog.setContent("增加了一个公司,该公司名称为:"+company.getCompanyname()); // systemLogService.insertSystem(systemOperationLog); response.sendRedirect("/hxzkuwb/HouTai/JobTicket/DongHuo.jsp"); } @PostMapping("updateFireSafety") public void updateFireSafety(TbZypFireSafety tbZypFireSafety, HttpServletResponse response) throws IOException { // smsReminder.setAddtime(gettime()); tbZypFireSafetyService.updateFireSafety(tbZypFireSafety); response.sendRedirect("/hxzkuwb/HouTai/JobTicket/DongHuo.jsp"); } @GetMapping("deleteFireSafety") public void deleteFireSafety(Integer id, HttpServletResponse response) throws IOException { tbZypFireSafetyService.deleteFireSafety(id); response.sendRedirect("/hxzkuwb/HouTai/JobTicket/DongHuo.jsp"); } @GetMapping("UpDongHuoState") public String UpDongHuoState(String code,String iscompleted) throws IOException { tbZypFireSafetyService.UpDongHuoState(code, iscompleted); return "success"; } @GetMapping("FindSMSReminder") public int FindSMSReminder(String iscompleted) throws IOException { return tbZypFireSafetyService.FindSMSReminder(iscompleted); } @GetMapping("/UpDongHuoQianZi") public int UpDongHuoQianZi(TbZypFireSafety zypFireSafety) throws IOException { return tbZypFireSafetyService.UpDongHuoQianZi(zypFireSafety); } }