|
|
@ -12,6 +12,7 @@ import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
|
|
import com.dreamchaser.depository_manage.utils.WordUtil; |
|
|
import com.dreamchaser.depository_manage.utils.WordUtil; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.thymeleaf.util.ArrayUtils; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
@ -31,6 +32,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件插入数据 |
|
|
* 根据条件插入数据 |
|
|
|
|
|
* |
|
|
* @param map 参数map |
|
|
* @param map 参数map |
|
|
* @return 影响条数 |
|
|
* @return 影响条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -109,6 +111,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件查询数据 |
|
|
* 根据条件查询数据 |
|
|
|
|
|
* |
|
|
* @param map |
|
|
* @param map |
|
|
* @return 影响条数 |
|
|
* @return 影响条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -136,6 +139,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件查询对应的总条数 |
|
|
* 根据条件查询对应的总条数 |
|
|
|
|
|
* |
|
|
* @param map 条件参数 |
|
|
* @param map 条件参数 |
|
|
* @return 查询条数 |
|
|
* @return 查询条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -146,6 +150,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据主键id删除数据 |
|
|
* 根据主键id删除数据 |
|
|
|
|
|
* |
|
|
* @param id |
|
|
* @param id |
|
|
* @return 影响条数 |
|
|
* @return 影响条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -163,6 +168,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据多个主键id删除多条数据 |
|
|
* 根据多个主键id删除多条数据 |
|
|
|
|
|
* |
|
|
* @param list |
|
|
* @param list |
|
|
* @return 影响条数 |
|
|
* @return 影响条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -173,6 +179,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据主键id获取数据信息 |
|
|
* 根据主键id获取数据信息 |
|
|
|
|
|
* |
|
|
* @param id |
|
|
* @param id |
|
|
* @return 查询结果 |
|
|
* @return 查询结果 |
|
|
*/ |
|
|
*/ |
|
|
@ -183,6 +190,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件修改对应数据信息 |
|
|
* 根据条件修改对应数据信息 |
|
|
|
|
|
* |
|
|
* @param map |
|
|
* @param map |
|
|
* @return 影响条数 |
|
|
* @return 影响条数 |
|
|
*/ |
|
|
*/ |
|
|
@ -193,6 +201,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件修改状态 |
|
|
* 根据条件修改状态 |
|
|
|
|
|
* |
|
|
* @param map |
|
|
* @param map |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -203,6 +212,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询所有数据信息 |
|
|
* 查询所有数据信息 |
|
|
|
|
|
* |
|
|
* @return 所有数据 |
|
|
* @return 所有数据 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@ -212,6 +222,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据主键id将仓库状态改为删除 |
|
|
* 根据主键id将仓库状态改为删除 |
|
|
|
|
|
* |
|
|
* @param id |
|
|
* @param id |
|
|
* @return 受影响数目 |
|
|
* @return 受影响数目 |
|
|
*/ |
|
|
*/ |
|
|
@ -222,6 +233,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据多个主键id将对应仓库状态改为删除 |
|
|
* 根据多个主键id将对应仓库状态改为删除 |
|
|
|
|
|
* |
|
|
* @param ids |
|
|
* @param ids |
|
|
* @return 受影响数目 |
|
|
* @return 受影响数目 |
|
|
*/ |
|
|
*/ |
|
|
@ -232,6 +244,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 计算未删除仓库综合 |
|
|
* 计算未删除仓库综合 |
|
|
|
|
|
* |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@ -241,6 +254,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取本部门以及个人管理仓库的名称和id |
|
|
* 获取本部门以及个人管理仓库的名称和id |
|
|
|
|
|
* |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@ -277,9 +291,9 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据仓库名称获取当前仓库库存容量 |
|
|
* 根据仓库名称获取当前仓库库存容量 |
|
|
|
|
|
* |
|
|
* @param dname |
|
|
* @param dname |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -298,6 +312,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据父级获取子类 |
|
|
* 根据父级获取子类 |
|
|
|
|
|
* |
|
|
* @param id |
|
|
* @param id |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -307,10 +322,9 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据多个主键id获取对应数据 |
|
|
* 根据多个主键id获取对应数据 |
|
|
|
|
|
* |
|
|
* @param ids |
|
|
* @param ids |
|
|
* @return 搜索结果 |
|
|
* @return 搜索结果 |
|
|
*/ |
|
|
*/ |
|
|
@ -321,6 +335,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 构造树形选择框 |
|
|
* 构造树形选择框 |
|
|
|
|
|
* |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@ -340,6 +355,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据部门构造树形选择框 |
|
|
* 根据部门构造树形选择框 |
|
|
|
|
|
* |
|
|
* @param adminorg |
|
|
* @param adminorg |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -360,9 +376,9 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前部门以及公共仓库 |
|
|
* 获取当前部门以及公共仓库 |
|
|
|
|
|
* |
|
|
* @param adminorg |
|
|
* @param adminorg |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -374,6 +390,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据仓库编码获取仓库 |
|
|
* 根据仓库编码获取仓库 |
|
|
|
|
|
* |
|
|
* @param code |
|
|
* @param code |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -384,6 +401,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前用户与其部门所管理的仓库 |
|
|
* 获取当前用户与其部门所管理的仓库 |
|
|
|
|
|
* |
|
|
* @param userByPort |
|
|
* @param userByPort |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -394,23 +412,23 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
|
|
|
|
|
|
// 仓库id列表
|
|
|
// 仓库id列表
|
|
|
List<Depository> depositoryList = new ArrayList<>(); |
|
|
List<Depository> depositoryList = new ArrayList<>(); |
|
|
// 添加到id列表
|
|
|
// 添加到列表
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
depositoryList.addAll(depositoryByAdminorg); |
|
|
depositoryList.add(depository); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前用户管理的仓库
|
|
|
// 获取当前用户管理的仓库
|
|
|
List<RoleAndDepository> depositoryAndRole = roleMapper.findDepositoryAndRole(userByPort.getId()); |
|
|
List<RoleAndDepository> depositoryAndRole = roleMapper.findDepositoryAndRole(userByPort.getId()); |
|
|
|
|
|
|
|
|
for (int i = 0; i < depositoryAndRole.size(); i++) { |
|
|
for (int i = 0; i < depositoryAndRole.size(); i++) { |
|
|
RoleAndDepository roleAndDepository = depositoryAndRole.get(i); |
|
|
RoleAndDepository roleAndDepository = depositoryAndRole.get(i); |
|
|
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(roleAndDepository.getDepositoryId()); |
|
|
// 如果重复则跳过
|
|
|
// 如果重复则跳过
|
|
|
if(depositoryList.get(i).getId().compareTo(roleAndDepository.getDepositoryId()) == 0){ |
|
|
if (hasDepository(depositoryList,depositoryRecordById)) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} else { |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(roleAndDepository.getDepositoryId()); |
|
|
|
|
|
depositoryList.add(depositoryRecordById); |
|
|
depositoryList.add(depositoryRecordById); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
return depositoryList; |
|
|
return depositoryList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -425,7 +443,6 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据id获取子类
|
|
|
// 根据id获取子类
|
|
|
public List<Object> findChildForDepositoryByParent(Integer id, String adminorg) { |
|
|
public List<Object> findChildForDepositoryByParent(Integer id, String adminorg) { |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
@ -510,8 +527,7 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -525,10 +541,21 @@ public class DepositoryServiceImpl implements DepositoryService { |
|
|
map.put("id", d.getId()); |
|
|
map.put("id", d.getId()); |
|
|
map.put("children", children); |
|
|
map.put("children", children); |
|
|
return map; |
|
|
return map; |
|
|
} |
|
|
} else { |
|
|
else{ |
|
|
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean hasDepository(List<Depository> list,Depository o){ |
|
|
|
|
|
boolean flag = false; |
|
|
|
|
|
for (Depository depository : list) { |
|
|
|
|
|
if (depository.getCode().equals(o.getCode())) { |
|
|
|
|
|
flag = true; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return flag; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|