|
|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.dreamchaser.depository_manage.controller; |
|
|
|
|
|
|
|
import com.alibaba.excel.util.ListUtils; |
|
|
|
import com.dreamchaser.depository_manage.config.PublicConfig; |
|
|
|
import com.dreamchaser.depository_manage.entity.*; |
|
|
|
import com.dreamchaser.depository_manage.exception.MyException; |
|
|
|
import com.dreamchaser.depository_manage.pojo.*; |
|
|
|
@ -231,8 +232,8 @@ public class DepositoryController { |
|
|
|
userKey = (String) request.getSession().getAttribute("userKey"); |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
String finalUserKey = userKey; |
|
|
|
String finalToken = token; |
|
|
|
String finalUserKey = userKey; |
|
|
|
String finalToken = token; |
|
|
|
if (map.containsKey("id")) { |
|
|
|
Integer id = ObjectFormatUtil.toInteger(map.get("id")); |
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id.toString(), 3, true, finalUserKey, finalToken)); |
|
|
|
@ -242,7 +243,7 @@ public class DepositoryController { |
|
|
|
List<Integer> ids = (List<Integer>) map.get("ids"); |
|
|
|
for (Integer integer : ids) { |
|
|
|
String id = integer.toString(); |
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, 3, true, finalUserKey,finalToken)); |
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, 3, true, finalUserKey, finalToken)); |
|
|
|
} |
|
|
|
return CrudUtil.deleteHandle(depositoryService.changeStateToDeletedByIds(ids), ids.size()); |
|
|
|
} else { |
|
|
|
@ -289,14 +290,14 @@ public class DepositoryController { |
|
|
|
int state = ((int) map.get("state")); |
|
|
|
String id = (String) map.get("id"); |
|
|
|
if (state == 2) { |
|
|
|
String finalUserKey = userKey; |
|
|
|
String finalToken = token; |
|
|
|
String finalUserKey = userKey; |
|
|
|
String finalToken = token; |
|
|
|
if (map.containsKey("envelop")) { |
|
|
|
// 封库
|
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, state, true, finalUserKey, finalToken)); |
|
|
|
} else { |
|
|
|
// 禁用仓库
|
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, state, false, finalUserKey,finalToken)); |
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> UpdateSonState(id, state, false, finalUserKey, finalToken)); |
|
|
|
} |
|
|
|
} |
|
|
|
return CrudUtil.insertHandle(depositoryService.updateDepository(map), 1); |
|
|
|
@ -307,15 +308,15 @@ public class DepositoryController { |
|
|
|
* |
|
|
|
* @param parentId |
|
|
|
*/ |
|
|
|
public void UpdateSonState(String parentId, Integer state, boolean envelop, String userKey,String token) { |
|
|
|
public void UpdateSonState(String parentId, Integer state, boolean envelop, String userKey, String token) { |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("parentId", parentId); |
|
|
|
|
|
|
|
// 获取当前仓库所有子仓库
|
|
|
|
List<Depository> depositoryRecordPByCondition = depositoryService.findDepositoryByCondition(param, userKey,token); |
|
|
|
List<Depository> depositoryRecordPByCondition = depositoryService.findDepositoryByCondition(param, userKey, token); |
|
|
|
for (Depository depository : depositoryRecordPByCondition) { |
|
|
|
int depositoryId = depository.getId(); |
|
|
|
UpdateSonState(String.valueOf(depositoryId), state, envelop, userKey,token); |
|
|
|
UpdateSonState(String.valueOf(depositoryId), state, envelop, userKey, token); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("id", depositoryId); |
|
|
|
map.put("state", state); |
|
|
|
@ -383,7 +384,12 @@ public class DepositoryController { |
|
|
|
show_weekday.add("周日"); |
|
|
|
|
|
|
|
// 获取各仓库名称以及id
|
|
|
|
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
Map<String, Integer> depositoryAllNameAndId = new HashMap<>(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(userByPort.getMaindeparment())) { |
|
|
|
depositoryAllNameAndId = depositoryService.findAllDepositoryNameAndId(); |
|
|
|
} else { |
|
|
|
depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
} |
|
|
|
|
|
|
|
Iterator it = depositoryAllNameAndId.keySet().iterator(); |
|
|
|
|
|
|
|
@ -426,8 +432,7 @@ public class DepositoryController { |
|
|
|
show_data.putAll((Map<?, ?>) result); |
|
|
|
} |
|
|
|
depository_data.put("data", show_data); |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 定义线程
|
|
|
|
int threadSize = depositoryAllNameAndId.size(); |
|
|
|
ExecutorService exs = new ThreadPoolExecutor(threadSize, threadSize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(threadSize)); |
|
|
|
@ -487,8 +492,12 @@ public class DepositoryController { |
|
|
|
show_weekday.add("周日"); |
|
|
|
|
|
|
|
// 获取各仓库名称以及id
|
|
|
|
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
|
|
|
|
Map<String, Integer> depositoryAllNameAndId = new HashMap<>(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(userByPort.getMaindeparment())) { |
|
|
|
depositoryAllNameAndId = depositoryService.findAllDepositoryNameAndId(); |
|
|
|
} else { |
|
|
|
depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
} |
|
|
|
Map<String, Object> depository_data = new HashMap<>(); |
|
|
|
depository_data.put("week", show_weekday); |
|
|
|
if ("0".equals(type)) { |
|
|
|
@ -529,7 +538,12 @@ public class DepositoryController { |
|
|
|
show_weekday.add("周日"); |
|
|
|
|
|
|
|
// 获取各仓库名称以及id
|
|
|
|
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
Map<String, Integer> depositoryAllNameAndId = new HashMap<>(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(userByPort.getMaindeparment())) { |
|
|
|
depositoryAllNameAndId = depositoryService.findAllDepositoryNameAndId(); |
|
|
|
} else { |
|
|
|
depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
} |
|
|
|
|
|
|
|
int threadSize = 10; |
|
|
|
ExecutorService exs = new ThreadPoolExecutor(threadSize, threadSize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(threadSize)); |
|
|
|
@ -841,12 +855,11 @@ public class DepositoryController { |
|
|
|
Material materialById = materialService.findMaterialById(Integer.parseInt(mid)); |
|
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
|
param.put("depositoryId", materialById.getDepositoryId()); |
|
|
|
List<Depository> depositoryId = depositoryService.findDepositoryByCondition(param, userKey,token); |
|
|
|
List<Depository> depositoryId = depositoryService.findDepositoryByCondition(param, userKey, token); |
|
|
|
return new RestResponse(depositoryId.get(0), 1, 200); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查找仓库内是否有物品 |
|
|
|
* |
|
|
|
@ -1212,7 +1225,12 @@ public class DepositoryController { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
Map<Object, Object> getBarChartData(UserByPort userByPort) { |
|
|
|
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
Map<String, Integer> depositoryAllNameAndId = new HashMap<>(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(userByPort.getMaindeparment())) { |
|
|
|
depositoryAllNameAndId = depositoryService.findAllDepositoryNameAndId(); |
|
|
|
} else { |
|
|
|
depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); |
|
|
|
} |
|
|
|
int threadSize = 2; |
|
|
|
ExecutorService exs = new ThreadPoolExecutor(threadSize, threadSize, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(threadSize)); |
|
|
|
|
|
|
|
@ -1499,11 +1517,11 @@ public class DepositoryController { |
|
|
|
for (i = days.size() - 1; i > 0; i--) { |
|
|
|
// 遍历 Map并计算各仓库的入库数
|
|
|
|
// 获取一段时间内的库存额度
|
|
|
|
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i), days.get(i-1), Integer.parseInt(type), val); |
|
|
|
Double depositoryRecordByDate1 = depositoryRecordService.findApplicationRecordByDate(days.get(i), days.get(i - 1), Integer.parseInt(type), val); |
|
|
|
drCountbyDrName.add(depositoryRecordByDate1); |
|
|
|
} |
|
|
|
Collections.reverse(drCountbyDrName); |
|
|
|
map.put("data",drCountbyDrName); |
|
|
|
map.put("data", drCountbyDrName); |
|
|
|
result.put(val, map); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|