解决隐患台账导出没有图片的问题。
一般隐患台账,隐患汇总和隐患汇总数据的导出。 增加隐患台账 隐患类型 等级 隐患位置 隐患简要情况 整改治理措施 发现隐患日期 整改完成时限 整改责任部门 整改责任人 整改督办人 投入资金(元) 复查时间 复查人 检查人员 的导出。 安全承诺书被承诺部门 选不了测试部门 (由于页面太小被挡住)。 安全承诺签字情况的统计和导出。 消防点位数据和二维码的导出。 修复当前版本App扫描二维码无效的问题。 增加安全环保检查新增功能的数据缓存,并增加手动保存的暂存和清除缓存按钮,优化提示内容。 安全环保检查新增和修改功能,对已创建的隐患进行修改 增加安全生产责任状的签字数据统计和导出功能。 菜单调整,给消防管理挪到 双预防里边和港股企业端一样。 地图数据同步,保持与港务局监管端看到的一致。 在线状态的监控,如果掉线则提示0927cmt
parent
c10d2740c5
commit
3dc5aac3ac
11
pom.xml
11
pom.xml
|
@ -84,7 +84,16 @@
|
|||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.jdom/jdom2 -->
|
||||
<dependency>
|
||||
<groupId>org.jdom</groupId>
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Map;
|
|||
|
||||
import com.zcloud.service.system.*;
|
||||
import com.zcloud.util.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.DisabledAccountException;
|
||||
|
@ -397,4 +398,23 @@ public class AppUsersController extends BaseController {
|
|||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
//根据用户id查询部门
|
||||
@RequestMapping(value="/getDepartmentByUserId")
|
||||
@ResponseBody
|
||||
public Object getDepartmentByUserId()throws Exception{
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
String errInfo = "success";
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
PageData data = usersService.findById(pd);
|
||||
if (data == null || StringUtils.equals(data.getString("DEPARTMENT_ID"),"")) {
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
map.put("data", data);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.zcloud.controller.firemanager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.zcloud.aspect.DockAnnotation;
|
||||
import com.zcloud.controller.base.BaseController;
|
||||
import com.zcloud.entity.Page;
|
||||
|
@ -10,19 +14,22 @@ import com.zcloud.service.bus.ImgFilesService;
|
|||
import com.zcloud.service.firemanager.FirePointService;
|
||||
import com.zcloud.service.system.DepartmentService;
|
||||
import com.zcloud.service.system.UsersService;
|
||||
import com.zcloud.util.DateUtil;
|
||||
import com.zcloud.util.InitPageDataUtil;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
import com.zcloud.util.*;
|
||||
import com.zcloud.util.logAop.LogOperation;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -273,27 +280,80 @@ public class FirePointController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* @Description: 获取当前部门下的所有员工
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/2/10/010 10:43
|
||||
* @Param: [] []
|
||||
* @Return: java.lang.Object
|
||||
* 导出到excel
|
||||
* 1.查询什么 导出什么
|
||||
* 2.增加 整改资金 字段
|
||||
* 3.导出慢
|
||||
* 4.没有图标
|
||||
* 5.增加进度条
|
||||
*
|
||||
* @param
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/getDepartmentPeople")
|
||||
@ResponseBody
|
||||
public Object getDepartmentPeople(Page page) throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String errInfo = "success";
|
||||
@RequestMapping(value = "/excel2")
|
||||
// // @RequiresPermissions("toExcel")
|
||||
public ModelAndView exportExcel2() throws Exception {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
PageData pdx = this.getPageData();
|
||||
PageData pd = new PageData();
|
||||
pd = this.getPageData();
|
||||
List<PageData> userList = usersService.getDepartmentId(pd.getString("DEPARTMENT_ID"));
|
||||
//列出用户列表
|
||||
pd.put("ROLE_ID", "1");
|
||||
map.put("userList", userList);
|
||||
map.put("page", page);
|
||||
map.put("pd", pd);
|
||||
map.put("result", errInfo);
|
||||
return map;
|
||||
Set<Map.Entry<String, Object>> set = pdx.entrySet();
|
||||
for (Map.Entry<String, Object> stringObjectEntry : set) {
|
||||
if (!Tools.isEmpty(pdx.getString(stringObjectEntry.getKey()))) {
|
||||
pd.put(stringObjectEntry.getKey(), pdx.getString(stringObjectEntry.getKey()));
|
||||
}
|
||||
}
|
||||
Integer imgCountToSession = 0;
|
||||
|
||||
Session session = Jurisdiction.getSession();
|
||||
|
||||
session.setAttribute(pd.getString("sessionID"), "0");
|
||||
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
|
||||
List<String> wertitles = this.setTitles();
|
||||
List<PageData> varList = new ArrayList<>();
|
||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||||
List<PageData> dataList = firePointService.listForExcel(pd);
|
||||
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
PageData firePoint = dataList.get(i);
|
||||
PageData vpd = new PageData();
|
||||
vpd.put("var1", firePoint.getString("FIRE_REGION_NAME")); // 消防区域名称
|
||||
vpd.put("var2", firePoint.getString("FIRE_POINT_NAME")); // 消防点位名称
|
||||
vpd.put("var3", firePoint.getString("DEPARTMENT_NAME")); // 部门名称
|
||||
vpd.put("var4", firePoint.getString("USERNAME")); // 人员名称
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("FIRE_POINT_ID",firePoint.getString("FIRE_POINT_ID"));
|
||||
jsonObject.put("MANAGER_TYPE","fireListManager");
|
||||
vpd.put("img5", jsonObject.toString()); // 二维码
|
||||
varList.add(vpd);
|
||||
}
|
||||
dataMap.put("titles", wertitles);
|
||||
dataMap.put("varList", varList);
|
||||
dataMap.put("sessionID", pd.getString("sessionID"));
|
||||
dataMap.put("imgCountToSession", imgCountToSession);
|
||||
|
||||
session.setAttribute(pd.getString("sessionID"), "10");
|
||||
FirePointExcelImgToSessionView erv2 = new FirePointExcelImgToSessionView();
|
||||
mv = new ModelAndView(erv2, dataMap);
|
||||
|
||||
System.out.println("|$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
|
||||
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入上方的列信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<String> setTitles() {
|
||||
List<String> titles = new ArrayList<String>();
|
||||
titles.add("消防区域"); //1
|
||||
titles.add("消防点位"); //2
|
||||
titles.add("负责部门"); //3
|
||||
titles.add("负责人"); //4
|
||||
titles.add("二维码"); //5
|
||||
return titles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -613,4 +613,21 @@ public class AppFireRecordController extends BaseController {
|
|||
map.put("varList", varList);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查人id获取检查人所涉及的查询点位列表
|
||||
* @Author: limingyu
|
||||
* @Date: 2024/3/18/008 09:11
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/getPointListByUserId")
|
||||
public Object getPointListByUserId() throws Exception {
|
||||
String errInfo = "success";
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
PageData pageData = getPageData();
|
||||
List<PageData> varList = fireCheckStandardService.getPointListByUserId(pageData);
|
||||
map.put("result", errInfo);
|
||||
map.put("varList", varList);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,4 +42,6 @@ public interface FireCheckStandardMapper {
|
|||
List<PageData> getListAll(PageData pd) ;
|
||||
|
||||
List<PageData> getStandardListByDeviceType(PageData pd);
|
||||
|
||||
List<PageData> getPointListByUserId(PageData pd);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.zcloud.mapper.datasource.firemanager;
|
|||
import com.zcloud.entity.Page;
|
||||
import com.zcloud.entity.PageData;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,6 +23,8 @@ public interface FirePointMapper {
|
|||
*/
|
||||
public List<PageData> datalistPage(Page page);
|
||||
|
||||
public List<PageData> listForExcel(PageData pd);
|
||||
|
||||
void savePosition(PageData pd);
|
||||
|
||||
/**
|
||||
|
@ -79,4 +82,6 @@ public interface FirePointMapper {
|
|||
void removeQualifiedByQIds(PageData pd);
|
||||
|
||||
List<PageData> getFirePointCheckPhotos(PageData pd);
|
||||
|
||||
List<PageData> findByIds(@Param("pointIds") List<String> pointIds);
|
||||
}
|
||||
|
|
|
@ -67,4 +67,6 @@ public interface FireCheckStandardService {
|
|||
* @Return: java.lang.Object
|
||||
*/
|
||||
List<PageData> goRecordDeviceByPid(PageData pd);
|
||||
|
||||
List<PageData> getPointListByUserId(PageData pageData);
|
||||
}
|
||||
|
|
|
@ -45,4 +45,7 @@ public interface FirePointService {
|
|||
void removeQualifiedByQIds(PageData pd);
|
||||
|
||||
List<PageData> getFirePointCheckPhotos(PageData pd);
|
||||
|
||||
List<PageData> findByIds(List<String> pointIds);
|
||||
List<PageData> listForExcel(PageData pd);
|
||||
}
|
||||
|
|
|
@ -5,16 +5,17 @@ import com.zcloud.entity.PageData;
|
|||
import com.zcloud.mapper.datasource.firemanager.FireCheckStandardMapper;
|
||||
import com.zcloud.service.bus.SysDateService;
|
||||
import com.zcloud.service.firemanager.FireCheckStandardService;
|
||||
import com.zcloud.service.firemanager.FirePointService;
|
||||
import com.zcloud.service.firemanager.FirePreparedCheckListService;
|
||||
import com.zcloud.service.firemanager.FireRecordService;
|
||||
import com.zcloud.util.DateUtil;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
import com.zcloud.util.PeriodDateUtil;
|
||||
import com.zcloud.util.UuidUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -33,7 +34,8 @@ public class FireCheckStandardServiceImpl implements FireCheckStandardService {
|
|||
|
||||
@Resource
|
||||
private FirePreparedCheckListService firePreparedCheckListService;
|
||||
|
||||
@Resource
|
||||
private FirePointService firePointService;
|
||||
@Resource
|
||||
private SysDateService sysDateService;
|
||||
@Resource
|
||||
|
@ -245,4 +247,20 @@ public class FireCheckStandardServiceImpl implements FireCheckStandardService {
|
|||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PageData> getPointListByUserId(PageData pageData) {
|
||||
List<PageData> pointListByUserId = fireCheckStandardMapper.getPointListByUserId(pageData);
|
||||
List<String> pointIds = new ArrayList<>();
|
||||
List<PageData> dataList = new ArrayList<>();
|
||||
if (pointListByUserId.size() > 0) {
|
||||
for (PageData data : pointListByUserId) {
|
||||
pointIds.add(data.getString("FIRE_POINT_ID"));
|
||||
}
|
||||
dataList = firePointService.findByIds(pointIds);
|
||||
}
|
||||
return dataList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ public class FirePointServiceImpl implements FirePointService {
|
|||
return firePointMapper.datalistPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PageData> listForExcel(PageData pd) {
|
||||
return firePointMapper.listForExcel(pd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePosition(PageData pd)throws Exception{
|
||||
firePointMapper.savePosition(pd);
|
||||
|
@ -156,4 +161,10 @@ public class FirePointServiceImpl implements FirePointService {
|
|||
public List<PageData> getFirePointCheckPhotos(PageData pd) {
|
||||
return firePointMapper.getFirePointCheckPhotos(pd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PageData> findByIds(List<String> pointIds) {
|
||||
return firePointMapper.findByIds(pointIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.qrcode.QRCodeWriter;
|
||||
import com.zcloud.entity.PageData;
|
||||
import net.coobird.thumbnailator.Thumbnails;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.servlet.view.document.AbstractXlsView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 说明:导出到EXCEL
|
||||
* 作者:luoxiaobao
|
||||
* 官网:www.qdkjchina.com
|
||||
*/
|
||||
public class FirePointExcelImgToSessionView extends AbstractXlsView{
|
||||
|
||||
@Value("${http.file.url}")
|
||||
private String fileUrl;
|
||||
|
||||
@Override
|
||||
protected void buildExcelDocument(Map<String, Object> model,
|
||||
Workbook workbook, HttpServletRequest request,
|
||||
HttpServletResponse response) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
String proPath = PathUtil.getProjectpath();
|
||||
Session session = Jurisdiction.getSession();
|
||||
String beji = fileUrl;
|
||||
//beji =beji.replaceAll("\\\\", "/");
|
||||
// String beji = "https://qgqy.qhdsafety.com/file/";
|
||||
Date date = new Date();
|
||||
String filename = DateUtil.date2Str(date, "yyyyMMddHHmmss");
|
||||
HSSFSheet sheet;
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename="+filename+".xls");
|
||||
|
||||
HSSFWorkbook book = (HSSFWorkbook) workbook;
|
||||
sheet = book.createSheet("sheet1");
|
||||
|
||||
List<String> titles = (List<String>) model.get("titles");
|
||||
int len = titles.size();
|
||||
HSSFCellStyle headerStyle = book.createCellStyle(); //标题样式
|
||||
headerStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
HSSFFont headerFont = book.createFont(); //标题字体
|
||||
headerFont.setBold(true);
|
||||
headerFont.setFontHeightInPoints((short)11);
|
||||
headerStyle.setFont(headerFont);
|
||||
short height=25*20;
|
||||
HSSFRow row = sheet.createRow(0);
|
||||
if(len>250) {
|
||||
len = 250;
|
||||
}
|
||||
for(int i=0; i<len; i++){ //设置标题
|
||||
String title = titles.get(i);
|
||||
row.setRowStyle(headerStyle);
|
||||
if(title.length()>250) {
|
||||
row.createCell(i).setCellValue(title.substring(0, 250));
|
||||
}else {
|
||||
row.createCell(i).setCellValue(title);
|
||||
}
|
||||
}
|
||||
sheet.getRow(0).setHeight(height);
|
||||
|
||||
HSSFCellStyle contentStyle = book.createCellStyle(); //内容样式
|
||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||
|
||||
contentStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
List<PageData> varList = (List<PageData>) model.get("varList");
|
||||
|
||||
Integer imgCountToSession = (Integer) model.get("imgCountToSession");
|
||||
String sessionID = (String) model.get("sessionID");
|
||||
Integer exImg = 0;
|
||||
int varCount = varList.size();
|
||||
for(int i=0; i<varCount; i++){
|
||||
PageData vpd = varList.get(i);
|
||||
HSSFRow rows = sheet.createRow(i+1);
|
||||
for(int j=0;j<len;j++){
|
||||
String valKey = "var"+(j+1);
|
||||
String imgKey = "img" +(j+1);
|
||||
if(vpd.containsKey(valKey)) {
|
||||
String varstr = vpd.getString(valKey) != null ? vpd.getString("var"+(j+1)) : "";
|
||||
rows.setRowStyle(contentStyle);
|
||||
rows.createCell(j).setCellValue(varstr);
|
||||
}
|
||||
if(vpd.containsKey(imgKey)) {
|
||||
String varstr = vpd.getString(imgKey) != null ? vpd.getString("img"+(j+1)) : "";
|
||||
if(Tools.isEmpty(varstr)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
int QR_CODE_SIZE = 200;
|
||||
QRCodeWriter qrCodeWriter = new QRCodeWriter();
|
||||
BitMatrix bitMatrix = qrCodeWriter.encode(varstr, BarcodeFormat.QR_CODE, QR_CODE_SIZE, QR_CODE_SIZE);
|
||||
File file = new File("qrcode.png");
|
||||
MatrixToImageWriter.writeToFile(bitMatrix, "PNG", file);
|
||||
InputStream inStream = Files.newInputStream(file.toPath());
|
||||
byte[] data = readInputStream(inStream);
|
||||
byte[] compressPicForScale = compressPicForScale(data, 100);
|
||||
HSSFClientAnchor anchor1 = new HSSFClientAnchor(0, 0, 0, 0,(short) (j), (i+1), (short) (j+1), (i+2));
|
||||
patriarch.createPicture(anchor1, book.addPicture(compressPicForScale, HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
exImg++;
|
||||
|
||||
}catch (Exception e) {
|
||||
|
||||
System.out.println("未找到图片");
|
||||
e.printStackTrace();
|
||||
}
|
||||
String baifenbi = getDivisionTwoNumbers(exImg,imgCountToSession);
|
||||
|
||||
session.setAttribute(sessionID, baifenbi );
|
||||
// BufferedImage bufferImg = null;//图片一
|
||||
// ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();//
|
||||
// File file=new File(beji+varstr);
|
||||
// if(file.exists()) {//https://wwag.qhdsafety.com/file//uploadFiles/yhtp/07bd077457ec4da7bd6ec2219984079c/20220126/545463a3effe4a3d9d50dc701c69cc01.png
|
||||
// bufferImg = ImageIO.read(file);
|
||||
// ImageIO.write(bufferImg, "jpg", byteArrayOut);
|
||||
// HSSFClientAnchor anchor1 = new HSSFClientAnchor(0, 0, 0, 0,(short) (j), (i+1), (short) (j+1), (i+2));
|
||||
// patriarch.createPicture(anchor1, book.addPicture(byteArrayOut
|
||||
// .toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
float progressA =100f;
|
||||
session.setAttribute(sessionID, progressA);
|
||||
}
|
||||
|
||||
private static byte[] readInputStream(InputStream inStream) throws Exception{
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
//创建一个Buffer字符串
|
||||
byte[] buffer = new byte[1024];
|
||||
//每次读取的字符串长度,如果为-1,代表全部读取完毕
|
||||
int len = 0;
|
||||
//使用一个输入流从buffer里把数据读取出来
|
||||
while( (len=inStream.read(buffer)) != -1 ){
|
||||
//用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
|
||||
outStream.write(buffer, 0, len);
|
||||
}
|
||||
//关闭输入流
|
||||
inStream.close();
|
||||
//把outStream里的数据写入内存
|
||||
return outStream.toByteArray();
|
||||
}
|
||||
private static final Integer ZERO = 0;
|
||||
private static final Integer ONE_ZERO_TWO_FOUR = 1024;
|
||||
private static final Integer NINE_ZERO_ZERO = 900;
|
||||
private static final Integer THREE_TWO_SEVEN_FIVE = 3275;
|
||||
private static final Integer TWO_ZERO_FOUR_SEVEN = 2047;
|
||||
private static final Double ZERO_EIGHT_FIVE = 0.85;
|
||||
private static final Double ZERO_SIX = 0.6;
|
||||
private static final Double ZERO_FOUR_FOUR = 0.44;
|
||||
private static final Double ZERO_FOUR = 0.4;
|
||||
public static byte[] compressPicForScale(byte[] imageBytes, long desFileSize) {
|
||||
if (imageBytes == null || imageBytes.length <= ZERO || imageBytes.length < desFileSize * ONE_ZERO_TWO_FOUR) {
|
||||
return imageBytes;
|
||||
}
|
||||
double accuracy = 0.5d;
|
||||
try {
|
||||
while (imageBytes.length > desFileSize * ONE_ZERO_TWO_FOUR) {
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(imageBytes.length);
|
||||
Thumbnails.of(inputStream)
|
||||
.scale(accuracy)
|
||||
.outputQuality(accuracy)
|
||||
.toOutputStream(outputStream);
|
||||
imageBytes = outputStream.toByteArray();
|
||||
}
|
||||
System.out.println("图片原大小={}kb | 压缩后大小={}kb");
|
||||
// logger.info("图片原大小={}kb | 压缩后大小={}kb",
|
||||
// srcSize / ONE_ZERO_TWO_FOUR, imageBytes.length / ONE_ZERO_TWO_FOUR);
|
||||
} catch (Exception e) {
|
||||
// logger.error("【图片压缩】msg=图片压缩失败!", e);
|
||||
}
|
||||
return imageBytes;
|
||||
}
|
||||
public static String getDivisionTwoNumbers(Integer a , Integer b){
|
||||
if (b.equals(0)){
|
||||
return "0";
|
||||
}
|
||||
float v = a.floatValue() / b.floatValue()*100;
|
||||
//格式化小数
|
||||
float v1 = (float) (Math.round(v * 100)) / 100;
|
||||
DecimalFormat decimalFormat=new DecimalFormat(".00");
|
||||
return decimalFormat.format(v1);
|
||||
}
|
||||
}
|
|
@ -341,4 +341,21 @@
|
|||
and FIRE_DEVICE_TYPE = #{FIRE_DEVICE_TYPE}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getPointListByUserId" resultType="com.zcloud.entity.PageData">
|
||||
SELECT DISTINCT
|
||||
fpp.FIRE_POINT_ID
|
||||
FROM
|
||||
bus_fire_point_prepared fpp
|
||||
WHERE
|
||||
fpp.FIRE_CHECK_ID IN (
|
||||
SELECT
|
||||
fc.FIRE_CHECK_ID
|
||||
FROM
|
||||
bus_fire_checklist fc
|
||||
WHERE
|
||||
fc.USER_ID = #{USER_ID}
|
||||
AND fc.ISDELETE = 0
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -149,6 +149,45 @@
|
|||
p.OPERATTIME desc
|
||||
</select>
|
||||
|
||||
<select id="listForExcel" parameterType="pd" resultType="pd">
|
||||
SELECT
|
||||
p.FIRE_POINT_ID,
|
||||
p.FIRE_POINT_NAME,
|
||||
d.`NAME` AS DEPARTMENT_NAME,
|
||||
u.`NAME` AS USERNAME,
|
||||
r.FIRE_REGION_NAME
|
||||
FROM
|
||||
bus_fire_point AS p
|
||||
LEFT JOIN bus_fire_qualified_photos fqp ON p.QUALIFIED_PHOTOS_ID = fqp.QUALIFIED_PHOTOS_ID
|
||||
LEFT JOIN bus_fire_region AS r ON p.FIRE_REGION_ID = r.FIRE_REGION_ID
|
||||
LEFT JOIN ( SELECT count( FIRE_DEVICE_ID ) DEVICE_COUNT, FIRE_POINT_ID FROM bus_fire_device WHERE ISDELETE = 0 GROUP BY FIRE_POINT_ID ) t ON t.FIRE_POINT_ID = p.FIRE_POINT_ID
|
||||
LEFT JOIN sys_user AS u ON p.USER_ID = u.USER_ID
|
||||
LEFT JOIN oa_department AS d ON p.DEPARTMENT_ID = d.DEPARTMENT_ID
|
||||
LEFT JOIN (SELECT DISTINCT
|
||||
f.FIRE_POINT_ID
|
||||
FROM
|
||||
`bus_fire_device` f
|
||||
LEFT JOIN bus_fire_device_prepared p ON f.FIRE_DEVICE_ID = p.FIRE_DEVICE_ID
|
||||
WHERE
|
||||
f.ISDELETE = '0') fp on fp.FIRE_POINT_ID = p.FIRE_POINT_ID
|
||||
WHERE
|
||||
r.CORPINFO_ID = #{CORPINFO_ID}
|
||||
AND r.ISDELETE = 0
|
||||
AND p.ISDELETE = 0
|
||||
<if test="FIRE_POINT_NAME != null and FIRE_POINT_NAME !='' ">
|
||||
AND p.FIRE_POINT_NAME like concat('%',#{FIRE_POINT_NAME,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID !='' ">
|
||||
AND p.DEPARTMENT_ID = #{DEPARTMENT_ID,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="FIRE_POINT_CODE != null and FIRE_POINT_CODE !='' ">
|
||||
AND p.FIRE_POINT_CODE like concat('%',#{FIRE_POINT_CODE,jdbcType=VARCHAR},'%')
|
||||
</if>
|
||||
group by p.FIRE_POINT_ID
|
||||
ORDER BY
|
||||
p.OPERATTIME desc
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="page" resultType="com.zcloud.entity.PageData">
|
||||
SELECT
|
||||
p.FIRE_POINT_ID,
|
||||
|
@ -242,4 +281,14 @@
|
|||
frp.CREATTIME DESC
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="findByIds" resultType="com.zcloud.entity.PageData">
|
||||
SELECT p.*
|
||||
FROM bus_fire_point AS p
|
||||
WHERE p.ISDELETE = 0
|
||||
AND p.FIRE_POINT_ID IN
|
||||
<foreach collection="pointIds" item="item" open="(" separator="," close=")" index="index">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue