|
|
|
@@ -1,5 +1,6 @@ |
|
|
|
package com.iformall.controller.rent; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.annotation.SystemControllerLog; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
@@ -14,6 +15,7 @@ import com.iformall.service.WxBillDailyService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -198,4 +200,40 @@ public class WxBillDailyController extends BaseController { |
|
|
|
return new ResultData(Result.SUCCESS, "模板正在导入"); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/queryTemplateCount") |
|
|
|
@SystemControllerLog(description = "日常费用账单-导入数据查询") |
|
|
|
public ResultData queryTemplateCount() { |
|
|
|
String importKey = Constant.importMemPrev + "bill_daily_" + getUser().getId(); |
|
|
|
Map entries = stringRedisTemplate.opsForHash().entries(importKey); |
|
|
|
logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>1"); |
|
|
|
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); |
|
|
|
logger.info(JSONArray.toJSONString(entries) + ">>>>>>>>>>>>>>>>>>>>>2"); |
|
|
|
//完全失败 |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
} |