功能优化
This commit is contained in:
parent
b91a5304b4
commit
fdd2df4576
|
|
@ -176,4 +176,7 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "任务单号")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "唯一任务id")
|
||||
private String keyId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,27 +82,35 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
@Override
|
||||
public List<MaterialBackApplyInfo> selectBackApplyInfoList(MaterialBackApplyInfo backApplyInfo) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
backApplyInfo.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = null;
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
backApplyInfo.setProjectIdList(projectIdList);
|
||||
}
|
||||
backApplyInfo.setIdCard(null);
|
||||
}
|
||||
backApplyInfo.setIdCard(null);
|
||||
}
|
||||
List<MaterialBackApplyInfo> list = materialBackInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
// 如果列表为空,直接返回空列表
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
|
|
@ -186,23 +194,31 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
*/
|
||||
@Override
|
||||
public List<MaterialBackApplyInfo> getTotalList(MaterialBackApplyInfo backApplyInfo) {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
backApplyInfo.setProjectIdList(projectIdList);
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
BmTeam teamData = null;
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
backApplyInfo.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<MaterialBackApplyInfo> list = materialBackInfoMapper.getTotalList(backApplyInfo);
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
|
|
@ -227,6 +243,18 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
* @return
|
||||
*/
|
||||
private boolean hasSpecialRole(Set<String> userRoles) {
|
||||
if (userRoles == null) {
|
||||
return false;
|
||||
}
|
||||
List<String> allowedRoles = Collections.singletonList("clzcx");
|
||||
return allowedRoles.stream().anyMatch(userRoles::contains);
|
||||
}
|
||||
/**
|
||||
* 查询总站点退料详情数据
|
||||
* @param backApplyInfo
|
||||
|
|
@ -535,23 +563,31 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
@Override
|
||||
public List<MaterialBackApplyTotalInfo> getBackInfoDetails(MaterialBackApplyTotalInfo info) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
info.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = null;
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
info.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
BigDecimal backNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<MaterialBackApplyTotalInfo> list = materialBackInfoMapper.getBackInfoDetails(info);
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
|
|
|
|||
|
|
@ -101,29 +101,37 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
*/
|
||||
@Override
|
||||
public List<MaterialLeaseApplyInfo> selectLeaseApplyInfoList(MaterialLeaseApplyInfo leaseApplyInfo) {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
leaseApplyInfo.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = null;
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
leaseApplyInfo.setProjectIdList(projectIdList);
|
||||
}
|
||||
leaseApplyInfo.setIdCard(null);
|
||||
}
|
||||
leaseApplyInfo.setIdCard(null);
|
||||
}
|
||||
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
|
||||
// 利用Stream API进行降序排序
|
||||
List<MaterialLeaseApplyInfo> sortedList = list.stream()
|
||||
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime).reversed())
|
||||
.collect(Collectors.toList());
|
||||
// 数据权限划分,获取当前用户的deptId
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
|
||||
// 删除元素
|
||||
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
// 数据权限划分,获取当前用户的deptId
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
|
||||
// 删除元素
|
||||
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(sortedList)) {
|
||||
if (teamData != null) {
|
||||
|
|
@ -131,9 +139,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
sortedList = sortedList.stream()
|
||||
.filter(item -> StringUtils.isBlank(item.getTeamLeaderIdCard()) || username.equals(item.getTeamLeaderIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
} /*else {
|
||||
sortedList = filterByDataPermission(sortedList);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
// 处理剩余数据
|
||||
if (!CollectionUtils.isEmpty(sortedList)) {
|
||||
|
|
@ -154,6 +160,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
return sortedList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据权限过滤
|
||||
*
|
||||
|
|
@ -214,16 +221,22 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
*/
|
||||
@Override
|
||||
public List<MaterialLeaseApplyInfo> getTotalList(MaterialLeaseApplyInfo leaseApplyInfo) {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getAllProjectList(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
leaseApplyInfo.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = new BmTeam();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getAllProjectList(departId);
|
||||
if (!CollectionUtils.isEmpty(projectIdList)) {
|
||||
leaseApplyInfo.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 领料数据
|
||||
|
|
@ -251,10 +264,12 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime,
|
||||
Comparator.nullsLast(Comparator.naturalOrder())).reversed())
|
||||
.collect(Collectors.toList());
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
|
||||
// 删除元素
|
||||
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
|
||||
// 删除元素
|
||||
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(sortedList)) {
|
||||
// 班组数据权限
|
||||
|
|
@ -276,6 +291,19 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
return sortedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
* @return
|
||||
*/
|
||||
private boolean hasSpecialRole(Set<String> userRoles) {
|
||||
if (userRoles == null) {
|
||||
return false;
|
||||
}
|
||||
List<String> allowedRoles = Collections.singletonList("clzcx");
|
||||
return allowedRoles.stream().anyMatch(userRoles::contains);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点领料详情数据
|
||||
*
|
||||
|
|
@ -1192,25 +1220,33 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
@Override
|
||||
public List<LeaseTotalInfo> getLeaseInfoDetails(LeaseTotalInfo info) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
info.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = null;
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
info.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
BigDecimal preNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal pendingNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
List<LeaseTotalInfo> list = materialLeaseInfoMapper.getLeaseInfoDetails(info);
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
if (!hasSpecialRole) {
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (!CollectionUtils.isEmpty(list) && deptId != null) {
|
||||
// 删除元素
|
||||
list.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
// 班组长权限
|
||||
|
|
|
|||
|
|
@ -59,20 +59,26 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
*/
|
||||
@Override
|
||||
public List<Machine> getMachineInfo(Machine machine) {
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
machine.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = new BmTeam();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
machine.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 查询slt_agreement_info数据
|
||||
machine.setImpUnit(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
|
||||
}
|
||||
// 查询slt_agreement_info数据
|
||||
machine.setImpUnit(SecurityUtils.getLoginUser().getSysUser().getDeptId().toString());
|
||||
List<Machine> mergedList = materialMachineMapper.getMachineInfo(machine);
|
||||
if (!CollectionUtils.isEmpty(mergedList)) {
|
||||
// 班组权限
|
||||
|
|
@ -718,8 +724,11 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
if (StringUtils.isBlank(departId)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
List<String> projectIdList = mapper.getInProject(departId);
|
||||
List<BmProject> list = mapper.getProjectInfo(new BmProject());
|
||||
Set<Integer> agreementIdList = new HashSet<>();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
@ -751,21 +760,28 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
@Override
|
||||
public List<MaterialTotalMentInfo> getTotalList(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
BmTeam teamData = null;
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
// 根据用户名判断用户是否为班组长
|
||||
teamData = materialMachineMapper.getTeamData(username);
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (deptId != null) {
|
||||
bean.setImpUnit(deptId.toString());
|
||||
}
|
||||
}
|
||||
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
|
||||
if (deptId != null) {
|
||||
bean.setImpUnit(deptId.toString());
|
||||
}
|
||||
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
|
||||
if (!CollectionUtils.isEmpty(recordList)) {
|
||||
if (teamData != null) {
|
||||
|
|
@ -815,6 +831,19 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
return groupedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否具有特殊角色
|
||||
* @param userRoles
|
||||
* @return
|
||||
*/
|
||||
private boolean hasSpecialRole(Set<String> userRoles) {
|
||||
if (userRoles == null) {
|
||||
return false;
|
||||
}
|
||||
List<String> allowedRoles = Collections.singletonList("clzcx");
|
||||
return allowedRoles.stream().anyMatch(userRoles::contains);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工器具台账关键字查询
|
||||
* @param item
|
||||
|
|
|
|||
|
|
@ -322,4 +322,11 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
List<String> getAllProjectList(String departId);
|
||||
|
||||
/**
|
||||
* 获取在建工程信息
|
||||
* @param departId
|
||||
* @return
|
||||
*/
|
||||
List<String> getInProject(String departId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,6 +203,9 @@ public class LeaseApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "待出库数量")
|
||||
private BigDecimal pendingOutNum;
|
||||
|
||||
@ApiModelProperty(value = "任务唯一标识单号")
|
||||
private String keyId;
|
||||
|
||||
@ApiModelProperty(value = "领料物资名称汇总")
|
||||
private String maTypeNames;
|
||||
public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ public interface LeaseApplyDetailsMapper {
|
|||
* @param leaseOutDetails
|
||||
* @return
|
||||
*/
|
||||
LeaseApplyDetails getPendingCodeLeaseApplyDetails(LeaseOutDetails leaseOutDetails);
|
||||
List<LeaseApplyDetails> getPendingCodeLeaseApplyDetails(LeaseOutDetails leaseOutDetails);
|
||||
|
||||
/**
|
||||
* 查询待出库详情
|
||||
|
|
@ -219,4 +219,20 @@ public interface LeaseApplyDetailsMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateLeaseApplyPublishDetails(LeaseApplyDetails bean);
|
||||
|
||||
/**
|
||||
* 获取领用任务详细
|
||||
* @param leaseOutDetails
|
||||
* @return
|
||||
*/
|
||||
List<LeaseApplyDetails> getLeaseMaCode(LeaseOutDetails leaseOutDetails);
|
||||
|
||||
/**
|
||||
* 获取待出库数量
|
||||
* @param leaseOutDetails
|
||||
* @return
|
||||
*/
|
||||
LeaseApplyDetails getPengNum(LeaseOutDetails leaseOutDetails);
|
||||
|
||||
LeaseApplyDetails getPendLease(LeaseOutDetails leaseOutDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1400,23 +1400,45 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
@Override
|
||||
public AjaxResult leaseOut(LeaseOutRequestVo leaseOutRequestVo) {
|
||||
// 判断库存是否充足
|
||||
/*if (!CollectionUtils.isEmpty(leaseOutRequestVo.getLeaseOutDetailsList())) {
|
||||
if (!CollectionUtils.isEmpty(leaseOutRequestVo.getLeaseOutDetailsList())) {
|
||||
LeaseOutDetails leaseOutDetails = leaseOutRequestVo.getLeaseOutDetailsList().get(0);
|
||||
if (leaseOutDetails != null) {
|
||||
// 根据前端传入的keyId进行判断
|
||||
BigDecimal pendingNum = BigDecimal.ZERO;
|
||||
if (leaseOutDetails.getKeyId() != null) {
|
||||
List<LeaseApplyDetails> list = leaseApplyDetailsMapper.getPendingCodeLeaseApplyDetails(leaseOutDetails);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.error("该设备已出库,请勿重复操作");
|
||||
}
|
||||
}
|
||||
if (leaseOutDetails.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) {
|
||||
// 查询待出库数量
|
||||
LeaseApplyDetails info = new LeaseApplyDetails();
|
||||
if (StringUtils.isNotBlank(leaseOutDetails.getPublishTask())) {
|
||||
info = leaseApplyDetailsMapper.getPengNum(leaseOutDetails);
|
||||
} else {
|
||||
info = leaseApplyDetailsMapper.getPendLease(leaseOutDetails);
|
||||
}
|
||||
LeaseApplyDetails details = leaseApplyDetailsMapper.getPendingLeaseApplyDetails(leaseOutDetails);
|
||||
if (leaseOutDetails.getInputNum().compareTo(details.getOutNum()) > 0) {
|
||||
return AjaxResult.error("出库数量大于领料数量,请重新输入选择");
|
||||
if (details == null) {
|
||||
pendingNum = info.getOutNum().subtract(BigDecimal.ZERO);
|
||||
} else {
|
||||
pendingNum = info.getOutNum().subtract(details.getOutNum());
|
||||
}
|
||||
if (leaseOutDetails.getInputNum().compareTo(pendingNum) > 0) {
|
||||
return AjaxResult.error("该设备已出库,请勿重复操作");
|
||||
}
|
||||
}
|
||||
if (leaseOutDetails.getManageType().equals(MaTypeManageTypeEnum.CODE_DEVICE.getTypeId())) {
|
||||
LeaseApplyDetails details = leaseApplyDetailsMapper.getPendingCodeLeaseApplyDetails(leaseOutDetails);
|
||||
if (BigDecimal.valueOf(leaseOutRequestVo.getLeaseOutDetailsList().size()).compareTo(details.getOutNum()) > 0) {
|
||||
return AjaxResult.error("出库数量大于领料数量,请重新输入选择");
|
||||
if (leaseOutDetails.getParentId() != null) {
|
||||
List<LeaseApplyDetails> detailsList = leaseApplyDetailsMapper.getLeaseMaCode(leaseOutDetails);
|
||||
if (!CollectionUtils.isEmpty(detailsList)) {
|
||||
return AjaxResult.error("该设备已出库,请勿重复操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) {
|
||||
if (Objects.isNull(bean)) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1020,4 +1020,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND project_dept_id = #{departId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getInProject" resultType="java.lang.String">
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
`data_center`.dx_fb_son
|
||||
WHERE
|
||||
project_status in ('在建')
|
||||
<if test="departId != null and departId != ''">
|
||||
AND project_dept_id = #{departId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -682,28 +682,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="getPendingLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
pre_num AS preNum,
|
||||
al_num AS alNum,
|
||||
pre_num - IFNULL( al_num, 0 ) AS outNum
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
IFNULL( SUM( out_num ), 0 ) AS outNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
lease_out_details
|
||||
WHERE
|
||||
id = #{id}
|
||||
parent_id = #{parentId}
|
||||
AND type_id = #{typeId}
|
||||
<if test="publishTask != null and publishTask != ''">
|
||||
AND publish_task = #{publishTask}
|
||||
</if>
|
||||
GROUP BY
|
||||
type_id
|
||||
</select>
|
||||
|
||||
<select id="getPendingCodeLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
pre_num AS preNum,
|
||||
al_num AS alNum,
|
||||
pre_num - IFNULL( al_num, 0 ) AS outNum
|
||||
IFNULL( out_num, 0) AS outNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
lease_out_details
|
||||
WHERE
|
||||
parent_id = #{parentId} and COALESCE(new_type, type_id) = #{typeId}
|
||||
key_id = #{keyId}
|
||||
</select>
|
||||
|
||||
<select id="getOutNum" resultType="java.math.BigDecimal">
|
||||
|
|
@ -728,4 +730,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND new_type = #{typeId}
|
||||
</select>
|
||||
|
||||
<select id="getLeaseMaCode" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
IFNULL( out_num, 0) AS outNum
|
||||
FROM
|
||||
lease_out_details
|
||||
WHERE
|
||||
parent_id = #{parentId} and ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<select id="getPengNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
IFNULL( num, 0) AS outNum
|
||||
FROM
|
||||
lease_publish_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
and COALESCE(new_type, type_id) = #{typeId}
|
||||
<if test="publishTask != null and publishTask != ''">
|
||||
AND publish_task = #{publishTask}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getPendLease" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
parent_id AS parentId,
|
||||
type_id AS typeId,
|
||||
IFNULL( pre_num, 0) AS outNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="publishTask != null and publishTask != ''">
|
||||
publish_task,
|
||||
</if>
|
||||
<if test="keyId != null and keyId != ''">
|
||||
key_id,
|
||||
</if>
|
||||
create_time,
|
||||
update_time
|
||||
</trim>
|
||||
|
|
@ -147,6 +150,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="publishTask != null and publishTask != ''">
|
||||
#{publishTask},
|
||||
</if>
|
||||
<if test="keyId != null and keyId != ''">
|
||||
#{keyId},
|
||||
</if>
|
||||
NOW(),
|
||||
NOW()
|
||||
</trim>
|
||||
|
|
|
|||
Loading…
Reference in New Issue