修改下发班组任务信息

This commit is contained in:
haozq 2025-11-25 16:02:16 +08:00
parent 537713fd0d
commit c141da401a
2 changed files with 19 additions and 70 deletions

View File

@ -29,66 +29,6 @@ public class ImageResizer {
/**
* 将bast64转成需要的图片格式
* @param filePath
* @param file
* @param
* @return
*/
public static String transImageByJpg(String filePath, File file ){
try{
String suffix=".png";
String path="/temp/";
File folder = new File(filePath+path);
if (folder.exists() && folder.isDirectory()) {
System.out.println("文件夹存在");
} else {
folder.mkdir();
System.out.println("文件夹不存在");
}
// 创建临时文件,将bast64转成字节流
// 创建临时文件确保文件名具有唯一性
// 将字节数据写入文件
String newJpgPath=null;
//不是jpg的先转成jpg的
getFileType();
if (!fileType.contains(suffix)){
String roundId2= StringUtils.randomUUID();
//jpg的路径
newJpgPath=filePath+path+roundId2+".jpg";
BufferedImage pngImage = ImageIO.read(file);
BufferedImage jpgImage = new BufferedImage(pngImage.getWidth(), pngImage.getHeight(), BufferedImage.TYPE_INT_RGB);
// 绘制PNG图片到jpgImage
jpgImage.createGraphics().drawImage(pngImage, 0, 0, Color.WHITE, null);
ImageIO.write(jpgImage, "jpg", new File(newJpgPath));
}
//
File inputFile;
//是jpg格式的
if(newJpgPath==null){
inputFile=file;
}else{
inputFile = new File(newJpgPath);
}
BufferedImage originalImage = ImageIO.read(inputFile);
BufferedImage resizedImage = resizeImage(originalImage, 1080, 800);
// 保存为PNG格式
String roundId3= StringUtils.randomUUID();
String lastPath=filePath+path+roundId3+".jpg";
saveImage(resizedImage, "jpg", lastPath);
if(newJpgPath!=null){
boolean isde=new File(newJpgPath).delete();
System.err.println("删除->"+isde);
}
// boolean delete=file.delete();
// System.err.println("删除->"+delete);
return lastPath;
}catch (Exception e){
log.error(e.toString(),e);
}
return null;
}
/** /**
* 将bast64转成需要的图片格式 * 将bast64转成需要的图片格式
@ -99,8 +39,15 @@ public class ImageResizer {
*/ */
public static String transImageByJpg( String bast64){ public static String transImageByJpg( String bast64){
try{ try{
// byte[] decodedBytes = Base64.getDecoder().decode(bast64);
// // 计算字节数组的大小
// long sizeInBytes = decodedBytes.length;
// if(sizeInBytes<1024*1024*0.5){
// return bast64;
// }
String path=""; String path="";
String suffix=".png"; String suffix=".jpg";
String roundId=StringUtils.randomUUID(); String roundId=StringUtils.randomUUID();
String osName = System.getProperty("os.name").toLowerCase(); String osName = System.getProperty("os.name").toLowerCase();
@ -142,7 +89,7 @@ public class ImageResizer {
inputFile = new File(newJpgPath); inputFile = new File(newJpgPath);
} }
BufferedImage originalImage = ImageIO.read(inputFile); BufferedImage originalImage = ImageIO.read(inputFile);
BufferedImage resizedImage = resizeImage(originalImage, 480, 640); BufferedImage resizedImage = resizeImage(originalImage, 640, 640);
// 保存为PNG格式 // 保存为PNG格式
String roundId3=StringUtils.randomUUID(); String roundId3=StringUtils.randomUUID();
String lastPath=path+roundId3+".jpg"; String lastPath=path+roundId3+".jpg";

View File

@ -34,7 +34,9 @@ public class UrkSendServiceImpl implements UrkSendService {
/** /**
* 默认分页数据 * 默认分页数据
*/ */
public final static int PAGE_SIZE=10; public final static int SET_USER_INFO_SIZE=5;
public final static int PAGE_SIZE=25;
/** /**
* 考勤机 下发人员 * 考勤机 下发人员
* @param deviceCode * @param deviceCode
@ -203,7 +205,7 @@ public class UrkSendServiceImpl implements UrkSendService {
public void sendUserToDeviceList(List<Integer> userId,String key,int pageNum, int type,BmwKqCmdTaskVo taskVo){ public void sendUserToDeviceList(List<Integer> userId,String key,int pageNum, int type,BmwKqCmdTaskVo taskVo){
List<BmwDeviceVo> list ; List<BmwDeviceVo> list ;
PageHelper.startPage(pageNum, PAGE_SIZE); PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
String proId=key.split("-")[0]; String proId=key.split("-")[0];
String teamId=key.split("-")[2]; String teamId=key.split("-")[2];
String supId=key.split("-")[1]; String supId=key.split("-")[1];
@ -219,12 +221,12 @@ public class UrkSendServiceImpl implements UrkSendService {
list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),Integer.parseInt(supId)); list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),Integer.parseInt(supId));
if(StringUtils.isEmpty(list)){ if(StringUtils.isEmpty(list)){
type=2; type=2;
PageHelper.startPage(pageNum, PAGE_SIZE); PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),0); list=mapper.getDeviceVoByProId(Integer.parseInt(proId),Integer.parseInt(teamId),0);
} }
if(StringUtils.isEmpty(list)) { if(StringUtils.isEmpty(list)) {
type=3; type=3;
PageHelper.startPage(pageNum, PAGE_SIZE); PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
list=mapper.getDeviceVoByProId(Integer.parseInt(proId), 0, 0); list=mapper.getDeviceVoByProId(Integer.parseInt(proId), 0, 0);
} }
} }
@ -284,7 +286,7 @@ public class UrkSendServiceImpl implements UrkSendService {
* @param taskVo * @param taskVo
*/ */
public void getUserSendToDev(int proId,int subId,int teamId,int pageNum, BmwKqCmdTaskVo taskVo) { public void getUserSendToDev(int proId,int subId,int teamId,int pageNum, BmwKqCmdTaskVo taskVo) {
PageHelper.startPage(pageNum, PAGE_SIZE); PageHelper.startPage(pageNum, SET_USER_INFO_SIZE);
//依据工程班组分包 查询在场人员 //依据工程班组分包 查询在场人员
List<String> list=mapper.getOnSiteUser(proId,subId,teamId); List<String> list=mapper.getOnSiteUser(proId,subId,teamId);
PageInfo<String> pageInfo =new PageInfo<String>(list); PageInfo<String> pageInfo =new PageInfo<String>(list);
@ -315,7 +317,7 @@ public class UrkSendServiceImpl implements UrkSendService {
*/ */
public void sendUserToDevice(int userId,int proId,int supId,int teamId,int pageNum, int type,BmwKqCmdTaskVo taskVo){ public void sendUserToDevice(int userId,int proId,int supId,int teamId,int pageNum, int type,BmwKqCmdTaskVo taskVo){
List<BmwDeviceVo> list; List<BmwDeviceVo> list;
PageHelper.startPage(pageNum,PAGE_SIZE); PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
if(type==1){ if(type==1){
list=mapper.getDeviceVoByProId(proId,supId,teamId); list=mapper.getDeviceVoByProId(proId,supId,teamId);
}else if(type==2){ }else if(type==2){
@ -328,12 +330,12 @@ public class UrkSendServiceImpl implements UrkSendService {
list=mapper.getDeviceVoByProId(proId,supId,teamId); list=mapper.getDeviceVoByProId(proId,supId,teamId);
if(StringUtils.isEmpty(list)){ if(StringUtils.isEmpty(list)){
type=2; type=2;
PageHelper.startPage(pageNum,PAGE_SIZE); PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
list=mapper.getDeviceVoByProId(proId,supId,0); list=mapper.getDeviceVoByProId(proId,supId,0);
} }
if(StringUtils.isEmpty(list)){ if(StringUtils.isEmpty(list)){
type=3; type=3;
PageHelper.startPage(pageNum,PAGE_SIZE); PageHelper.startPage(pageNum,SET_USER_INFO_SIZE);
list=mapper.getDeviceVoByProId(proId,0,0); list=mapper.getDeviceVoByProId(proId,0,0);
} }
} }