From 871d4095b07cedacb7fbef4c38d64982f539c404 Mon Sep 17 00:00:00 2001
From: fei.wang <wf18701153496@163.com>
Date: 星期四, 09 五月 2024 15:40:15 +0800
Subject: [PATCH] 测试提交

---
 src/main/java/com/flow/controller/TbFuwuqiController.java |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/flow/controller/TbFuwuqiController.java b/src/main/java/com/flow/controller/TbFuwuqiController.java
new file mode 100644
index 0000000..efeee02
--- /dev/null
+++ b/src/main/java/com/flow/controller/TbFuwuqiController.java
@@ -0,0 +1,158 @@
+package com.flow.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.flow.mapper.OperationLogMapper;
+import com.flow.mapper.TbFuwuqiMapper;
+import com.flow.pojo.Card;
+import com.flow.pojo.OperationLog;
+import com.flow.pojo.TbFuwuqi;
+import com.flow.service.CompanyService;
+import com.flow.service.OperationLogService;
+import com.flow.service.TbFuwuqiService;
+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.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequestMapping({"/hxzk"})
+public class TbFuwuqiController {
+
+    @Autowired
+    TbFuwuqiService tbFuwuqiService;
+    @Autowired
+    CompanyService companyService;
+
+    @Autowired
+    OperationLogService operationLogService;
+    @Autowired
+    TbFuwuqiMapper tbFuwuqiMapper;
+    @Autowired
+    OperationLogMapper operationLogMapper;
+    @GetMapping({"findTbFuwuqi"})
+    result<List<TbFuwuqi>> findBangZhu(Integer page, Integer limit) throws ParseException {
+        PageInfo<TbFuwuqi> cz = this.tbFuwuqiService.FindTbFuwuqi(page, limit);
+        for(int i = 0; i < cz.getSize(); ++i) {
+            if (((TbFuwuqi)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){
+                    ((TbFuwuqi)cz.getList().get(i)).setRemainingdays("0澶�");
+                }else{
+                    ((TbFuwuqi)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"澶�");
+                }
+                if (!((TbFuwuqi)cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((TbFuwuqi)cz.getList().get(i)).getRemainingdays().equals(+num11/24/60/60/1000+"澶�") ){
+                    System.out.println("鎵撳嵃鏁版嵁==========銆嬨�嬨�嬨�嬨�嬨�嬨�嬨�嬨�嬨��");
+                    this.tbFuwuqiService.UpdateTbFuwuqi((TbFuwuqi)cz.getList().get(i));
+                }
+//
+            }
+        }
+        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
+    }
+
+    @GetMapping({"findTbFuwuqiZi"})
+    result<List<TbFuwuqi>> findTbFuwuqiZi(String Zong, Integer page, Integer limit) throws ParseException {
+        PageInfo<TbFuwuqi> cz = this.tbFuwuqiService.findTbFuwuqiZi(Zong, page, limit);
+        for(int i = 0; i < cz.getSize(); ++i) {
+            if (((TbFuwuqi)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){
+                    ((TbFuwuqi)cz.getList().get(i)).setRemainingdays("0澶�");
+                }else{
+                    ((TbFuwuqi)cz.getList().get(i)).setRemainingdays(+num11/24/60/60/1000+"澶�");
+                }
+                if (!((TbFuwuqi)cz.getList().get(i)).getRemainingdays().equals("0澶�") || !((TbFuwuqi)cz.getList().get(i)).getRemainingdays().equals(+num11/24/60/60/1000+"澶�") ){
+                    System.out.println("222222222222");
+                    this.tbFuwuqiService.UpdateTbFuwuqi((TbFuwuqi)cz.getList().get(i));
+                }
+            }
+        }
+        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
+    }
+
+    @PostMapping({"addTbFuwuqi"})
+    public ModelAndView addBang(TbFuwuqi tbFuwuqi) throws Exception {
+        ModelAndView modelAndView = new ModelAndView();
+        tbFuwuqi.setId(null);
+        this.tbFuwuqiService.addTbFuwuqi(tbFuwuqi);
+        modelAndView.addObject("suoshu", this.companyService.findSuoShu());
+        modelAndView.setViewName("/page/Fuwuqi.jsp");
+        return modelAndView;
+    }
+
+    @PostMapping({"UpdateTbFuwuqi"})
+    public ModelAndView UpdateCard(TbFuwuqi tbFuwuqi) {
+        this.tbFuwuqiService.UpdateTbFuwuqi(tbFuwuqi);
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("id", tbFuwuqi.getId());
+        TbFuwuqi tbFuwuqi1 = tbFuwuqiMapper.selectOne(queryWrapper);
+        OperationLog operationLog = new OperationLog();
+        operationLog.setCaozuotype("淇敼");
+        operationLog.setCaozuocontent("淇敼鏈嶅姟鍣細"+tbFuwuqi1.getServername());
+        operationLog.setCaozuoname(tbFuwuqi1.getCaozuoname());
+        operationLogService.addOperationLog(operationLog);
+        Date date = new Date();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        operationLog.setCaozuodate(formatter.format(date));
+        operationLogMapper.insert(operationLog);
+        ModelAndView modelAndView = new ModelAndView();
+        modelAndView.setViewName("/page/Fuwuqi.jsp");
+        return modelAndView;
+    }
+
+    @PostMapping({"DeleteTbFuwuqi"})
+    public int DeleteCard(String num,String caozuoname) {
+        return this.tbFuwuqiService.DeleteTbFuwuqi(num,caozuoname);
+    }
+
+    @PostMapping({"tbFuwuqiSearch"})
+    public result<List<TbFuwuqi>> tableSearch(TbFuwuqi tbFuwuqi, int page, int limit) throws Exception {
+        PageInfo<TbFuwuqi> cz = this.tbFuwuqiService.tableSearch(tbFuwuqi, page, limit);
+        for(int i = 0; i < cz.getSize(); ++i) {
+            if (((TbFuwuqi)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){
+                    ((TbFuwuqi)cz.getList().get(i)).setRemainingdays("0澶�");
+                }else{
+                    ((TbFuwuqi)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({"ifFuwuqi"})
+    public TbFuwuqi ifFuwuqi(TbFuwuqi tbFuwuqi) {
+        return this.tbFuwuqiService.ifFuwuqi(tbFuwuqi);
+    }
+
+
+}

--
Gitblit v1.9.3