企业微信登录

master
yechenhao 6 years ago
parent 78bf8f8a8d
commit c01146c056

@ -81,13 +81,24 @@ public class StoreEmployeeController extends BaseController {
/**
*
* @param response
*/
@RequestMapping(value = "download/store/code/file",method = RequestMethod.POST)
@ResponseBody
public void downloadCodeBSD() {
try {
storeEmployeeService.downloadStoreUserCodeFromBSD();
} catch (Exception e) {
log.error("批量下载店铺二维码失败", e);
}
}
/**
*
*/
@RequestMapping(value = "download/store/code/bsd",method = RequestMethod.POST)
@ResponseBody
public void downloadCodeBSD(HttpServletResponse response) {
try {
storeEmployeeService.downloadStoreUserCodeFromBSD(response);
storeEmployeeService.downloadStoreUserCodeFile(response);
} catch (Exception e) {
log.error("批量下载店铺二维码失败", e);
}
@ -123,13 +134,25 @@ public class StoreEmployeeController extends BaseController {
/**
*
* @param response
*/
@RequestMapping(value = "download/store/seller/code/file",method = RequestMethod.POST)
@ResponseBody
public void downloadSellerCodeBSD() {
try {
storeEmployeeService.downloadStoreStaffCodeFromBSD();
} catch (Exception e) {
log.error("批量下载店铺二维码失败", e);
}
}
/**
*
*/
@RequestMapping(value = "download/store/seller/code/bsd",method = RequestMethod.POST)
@ResponseBody
public void downloadSellerCodeBSD(HttpServletResponse response) {
try {
storeEmployeeService.downloadStoreStaffCodeFromBSD(response);
storeEmployeeService.downloadStoreStaffCodeFile(response);
} catch (Exception e) {
log.error("批量下载店铺二维码失败", e);
}

@ -45,6 +45,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -299,9 +300,13 @@ public class StoreEmployeeService {
/**
*
*
* @param response
*/
public void downloadStoreUserCodeFromBSD(HttpServletResponse response) throws Exception {
@Scheduled(cron = "0 0 0 * * ?")
public void downloadStoreUserCodeFromBSD() throws Exception {
File zipFile = new File("store_qrCode.zip");
if (zipFile.exists()){
zipFile.delete();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//查询所有公司
QueryWrapper<PrivilageOrganizational> queryWrapper = new QueryWrapper<>();
@ -313,7 +318,7 @@ public class StoreEmployeeService {
File file = new File(fileUrl);
file.mkdir();
// 生成的ZIP文件名
String strZipName = "store_qrCode_" + fileUrl + ".zip";
String strZipName = "store_qrCode.zip";
FileOutputStream out = new FileOutputStream(new File(strZipName));
@ -381,18 +386,9 @@ public class StoreEmployeeService {
//将根文件转换为zip文件
ZipUtils.toZip(file.getPath(), out, true);
//将文件输入到response
ServletOutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
File zipFile = new File(strZipName);
FileInputStream inStream = new FileInputStream(zipFile);
int lenNew;
while ((lenNew = inStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, lenNew);
}
//删除文件,清理空间
file.delete();
zipFile.delete();
System.out.println("门店码生成成功");
}
}
@ -607,9 +603,13 @@ public class StoreEmployeeService {
/**
*
*
* @param response
*/
public void downloadStoreStaffCodeFromBSD(HttpServletResponse response) throws Exception {
@Scheduled(cron = "0 0 1 * * ?")
public void downloadStoreStaffCodeFromBSD() throws Exception {
File zipFile = new File("seller_qrCode.zip");
if (zipFile.exists()){
zipFile.delete();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//查询所有公司
//查询所有公司
@ -622,7 +622,7 @@ public class StoreEmployeeService {
File file = new File(fileUrl);
file.mkdir();
// 生成的ZIP文件名
String strZipName = "store_qrCode_" + fileUrl + ".zip";
String strZipName = "seller_qrCode.zip";
FileOutputStream out = new FileOutputStream(new File(strZipName));
//遍历零售公司
@ -694,18 +694,9 @@ public class StoreEmployeeService {
//将根文件转换为zip文件
ZipUtils.toZip(file.getPath(), out, true);
//将文件输入到response
ServletOutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
File zipFile = new File(strZipName);
FileInputStream inStream = new FileInputStream(zipFile);
int lenNew;
while ((lenNew = inStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, lenNew);
}
//删除文件,清理空间
file.delete();
zipFile.delete();
System.out.println("导购码生成成功");
}
}
@ -838,4 +829,30 @@ public class StoreEmployeeService {
importErrorDTO.setReason(reason);
results.add(importErrorDTO);
}
public void downloadStoreStaffCodeFile(HttpServletResponse response) throws IOException {
//将文件输入到response
ServletOutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
File zipFile = new File("seller_qrCode.zip");
FileInputStream inStream = new FileInputStream(zipFile);
int lenNew;
while ((lenNew = inStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, lenNew);
}
outputStream.flush();
}
public void downloadStoreUserCodeFile(HttpServletResponse response) throws IOException {
//将文件输入到response
ServletOutputStream outputStream = response.getOutputStream();
byte[] buffer = new byte[1024];
File zipFile = new File("store_qrCode.zip");
FileInputStream inStream = new FileInputStream(zipFile);
int lenNew;
while ((lenNew = inStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, lenNew);
}
outputStream.flush();
}
}

Loading…
Cancel
Save