| | |
| | | package com.whyc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.whyc.constant.BattSingalIdEnum; |
| | | import com.whyc.constant.DevAlarmEnum; |
| | | import com.whyc.constant.PowerAlarmEnum; |
| | |
| | | String stationName = result.getStationName(); |
| | | Date now = new Date(); |
| | | String timeFormat = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS_UNION, now); |
| | | String fileDirPath = CommonUtil.getRootFile() + "alarmInspection" + File.separator + stationName + "_" + timeFormat; |
| | | String dirMonth = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM, now); |
| | | |
| | | String fileDirPath = CommonUtil.getRootFile() + "alarmInspection" + File.separator + dirMonth + File.separator + stationName + "_" + timeFormat; |
| | | File fileDir = new File(fileDirPath); |
| | | //如果文件夹不存在则创建 |
| | | if (!fileDir.exists()) { |
| | |
| | | } |
| | | StringBuilder pictureUrlSb = new StringBuilder(); |
| | | if (file != null && file.size() > 0) { |
| | | for (MultipartFile multipartFile : file) { |
| | | for (int j = 0; j < file.size(); j++) { |
| | | MultipartFile multipartFile = file.get(j); |
| | | String fileName = multipartFile.getOriginalFilename(); |
| | | //将fileName中可能存在的,去掉 |
| | | fileName = fileName.replace(",",""); |
| | |
| | | |
| | | multipartFile.transferTo(new File(filePath)); |
| | | String split = "pis_file"+File.separator+"alarmInspection"; |
| | | pictureUrlSb.append(File.separator + filePath.substring(filePath.indexOf(split))).append(","); |
| | | String picUrl = File.separator + filePath.substring(filePath.indexOf(split)); |
| | | //最后一个元素 |
| | | if (j == file.size() - 1) { |
| | | pictureUrlSb.append(picUrl); |
| | | }else { |
| | | pictureUrlSb.append(picUrl).append(","); |
| | | } |
| | | } |
| | | } |
| | | result.setPictureUrl(pictureUrlSb.toString()); |
| | |
| | | |
| | | return new Response().set(1,true,"提交完成"); |
| | | } |
| | | |
| | | public void addBatch(List<AlarmInspection> inspectionList) { |
| | | mapper.insertBatchSomeColumn(inspectionList); |
| | | } |
| | | |
| | | public List<AlarmInspection> getAlarmExistList() { |
| | | QueryWrapper<AlarmInspection> query = Wrappers.query(); |
| | | query.eq("is_exist",1); |
| | | return mapper.selectList(query); |
| | | } |
| | | |
| | | public void updateIsExist(List<Long> notExistIdList) { |
| | | QueryWrapper<AlarmInspection> query = Wrappers.query(); |
| | | query.in("id",notExistIdList); |
| | | AlarmInspection alarmInspection = new AlarmInspection(); |
| | | alarmInspection.setIsExist(0); |
| | | mapper.update(alarmInspection,query); |
| | | } |
| | | } |