|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.controller.market; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.annotation.TenantIgnore; |
|
|
|
@@ -31,8 +32,13 @@ import java.io.BufferedInputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -159,6 +165,12 @@ public class WxCouponPasswordController extends BaseController { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@RequestMapping("/exportTemplate") |
|
|
|
public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
wxCouponPasswordService.exportTemplate(request, response); |
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@PostMapping(value = "/importPrice", consumes = "multipart/*") |
|
|
|
@SystemControllerLog(description = "消费卡批量导入面额") |
|
|
|
@@ -237,10 +249,43 @@ public class WxCouponPasswordController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
asyncTask.importExcelData(lFile, user, importKey); |
|
|
|
asyncTask.importCardPriceData(lFile, user, importKey); |
|
|
|
|
|
|
|
return new ResultData(Result.SUCCESS, "模板正在导入"); |
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@GetMapping("/queryTemplateCount") |
|
|
|
public ResultData queryTemplateCount() { |
|
|
|
String importKey = Constant.importCardPrice + getUser().getId(); |
|
|
|
Map entries = stringRedisTemplate.opsForHash().entries(importKey); |
|
|
|
if (entries.size() < 4) { |
|
|
|
entries.clear(); |
|
|
|
return new ResultData(Result.SUCCESS, "ok", entries); |
|
|
|
} |
|
|
|
String allCount = entries.get("allCount").toString(); |
|
|
|
String allSuccessCount = entries.get("allSuccessCount").toString(); |
|
|
|
String processCount = entries.get("processCount").toString(); |
|
|
|
String failCount = entries.get("failCount").toString(); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); |
|
|
|
//完全失败 |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "allCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "processCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "failCount"); |
|
|
|
return new ResultData(ErrorCode.MEM_IMPORT_ERR); |
|
|
|
} |
|
|
|
//导入完成 |
|
|
|
if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(processCount)) { |
|
|
|
ResultData ok = new ResultData(Result.SUCCESS, "ok", entries); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "allCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "processCount"); |
|
|
|
stringRedisTemplate.opsForHash().delete(importKey, "failCount"); |
|
|
|
return ok; |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", entries); |
|
|
|
} |
|
|
|
|
|
|
|
} |