Commit 48f6e5a1 by 墨竹

fix:删除无效代码

parent 1d2bc45f
...@@ -28,8 +28,6 @@ import com.gic.haoban.manage.api.service.DepartmentApiService; ...@@ -28,8 +28,6 @@ import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.SyncDepartmentQO;
import com.gic.haoban.manage.web.thread.SyncDepartmentThread;
import com.gic.haoban.manage.web.vo.DepartmentChainVO; import com.gic.haoban.manage.web.vo.DepartmentChainVO;
import com.gic.haoban.manage.web.vo.DepartmentVO; import com.gic.haoban.manage.web.vo.DepartmentVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
...@@ -37,9 +35,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -37,9 +35,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
...@@ -181,32 +177,6 @@ public class DepartmentContoller extends WebBaseController { ...@@ -181,32 +177,6 @@ public class DepartmentContoller extends WebBaseController {
} }
@RequestMapping("department-batch-sync")
@ResponseBody
public HaobanResponse departmentBatchSync(@RequestBody SyncDepartmentQO args) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
String key = "haoban-sync-department-" + wxEnterpriseId;
if (RedisUtil.getCache(key) != null) {
return resultResponse(HaoBanErrCode.ERR_10011);
}
Object editDepartmentObject = null;
Object addDepartmentObject = null;
String editDepartment = "";
String addDepartment = "";
String delDepartmentIds = "";
logger.info("【部门同步】args={}", JSON.toJSONString(args));
if (args != null) {
editDepartmentObject = args.getEditDepartment();
addDepartmentObject = args.getAddDepartment();
editDepartment = JSON.toJSONString(editDepartmentObject);
addDepartment = JSON.toJSONString(addDepartmentObject);
}
RedisUtil.setCache(key, 1, 3600L);
new SyncDepartmentThread(this, editDepartment, delDepartmentIds, addDepartment, key).start();
return resultResponse(HaoBanErrCode.ERR_1, key);
}
@RequestMapping("department-chain") @RequestMapping("department-chain")
public HaobanResponse departmentChain(String departmentId) { public HaobanResponse departmentChain(String departmentId) {
if (StringUtils.isBlank(departmentId)) { if (StringUtils.isBlank(departmentId)) {
......
...@@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -118,31 +117,6 @@ public class TestController extends WebBaseController { ...@@ -118,31 +117,6 @@ public class TestController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1); 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) -> {
val.forEach(departmentDTO1 -> {
departmentApiService.del(departmentDTO1.getDepartmentId());
});
});
RedisUtil.delCache(key);
return resultResponse(HaoBanErrCode.ERR_1);
}
@RequestMapping("/lock") @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); RedisUtil.lock(name, time, TimeUnit.SECONDS, 0L);
......
package com.gic.haoban.manage.web.thread;
import com.gic.haoban.manage.web.controller.DepartmentContoller;
import com.gic.redis.data.util.RedisUtil;
public class SyncDepartmentThread extends Thread{
DepartmentContoller departmentController;
String editDepartment;
String delDepartmentIds;
String addDepartment;
String key;
@Override
public void run() {
System.out.println("【开始同步】" + System.currentTimeMillis());
departmentController.syncDepartment(editDepartment, delDepartmentIds, addDepartment);
RedisUtil.delCache(key);
System.out.println("【结束同步】" + System.currentTimeMillis());
}
public SyncDepartmentThread(DepartmentContoller departmentController,String editDepartment,String delDepartmentIds,
String addDepartment,String key){
this.departmentController = departmentController;
this.editDepartment = editDepartment;
this.delDepartmentIds = delDepartmentIds;
this.addDepartment = addDepartment;
this.key = key;
}
}
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