fei.wang
7 天以前 e15f561a1f9eddfde503d59baf45a860b131928e
src/main/java/com/flow/controller/TbFuwuqiController.java
@@ -1,18 +1,19 @@
package com.flow.controller;
import com.flow.pojo.Card;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.flow.mapper.OperationLogMapper;
import com.flow.mapper.TbFuwuqiMapper;
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.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.text.ParseException;
@@ -29,9 +30,17 @@
    @Autowired
    CompanyService companyService;
    @GetMapping({"findTbFuwuqi"})
    result<List<TbFuwuqi>> findBangZhu(Integer page, Integer limit) throws ParseException {
        PageInfo<TbFuwuqi> cz = this.tbFuwuqiService.FindTbFuwuqi(page, limit);
    @Autowired
    OperationLogService operationLogService;
    @Autowired
    TbFuwuqiMapper tbFuwuqiMapper;
    @Autowired
    OperationLogMapper operationLogMapper;
//    @RequestMapping(value = "findTbFuwuqi", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    @PostMapping({"findTbFuwuqi"})
    result<List<TbFuwuqi>> findBangZhu(Integer page, Integer limit,String entry) throws ParseException {
        PageInfo<TbFuwuqi> cz = this.tbFuwuqiService.FindTbFuwuqi(page, limit,entry);
        for(int i = 0; i < cz.getSize(); ++i) {
            if (((TbFuwuqi)cz.getList().get(i)).getCompany() != null) {
                SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd");
@@ -46,6 +55,7 @@
                    ((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));
                }
//
@@ -54,8 +64,9 @@
        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
    }
    @GetMapping({"findTbFuwuqiZi"})
    @PostMapping({"findTbFuwuqiZi"})
    result<List<TbFuwuqi>> findTbFuwuqiZi(String Zong, Integer page, Integer limit) throws ParseException {
        System.out.println(Zong);
        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) {
@@ -71,6 +82,7 @@
                    ((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));
                }
            }
@@ -91,14 +103,26 @@
    @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) {
        return this.tbFuwuqiService.DeleteTbFuwuqi(num);
    public int DeleteCard(String num,String caozuoname) {
        return this.tbFuwuqiService.DeleteTbFuwuqi(num,caozuoname);
    }
    @PostMapping({"tbFuwuqiSearch"})
@@ -124,10 +148,10 @@
        }
        return resultutil.returnSuccess(cz.getTotal(), cz.getList());
    }
    @PostMapping({"ifFuwuqi"})
    public TbFuwuqi ifFuwuqi(TbFuwuqi tbFuwuqi) {
        return this.tbFuwuqiService.ifFuwuqi(tbFuwuqi);
    }
}