songhuangfeng123
2022-09-02 fabd08d87d00bfdf1aacf473fd905fdd3c903ed3
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/controller/EquipmentInfoController.java
@@ -1,11 +1,13 @@
package com.gkhy.safePlatform.equipment.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.equipment.entity.*;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoImportExcel;
import com.gkhy.safePlatform.equipment.model.dto.req.EquipmentInfoSaveOrUpdate;
import com.gkhy.safePlatform.equipment.model.dto.resp.EquipmentInfoExcel;
import com.gkhy.safePlatform.equipment.utils.DateUtils;
import com.gkhy.safePlatform.equipment.utils.QueryHelpPlus;
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelLogs;
import com.gkhy.safePlatform.equipment.utils.poihelper.ExcelUtil;
import com.google.common.collect.Lists;
@@ -67,10 +69,10 @@
            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL,"缺少infoType");
        }
      PageUtils.checkCheck(pageQuery);
        PageUtils.checkCheck(pageQuery);
      return this.equipmentInfoService.queryAll(pageQuery);
    }
    /**
     * 通过主键查询单条数据
@@ -108,11 +110,21 @@
     * @param ids 主键结合
     * @return 删除结果
     */
    @GetMapping(value = "/delete")
    public ResultVO delete(String ids) {
   List<String> idList = Arrays.stream(ids.split(","))
                .collect(Collectors.toList());
        this.equipmentInfoService.removeByIds(idList);
    @RequestMapping(value = "/delete",method = RequestMethod.POST)
    public ResultVO delete(@RequestBody Long[] ids) {
        if(ids == null){
            return new ResultVO<>(ResultCodes.CLIENT_PARAM_ILLEGAL);
        }
        List<Long> idList = Arrays.asList(ids);
        List<EquipmentInfo> delList = new ArrayList<>();
        idList.forEach(f->{
            EquipmentInfo info = new EquipmentInfo();
            info.setDelFlag(1);
            info.setId(f);
            delList.add(info);
        });
        this.equipmentInfoService.updateBatchById(delList);
        return new ResultVO<>(ResultCodes.OK);
    }
@@ -184,6 +196,7 @@
        map.put("45", "报废理由");
        map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
        map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
        map.put("48", "保养周期");
        String fileName = URLEncoder.encode("设备设施管理数据导入模板.xls", "UTF-8");
        response.setContentType("application/vnd.ms-excel");
        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
@@ -276,6 +289,7 @@
        map.put("45", "报废理由");
        map.put("46", "报废填报日期(yyyy-MM-dd HH:mm:ss)");
        map.put("47", "实际报废日期(yyyy-MM-dd HH:mm:ss)");
        map.put("48", "保养周期");
        String key = DateUtils.date2String(new Date(), DateUtils.PATTERN_ALLTIME_NOSIGN) ;
        String fileName = URLEncoder.encode("设备设施管理"+key+".xls", "UTF-8");
@@ -283,7 +297,7 @@
        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
        queryCriteria.setDelFlag(0);
        List<EquipmentInfoExcel> respList = BeanCopyUtils.copyBeanList(equipmentInfoService.queryAll(queryCriteria), EquipmentInfoExcel.class);
        ExcelUtil.exportExcel(map,respList , response.getOutputStream(),DateUtils.PATTERN_STANDARD);
@@ -401,8 +415,8 @@
        infoDto.setDestoryReason("");
        infoDto.setDestorySubmitDate(new Timestamp(new java.util.Date().getTime()));
        infoDto.setActualDestoryDate(new Timestamp(new java.util.Date().getTime()));
        System.out.println(JSONObject.toJSONString(infoDto));
    }
}
}