|
|
|
@@ -14,16 +14,20 @@ import com.iformall.enums.EnumUserAdmin; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.shiro.PasswordHelper; |
|
|
|
import com.iformall.sms.EnumSMSChannel; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Qualifier; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@Api(description = "初始化相关接口") |
|
|
|
@@ -85,6 +89,10 @@ public class WxProjectConfigController extends BaseController { |
|
|
|
@Autowired |
|
|
|
MallUserInfoService mallUserInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Qualifier("openRedisTemplate") |
|
|
|
RedisTemplate<String, String> openRedisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("添加商场基础数据") |
|
|
|
@GetMapping(value = "/init/{id}") |
|
|
|
@@ -577,5 +585,44 @@ public class WxProjectConfigController extends BaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("刷集团商场历史数据(五分钟内只能掉一次)") |
|
|
|
@PostMapping("/init/after/group") |
|
|
|
@SystemControllerLog(description = "商场-数据更新") |
|
|
|
public ResultData initAfterGroup(@RequestBody WxMall wxMall) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxProjectConfigController::initAfterGroup"); |
|
|
|
try { |
|
|
|
if(StringUtils.isBlank(wxMall.getTenantId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(wxMall.getParentTenantId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
TenantEntity TenantEntity = new TenantEntity(){{ |
|
|
|
setTenantId(wxMall.getParentTenantId()); |
|
|
|
}}; |
|
|
|
WxMall parentWxMall = wxMallService.getByTenantInfo(TenantEntity); |
|
|
|
if(parentWxMall == null || parentWxMall.getSaleType() != 100 |
|
|
|
|| !parentWxMall.getGroupSupport().equals(EnumGroupSupport.SUPPORT.getCode()) |
|
|
|
|| StringUtils.isNotBlank(parentWxMall.getParentTenantId())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); |
|
|
|
} |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.append(Constant.INTERFACE_VISIT_LIMIT_KEY).append("initAfterGroup"); |
|
|
|
String key = sb.toString(); |
|
|
|
boolean hasKey = openRedisTemplate.hasKey(key); |
|
|
|
if(hasKey){ |
|
|
|
return new ResultData(ErrorCode.TOO_MANY_REQUEST); |
|
|
|
}else{ |
|
|
|
openRedisTemplate.opsForValue().set(key,"1",3000, TimeUnit.SECONDS); |
|
|
|
} |
|
|
|
wxProjectConfigService.initAfterGroup(wxMall.getParentTenantId(),wxMall.getTenantId()); |
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
}catch (Exception e){ |
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |