Commit 6055960d by 墨竹

feat:新增查询在哪个表接口

parent b68ab71c
......@@ -13,7 +13,6 @@ import com.gic.redis.data.util.GicRateLimiter;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -40,7 +39,7 @@ import java.util.stream.Collectors;
public class TestController extends WebBaseController {
private static final Logger logger= LoggerFactory.getLogger(TestController.class);
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
......@@ -85,16 +84,16 @@ public class TestController extends WebBaseController {
}
@RequestMapping("/test-dubbo")
public HaobanResponse dubbo(@RequestParam(defaultValue = "2000") Integer n,@RequestParam(defaultValue = "100") String t) {
int i=n;
while (i-->0) {
public HaobanResponse dubbo(@RequestParam(defaultValue = "2000") Integer n, @RequestParam(defaultValue = "100") String t) {
int i = n;
while (i-- > 0) {
int finalI = i;
pools.execute(new Runnable(){
pools.execute(new Runnable() {
@Override
public void run() {
long start = System.currentTimeMillis();
testApiService.checkThread(finalI +"",Long.valueOf(t));
logger.info("时间:{}",System.currentTimeMillis()-start);
testApiService.checkThread(finalI + "", Long.valueOf(t));
logger.info("时间:{}", System.currentTimeMillis() - start);
}
});
}
......@@ -103,12 +102,12 @@ public class TestController extends WebBaseController {
@RequestMapping("/del-department-batch")
public HaobanResponse departmentDel(String departmentId) {
String key="del-department-batch";
String key = "del-department-batch";
Object cache = RedisUtil.getCache(key);
if (null != cache) {
return resultResponse(HaoBanErrCode.ERR_0);
}
RedisUtil.setCache(key,1,120L, TimeUnit.SECONDS);
RedisUtil.setCache(key, 1, 120L, TimeUnit.SECONDS);
DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId);
if (null == departmentDTO) {
return resultResponse(HaoBanErrCode.ERR_0);
......@@ -127,10 +126,10 @@ public class TestController extends WebBaseController {
@RequestMapping("/lock")
public HaobanResponse lock(String name,Long time,int ty) {
public HaobanResponse lock(String name, Long time, int ty) {
RedisUtil.lock(name, time, TimeUnit.SECONDS, 0L);
if (ty==0) {
if(RedisUtil.isLocked(name)){
if (ty == 0) {
if (RedisUtil.isLocked(name)) {
RedisUtil.unlock(name);
}
}
......@@ -140,24 +139,24 @@ public class TestController extends WebBaseController {
@RequestMapping("/maidian-log")
public HaobanResponse maidian(String hbversion, BasePageInfo pageInfo) {
Page<MaidianLogDTO> page = maidianLogApiService.queryList(hbversion, pageInfo);
return resultResponse(HaoBanErrCode.ERR_1,page);
return resultResponse(HaoBanErrCode.ERR_1, page);
}
@RequestMapping("/deal-slef-qywx-sys-department")
public HaobanResponse dealSys1(String corpid,String secretVal,String dataId) {
public HaobanResponse dealSys1(String corpid, String secretVal, String dataId) {
testApiService.listSelfQywxUser(corpid, secretVal, dataId);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/deal-all-qywx-sys-department")
public HaobanResponse dealSys2(String corpid,String secretVal,String dataId) {
public HaobanResponse dealSys2(String corpid, String secretVal, String dataId) {
testApiService.listAllQywxUser(corpid, secretVal, dataId);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/test-limiter")
public HaobanResponse testLimiter(String key, String eid) {
if (StringUtils.isAnyBlank(key,eid)) {
if (StringUtils.isAnyBlank(key, eid)) {
return resultResponse(HaoBanErrCode.ERR_5);
}
GicRateLimiter instance = GicRateLimiter.getInstance("haoban-manage3-web");
......@@ -173,4 +172,17 @@ public class TestController extends WebBaseController {
wxEnterpriseRelatedApiService.initHistoryEnterprise(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 获取到分表到哪个表内
*
* @param enterpriseId
* @param count
* @return
*/
@RequestMapping("/test-table")
public HaobanResponse testTable(String enterpriseId, int count) {
int i = enterpriseId.hashCode() % count;
return resultResponse(HaoBanErrCode.ERR_1, i);
}
}
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