Commit c3767707 by fudahua

删除接口

parent 936b48ff
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.contacts.manage.api.dto.StoreAddDTO;
import com.gic.haoban.manage.api.dto.SyncSingleDealDTO;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import org.junit.Test;
......@@ -13,22 +14,43 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Setest {
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService;
@Test
public void test() {
Map<String,String> ret=new HashMap<>();
ret.put("test","test");
ret.put("name","name11");
AES aes = SecureUtil.aes("test111111111113".getBytes());
String code = aes.encryptHex(JSONObject.toJSONString(ret));
System.out.println(code);
String str = aes.decryptStr(code);
System.out.println(str);
List<StoreAddDTO> list=new ArrayList<>();
{
StoreAddDTO storeAddDTO = new StoreAddDTO();
storeAddDTO.setBrandId("1");
storeAddDTO.setStoreName("1-1");
list.add(storeAddDTO);
}
{
StoreAddDTO storeAddDTO = new StoreAddDTO();
storeAddDTO.setBrandId("2");
storeAddDTO.setStoreName("2-1");
list.add(storeAddDTO);
}
{
StoreAddDTO storeAddDTO = new StoreAddDTO();
storeAddDTO.setBrandId("1");
storeAddDTO.setStoreName("1-2");
list.add(storeAddDTO);
}
{
StoreAddDTO storeAddDTO = new StoreAddDTO();
storeAddDTO.setBrandId("2");
storeAddDTO.setStoreName("2-2");
list.add(storeAddDTO);
}
Map<String, List<StoreAddDTO>> collect = list.stream().collect(Collectors.groupingBy(StoreAddDTO::getBrandId, Collectors.toList()));
System.out.println(JSONObject.toJSONString(collect));
}
......
......@@ -2,10 +2,13 @@ package com.gic.haoban.manage.web.controller;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo;
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.slf4j.Logger;
......@@ -16,8 +19,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Created 2020/4/9.
......@@ -42,6 +49,9 @@ public class TestController extends WebBaseController {
@Autowired
private TestApiService testApiService;
@Autowired
private DepartmentApiService departmentApiService;
@RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
QywxXcxSendMessageDTO messageDTO = EntityUtil.changeEntityByOrika(QywxXcxSendMessageDTO.class, qo);
......@@ -80,4 +90,26 @@ public class TestController extends WebBaseController {
}
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/del-department-batch")
public HaobanResponse departmentDel(String departmentId) {
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);
DepartmentDTO departmentDTO = departmentApiService.selectById(departmentId);
if (null == departmentDTO) {
return resultResponse(HaoBanErrCode.ERR_0);
}
List<DepartmentDTO> departmentDTOS = departmentApiService.listByChainId(departmentDTO.getChainId(), departmentDTO.getWxEnterpriseId());
TreeMap<Integer, List<DepartmentDTO>> treeMap = departmentDTOS.stream().collect(Collectors.groupingBy(DepartmentDTO::getLevel, TreeMap::new, Collectors.toList()));
treeMap.descendingMap().forEach((midKey, val) -> {
departmentApiService.del(departmentId);
});
RedisUtil.delCache(key);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
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