Commit 05b2a97a by 罗承锋

修改部分代码审计问题

parent 7d3b5028
...@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
/** /**
...@@ -32,18 +31,18 @@ public class ImgController { ...@@ -32,18 +31,18 @@ public class ImgController {
FileInputStream inputStream = null; FileInputStream inputStream = null;
try { try {
inputStream = new FileInputStream(file); inputStream = new FileInputStream(file);
} catch (FileNotFoundException e) {
log.error("图片下载失败",e.getMessage());
}
try {
bytes = new byte[inputStream.available()]; bytes = new byte[inputStream.available()];
if (inputStream != null) {
inputStream.read(bytes, 0, inputStream.available());
}
} catch (IOException e) { } catch (IOException e) {
log.error("图片下载失败",e.getMessage()); log.error("图片下载失败",e.getMessage());
} }finally {
try { if (inputStream != null) {
inputStream.read(bytes, 0, inputStream.available()); try{
} catch (IOException e) { inputStream.close();
log.error("图片下载失败",e.getMessage()); }catch (Exception e){}
}
} }
return bytes; return bytes;
} }
......
...@@ -418,8 +418,8 @@ public class YxtCardController extends BaseController { ...@@ -418,8 +418,8 @@ public class YxtCardController extends BaseController {
Wrapper<YxtOrderDetail> detailWrapper = new EntityWrapper<>(); Wrapper<YxtOrderDetail> detailWrapper = new EntityWrapper<>();
detailWrapper.eq("order_id",orderNum); detailWrapper.eq("order_id",orderNum);
List<YxtOrderDetail> list = yxtOrderDetailMapper.selectList(detailWrapper); List<YxtOrderDetail> list = yxtOrderDetailMapper.selectList(detailWrapper);
List<Integer> couponIds = null; List<Integer> couponIds = new ArrayList<>();
List<Integer> detailIds = null; List<Integer> detailIds = new ArrayList<>();
if(list.size()>0){ if(list.size()>0){
for (YxtOrderDetail detail : list) { for (YxtOrderDetail detail : list) {
couponIds.add(detail.getYxtId()); couponIds.add(detail.getYxtId());
...@@ -461,7 +461,7 @@ public class YxtCardController extends BaseController { ...@@ -461,7 +461,7 @@ public class YxtCardController extends BaseController {
orderWrapper.eq("order_num",orderNum); orderWrapper.eq("order_num",orderNum);
orderWrapper.eq("state",2); orderWrapper.eq("state",2);
List<YxtOrder> orderList = yxtOrderMapper.selectList(orderWrapper); List<YxtOrder> orderList = yxtOrderMapper.selectList(orderWrapper);
List<Integer> couponIds = null; List<Integer> couponIds = new ArrayList<>();
if(orderList.size()>0){ if(orderList.size()>0){
Wrapper<YxtOrderDetail> detailWrapper = new EntityWrapper<>(); Wrapper<YxtOrderDetail> detailWrapper = new EntityWrapper<>();
detailWrapper.eq("order_id",orderList.get(0).getId()); detailWrapper.eq("order_id",orderList.get(0).getId());
......
...@@ -12,6 +12,7 @@ import com.winsun.mapper.OrderMapper; ...@@ -12,6 +12,7 @@ import com.winsun.mapper.OrderMapper;
import com.winsun.mapper.RegularMapper; import com.winsun.mapper.RegularMapper;
import com.winsun.mapper.XshInventoryMapper; import com.winsun.mapper.XshInventoryMapper;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -65,7 +66,7 @@ public class codeManagerController { ...@@ -65,7 +66,7 @@ public class codeManagerController {
List<Order> list1 = orderMapper.selectList(wrapper2); List<Order> list1 = orderMapper.selectList(wrapper2);
if(list.size()>0 || list1.size()>0){ if(list.size()>0 || list1.size()>0){
// 生成6位随机数 // 生成6位随机数
String veCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String veCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
//MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。"); //MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。");
redisTemplate.opsForValue().set(phone, veCode, 240, TimeUnit.MINUTES); redisTemplate.opsForValue().set(phone, veCode, 240, TimeUnit.MINUTES);
SendSmsAndMail.sendSms(phone,veCode + "","7"); SendSmsAndMail.sendSms(phone,veCode + "","7");
......
...@@ -6,7 +6,6 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -6,7 +6,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
/** /**
...@@ -19,6 +18,7 @@ public class FileUtil { ...@@ -19,6 +18,7 @@ public class FileUtil {
//写到相应路径 //写到相应路径
public static boolean makefile(String path, MultipartFile file,String filename){ public static boolean makefile(String path, MultipartFile file,String filename){
File dir = new File(path); File dir = new File(path);
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
...@@ -29,11 +29,15 @@ public class FileUtil { ...@@ -29,11 +29,15 @@ public class FileUtil {
os = new FileOutputStream(savePath); os = new FileOutputStream(savePath);
os.write(file.getBytes()); os.write(file.getBytes());
os.flush(); os.flush();
} catch (IOException e) { } catch (Exception e) {
log.error("上传文件失败:" + e.getMessage(), e); log.error("上传文件失败:" + e.getMessage(), e);
return false; return false;
} finally { } finally {
IOUtils.closeQuite(os); if (os != null) {
try{
os.close();
}catch(Exception e) {}
}
} }
return true; return true;
} }
...@@ -49,11 +53,13 @@ public class FileUtil { ...@@ -49,11 +53,13 @@ public class FileUtil {
os = new FileOutputStream(savePath); os = new FileOutputStream(savePath);
os.write(file.getBytes()); os.write(file.getBytes());
os.flush(); os.flush();
} catch (IOException e) { } catch (Exception e) {
log.error("上传文件失败:" + e.getMessage(), e); log.error("上传文件失败:" + e.getMessage(), e);
return false; return false;
} finally { } finally {
IOUtils.closeQuite(os); if (os != null) {
IOUtils.closeQuite(os);
}
} }
return true; return true;
} }
......
...@@ -238,10 +238,11 @@ public class HTTPSClient { ...@@ -238,10 +238,11 @@ public class HTTPSClient {
PrintWriter out = null; PrintWriter out = null;
BufferedReader in = null; BufferedReader in = null;
String result = ""; String result = "";
// 打开和URL之间的连接
URLConnection conn = null;
try { try {
URL realUrl = new URL(url); URL realUrl = new URL(url);
// 打开和URL之间的连接 conn = realUrl.openConnection();
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性 // 设置通用的请求属性
/// conn.setRequestProperty("accept", "*/*"); /// conn.setRequestProperty("accept", "*/*");
// conn.setRequestProperty("connection", "Keep-Alive"); // conn.setRequestProperty("connection", "Keep-Alive");
...@@ -269,16 +270,27 @@ public class HTTPSClient { ...@@ -269,16 +270,27 @@ public class HTTPSClient {
} }
// 使用finally块来关闭输出流、输入流 // 使用finally块来关闭输出流、输入流
finally { finally {
try { if (out != null) {
if (out != null) { try{
out.close(); out.close();
} } catch (Exception ex) {}
if (in != null) { }
if (in != null) {
try{
in.close(); in.close();
} } catch (IOException ex) {}
} catch (IOException ex) {
ex.printStackTrace();
} }
try{
if (conn.getInputStream() != null) {
conn.getInputStream().close();
}
} catch (IOException ex) {}
try{
if (conn.getOutputStream() != null) {
conn.getOutputStream().close();
}
} catch (IOException ex) {}
} }
return result; return result;
} }
......
package com.winsun.utils; package com.winsun.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
/** /**
* 导入Excel文件(支持“XLS”和“XLSX”格式) * 导入Excel文件(支持“XLS”和“XLSX”格式)
* @author * @author
...@@ -92,7 +85,7 @@ public class ImportExcel { ...@@ -92,7 +85,7 @@ public class ImportExcel {
*/ */
public ImportExcel(File file, int headerNum, int sheetIndex) public ImportExcel(File file, int headerNum, int sheetIndex)
throws InvalidFormatException, IOException { throws InvalidFormatException, IOException {
this(file.getName(), new FileInputStream(file), headerNum, sheetIndex); this(file.getName(), new FileInputStream(file), headerNum, sheetIndex);
} }
/** /**
...@@ -116,21 +109,29 @@ public class ImportExcel { ...@@ -116,21 +109,29 @@ public class ImportExcel {
*/ */
public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex) public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex)
throws InvalidFormatException, IOException { throws InvalidFormatException, IOException {
if (StringUtils.isBlank(fileName)){ try{
throw new RuntimeException("导入文档为空!"); if (StringUtils.isBlank(fileName)){
}else if(fileName.toLowerCase().endsWith("xls")){ throw new RuntimeException("导入文档为空!");
this.wb = new HSSFWorkbook(is); }else if(fileName.toLowerCase(Locale.ENGLISH).endsWith("xls")){
}else if(fileName.toLowerCase().endsWith("xlsx")){ this.wb = new HSSFWorkbook(is);
this.wb = new XSSFWorkbook(is); }else if(fileName.toLowerCase(Locale.ENGLISH).endsWith("xlsx")){
}else{ this.wb = new XSSFWorkbook(is);
throw new RuntimeException("文档格式不正确!"); }else{
} throw new RuntimeException("文档格式不正确!");
if (this.wb.getNumberOfSheets()<sheetIndex){ }
throw new RuntimeException("文档中没有工作表!"); if (this.wb.getNumberOfSheets()<sheetIndex){
throw new RuntimeException("文档中没有工作表!");
}
this.sheet = this.wb.getSheetAt(sheetIndex);
this.headerNum = headerNum;
log.debug("Initialize success.");
}catch (IOException ioe) {
throw ioe;
} finally{
if (is != null) {
is.close();
}
} }
this.sheet = this.wb.getSheetAt(sheetIndex);
this.headerNum = headerNum;
log.debug("Initialize success.");
} }
/** /**
......
...@@ -55,7 +55,8 @@ public class PicturesUtil { ...@@ -55,7 +55,8 @@ public class PicturesUtil {
if (!dir.exists()) { if (!dir.exists()) {
dir.mkdirs(); dir.mkdirs();
}//enclosure/images/idCard/temp/年/月/日/name.jpeg }//enclosure/images/idCard/temp/年/月/日/name.jpeg
filePath = FilePath.PATH.getValue()+ pathType+ "/" + yymmdd + "/" + orderNum + "/" + (new Date()).getTime() + "." + houzhui; filePath = FilePath.PATH.getValue()+ pathType+ "/" + yymmdd + "/" + orderNum + "/" + (new Date()).getTime() + "." + PicturesUtil.checkSuffix(houzhui);
//byte[] bytes = Base64.getUrlDecoder().decode(base64Data); //byte[] bytes = Base64.getUrlDecoder().decode(base64Data);
//byte[] bytes =new BASE64Decoder().decodeBuffer(base64Data); //byte[] bytes =new BASE64Decoder().decodeBuffer(base64Data);
...@@ -64,7 +65,9 @@ public class PicturesUtil { ...@@ -64,7 +65,9 @@ public class PicturesUtil {
FileOutputStream fos = null; FileOutputStream fos = null;
try { try {
fos = new FileOutputStream(filePath); fos = new FileOutputStream(filePath);
fos.write(bytes); if (fos != null) {
fos.write(bytes);
}
} catch (IOException e) { } catch (IOException e) {
log.error("图片上传异常",e.getMessage()); log.error("图片上传异常",e.getMessage());
e.printStackTrace(); e.printStackTrace();
...@@ -80,10 +83,28 @@ public class PicturesUtil { ...@@ -80,10 +83,28 @@ public class PicturesUtil {
} }
} }
} }
String enclosure = filePath.replace("enclosure", "manager/ciop"); String enclosure = "";
if (filePath != null) {
enclosure = filePath.replace("enclosure", "manager/ciop");
}
return enclosure; return enclosure;
} }
/**
* 校验后缀
* @param houzhui
* @return
*/
public static String checkSuffix(String houzhui) {
String[] allowTypes = new String[] { "jpeg", "jpg", "gif", "png" , "zip" };
for(String str : allowTypes) {
if(str.equals(houzhui)) {
return str;
}
}
return "jpeg";
}
/** /**
* 海报删除图片 * 海报删除图片
......
package com.winsun.utils;
import java.security.SecureRandom;
/**
* 随机数工具类
*/
public class RandomUtil {
/**
* 获取更安全的随机数
* @return
*/
public static double getSecrityRandom() {
SecureRandom random = null;
try {
random = SecureRandom.getInstance("SHA1PRNG");
return random.nextDouble();
}catch (Exception e) {
}
return 0.0;
}
/**
* 获取int随机数
* @return
*/
public static int getSecrityRandomInt(Integer i) {
SecureRandom random = null;
try {
random = SecureRandom.getInstance("SHA1PRNG");
return random.nextInt(i);
}catch (Exception e) {
}
return 0;
}
}
package com.winsun.utils; package com.winsun.utils;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Random;
public class Sha1Util { public class Sha1Util {
...@@ -33,8 +32,7 @@ public class Sha1Util { ...@@ -33,8 +32,7 @@ public class Sha1Util {
// 获取随机字符串 // 获取随机字符串
public static String getNonceStr() { public static String getNonceStr() {
Random random = new Random(); return MD5Util.MD5Encode(String.valueOf(RandomUtil.getSecrityRandomInt(10000)), "UTF-8");
return MD5Util.MD5Encode(String.valueOf(random.nextInt(10000)), "UTF-8");
} }
// 获取时间戳 // 获取时间戳
......
...@@ -104,7 +104,7 @@ public class WxInterfacesUtil { ...@@ -104,7 +104,7 @@ public class WxInterfacesUtil {
// 时间戳 // 时间戳
long timeStamp = System.currentTimeMillis(); long timeStamp = System.currentTimeMillis();
// 随机字符串 // 随机字符串
String nonceStr = Integer.toString(((int) ((Math.random() + 1) * 1000000))); String nonceStr = Integer.toString(((int) ((RandomUtil.getSecrityRandom() + 1) * 1000000)));
// 凭证 // 凭证
if(StringUtils.isBlank(access_token)){ if(StringUtils.isBlank(access_token)){
access_token = getToken("client_credential",WxConfig.APPID,WxConfig.APPSECRET,access_token); access_token = getToken("client_credential",WxConfig.APPID,WxConfig.APPSECRET,access_token);
......
...@@ -5,13 +5,12 @@ import com.winsun.auth.core.base.controller.BaseController; ...@@ -5,13 +5,12 @@ import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.util.DateUtil; import com.winsun.auth.core.util.DateUtil;
import com.winsun.auth.model.user.User; import com.winsun.auth.model.user.User;
import com.winsun.item.core.shiro.MyWebSessionManager;
import com.winsun.item.core.shiro.ShiroKit; import com.winsun.item.core.shiro.ShiroKit;
import com.winsun.item.core.util.ResponseEntity; import com.winsun.item.core.util.ResponseEntity;
import com.winsun.item.modular.system.service.IUserService; import com.winsun.item.modular.system.service.IUserService;
import com.winsun.item.util.LoginUtils; import com.winsun.item.util.LoginUtils;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
...@@ -78,7 +77,7 @@ public class GetPhoneCodeController extends BaseController { ...@@ -78,7 +77,7 @@ public class GetPhoneCodeController extends BaseController {
//只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415 //只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415
verificationCode= DateUtil.formatDate(new Date(),"MMddHH"); verificationCode= DateUtil.formatDate(new Date(),"MMddHH");
}else { }else {
verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
} }
Long expire = stringRedisTemplate.getExpire(code); Long expire = stringRedisTemplate.getExpire(code);
...@@ -126,7 +125,7 @@ public class GetPhoneCodeController extends BaseController { ...@@ -126,7 +125,7 @@ public class GetPhoneCodeController extends BaseController {
//只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415 //只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415
verificationCode= DateUtil.formatDate(new Date(),"MMddHH"); verificationCode= DateUtil.formatDate(new Date(),"MMddHH");
}else { }else {
verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
} }
log.info(verificationCode); log.info(verificationCode);
Long expire = stringRedisTemplate.getExpire(code); Long expire = stringRedisTemplate.getExpire(code);
...@@ -170,7 +169,7 @@ public class GetPhoneCodeController extends BaseController { ...@@ -170,7 +169,7 @@ public class GetPhoneCodeController extends BaseController {
if (expire>(60*4)){ if (expire>(60*4)){
return ResponseEntity.newJSON("code", 400, "message", "请勿频繁发送手机验证码操作!"); return ResponseEntity.newJSON("code", 400, "message", "请勿频繁发送手机验证码操作!");
} }
String verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
//5分钟内有效 //5分钟内有效
stringRedisTemplate.opsForValue().set(userId.toString(), verificationCode, 1000 * 60*5, TimeUnit.MILLISECONDS); stringRedisTemplate.opsForValue().set(userId.toString(), verificationCode, 1000 * 60*5, TimeUnit.MILLISECONDS);
Map<String, Object> sent=new HashMap<>(); Map<String, Object> sent=new HashMap<>();
......
...@@ -19,11 +19,7 @@ import com.winsun.mapper.HhrUserMapper; ...@@ -19,11 +19,7 @@ import com.winsun.mapper.HhrUserMapper;
import com.winsun.mapper.SchoolMapper; import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SysUserMapper; import com.winsun.mapper.SysUserMapper;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.HttpHelper; import com.winsun.utils.*;
import com.winsun.utils.IDCardUtil;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.PicturesUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,14 +27,11 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -31,14 +27,11 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.*; import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -292,7 +285,7 @@ public class LoginPwdController extends BaseController { ...@@ -292,7 +285,7 @@ public class LoginPwdController extends BaseController {
//只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415 //只有admin验证码有后门 验证码规则:当前月份日期小时例如 011415
verificationCode = DateUtil.formatDate(new Date(), "MMddHH"); verificationCode = DateUtil.formatDate(new Date(), "MMddHH");
} else { } else {
verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
} }
Long expire = stringRedisTemplate.getExpire(code); Long expire = stringRedisTemplate.getExpire(code);
......
...@@ -7,6 +7,7 @@ import com.winsun.bean.*; ...@@ -7,6 +7,7 @@ import com.winsun.bean.*;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.utils.MD5Utils; import com.winsun.utils.MD5Utils;
import com.winsun.utils.ProduceIdUtil; import com.winsun.utils.ProduceIdUtil;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
...@@ -488,7 +489,7 @@ public class StartSelectController { ...@@ -488,7 +489,7 @@ public class StartSelectController {
uuid = uuid.substring(1, 12); uuid = uuid.substring(1, 12);
SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd");//设置日期格式 SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd");//设置日期格式
order.setId(uuid); order.setId(uuid);
order.setOrderNumber("YRYM" + df2.format(new Date()) + (int) ((Math.random() * 9 + 1) * 1000)); order.setOrderNumber("YRYM" + df2.format(new Date()) + (int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 1000));
order.setNetNumber(orderMap.get("order_customer_account")); order.setNetNumber(orderMap.get("order_customer_account"));
order.setNetPassword(orderMap.get("order_customer_pwd")); order.setNetPassword(orderMap.get("order_customer_pwd"));
order.setUserSchool(orderMap.get("order_university_name")); order.setUserSchool(orderMap.get("order_university_name"));
...@@ -528,7 +529,7 @@ public class StartSelectController { ...@@ -528,7 +529,7 @@ public class StartSelectController {
uuid = uuid.substring(1, 12); uuid = uuid.substring(1, 12);
order.setId(uuid); order.setId(uuid);
SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd");//设置日期格式 SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd");//设置日期格式
order.setOrderNumber("YRYM" + df2.format(new Date()) + (int) ((Math.random() * 9 + 1) * 1000)); order.setOrderNumber("YRYM" + df2.format(new Date()) + (int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 1000));
order.setNetNumber(orderMap.get("order_customer_account")); order.setNetNumber(orderMap.get("order_customer_account"));
order.setNetPassword(orderMap.get("order_customer_pwd")); order.setNetPassword(orderMap.get("order_customer_pwd"));
order.setUserSchool(orderMap.get("order_university_name")); order.setUserSchool(orderMap.get("order_university_name"));
......
...@@ -11,6 +11,7 @@ import com.winsun.bean.StudentLists; ...@@ -11,6 +11,7 @@ import com.winsun.bean.StudentLists;
import com.winsun.bean.SysUser; import com.winsun.bean.SysUser;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.RandomUtil;
import com.winsun.utils.XbkUtil; import com.winsun.utils.XbkUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -192,7 +193,7 @@ public class ChooseController { ...@@ -192,7 +193,7 @@ public class ChooseController {
uuid = uuid.substring(1, 12); uuid = uuid.substring(1, 12);
order.setId(uuid); order.setId(uuid);
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");//设置日期格式 SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");//设置日期格式
String orderNumber = "YRYM" + df.format(new Date()) + (int) ((Math.random() * 9 + 1) * 100000); String orderNumber = "YRYM" + df.format(new Date()) + (int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000);
order.setOrderNumber(orderNumber); order.setOrderNumber(orderNumber);
order.setOrderStatus("待处理"); order.setOrderStatus("待处理");
order.setHehuorenId(hhrId); order.setHehuorenId(hhrId);
......
...@@ -12,6 +12,7 @@ import com.winsun.constant.UserType; ...@@ -12,6 +12,7 @@ import com.winsun.constant.UserType;
import com.winsun.mapper.*; import com.winsun.mapper.*;
import com.winsun.utils.IDCardUtil; import com.winsun.utils.IDCardUtil;
import com.winsun.utils.ProduceIdUtil; import com.winsun.utils.ProduceIdUtil;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -73,11 +74,11 @@ public class PackageUpgradeController extends BaseController { ...@@ -73,11 +74,11 @@ public class PackageUpgradeController extends BaseController {
public ResponseData<Map<String, Object>> sendVerificationCode(@RequestParam("selectOrder") String selectOrder, @RequestParam(value = "servId", required = false) String servId) { public ResponseData<Map<String, Object>> sendVerificationCode(@RequestParam("selectOrder") String selectOrder, @RequestParam(value = "servId", required = false) String servId) {
if (StringUtils.isNotBlank(servId)) { if (StringUtils.isNotBlank(servId)) {
PackageUpgrade packageUpgrade = appMapper.selectById(servId); PackageUpgrade packageUpgrade = appMapper.selectById(servId);
String s = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String s = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
log.info("验证码:" + s); log.info("验证码:" + s);
//MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。"); //MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。");
redisTemplate.opsForValue().set(servId, s, 30, TimeUnit.MINUTES); redisTemplate.opsForValue().set(servId, s, 30, TimeUnit.MINUTES);
return ResponseData.success(null, "已发送验证码到手机:" + packageUpgrade.getAccNbr().substring(0, 3) + "****" + packageUpgrade.getAccNbr().substring(7, 11) + "验证码:" + s); return ResponseData.success(new HashMap<>(), "已发送验证码到手机:" + packageUpgrade.getAccNbr().substring(0, 3) + "****" + packageUpgrade.getAccNbr().substring(7, 11) + "验证码:" + s);
} }
Wrapper<PackageUpgrade> wrapper = new EntityWrapper(); Wrapper<PackageUpgrade> wrapper = new EntityWrapper();
...@@ -124,7 +125,7 @@ public class PackageUpgradeController extends BaseController { ...@@ -124,7 +125,7 @@ public class PackageUpgradeController extends BaseController {
objMap.put("isStock", false); objMap.put("isStock", false);
return ResponseData.success(objMap,"当前查询条件未查出套餐升级数据,如有疑问请联系客服!"); return ResponseData.success(objMap,"当前查询条件未查出套餐升级数据,如有疑问请联系客服!");
} }
String s = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String s = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
log.info("验证码:" + s); log.info("验证码:" + s);
//MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。"); //MessageUtil.sent(packageUpgrade.getAccNbr(),"4","您获取的验证码为:"+s+",半小时内有效。");
redisTemplate.opsForValue().set(selectOrder, s, 30, TimeUnit.MINUTES); redisTemplate.opsForValue().set(selectOrder, s, 30, TimeUnit.MINUTES);
...@@ -359,7 +360,7 @@ public class PackageUpgradeController extends BaseController { ...@@ -359,7 +360,7 @@ public class PackageUpgradeController extends BaseController {
if (StringUtils.isNotBlank(mark)) { if (StringUtils.isNotBlank(mark)) {
String uuid1 = UUID.randomUUID().toString(); String uuid1 = UUID.randomUUID().toString();
String id1 = uuid1.split("-")[0] + uuid1.split("-")[1]; String id1 = uuid1.split("-")[0] + uuid1.split("-")[1];
String s1 = String.valueOf((int) ((Math.random() * 9 + 1) * 1000)); String s1 = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 1000));
order.setId(id1); order.setId(id1);
order.setOrderNumber("YRYM" + ProduceIdUtil.getId()); order.setOrderNumber("YRYM" + ProduceIdUtil.getId());
order.setUserType(UserType.YCTK.getId()); order.setUserType(UserType.YCTK.getId());
......
...@@ -19,26 +19,26 @@ public class FormController { ...@@ -19,26 +19,26 @@ public class FormController {
} }
public ResponseData<Form> list() { public ResponseData<Form> list() {
return ResponseData.error(null); return ResponseData.error("");
} }
public ResponseData<Form> creat() { public ResponseData<Form> creat() {
return ResponseData.error(null); return ResponseData.error("");
} }
public ResponseData<Form> modify() { public ResponseData<Form> modify() {
return ResponseData.error(null); return ResponseData.error("");
} }
public ResponseData<Form> delete() { public ResponseData<Form> delete() {
return ResponseData.error(null); return ResponseData.error("");
} }
public ResponseData<Form> disable() { public ResponseData<Form> disable() {
return ResponseData.error(null); return ResponseData.error("");
} }
public ResponseData<Form> enable() { public ResponseData<Form> enable() {
return ResponseData.error(null); return ResponseData.error("");
} }
} }
package com.winsun.controller; package com.winsun.controller;
import java.io.IOException;
import java.security.SecureRandom;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.winsun.auth.core.annotion.Permission; import com.winsun.auth.core.annotion.Permission;
import com.winsun.auth.core.base.controller.BaseController; import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser; import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.auth.core.util.IOUtils; import com.winsun.auth.core.util.IOUtils;
import com.winsun.bean.Bill; import com.winsun.bean.*;
import com.winsun.bean.BonusApply; import com.winsun.mapper.*;
import com.winsun.bean.HhrUser;
import com.winsun.bean.SalesList;
import com.winsun.bean.School;
import com.winsun.bean.SysUser;
import com.winsun.mapper.BonusMapper;
import com.winsun.mapper.HhrUserMapper;
import com.winsun.mapper.SalesListMapper;
import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SysUserMapper;
import com.winsun.tenpay.CorporatePrepayResponse; import com.winsun.tenpay.CorporatePrepayResponse;
import com.winsun.tenpay.business.TenpayXyjlBusiness; import com.winsun.tenpay.business.TenpayXyjlBusiness;
import com.winsun.utils.ExcelDealUtils; import com.winsun.utils.ExcelDealUtils;
import com.winsun.utils.MapUtil; import com.winsun.utils.MapUtil;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* 奖励结算 controller * 奖励结算 controller
...@@ -69,8 +51,7 @@ public class BonusController extends BaseController { ...@@ -69,8 +51,7 @@ public class BonusController extends BaseController {
private static SchoolMapper schoolMapper; private static SchoolMapper schoolMapper;
public static Lock lock = new ReentrantLock(); public static Lock lock = new ReentrantLock();
List<Map<String,Object>> exportResponseList = new ArrayList<Map<String,Object>>(); private static ThreadLocal<List<Map<String,Object>>> exportResponseList = new ThreadLocal<>();
@Autowired @Autowired
private HhrUserMapper hhrUserMapper; private HhrUserMapper hhrUserMapper;
@Autowired @Autowired
...@@ -81,6 +62,7 @@ public class BonusController extends BaseController { ...@@ -81,6 +62,7 @@ public class BonusController extends BaseController {
BonusController.bonusMapper = bonusMapper; BonusController.bonusMapper = bonusMapper;
BonusController.sysUserMapper = sysUserMapper; BonusController.sysUserMapper = sysUserMapper;
BonusController.schoolMapper = schoolMapper; BonusController.schoolMapper = schoolMapper;
exportResponseList.set(new ArrayList<>());
} }
@Permission(menuname = "获取佣金申请数据", value = "applyDataList", method = RequestMethod.POST) @Permission(menuname = "获取佣金申请数据", value = "applyDataList", method = RequestMethod.POST)
...@@ -196,13 +178,13 @@ public class BonusController extends BaseController { ...@@ -196,13 +178,13 @@ public class BonusController extends BaseController {
Map<String, Object> firstMap = dataList.get(0); Map<String, Object> firstMap = dataList.get(0);
String theUserId = firstMap.get("userId").toString(); String theUserId = firstMap.get("userId").toString();
double bonus = 0;; double bonus = 0;;
String applyNum = "Tbo" + Long.toString(System.currentTimeMillis()) + (int)(Math.random()* 100000) ; String applyNum = "Tbo" + Long.toString(System.currentTimeMillis()) + (int)(RandomUtil.getSecrityRandom()* 100000) ;
for(Map<String, Object> map : dataList) { for(Map<String, Object> map : dataList) {
String userId = map.get("userId").toString(); String userId = map.get("userId").toString();
double theBonus = (double)map.get("bonus"); double theBonus = (double)map.get("bonus");
String bonusNum = "Tb" + Long.toString(System.currentTimeMillis()) + (int)(Math.random()* 100000) ; String bonusNum = "Tb" + Long.toString(System.currentTimeMillis()) + (int)(RandomUtil.getSecrityRandom()* 100000) ;
if(userId.equals(theUserId)) { if(userId.equals(theUserId)) {
bonus += theBonus; bonus += theBonus;
...@@ -224,7 +206,7 @@ public class BonusController extends BaseController { ...@@ -224,7 +206,7 @@ public class BonusController extends BaseController {
} }
Map<String, Object> lastMap = new HashMap<String, Object>(); Map<String, Object> lastMap = new HashMap<String, Object>();
String lastBonusNum = "Tb" + Long.toString(System.currentTimeMillis()) + (int)(Math.random()* 100000) ; String lastBonusNum = "Tb" + Long.toString(System.currentTimeMillis()) + (int)(RandomUtil.getSecrityRandom() * 100000) ;
lastMap.put("userId", theUserId); lastMap.put("userId", theUserId);
lastMap.put("bonus", bonus); lastMap.put("bonus", bonus);
lastMap.put("applyNum", applyNum); lastMap.put("applyNum", applyNum);
...@@ -469,8 +451,8 @@ public class BonusController extends BaseController { ...@@ -469,8 +451,8 @@ public class BonusController extends BaseController {
} }
} }
} }
exportResponseList = null; exportResponseList.set(new ArrayList<>());
int num = wxPayBonus(dataList, orderMaps); int num = wxPayBonus(dataList, orderMaps);
StringBuffer info = new StringBuffer(); StringBuffer info = new StringBuffer();
resultMap.put("num", num); resultMap.put("num", num);
...@@ -486,7 +468,7 @@ public class BonusController extends BaseController { ...@@ -486,7 +468,7 @@ public class BonusController extends BaseController {
public int wxPayBonus(List<Map<String, Object>> list,Map<String, Map<String, Object>> orderMaps) { public int wxPayBonus(List<Map<String, Object>> list,Map<String, Map<String, Object>> orderMaps) {
ShiroUser user = getShiroUser(); ShiroUser user = getShiroUser();
int successNum = 0; int successNum = 0;
for(Map<String, Object> map : list) { for(Map<String, Object> map : list) {
String account = map.get("account").toString(); String account = map.get("account").toString();
double amount = Double.valueOf(map.get("bonus").toString()).doubleValue(); double amount = Double.valueOf(map.get("bonus").toString()).doubleValue();
...@@ -528,7 +510,7 @@ public class BonusController extends BaseController { ...@@ -528,7 +510,7 @@ public class BonusController extends BaseController {
respMap.put("schoolName", map.get("schoolName")); respMap.put("schoolName", map.get("schoolName"));
respMap.put("bonus", map.get("bonus")); respMap.put("bonus", map.get("bonus"));
respMap.put("desc", resp.getErrCodeDesc()); respMap.put("desc", resp.getErrCodeDesc());
exportResponseList.add(respMap); exportResponseList.get().add(respMap);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -605,7 +587,7 @@ public class BonusController extends BaseController { ...@@ -605,7 +587,7 @@ public class BonusController extends BaseController {
}); });
//数据 //数据
int rowIndex = row.getRowNum(); int rowIndex = row.getRowNum();
for (Map<String, Object> maps: exportResponseList) { for (Map<String, Object> maps: exportResponseList.get()) {
final XSSFRow rowdata = sheet.createRow(++rowIndex); final XSSFRow rowdata = sheet.createRow(++rowIndex);
for (String column : columns) { for (String column : columns) {
XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0)); XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0));
...@@ -622,8 +604,8 @@ public class BonusController extends BaseController { ...@@ -622,8 +604,8 @@ public class BonusController extends BaseController {
os = response.getOutputStream(); os = response.getOutputStream();
workbook.write(os); workbook.write(os);
os.flush(); os.flush();
exportResponseList = null; exportResponseList.set(new ArrayList<>());
} catch (Exception e) { } catch (Exception e) {
log.error("文件出错!" + e.getMessage(), e); log.error("文件出错!" + e.getMessage(), e);
} finally { } finally {
......
package com.winsun.controller; package com.winsun.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.enums.SqlLike; import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
...@@ -10,23 +9,21 @@ import com.winsun.auth.core.base.controller.BaseController; ...@@ -10,23 +9,21 @@ import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.common.model.ResponseData; import com.winsun.auth.core.common.model.ResponseData;
import com.winsun.auth.core.shiro.ShiroUser; import com.winsun.auth.core.shiro.ShiroUser;
import com.winsun.bean.ExportExcel; import com.winsun.bean.ExportExcel;
import com.winsun.bean.YsmUser;
import com.winsun.mapper.ExportExcelMapper; import com.winsun.mapper.ExportExcelMapper;
import com.winsun.mapper.YsmUserMapper;
import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 智能平台账号实名管理 * 智能平台账号实名管理
...@@ -50,6 +47,8 @@ public class ExportExcelController extends BaseController { ...@@ -50,6 +47,8 @@ public class ExportExcelController extends BaseController {
@Permission(menuname = "订单excel文件下载", value = "uploadExcel", method = RequestMethod.POST) @Permission(menuname = "订单excel文件下载", value = "uploadExcel", method = RequestMethod.POST)
public void uploadExcel(String exportId) { public void uploadExcel(String exportId) {
ServletOutputStream os = null; ServletOutputStream os = null;
DataInputStream in = null;
FileInputStream fileInputStream = null;
try { try {
HttpServletResponse response = getHttpServletResponse(); HttpServletResponse response = getHttpServletResponse();
response.reset(); response.reset();
...@@ -58,17 +57,29 @@ public class ExportExcelController extends BaseController { ...@@ -58,17 +57,29 @@ public class ExportExcelController extends BaseController {
os = response.getOutputStream(); os = response.getOutputStream();
ExportExcel exportExcel = exportExcelMapper.selectById(exportId); ExportExcel exportExcel = exportExcelMapper.selectById(exportId);
//输入流:本地文件路径 //输入流:本地文件路径
DataInputStream in = new DataInputStream(new FileInputStream(new File(exportExcel.getExportUrl()))); fileInputStream = new FileInputStream(new File(exportExcel.getExportUrl()));
in = new DataInputStream(fileInputStream);
//输出文件 //输出文件
int bytes = 0; int bytes = 0;
byte[] bufferOut = new byte[1024]; byte[] bufferOut = new byte[1024];
while ((bytes = in.read(bufferOut)) != -1) { while ((bytes = in.read(bufferOut)) != -1) {
os.write(bufferOut, 0, bytes); os.write(bufferOut, 0, bytes);
} }
in.close();
os.flush(); os.flush();
} catch (Exception e) { }catch (Exception e) {
log.error("下载excel文件异常", e.getMessage()); log.error("下载excel文件异常", e.getMessage());
}finally {
if (fileInputStream != null) {
try{
fileInputStream.close();
}catch (Exception e){}
}
if (in != null) {
try{
in.close();
}catch (Exception e) {}
}
} }
} }
......
package com.winsun.controller; package com.winsun.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.sun.org.apache.regexp.internal.RE;
import com.winsun.bean.Package;
import com.winsun.constant.FilePath; import com.winsun.constant.FilePath;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/** /**
* @Author xuede * @Author xuede
...@@ -41,19 +30,23 @@ public class ImgController { ...@@ -41,19 +30,23 @@ public class ImgController {
FileInputStream inputStream = null; FileInputStream inputStream = null;
try { try {
inputStream = new FileInputStream(file); inputStream = new FileInputStream(file);
} catch (Exception e) {
log.error("图片下载失败",e.getMessage()); bytes = new byte[0];
}
bytes = new byte[0];
try {
bytes = new byte[inputStream.available()]; bytes = new byte[inputStream.available()];
if (inputStream != null) {
inputStream.read(bytes, 0, inputStream.available());
}
} catch (Exception e) { } catch (Exception e) {
log.error("图片下载失败",e.getMessage()); log.error("图片下载失败",e.getMessage());
} }finally{
try { if (inputStream != null) {
inputStream.read(bytes, 0, inputStream.available()); try{
} catch (Exception e) { inputStream.close();
log.error("图片下载失败",e.getMessage()); }catch (Exception e){}
}
} }
return bytes; return bytes;
} }
......
...@@ -225,7 +225,7 @@ public class LzKpiController extends BaseController { ...@@ -225,7 +225,7 @@ public class LzKpiController extends BaseController {
userIds1.add(sysUser.getId()); userIds1.add(sysUser.getId());
} }
if(sysUserList.size()==0){ if(sysUserList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -238,7 +238,7 @@ public class LzKpiController extends BaseController { ...@@ -238,7 +238,7 @@ public class LzKpiController extends BaseController {
schoolIds.add(school.getId()); schoolIds.add(school.getId());
} }
if(schoolList.size()==0){ if(schoolList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -259,7 +259,7 @@ public class LzKpiController extends BaseController { ...@@ -259,7 +259,7 @@ public class LzKpiController extends BaseController {
wrapper.in("user_id",userIds); wrapper.in("user_id",userIds);
List<LzKpi> lzKpis = lzKpiMapper.selectList(wrapper); List<LzKpi> lzKpis = lzKpiMapper.selectList(wrapper);
if(lzKpis.size()==0){ if(lzKpis.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
......
...@@ -311,7 +311,7 @@ public class LzSalaryController extends BaseController { ...@@ -311,7 +311,7 @@ public class LzSalaryController extends BaseController {
userIds1.add(sysUser.getId()); userIds1.add(sysUser.getId());
} }
if(sysUserList.size()==0){ if(sysUserList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -324,7 +324,7 @@ public class LzSalaryController extends BaseController { ...@@ -324,7 +324,7 @@ public class LzSalaryController extends BaseController {
schoolIds.add(school.getId()); schoolIds.add(school.getId());
} }
if(schoolList.size()==0){ if(schoolList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -352,7 +352,7 @@ public class LzSalaryController extends BaseController { ...@@ -352,7 +352,7 @@ public class LzSalaryController extends BaseController {
wrapper.in("user_id",userIds); wrapper.in("user_id",userIds);
List<LzWage> lzWages = lzWageMpapper.selectList(wrapper); List<LzWage> lzWages = lzWageMpapper.selectList(wrapper);
if(lzWages.size()==0){ if(lzWages.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
......
...@@ -138,7 +138,7 @@ public class NewUserController extends BaseController { ...@@ -138,7 +138,7 @@ public class NewUserController extends BaseController {
} }
List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper); List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper);
if(sysUserList.size()==0){ if(sysUserList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -151,7 +151,7 @@ public class NewUserController extends BaseController { ...@@ -151,7 +151,7 @@ public class NewUserController extends BaseController {
userSchoolWrapper.groupBy("user_id"); userSchoolWrapper.groupBy("user_id");
List<UserSchool> userSchools = userSchoolMapper.selectList(userSchoolWrapper); List<UserSchool> userSchools = userSchoolMapper.selectList(userSchoolWrapper);
if(userSchools.size()==0){ if(userSchools.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -165,7 +165,7 @@ public class NewUserController extends BaseController { ...@@ -165,7 +165,7 @@ public class NewUserController extends BaseController {
schoolWrapper.eq(StringUtils.isNotBlank(salesSchool),"school_name",salesSchool); schoolWrapper.eq(StringUtils.isNotBlank(salesSchool),"school_name",salesSchool);
List<School> schoolList = schoolMapper.selectList(schoolWrapper); List<School> schoolList = schoolMapper.selectList(schoolWrapper);
if(schoolList.size()==0){ if(schoolList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
...@@ -186,7 +186,7 @@ public class NewUserController extends BaseController { ...@@ -186,7 +186,7 @@ public class NewUserController extends BaseController {
hhrUserWrapper.in("id",userIds); hhrUserWrapper.in("id",userIds);
List<HhrUser> hhrUserList = hhrUserMapper.selectList(hhrUserWrapper); List<HhrUser> hhrUserList = hhrUserMapper.selectList(hhrUserWrapper);
if(hhrUserList.size()==0){ if(hhrUserList.size()==0){
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page); return ResponseData.success(page);
} }
......
...@@ -322,13 +322,22 @@ public class OrderController extends BaseController { ...@@ -322,13 +322,22 @@ public class OrderController extends BaseController {
} finally { } finally {
//关闭资源 //关闭资源
if (excelWriter != null) { if (excelWriter != null) {
excelWriter.finish(); try {
excelWriter.finish();
}catch(Exception e) {
}
} }
if (outputStream != null) { if (outputStream != null) {
outputStream.flush(); try{
outputStream.flush();
}catch(Exception e) {
}
} }
if (in != null) { if (in != null) {
in.close(); try{
in.close();
}catch(Exception e) {
}
} }
} }
} }
......
...@@ -17,18 +17,16 @@ import com.winsun.utils.MyBatisPlusUpdateUtils; ...@@ -17,18 +17,16 @@ import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO; import java.util.ArrayList;
import java.awt.image.BufferedImage; import java.util.HashMap;
import java.io.File; import java.util.List;
import java.io.FileInputStream; import java.util.Map;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
/** /**
* @Author: chancy * @Author: chancy
...@@ -189,7 +187,7 @@ public class PackageController extends BaseController { ...@@ -189,7 +187,7 @@ public class PackageController extends BaseController {
@Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST) @Permission(menuname = "上传背景图", value = "backgroundUpload", method = RequestMethod.POST)
public ResponseData<String>backgroundUpload(@RequestParam(value = "file") MultipartFile file,@RequestParam(value = "id",required = false) String id) { public ResponseData<String>backgroundUpload(@RequestParam(value = "file") MultipartFile file,@RequestParam(value = "id",required = false) String id) {
String subfix = "";
String backgroundpath= FilePath.BACKGROUNDIMG.getValue()+"/"+DEFAULTPATH+"/"; String backgroundpath= FilePath.BACKGROUNDIMG.getValue()+"/"+DEFAULTPATH+"/";
if (StringUtils.isBlank(id)){ if (StringUtils.isBlank(id)){
EntityWrapper<Package> packagewrapper = new EntityWrapper<>(); EntityWrapper<Package> packagewrapper = new EntityWrapper<>();
...@@ -197,10 +195,13 @@ public class PackageController extends BaseController { ...@@ -197,10 +195,13 @@ public class PackageController extends BaseController {
List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper); List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper);
id = selectMaps.get(0).get("id").toString(); id = selectMaps.get(0).get("id").toString();
Integer fileid = Integer.valueOf(id)+1; Integer fileid = Integer.valueOf(id)+1;
backgroundpath = backgroundpath +fileid.toString(); subfix = fileid.toString();
}else { }else {
backgroundpath = backgroundpath+id; subfix = id;
} }
backgroundpath = backgroundpath + subfix.replace(".", "").
replace("/","")
.replace("\\","");
boolean makefile = FileUtil.makefile(backgroundpath, file,FILENAME); boolean makefile = FileUtil.makefile(backgroundpath, file,FILENAME);
if (!makefile){ if (!makefile){
return ResponseData.error("上传失败!"); return ResponseData.error("上传失败!");
...@@ -210,7 +211,7 @@ public class PackageController extends BaseController { ...@@ -210,7 +211,7 @@ public class PackageController extends BaseController {
//xiaotudUpload //xiaotudUpload
@Permission(menuname = "上传小图", value = "xiaotuUpload", method = RequestMethod.POST) @Permission(menuname = "上传小图", value = "xiaotuUpload", method = RequestMethod.POST)
public ResponseData<String>xiaotuUpload(@RequestParam(value = "file") MultipartFile file,@RequestParam(value = "id",required = false) String id) { public ResponseData<String>xiaotuUpload(@RequestParam(value = "file") MultipartFile file,@RequestParam(value = "id",required = false) String id) {
String subfix = "";
String backgroundpath= FilePath.BACKGROUNDIMG.getValue()+"/"+DEFAULTPATH+"/"; String backgroundpath= FilePath.BACKGROUNDIMG.getValue()+"/"+DEFAULTPATH+"/";
if (StringUtils.isBlank(id)){ if (StringUtils.isBlank(id)){
EntityWrapper<Package> packagewrapper = new EntityWrapper<>(); EntityWrapper<Package> packagewrapper = new EntityWrapper<>();
...@@ -218,9 +219,9 @@ public class PackageController extends BaseController { ...@@ -218,9 +219,9 @@ public class PackageController extends BaseController {
List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper); List<Map<String, Object>> selectMaps = packageMapper.selectMaps(packagewrapper);
id = selectMaps.get(0).get("id").toString(); id = selectMaps.get(0).get("id").toString();
Integer fileid = Integer.valueOf(id)+1; Integer fileid = Integer.valueOf(id)+1;
backgroundpath = backgroundpath +fileid.toString(); subfix = fileid.toString();
}else { }else {
backgroundpath = backgroundpath+id; subfix = id;
} }
boolean makefile = FileUtil.makefile(backgroundpath, file,XIAOTUFILENAME); boolean makefile = FileUtil.makefile(backgroundpath, file,XIAOTUFILENAME);
if (!makefile){ if (!makefile){
......
...@@ -14,6 +14,7 @@ import com.winsun.smsUtils.SendSmsAndMail; ...@@ -14,6 +14,7 @@ import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.IDCardUtil; import com.winsun.utils.IDCardUtil;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import com.winsun.utils.PicturesUtil; import com.winsun.utils.PicturesUtil;
import com.winsun.utils.RandomUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -257,7 +258,7 @@ public class PersonalCenterController extends BaseController { ...@@ -257,7 +258,7 @@ public class PersonalCenterController extends BaseController {
if (expire > (60 * 4)) { if (expire > (60 * 4)) {
return ResponseData.error("请勿频繁发送手机验证码操作!"); return ResponseData.error("请勿频繁发送手机验证码操作!");
} }
String verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
stringRedisTemplate.opsForValue().set(code, verificationCode, CODETIME, TimeUnit.MILLISECONDS); stringRedisTemplate.opsForValue().set(code, verificationCode, CODETIME, TimeUnit.MILLISECONDS);
try { try {
if (sysUser.getPhone().length() == 11) { if (sysUser.getPhone().length() == 11) {
......
...@@ -99,11 +99,13 @@ public class SaleCensusController extends BaseController{ ...@@ -99,11 +99,13 @@ public class SaleCensusController extends BaseController{
} }
sysUserWrapper.eq( "name", leader.trim()); sysUserWrapper.eq( "name", leader.trim());
List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper); List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper);
Wrapper<HhrUser> hhrUserWrapper = new EntityWrapper<>();
if(sysUserList.size()==0){ if(sysUserList.size()==0){
log.info("没有数据"); log.info("没有数据");
} }
Wrapper<HhrUser> hhrUserWrapper = new EntityWrapper<>(); else{
hhrUserWrapper.eq("parent_id",sysUserList.get(0).getId()); hhrUserWrapper.eq("parent_id",sysUserList.get(0).getId());
}
List<HhrUser> hhrUserList = hhrUserMapper.selectList(hhrUserWrapper); List<HhrUser> hhrUserList = hhrUserMapper.selectList(hhrUserWrapper);
if(hhrUserList.size()==0){ if(hhrUserList.size()==0){
log.info("没有数据"); log.info("没有数据");
......
package com.winsun.controller; package com.winsun.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
...@@ -44,8 +16,22 @@ import com.winsun.mapper.SchoolMapper; ...@@ -44,8 +16,22 @@ import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SysUserMapper; import com.winsun.mapper.SysUserMapper;
import com.winsun.utils.ImportExcel; import com.winsun.utils.ImportExcel;
import com.winsun.utils.MapUtil; import com.winsun.utils.MapUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
/** /**
* 销售订单 * 销售订单
...@@ -85,15 +71,15 @@ public class SalesListController extends BaseController{ ...@@ -85,15 +71,15 @@ public class SalesListController extends BaseController{
private static SalesListMapper salesListMapper; private static SalesListMapper salesListMapper;
private static SysUserMapper sysUserMapper; private static SysUserMapper sysUserMapper;
private static SchoolMapper schoolMapper; private static SchoolMapper schoolMapper;
private List<Map<String, Object>> exportList = new ArrayList<Map<String,Object>>(); private static ThreadLocal<List<Map<String, Object>>> exportList = new ThreadLocal<>();
private SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Autowired @Autowired
public SalesListController(SalesListMapper salesListMapper,SysUserMapper sysUserMapper,SchoolMapper schoolMapper) { public SalesListController(SalesListMapper salesListMapper,SysUserMapper sysUserMapper,SchoolMapper schoolMapper) {
SalesListController.salesListMapper = salesListMapper; SalesListController.salesListMapper = salesListMapper;
SalesListController.sysUserMapper = sysUserMapper; SalesListController.sysUserMapper = sysUserMapper;
SalesListController.schoolMapper = schoolMapper; SalesListController.schoolMapper = schoolMapper;
exportList.set(new ArrayList<>());
} }
@Permission(menuname = "获取销售订单列表", value ="/list", method = RequestMethod.POST) @Permission(menuname = "获取销售订单列表", value ="/list", method = RequestMethod.POST)
...@@ -287,9 +273,9 @@ public class SalesListController extends BaseController{ ...@@ -287,9 +273,9 @@ public class SalesListController extends BaseController{
listMap.remove(0); listMap.remove(0);
Map<String, Object> resultMap = dealUploadData(listMap); Map<String, Object> resultMap = dealUploadData(listMap);
int num = (int)resultMap.get("num"); int num = (int)resultMap.get("num");
exportList = (List<Map<String, Object>>)resultMap.get("infoList"); exportList.set((List<Map<String, Object>>)resultMap.get("infoList"));
info.append("导入" + num+ "条数据!"); info.append("导入" + num+ "条数据!");
if(exportList.size() > 0) { if(exportList.get().size() > 0) {
info.append("返回导入结果清单!"); info.append("返回导入结果清单!");
} }
...@@ -592,6 +578,7 @@ public class SalesListController extends BaseController{ ...@@ -592,6 +578,7 @@ public class SalesListController extends BaseController{
int num = 0; int num = 0;
try { try {
SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for(Map<String, Object> map : list) { for(Map<String, Object> map : list) {
SalesList order = new SalesList(); SalesList order = new SalesList();
order.setId((int)map.get("id")); order.setId((int)map.get("id"));
...@@ -743,7 +730,7 @@ public class SalesListController extends BaseController{ ...@@ -743,7 +730,7 @@ public class SalesListController extends BaseController{
}); });
//数据 //数据
int rowIndex = row.getRowNum(); int rowIndex = row.getRowNum();
for (Map<String, Object> maps: exportList) { for (Map<String, Object> maps: exportList.get()) {
final XSSFRow rowdata = sheet.createRow(++rowIndex); final XSSFRow rowdata = sheet.createRow(++rowIndex);
for (String column : columns) { for (String column : columns) {
XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0)); XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0));
...@@ -761,7 +748,7 @@ public class SalesListController extends BaseController{ ...@@ -761,7 +748,7 @@ public class SalesListController extends BaseController{
workbook.write(os); workbook.write(os);
os.flush(); os.flush();
exportList = null; exportList.set(new ArrayList<>());
} catch (Exception e) { } catch (Exception e) {
log.error("文件出错!" + e.getMessage(), e); log.error("文件出错!" + e.getMessage(), e);
} finally { } finally {
......
package com.winsun.controller; package com.winsun.controller;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.winsun.auth.core.base.controller.BaseController; import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.util.ResponseEntity; import com.winsun.auth.core.util.ResponseEntity;
import com.winsun.bean.SalesList; import com.winsun.bean.SalesList;
import com.winsun.mapper.SalesListMapper; import com.winsun.mapper.SalesListMapper;
import com.winsun.smsUtils.SendSmsAndMail; import com.winsun.smsUtils.SendSmsAndMail;
import com.winsun.utils.MapUtil; import com.winsun.utils.MapUtil;
import com.winsun.utils.RandomUtil;
import cn.hutool.http.Method;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/** /**
* *
...@@ -97,7 +94,7 @@ public class SalesListMobileController extends BaseController { ...@@ -97,7 +94,7 @@ public class SalesListMobileController extends BaseController {
public Object phoneLoginCodeY(@RequestParam("phone") String phone){ public Object phoneLoginCodeY(@RequestParam("phone") String phone){
//5分钟内有效 //5分钟内有效
String verificationCode = String.valueOf((int) ((Math.random() * 9 + 1) * 100000)); String verificationCode = String.valueOf((int) ((RandomUtil.getSecrityRandom() * 9 + 1) * 100000));
String code = phone + CODE; String code = phone + CODE;
Long expire = stringRedisTemplate.getExpire(code); Long expire = stringRedisTemplate.getExpire(code);
//验证码 有效时间是五分钟倒计时 //验证码 有效时间是五分钟倒计时
......
...@@ -77,9 +77,7 @@ public class SalesOrderController extends BaseController{ ...@@ -77,9 +77,7 @@ public class SalesOrderController extends BaseController{
private static SchoolMapper schoolMapper; private static SchoolMapper schoolMapper;
private static HhrUserMapper hhrUserMapper; private static HhrUserMapper hhrUserMapper;
private List<Map<String, Object>> exportList = new ArrayList<Map<String,Object>>(); private ThreadLocal<List<Map<String, Object>>> exportList = new ThreadLocal<>();
private SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Autowired @Autowired
public SalesOrderController(SalesOrderMapper salesOrderMapper,SysUserMapper sysUserMapper, public SalesOrderController(SalesOrderMapper salesOrderMapper,SysUserMapper sysUserMapper,
SchoolMapper schoolMapper,HhrUserMapper hhrUserMapper) { SchoolMapper schoolMapper,HhrUserMapper hhrUserMapper) {
...@@ -87,6 +85,7 @@ public class SalesOrderController extends BaseController{ ...@@ -87,6 +85,7 @@ public class SalesOrderController extends BaseController{
SalesOrderController.sysUserMapper = sysUserMapper; SalesOrderController.sysUserMapper = sysUserMapper;
SalesOrderController.schoolMapper = schoolMapper; SalesOrderController.schoolMapper = schoolMapper;
SalesOrderController.hhrUserMapper = hhrUserMapper; SalesOrderController.hhrUserMapper = hhrUserMapper;
exportList.set(new ArrayList<Map<String, Object>>());
} }
@Permission(menuname = "获取放号充值达标数据列表", value ="/list", method = RequestMethod.POST) @Permission(menuname = "获取放号充值达标数据列表", value ="/list", method = RequestMethod.POST)
...@@ -571,9 +570,10 @@ public class SalesOrderController extends BaseController{ ...@@ -571,9 +570,10 @@ public class SalesOrderController extends BaseController{
listMap.remove(0); listMap.remove(0);
Map<String, Object> resultMap = dealUploadData(listMap); Map<String, Object> resultMap = dealUploadData(listMap);
int num = (int)resultMap.get("num"); int num = (int)resultMap.get("num");
exportList = (List<Map<String, Object>>)resultMap.get("infoList"); exportList.set((List<Map<String, Object>>)resultMap.get("infoList"));
// exportList = (List<Map<String, Object>>)resultMap.get("infoList");
info.append("导入" + num+ "条数据!"); info.append("导入" + num+ "条数据!");
if(exportList.size() > 0) { if(exportList.get().size() > 0) {
info.append("返回导入结果清单!"); info.append("返回导入结果清单!");
} }
...@@ -874,8 +874,8 @@ public class SalesOrderController extends BaseController{ ...@@ -874,8 +874,8 @@ public class SalesOrderController extends BaseController{
// 更新审核结果到销售订单 // 更新审核结果到销售订单
public int updateAuditResult(List<Map<String, Object>> list) { public int updateAuditResult(List<Map<String, Object>> list) {
int num = 0; int num = 0;
try { try {
SimpleDateFormat sFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for(Map<String, Object> map : list) { for(Map<String, Object> map : list) {
SalesOrder order = new SalesOrder(); SalesOrder order = new SalesOrder();
order.setId((int)map.get("id")); order.setId((int)map.get("id"));
...@@ -1027,7 +1027,7 @@ public class SalesOrderController extends BaseController{ ...@@ -1027,7 +1027,7 @@ public class SalesOrderController extends BaseController{
}); });
//数据 //数据
int rowIndex = row.getRowNum(); int rowIndex = row.getRowNum();
for (Map<String, Object> maps: exportList) { for (Map<String, Object> maps: exportList.get()) {
final XSSFRow rowdata = sheet.createRow(++rowIndex); final XSSFRow rowdata = sheet.createRow(++rowIndex);
for (String column : columns) { for (String column : columns) {
XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0)); XSSFCell cell = rowdata.createCell(Math.max(rowdata.getLastCellNum(), 0));
...@@ -1045,7 +1045,7 @@ public class SalesOrderController extends BaseController{ ...@@ -1045,7 +1045,7 @@ public class SalesOrderController extends BaseController{
workbook.write(os); workbook.write(os);
os.flush(); os.flush();
exportList = null; exportList.set(new ArrayList<>());
} catch (Exception e) { } catch (Exception e) {
log.error("文件出错!" + e.getMessage(), e); log.error("文件出错!" + e.getMessage(), e);
} finally { } finally {
......
package com.winsun.controller; package com.winsun.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.enums.SqlLike; import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
...@@ -33,8 +19,20 @@ import com.winsun.mapper.SchoolMapper; ...@@ -33,8 +19,20 @@ import com.winsun.mapper.SchoolMapper;
import com.winsun.mapper.SchoolPackageMapper; import com.winsun.mapper.SchoolPackageMapper;
import com.winsun.utils.FileUtil; import com.winsun.utils.FileUtil;
import com.winsun.utils.MyBatisPlusUpdateUtils; import com.winsun.utils.MyBatisPlusUpdateUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Author: chancy * @Author: chancy
......
...@@ -127,7 +127,7 @@ public class UserDeployController extends BaseController { ...@@ -127,7 +127,7 @@ public class UserDeployController extends BaseController {
List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper); List<SysUser> sysUserList = sysUserMapper.selectList(sysUserWrapper);
return ResponseData.success(sysUserList); return ResponseData.success(sysUserList);
} }
return ResponseData.success(null); return ResponseData.success();
} }
/** /**
* 初始合伙人列表 * 初始合伙人列表
......
...@@ -56,7 +56,7 @@ public class YxtCouponController extends BaseController { ...@@ -56,7 +56,7 @@ public class YxtCouponController extends BaseController {
* KPI信息模板列名 * KPI信息模板列名
*/ */
private static String SL_cardNumber = "兑换券账号"; private static String SL_cardNumber = "兑换券账号";
private static String SL_password = "密码"; private static String SL_cypher = "密码";
private static String SL_updateDate = "有效截止日期"; private static String SL_updateDate = "有效截止日期";
private static String SL_state = "出售状态(1:未售出,2:已售出,3:售出中)"; private static String SL_state = "出售状态(1:未售出,2:已售出,3:售出中)";
private static String SL_validityPeriod = "有效截止日期"; private static String SL_validityPeriod = "有效截止日期";
...@@ -258,7 +258,7 @@ public class YxtCouponController extends BaseController { ...@@ -258,7 +258,7 @@ public class YxtCouponController extends BaseController {
public ResponseData downloadMoBan() { public ResponseData downloadMoBan() {
ArrayList<String> columns = new ArrayList<>(); ArrayList<String> columns = new ArrayList<>();
columns.add(SL_cardNumber); columns.add(SL_cardNumber);
columns.add(SL_password); columns.add(SL_cypher);
columns.add(SL_validityPeriod); columns.add(SL_validityPeriod);
ServletOutputStream os = null; ServletOutputStream os = null;
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = new XSSFWorkbook();
...@@ -345,7 +345,7 @@ public class YxtCouponController extends BaseController { ...@@ -345,7 +345,7 @@ public class YxtCouponController extends BaseController {
if (!listMap.get(0).get("a").toString().equals(SL_cardNumber)) { if (!listMap.get(0).get("a").toString().equals(SL_cardNumber)) {
return ResponseData.error("模板不对,请选择正确的模板!"); return ResponseData.error("模板不对,请选择正确的模板!");
} }
if (!listMap.get(0).get("b").toString().equals(SL_password)) { if (!listMap.get(0).get("b").toString().equals(SL_cypher)) {
return ResponseData.error("模板不对,请选择正确的模板!"); return ResponseData.error("模板不对,请选择正确的模板!");
} }
if (!listMap.get(0).get("c").toString().equals(SL_validityPeriod)) { if (!listMap.get(0).get("c").toString().equals(SL_validityPeriod)) {
......
...@@ -201,7 +201,7 @@ public class YxtOrderController extends BaseController { ...@@ -201,7 +201,7 @@ public class YxtOrderController extends BaseController {
userIds0.add(sysUser.getId()); userIds0.add(sysUser.getId());
} }
if (sysUserList.size() == 0) { if (sysUserList.size() == 0) {
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page, "查询成功!"); return ResponseData.success(page, "查询成功!");
} }
...@@ -221,7 +221,7 @@ public class YxtOrderController extends BaseController { ...@@ -221,7 +221,7 @@ public class YxtOrderController extends BaseController {
schoolWrapper.in("id", schoolIds); schoolWrapper.in("id", schoolIds);
List<School> schoolList = schoolMapper.selectList(schoolWrapper); List<School> schoolList = schoolMapper.selectList(schoolWrapper);
if (schoolList.size() == 0) { if (schoolList.size() == 0) {
page.setRecords(null); page.setRecords(new ArrayList<>());
page.setTotal(0); page.setTotal(0);
return ResponseData.success(page, "查询成功!"); return ResponseData.success(page, "查询成功!");
} }
......
package com.winsun.tenpay.util; package com.winsun.tenpay.util;
import com.winsun.utils.RandomUtil;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.util.Random;
public class Sha1Util { public class Sha1Util {
...@@ -33,9 +34,8 @@ public class Sha1Util { ...@@ -33,9 +34,8 @@ public class Sha1Util {
// 获取随机字符串 // 获取随机字符串
public static String getNonceStr() { public static String getNonceStr() {
Random random = new Random();
return MD5Util return MD5Util
.MD5Encode(String.valueOf(random.nextInt(10000)), "UTF-8"); .MD5Encode(String.valueOf(RandomUtil.getSecrityRandomInt(10000)), "UTF-8");
} }
// 获取时间戳 // 获取时间戳
......
package com.winsun.tenpay.util; package com.winsun.tenpay.util;
import java.io.BufferedOutputStream; import javax.net.ssl.HttpsURLConnection;
import java.io.File; import javax.net.ssl.SSLContext;
import java.io.FileInputStream; import javax.net.ssl.SSLSocketFactory;
import java.io.FileOutputStream; import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.KeyStoreException; import java.security.KeyStoreException;
...@@ -16,19 +14,15 @@ import java.security.cert.CertificateException; ...@@ -16,19 +14,15 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.Locale; import java.util.Locale;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
public class TenpayHttpClient public class TenpayHttpClient
{ {
private static final String USER_AGENT_VALUE = "Mozilla/4.0 (compatible; MSIE 6.0; Windows XP)"; private static final String USER_AGENT_VALUE = "Mozilla/4.0 (compatible; MSIE 6.0; Windows XP)";
private static final String JKS_CA_FILENAME = "tenpay_cacert.jks"; private static final String JKS_CA_FILENAME = "tenpay_cacert.jks";
private static final String JKS_CA_ALIAS = "tenpay"; private static final String JKS_CA_ALIAS = "tenpay";
private static final String JKS_CA_PASSWORD = ""; private static final String JKS_CA_CYPHER = ""; // 密码
private File caFile; private File caFile;
private File certFile; private File certFile;
private String certPasswd; private String certCypher; //密码
private String reqContent; private String reqContent;
private String resContent; private String resContent;
private String method; private String method;
...@@ -42,7 +36,7 @@ public class TenpayHttpClient ...@@ -42,7 +36,7 @@ public class TenpayHttpClient
{ {
this.caFile = null; this.caFile = null;
this.certFile = null; this.certFile = null;
this.certPasswd = ""; this.certCypher = "";
this.reqContent = ""; this.reqContent = "";
this.resContent = ""; this.resContent = "";
...@@ -56,10 +50,10 @@ public class TenpayHttpClient ...@@ -56,10 +50,10 @@ public class TenpayHttpClient
this.inputStream = null; this.inputStream = null;
} }
public void setCertInfo(File certFile, String certPasswd) public void setCertInfo(File certFile, String certCypher)
{ {
this.certFile = certFile; this.certFile = certFile;
this.certPasswd = certPasswd; this.certCypher = certCypher;
} }
public void setCaInfo(File caFile) public void setCaInfo(File caFile)
...@@ -179,35 +173,53 @@ public class TenpayHttpClient ...@@ -179,35 +173,53 @@ public class TenpayHttpClient
{ {
X509Certificate cert = (X509Certificate) X509Certificate cert = (X509Certificate)
HttpClientUtil.getCertificate(this.caFile); HttpClientUtil.getCertificate(this.caFile);
FileOutputStream out = new FileOutputStream(jksCAFile);
HttpClientUtil.storeCACert(cert, "tenpay", FileOutputStream out = new FileOutputStream(jksCAFile);
"", out);
try{
out.close(); HttpClientUtil.storeCACert(cert, "tenpay",
"", out);
}catch (Exception e) {
throw e;
}finally{
out.close();
}
} }
FileInputStream trustStream = new FileInputStream(jksCAFile); FileInputStream trustStream = null;
FileInputStream keyStream = new FileInputStream(this.certFile); FileInputStream keyStream = null;
try{
SSLContext sslContext = HttpClientUtil.getSSLContext(trustStream, keyStream = new FileInputStream(this.certFile);
"", keyStream, this.certPasswd); trustStream = new FileInputStream(jksCAFile);
SSLContext sslContext = HttpClientUtil.getSSLContext(trustStream,
"", keyStream, this.certCypher);
keyStream.close();
trustStream.close(); if ("POST".equals(this.method.toUpperCase(Locale.ENGLISH)))
if ("POST".equals(this.method.toUpperCase(Locale.ENGLISH))) {
{ String url = HttpClientUtil.getURL(this.reqContent);
String url = HttpClientUtil.getURL(this.reqContent); String queryString = HttpClientUtil.getQueryString(this.reqContent);
String queryString = HttpClientUtil.getQueryString(this.reqContent); byte[] postData = queryString.getBytes(this.charset);
byte[] postData = queryString.getBytes(this.charset);
httpsPostMethod(url, postData, sslContext);
httpsPostMethod(url, postData, sslContext);
return;
return; }
httpsGetMethod(this.reqContent, sslContext);
}catch (Exception e) {
throw e;
}finally {
if (keyStream != null) {
try{
keyStream.close();
}catch(Exception e) {}
}
if (trustStream != null) {
try{
trustStream.close();
}catch(Exception e) {}
}
} }
httpsGetMethod(this.reqContent, sslContext);
} }
public boolean callHttpPost(String url, String postdata) public boolean callHttpPost(String url, String postdata)
...@@ -235,32 +247,54 @@ public class TenpayHttpClient ...@@ -235,32 +247,54 @@ public class TenpayHttpClient
if (!jksCAFile.isFile()) if (!jksCAFile.isFile())
{ {
X509Certificate cert = (X509Certificate)HttpClientUtil.getCertificate(this.caFile); X509Certificate cert = (X509Certificate)HttpClientUtil.getCertificate(this.caFile);
FileOutputStream out = null;
FileOutputStream out = new FileOutputStream(jksCAFile); try{
out = new FileOutputStream(jksCAFile);
HttpClientUtil.storeCACert(cert, "tenpay", "123456", out); HttpClientUtil.storeCACert(cert, "tenpay", "123456", out);
}catch (Exception e) {
out.close(); throw e;
}finally {
if (out != null) {
try{
out.close();
}catch(Exception e) {
}
}
}
} }
FileInputStream trustStream = new FileInputStream(jksCAFile); FileInputStream trustStream = null;
FileInputStream keyStream = new FileInputStream(this.certFile); FileInputStream keyStream = null;
try {
SSLContext sslContext = HttpClientUtil.getSSLContext(trustStream, "123456", keyStream, keyStream = new FileInputStream(this.certFile);
this.certPasswd); trustStream = new FileInputStream(jksCAFile);
SSLContext sslContext = HttpClientUtil.getSSLContext(trustStream, "123456", keyStream,
this.certCypher);
if ("POST".equals(this.method.toUpperCase(Locale.ENGLISH)))
{
String url = HttpClientUtil.getURL(this.reqContent);
byte[] postData = xml.getBytes(this.charset);
keyStream.close(); httpsPostMethodXml(url, postData, sslContext);
trustStream.close();
if ("POST".equals(this.method.toUpperCase(Locale.ENGLISH))) return;
{ }
String url = HttpClientUtil.getURL(this.reqContent); httpsGetMethod(this.reqContent, sslContext);
byte[] postData = xml.getBytes(this.charset); }catch(Exception e) {
throw e;
httpsPostMethodXml(url, postData, sslContext); }finally {
if (keyStream != null) {
return; try{
keyStream.close();
}catch (Exception e) {}
}
if (trustStream != null) {
try{
trustStream.close();
}catch (Exception e) {}
}
} }
httpsGetMethod(this.reqContent, sslContext);
} }
protected void httpPostMethod(String url, byte[] postData) protected void httpPostMethod(String url, byte[] postData)
......
package com.winsun.tenpay.util; package com.winsun.tenpay.util;
import java.text.SimpleDateFormat; import com.winsun.utils.RandomUtil;
import java.util.Date;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
public class TenpayUtil public class TenpayUtil
{ {
...@@ -46,7 +48,7 @@ public class TenpayUtil ...@@ -46,7 +48,7 @@ public class TenpayUtil
public static int buildRandom(int length) public static int buildRandom(int length)
{ {
int num = 1; int num = 1;
double random = Math.random(); double random = RandomUtil.getSecrityRandom();
if (random < 0.1D) { if (random < 0.1D) {
random += 0.1D; random += 0.1D;
} }
......
package com.winsun.tenpay.util; package com.winsun.tenpay.util;
import java.util.Random; import com.winsun.utils.RandomUtil;
public class WXUtil public class WXUtil
{ {
public static String getNonceStr() public static String getNonceStr()
{ {
Random random = new Random(); return MD5Util.MD5Encode(String.valueOf(RandomUtil.getSecrityRandomInt(10000)), "GBK");
return MD5Util.MD5Encode(String.valueOf(random.nextInt(10000)), "GBK");
} }
public static String getTimeStamp() public static String getTimeStamp()
......
...@@ -2,11 +2,8 @@ package com.winsun.service; ...@@ -2,11 +2,8 @@ package com.winsun.service;
import com.baomidou.mybatisplus.enums.SqlLike; import com.baomidou.mybatisplus.enums.SqlLike;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.winsun.auth.core.base.controller.BaseController; import com.winsun.auth.core.base.controller.BaseController;
import com.winsun.auth.core.util.IOUtils; import com.winsun.auth.core.util.IOUtils;
import com.winsun.auth.core.util.TimeUtil;
import com.winsun.bean.ExportExcel; import com.winsun.bean.ExportExcel;
import com.winsun.bean.Order; import com.winsun.bean.Order;
import com.winsun.constant.FilePath; import com.winsun.constant.FilePath;
...@@ -150,8 +147,9 @@ public class ExportService extends BaseController { ...@@ -150,8 +147,9 @@ public class ExportService extends BaseController {
dir.mkdirs(); dir.mkdirs();
} }
FileOutputStream os = null; FileOutputStream os = null;
XSSFWorkbook workbook = new XSSFWorkbook(); XSSFWorkbook workbook = null;
try { try {
workbook = new XSSFWorkbook();
os = new FileOutputStream(filePath1); os = new FileOutputStream(filePath1);
//创建工作表 //创建工作表
XSSFSheet sheet = workbook.createSheet("订单清单"); XSSFSheet sheet = workbook.createSheet("订单清单");
...@@ -194,7 +192,16 @@ public class ExportService extends BaseController { ...@@ -194,7 +192,16 @@ public class ExportService extends BaseController {
} catch (Exception e) { } catch (Exception e) {
log.error("文件出错!" + e.getMessage(), e); log.error("文件出错!" + e.getMessage(), e);
} finally { } finally {
IOUtils.closeQuite(workbook, os); if (workbook != null) {
try{
IOUtils.closeQuite(workbook);
}catch(Exception e) {}
}
if (os != null) {
try{
IOUtils.closeQuite(os);
}catch(Exception e) {}
}
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment