| | |
| | | import com.nanometer.smartlab.entity.*; |
| | | import com.nanometer.smartlab.entity.dto.PersonUseDetail; |
| | | import com.nanometer.smartlab.entity.enumtype.ValidFlag; |
| | | import com.nanometer.smartlab.util.ExcelUtils; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.dao.DataAccessException; |
| | | import org.springframework.dao.DataIntegrityViolationException; |
| | | import org.springframework.dao.DuplicateKeyException; |
| | | import org.springframework.stereotype.Repository; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private OpeUseFlowDao opeUseFlowDao; |
| | | @Resource |
| | | private OpeWarehouseReserveDao opeWarehouseReserveDao; |
| | | @Resource |
| | | private BaseRoleService baseRoleService; |
| | | |
| | | @Resource(name="baseMetaDao") |
| | | BaseMetaDao baseMetaDao; |
| | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public List<OpeReagentStatus> getOpeReagentStatusListForLab(String name, String articleNumber, Integer status, |
| | | String reagentCode, String userId, Integer first, Integer pageSize) { |
| | | String reagentCode, String userId,String labName, Integer first, Integer pageSize) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | |
| | | params.put("name", "%" + name + "%"); |
| | | params.put("articleNumber", articleNumber); |
| | | params.put("status", status); |
| | | addParamByUserId(userId, params); |
| | | params.put("labName", labName); |
| | | // addParamByUserId(userId, params); |
| | | if (StringUtils.isNotBlank(userId)) { |
| | | SysUser sysUser = sysUserService.getSysUser(userId); |
| | | BaseRole baseRole = baseRoleService.getBaseRole(sysUser.getRoleId()); |
| | | //不是系统管理员 根据用户的课题组判断可视(用户所在课题组是否 在实验室的课题组下) |
| | | if (!"系统管理员".equals(baseRole.getName())) { |
| | | if (StringUtils.isBlank(sysUser.getProject())) { |
| | | return null; |
| | | } |
| | | params.put("project", sysUser.getProject()); |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(reagentCode)) { |
| | | params.put("reagentCode", "%" + reagentCode + "%"); |
| | | } |
| | |
| | | |
| | | @Transactional(propagation = Propagation.REQUIRED) |
| | | public int getOpeReagentStatusTotalCountForLab(String name, String articleNumber, Integer status, String reagentCode, |
| | | String userId) { |
| | | String userId,String labName) { |
| | | try { |
| | | Map<String, Object> params = new HashMap<String, Object>(); |
| | | params.put("name", "%" + name + "%"); |
| | | |
| | | addParamByUserId(userId, params); |
| | | // addParamByUserId(userId, params); |
| | | params.put("articleNumber", articleNumber); |
| | | if (StringUtils.isNotBlank(userId)) { |
| | | SysUser sysUser = sysUserService.getSysUser(userId); |
| | | BaseRole baseRole = baseRoleService.getBaseRole(sysUser.getRoleId()); |
| | | //不是系统管理员 根据用户的课题组判断可视(用户所在课题组是否 在实验室的课题组下) |
| | | if (!"系统管理员".equals(baseRole.getName())) { |
| | | if (StringUtils.isBlank(sysUser.getProject())) { |
| | | return 0; |
| | | } |
| | | params.put("project", sysUser.getProject()); |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(reagentCode)) { |
| | | params.put("reagentCode", "%" + reagentCode + "%"); |
| | | } |
| | | params.put("status", status); |
| | | params.put("labName", labName); |
| | | return this.opeReagentStatusDao.getOpeReagentStatusTotalCountForLab(params); |
| | | } catch (DataAccessException e) { |
| | | logger.error(e.getMessage(), e); |
| | |
| | | |
| | | // 不是管理员时,加入userid |
| | | //if (sysUser.getSeeFlag().getKey() == SeeFlag.MANAGE.getKey()||sysUser.getSeeFlag().getKey() == SeeFlag.LEADING.getKey()) { |
| | | if (sysUser.getSeeFlag().getKey() == SeeFlag.MANAGE.getKey()) { |
| | | if (sysUser.getSeeFlag().getKey() == SeeFlag.MANAGE.getKey() |
| | | && sysUser.getSeeFlag().getKey() != SeeFlag.LEADING.getKey()) { |
| | | |
| | | } else { |
| | | params.put("userId", userId); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @Description: 导出 |
| | | * @date 2021/4/22 10:33 |
| | | */ |
| | | @Override |
| | | public List<Map> selectExportList(String name, String articleNumber, Integer status, String reagentCode, String userId,String labName) { |
| | | |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("name", name); |
| | | params.put("articleNumber", articleNumber); |
| | | params.put("status", status); |
| | | params.put("labName", labName); |
| | | if (StringUtils.isNotBlank(userId)) { |
| | | SysUser sysUser = sysUserService.getSysUser(userId); |
| | | BaseRole baseRole = baseRoleService.getBaseRole(sysUser.getRoleId()); |
| | | //不是系统管理员 根据用户的课题组判断可视(用户所在课题组是否 在实验室的课题组下) |
| | | if (!"系统管理员".equals(baseRole.getName())) { |
| | | if (StringUtils.isBlank(sysUser.getProject())) { |
| | | return null; |
| | | } |
| | | params.put("project", sysUser.getProject()); |
| | | } |
| | | } |
| | | params.put("reagentCode", reagentCode); |
| | | return opeReagentStatusDao.selectExportList(params); |
| | | } |
| | | |
| | | @Override |
| | | public void exportLabStock2Excel(List<Map> list) throws Exception { |
| | | Map<String, String> map = new LinkedHashMap<>(); |
| | | map.put("houseName", "实验室名称"); |
| | | map.put("containerCode", "临时存储库条码"); |
| | | map.put("reagentName", "试剂名称"); |
| | | map.put("reagentCode", "试剂条形码"); |
| | | map.put("articleNumber", "批号"); |
| | | map.put("cas", "cas"); |
| | | map.put("productHome", "厂家"); |
| | | map.put("supplierName", "供应商"); |
| | | map.put("remainder", "残存量"); |
| | | ExcelUtils.export2Excel(list,"实验室库存",map); |
| | | } |
| | | |
| | | @Override |
| | | public OpeReagentStatus getStatus(String reagentId, String reagentCode) { |
| | | |
| | | |
| | | return opeReagentStatusDao.getStatus(reagentId,reagentCode); |
| | | } |
| | | |
| | | |
| | | } |