修改bug

master
yechenhao 6 years ago
parent 67de527c09
commit 0f55a4965f

@ -9,14 +9,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream; import java.awt.*;
import java.io.File; import java.awt.image.BufferedImage;
import java.io.FileInputStream; import java.io.*;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* @Description: controller * @Description: controller
@ -50,7 +51,7 @@ public class EmployeeController extends BaseController {
} }
} }
/** /**
* *
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -60,16 +61,39 @@ public class EmployeeController extends BaseController {
try { try {
in = new BufferedInputStream(employeeService.getInputStream(url)); in = new BufferedInputStream(employeeService.getInputStream(url));
//输入到response String fileName = UUID.randomUUID().toString().replace("-","");
File file = new File(fileName + ".png");
//字节流转图片对象
Image bi = ImageIO.read(in);
//构建图片流
BufferedImage tag = new BufferedImage(300, 300, BufferedImage.TYPE_INT_RGB);
//绘制改变尺寸后的图
tag.getGraphics().drawImage(bi, 0, 0, 300, 300, null);
//输出流
BufferedOutputStream image = new BufferedOutputStream(new FileOutputStream(file));
ImageIO.write(tag, "PNG", image);
in.close();
image.close();
//将文件输入到response
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();
byte[] bufferNew = new byte[1024]; byte[] buffer = new byte[1024];
File zipFile = new File(fileName + ".png");
FileInputStream inStream = new FileInputStream(zipFile);
int lenNew; int lenNew;
while ((lenNew = in.read(bufferNew)) > 0) { while ((lenNew = inStream.read(buffer)) > 0) {
outputStream.write(bufferNew, 0, lenNew); outputStream.write(buffer, 0, lenNew);
} }
//删除文件,清理空间
file.delete();
zipFile.delete();
outputStream.flush(); outputStream.flush();
}catch (Exception e){ }catch (Exception e){
log.error("添加用户失败",e); log.error("下载图片",e);
}finally { }finally {
try { try {
in.close(); in.close();

@ -10,20 +10,18 @@
t5.NAME AS inviteSellerName, t5.NAME AS inviteSellerName,
t4.id AS inviteSellerId, t4.id AS inviteSellerId,
t1.create_time AS addTime, t1.create_time AS addTime,
t6.avatar, t2.avatar,
t3.id as vipFlag t3.id as vipFlag
FROM FROM
op_seller_customer_relation t1, op_seller_customer_relation t1,
op_customer t2 left join op_vip t3 on t2.member_id = t3.id and t3.status = 1, op_customer t2 left join op_vip t3 on t2.member_id = t3.id and t3.status = 1,
poi_store_staff t4, poi_store_staff t4,
privilage_user t5, privilage_user t5
op_customer_enterprise_wechat t6
WHERE WHERE
t1.customer_id = t2.id t1.customer_id = t2.id
AND t1.user_id = t5.id AND t1.user_id = t5.id
AND t1.user_id = t4.user_id AND t1.user_id = t4.user_id
AND t1.store_id = t4.store_id AND t1.store_id = t4.store_id
and t2.id = t6.customer_id
<if test="type == 1"> <if test="type == 1">
and t3.id is not null and t3.id is not null
</if> </if>

Loading…
Cancel
Save