fei.wang
2024-04-15 61747a14819075bf6da2c1597b6c22e22e026686
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) {