From 61747a14819075bf6da2c1597b6c22e22e026686 Mon Sep 17 00:00:00 2001 From: fei.wang <wf18701153496@163.com> Date: 星期一, 15 四月 2024 14:25:11 +0800 Subject: [PATCH] 4-15修改提交 --- src/main/java/com/flow/controller/IndexController.java | 72 +++++++++++++++++++++++++++++------- 1 files changed, 58 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/flow/controller/IndexController.java b/src/main/java/com/flow/controller/IndexController.java index 27c254f..03e3ba8 100644 --- a/src/main/java/com/flow/controller/IndexController.java +++ b/src/main/java/com/flow/controller/IndexController.java @@ -8,10 +8,15 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.flow.mapper.CardMapper; +import com.flow.mapper.OperationLogMapper; import com.flow.pojo.Card; +import com.flow.pojo.OperationLog; import com.flow.pojo.TbFuwuqi; import com.flow.service.CardService; import com.flow.service.CompanyService; +import com.flow.service.OperationLogService; import com.flow.util.result; import com.flow.util.resultutil; import com.github.pagehelper.PageInfo; @@ -29,6 +34,7 @@ import javax.crypto.spec.SecretKeySpec; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -42,6 +48,12 @@ CardService cardService; @Autowired CompanyService companyService; + + @Autowired + CardMapper cardMapper; + + @Autowired + OperationLogMapper operationLogMapper; public IndexController() { } @@ -60,9 +72,9 @@ for (int i = 0; i < cz.getSize(); ++i) { if (((Card) cz.getList().get(i)).getCompany() != null) { - ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); - ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); - ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow()); +// ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); +// ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); +// ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow()); if (((Card) cz.getList().get(i)).getBindid() == null || ((Card) cz.getList().get(i)).getBindid().equals("undefined")) { ((Card) cz.getList().get(i)).setBindid("鏈煡"); @@ -108,15 +120,15 @@ return this.companyService.chaZi(Zong); } - @GetMapping({"FindCardZi"}) - public result<List<Card>> FindCardZi(String Zong, Integer page, Integer limit) throws Exception { - PageInfo<Card> cz = this.cardService.FindCardaZi(Zong, page, limit); + @PostMapping({"FindCardZi"}) + public result<List<Card>> FindCardZi(Card card, Integer page, Integer limit) throws Exception { + PageInfo<Card> cz = this.cardService.FindCardaZi(card, page, limit); for (int i = 0; i < cz.getSize(); ++i) { if (((Card) cz.getList().get(i)).getCompany() != null) { - ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); - ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); - ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow()); +// ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); +// ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); +// ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getZflow() - ((Card) cz.getList().get(i)).getSyflow()); SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); if (cz.getList().get(i).getEnddate() != null) { @@ -140,8 +152,9 @@ } @PostMapping({"DeleteCard"}) - public int DeleteCard(String num) { - return this.cardService.DeleteCard(num); + public int DeleteCard(String num ,String caozuoname) { + + return this.cardService.DeleteCard(num,caozuoname); } @PostMapping({"Update"}) @@ -155,6 +168,34 @@ @PostMapping({"UpdateChong"}) public ModelAndView UpdateChong(Card card) { this.cardService.UpdateCardChong(card); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("cardnumber", card.getCardnumber()); + Card tbFuwuqi1 = cardMapper.selectOne(queryWrapper); + OperationLog operationLog = new OperationLog(); + operationLog.setCaozuotype("淇敼"); + operationLog.setCaozuocontent("淇敼鍗″彿锛�"+tbFuwuqi1.getCardnumber()); +// operationLogMapper.addOperationLog(operationLog); + operationLog.setCaozuoname(card.getCaozuoname()); + 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/index1.jsp"); + modelAndView.addObject("operatornum", 2); + return modelAndView; + } + @PostMapping({"updateBatchById"}) + @Transactional(rollbackFor = Exception.class) + public ModelAndView updateBatchById(Card card) { + this.cardService.updateBatchById(card); + OperationLog operationLog = new OperationLog(); + operationLog.setCaozuotype("淇敼"); + operationLog.setCaozuocontent("淇敼鍗″彿锛�"+card.getCardnumber()); + 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/index1.jsp"); modelAndView.addObject("operatornum", 2); @@ -231,9 +272,12 @@ PageInfo<Card> cz = this.cardService.tableSearch(card, page, limit); for (int i = 0; i < cz.getSize(); ++i) { - ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); - ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); - ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getSyll() / 1024); + if (((Card) cz.getList().get(i)).getCompany().equals("鍗庢槦鏅烘帶")){ + ((Card) cz.getList().get(i)).setCompany("鍖椾含鍗庢槦鍖楁枟鏅烘帶鎶�鏈湁闄愬叕鍙�"); + } +// ((Card) cz.getList().get(i)).setZflow(((Card) cz.getList().get(i)).getZflow() / 1024); +// ((Card) cz.getList().get(i)).setSyflow(((Card) cz.getList().get(i)).getSyflow() / 1024); +// ((Card) cz.getList().get(i)).setSyll(((Card) cz.getList().get(i)).getSyll() / 1024); SimpleDateFormat date2 = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); if (cz.getList().get(i).getEnddate() != null) { -- Gitblit v1.9.3