diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java index 63f7ee6c..5e89a4d5 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/clz/service/impl/MaterialMachineServiceImpl.java @@ -456,36 +456,45 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { @Override public List getToolsLedgerList(MaterialRetainedEquipmentInfo bean) { String username = SecurityUtils.getLoginUser().getUsername(); + // 根据用户名判断用户是否为班组长 + BmTeam teamData = materialMachineMapper.getTeamData(username); + if (teamData == null) { + // 根据用户名查询项目部信息 + String departId = mapper.getDepartId(username); + // 根据项目部id查询工程信息 + List projectIdList = mapper.getProjectId(departId); + if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) { + bean.setProjectIdList(projectIdList); + } + } List list1 = new ArrayList<>(); try { - List totalList = materialMachineMapper.getToolsLedgerList(bean); + //List totalList = materialMachineMapper.getToolsLedgerList(bean); List list = materialMachineMapper.getRetainedEquipmentList(bean); Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); - if (!CollectionUtils.isEmpty(totalList) && deptId != null) { + /*if (!CollectionUtils.isEmpty(totalList) && deptId != null) { // 删除元素 totalList.removeIf(m -> !deptId.toString().equals(m.getImpUnit())); } if (CollectionUtils.isEmpty(totalList)) { return new ArrayList<>(); - } - // 根据用户名判断用户是否为班组长 - BmTeam teamData = materialMachineMapper.getTeamData(username); + }*/ if (!org.springframework.util.CollectionUtils.isEmpty(list)) { if (teamData != null) { // 将sortedList中班组身份证号与username相同的元素过滤处理 list = list.stream() .filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard())) .collect(Collectors.toList()); - } else { + } /*else { list = filterInfoTools(list, username); - } + }*/ } // 根据用户名判断用户是否为班组长 if (CollectionUtils.isNotEmpty(list)) { list1 = groupByThirdTypeId(list); - } else if (CollectionUtils.isNotEmpty(totalList)) { + } /*else if (CollectionUtils.isNotEmpty(totalList)) { list1 = groupByThirdTypeId(totalList); - } + }*/ return list1; } catch (Exception e){ log.error("获取设备台账列表失败,参数:{}", bean, e); @@ -562,9 +571,9 @@ public class MaterialMachineServiceImpl implements MaterialMachineService { if (CollectionUtils.isNotEmpty(list)) { return getMaterialRetainedEquipmentInfo(list); } - } else { + } /*else { primaryList = filterInfo(primaryList, username); - } + }*/ } if (!CollectionUtil.isEmpty(primaryList)) { return getMaterialRetainedEquipmentInfo(primaryList); diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java index 10edd099..47836761 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/controller/SelectController.java @@ -9,6 +9,7 @@ import com.bonus.material.common.service.SelectService; import com.bonus.material.materialStation.domain.ProAuthorizeInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -20,6 +21,7 @@ import javax.annotation.Resource; @Api(tags = "统一下拉选接口") @RestController @RequestMapping("/select/") +@Slf4j public class SelectController { @Resource(name = "SelectService") @@ -64,7 +66,12 @@ public class SelectController { @ApiOperation(value = "工程下拉选") @PostMapping("getProjectList") public AjaxResult getProjectList(@RequestBody BmProject bmProject) { - return service.getProjectList(bmProject); + try { + return service.getProjectList(bmProject); + } catch (Exception e) { + log.error("获取数据失败"); + return AjaxResult.error("获取数据失败"); + } } @ApiOperation(value = "机具类型下拉选") @@ -207,6 +214,11 @@ public class SelectController { @ApiOperation(value = "工程下拉选") @PostMapping("getProjectInfo") public AjaxResult getProjectInfo(@RequestBody BmProject bmProject) { - return service.getProjectInfo(bmProject); + try { + return service.getProjectInfo(bmProject); + } catch (Exception e) { + log.error("获取工程信息异常", e); + return AjaxResult.error("获取工程信息异常"); + } } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml index 1bfa555c..cae81f0a 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialLeaseInfoMapper.xml @@ -409,7 +409,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames, tt.task_type as taskType, bp.external_id AS externalId, - bu.bzz_idcard AS idCard + bu.bzz_idcard AS idCard, + bp.imp_unit AS impUnit from lease_apply_info lai left join tm_task tt on lai.task_id = tt.task_id @@ -991,7 +992,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" lpd.lease_sign_type AS leaseSignType, tt.task_type AS taskType, bp.external_id AS externalId, - bu.bzz_idcard AS idCard + bu.bzz_idcard AS idCard, + bp.imp_unit AS impUnit FROM lease_publish_details lpd LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index 6a0d11a6..7fb4d4e0 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -418,6 +418,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and (mt2.type_name like concat('%',#{keyWord},'%') OR mt.type_name like concat('%',#{keyWord},'%') ) + + and subquery1.externalId in + + #{item} + + GROUP BY mt.type_id