Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java =================================================================== diff -u -r35772 -r35776 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java (.../RecyclingRecordManagerImpl.java) (revision 35772) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java (.../RecyclingRecordManagerImpl.java) (revision 35776) @@ -396,7 +396,8 @@ Set useRecordIds = new HashSet(); if (recyclingBasketItems != null) { Map tousseMap = getRecycleTousseItemMap(recyclingBasketItems); - String errorMessage = ""; + StringBuffer errorMessage = new StringBuffer(); + for(Entry entry : tousseMap.entrySet()){ Long tousseDefinitionID = entry.getKey(); Integer amount = entry.getValue(); @@ -407,11 +408,11 @@ if(ti_tdId != null && ti_tdId.longValue() == tousseDefinitionID.longValue()){ recyclingItem = ti; if(recyclingContext.isExpressRecycling()){ - errorMessage += "【" + ti.getTousseName() +"】"; + errorMessage.append("【" + ti.getTousseName() +"】"); } } } - if(StringUtils.isNotBlank(errorMessage)){ + if(errorMessage.length() > 0){ continue;//继续获取本次回收记录中下一种可能已经回收过的物品,获取完再一起提示 } if (recyclingItem == null) { @@ -494,8 +495,8 @@ } } } - if(StringUtils.isNotBlank(errorMessage)){ - throw new SystemException(recyclingRecord.getDepart() + "的" + errorMessage + "已经被回收,不会被快速回收!"); + if(errorMessage.length() > 0){ + throw new SystemException(recyclingRecord.getDepart() + "的" + errorMessage.toString() + "已经被回收,不会被快速回收!"); } } @@ -1157,7 +1158,7 @@ //新篮筐要判断是否可以回收 if(CssdUtils.getSystemSetConfigByNameBool("recycleClassifyBasketAfterPacked",true)){ boolean isNewClassifyBasket = true; - if(record !=null && record.getClassifyBaskets() != null){ + if(record.getClassifyBaskets() != null){ for (ClassifyBasket basket : record.getClassifyBaskets()) { if (StringUtils.equals(basket.getContainerBarcode(),container.getBarcode())) { isNewClassifyBasket = false; @@ -1226,7 +1227,7 @@ item = new ClassifiedItem(); items.add(item); } - Integer oldAmount = item.getAmount() == null ? 0 : item.getAmount(); + Integer oldAmount = item.getAmount() == null ? MathTools.ZERO_INTEGER : item.getAmount(); Integer newAmount = oldAmount + amount; if(newAmount <= 0){ item.setClassifyBasket(null); @@ -1260,8 +1261,7 @@ item.setRecyclingRecordId(record.getId()); if("材料".equals(itemType)){ item.setTousseNameForMaterial(tousseNameForMaterial); - - Integer oldTousseAmount = item.getTousseAmountForMaterial() == null ? 0 : item.getTousseAmountForMaterial(); + Integer oldTousseAmount = item.getTousseAmountForMaterial() == null ? MathTools.ZERO_INTEGER : item.getTousseAmountForMaterial(); item.setTousseAmountForMaterial(oldTousseAmount + tousseAmountForMaterial); String specification = null; @@ -1405,11 +1405,11 @@ String basketGroupBarcodes, String idCardBarcode, Long lastTousseInstanceId, Set items) { ClassifiedItem classifiedItem = null; - lastTousseInstanceId = lastTousseInstanceId == null ? 0L : lastTousseInstanceId; + lastTousseInstanceId = lastTousseInstanceId == null ? MathTools.ZERO_LONG : lastTousseInstanceId; for (ClassifiedItem ci : items) { String oldIdcardBarcode = StringTools.defaultIfBlank(ci.getIdCardBarcode(),""); idCardBarcode = StringTools.defaultIfBlank(idCardBarcode,""); - Long ciLastTousseInstanceId = ci.getLastTousseInstanceId() == null ? 0L : ci.getLastTousseInstanceId(); + Long ciLastTousseInstanceId = ci.getLastTousseInstanceId() == null ? MathTools.ZERO_LONG : ci.getLastTousseInstanceId(); if (StringTools.equals(ci.getName(),name) && MathTools.valueEquals(ci.getTousseDefinitionID(), tousseDefinitionId) && ci.getRecyclingRecordId() != null @@ -2333,14 +2333,14 @@ try { List wrongTds = tousseDefinitionManager.getTousseDefinitionListNotInCssdHandleTousses(tousseDefIds); if(CollectionUtils.isNotEmpty(wrongTds)){ - String msg = ""; + StringBuffer msg = new StringBuffer(); for (int i = 0; i < wrongTds.size(); i++) { TousseDefinition tdItem = wrongTds.get(i); - msg += "[" + tdItem.getName() + tdItem.getId() + "]"; + msg.append("[" + tdItem.getName() + tdItem.getId() + "]"); } - if(StringUtils.isNotBlank(msg)){ - msg += "未在供应室器械包设置中配置或数据异常,回收时间:" + record.getRecyclingTime()+",回收人:"+record.getRecyclingUser()+",客户端地址:"+recyclingContext.getUserIpAddr(); - appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_RECYCLINGRECORD, Log.TYPE_QUERY, msg); + if(msg.length() > 0){ + msg.append("未在供应室器械包设置中配置或数据异常,回收时间:" + record.getRecyclingTime()+",回收人:"+record.getRecyclingUser()+",客户端地址:"+recyclingContext.getUserIpAddr()); + appLogManager.saveLog(AcegiHelper.getLoginUser(), Log.MODEL_RECYCLINGRECORD, Log.TYPE_QUERY, msg.toString()); } } } catch (Exception e) { @@ -2614,7 +2614,7 @@ //设置回收物品(如果回收项为空或(所有回收项的物品申请数量及回收数量都为0、null)、同时对应申请单的申请项为空或(所有申请项的物品申请数量及回收数量都为0、null)),则删除此回收记录及对象设置为空 setRecylingItems(recyclingContext,record, tousseItemJson,tousseDefinitions,urgentTousseItems,tousseDefIdTousseItemVoMap,taskGroupOfModifiedNumOfTousse, null); - if(record != null){ + if(true){ //设置回收误差、器械报损 setMaterialErrorDamageDetail(record, errorDamageDetail,confirmation); //设置回收记录状态 @@ -3197,7 +3197,7 @@ allMaterial.addAll(tousseItemVo.getMaterials()); } - if(tousseItemVo != null && CollectionUtils.isNotEmpty(thisTousseErrorDamages)){ + if(CollectionUtils.isNotEmpty(thisTousseErrorDamages)){ for(RecyclingBasketItemMaterialVo material : allMaterial){ List filters = thisTousseErrorDamages.stream().filter(p->p != null && StringTools.equals(p.getMaterialName(),material.getName())).collect(Collectors.toList()); int errorCount = MathTools.sub(material.getCount(), count(filters)).intValue(); @@ -3565,24 +3565,26 @@ if(MapUtils.isEmpty(barcodeAndAmount)){ barcodeAndAmount.put(basketBarcode, json.getAmount()); } + StringBuffer basketName = new StringBuffer(); for (Entry entry : barcodeAndAmount.entrySet()) { basketBarcode = entry.getKey(); Integer amount = entry.getValue(); - String basketName = ""; + basketName.setLength(0); if(basketBarcode.contains(";")){ for (String barcodStr : barcodeArray) { Container container = getContainerByBarcode(containerBarcodeMap, barcodStr); - if(StringUtils.isNotBlank(basketName)){ - basketName += ";"; + if(basketName.length() > 0){ + basketName.append(";"); } if(container != null){ - basketName += container.getContainerName(); + basketName.append(container.getContainerName()); } } }else{ Container container = getContainerByBarcode(containerBarcodeMap, basketBarcode); if(container != null){ - basketName = container.getContainerName(); + basketName.setLength(0); + basketName.append(container.getContainerName()); } } String idCardBarcode = json.getIdCardBarcode(); @@ -3714,7 +3716,7 @@ task.setOrgUnitCoding(orgUnitCoding); task.setSourceId(recyclingRecord.getId()); task.setTaskType(PackingTask.TASK_RECYCLINGRECORD); - task.setRecyclingBasketName(basketName); + task.setRecyclingBasketName(basketName.toString()); task.setBasketBarcode(basketBarcode); task.setDepartment(recyclingRecord.getDepart()); task.setDepartCoding(recyclingRecord.getDepartCode()); @@ -4328,7 +4330,7 @@ isNewAddTousse = true; } } - Integer recyclingAmount = appItem.getRecyclingAmount() == null ? 0 : appItem.getRecyclingAmount(); + Integer recyclingAmount = appItem.getRecyclingAmount() == null ? MathTools.ZERO_INTEGER : appItem.getRecyclingAmount(); Integer currentAmount = recyclingAmount + amount; //删除的物品 if(currentAmount <= 0){ @@ -4842,8 +4844,8 @@ if(!StringUtils.equals(application.getType(), InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION)){ Integer amount = tousseItem.getAmount(); Integer recyclingAmount = tousseItem.getRecyclingAmount(); - amount = (amount == null ? 0 : amount); - recyclingAmount = (recyclingAmount == null ? 0 : recyclingAmount); + amount = (amount == null ? MathTools.ZERO_INTEGER : amount); + recyclingAmount = (recyclingAmount == null ? MathTools.ZERO_INTEGER : recyclingAmount); if(amount.intValue() != recyclingAmount.intValue()){ msg.append(String.format("%s申请数%s,回收数%s;", tousseItem.getTousseName(), amount, recyclingAmount)); } @@ -5117,9 +5119,9 @@ materialInstance.getMaterialDefinition().getId() .toString())) { Integer newCount = Integer.valueOf(countStr); - newCount = newCount == null ? 0 : newCount; + newCount = newCount == null ? MathTools.ZERO_INTEGER : newCount; Integer oldCount = materialInstance.getCount(); - oldCount = oldCount == null ? 0 : oldCount; + oldCount = oldCount == null ? MathTools.ZERO_INTEGER : oldCount; if(newCount.intValue() != oldCount.intValue()){ MaterialModifyRecord lastModifyRecord = lastMaterialModifyRecordMap.get(materialInstance.getMaterialDefinition().getId()); MaterialModifyRecord materialModifyRecord = new MaterialModifyRecord(); @@ -6362,7 +6364,7 @@ miCount = mi.getCount(); } if(td.isForeignTousse() && InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE.equals(ip.getRecyclingStatus())){ - miCount = mi.getApplyAmount() == null?mi.getCount():mi.getApplyAmount(); + miCount = mi.getApplyAmount() == null?Integer.valueOf(mi.getCount()):mi.getApplyAmount(); } Integer totalIntoBasketAmount = miCount * amount; List errorMsg = new ArrayList<>(); @@ -6499,7 +6501,7 @@ data.put("tousseName", td.getName()); data.put("tousseDefinitionID", td.getId()); data.put("amount", loadedAmount); - data.put("putBasketMaxAmount", maxAmount == null ? 0 : maxAmount); + data.put("putBasketMaxAmount", maxAmount == null ? MathTools.ZERO_INTEGER : maxAmount); } //装配时自动设置标识牌条码验证(前提是一个包实例只能装一个篮筐而且是整包清洗) boolean autoSetIDCardBarcodeForPacking = CssdUtils.getSystemSetConfigByNameBool("autoSetIDCardBarcodeForPacking"); @@ -6726,7 +6728,7 @@ Integer intoBasketMaxAmount = item.intoBasketMaxAmount(); if(intoBasketMaxAmount != null && intoBasketMaxAmount > 0){ //获取未清洗就终止的数量,此数量不计算在内 - Integer numOfUnwashedStops = item.getNumOfUnwashedStops()==null?0:item.getNumOfUnwashedStops(); + Integer numOfUnwashedStops = item.getNumOfUnwashedStops()==null?MathTools.ZERO_INTEGER :item.getNumOfUnwashedStops(); percentage = MathTools.add(percentage, MathTools.divide(item.getAmount() - numOfUnwashedStops, intoBasketMaxAmount, 4)).doubleValue(); } @@ -6823,7 +6825,7 @@ printData.setDoctor(fa.getDoctor()); printData.setHospitalNumber(fa.getHospitalNumber()); printData.setPatient(fa.getPatient()); - printData.setSplitIndex(sequence == null?1:sequence.getSequence()); + printData.setSplitIndex(sequence == null?Integer.valueOf(1):sequence.getSequence()); printData.setContainerName(cb.getContainerName()); TousseItem ti = tousseItemManager.find(fa.getApplicationItems(), tdId); if(ti == null){ @@ -7534,7 +7536,7 @@ obj.put("tousseDefinitionID", tousseId); obj.put("tousseAmountForMaterial", recycleAmount); obj.put("idCardBarcode", idCardBarcode); - obj.put("putBasketMaxAmount", md.getIntoBasketMaxAmount() == null ? 0 : md.getIntoBasketMaxAmount()); + obj.put("putBasketMaxAmount", md.getIntoBasketMaxAmount() == null ? MathTools.ZERO_INTEGER : md.getIntoBasketMaxAmount()); obj.put("isImplant", td.isForeignOrSplitTousse()?StringTools.defaultString(mi.getIsImplant()):Constants.STR_NO); obj.put("tousseType", td.getTousseType()); materialItem.add(obj); @@ -7566,9 +7568,6 @@ if(CollectionUtils.isEmpty(applicationItems)){ continue; } - - recyclingRecord.getClassifyBaskets(); - // 获取入筐的物品 List recyclingItems = recyclingRecord.getItems(); // 获取入筐的物品的包定义的ID的集合 @@ -7654,14 +7653,14 @@ Iterator it = keySet.iterator(); while(it.hasNext()){ String materialDefinitionId = it.next(); - String count = obj.optJSONObject(materialDefinitionId).optString("count"); + int count = obj.optJSONObject(materialDefinitionId).optInt("count",0); List list = tousseDefinition.getMaterialInstances(); for (MaterialInstance materialInstance : tousseDefinition .getMaterialInstances()) { if (StringUtils.equals(materialDefinitionId, materialInstance.getMaterialDefinition().getId() .toString())) { - materialInstance.setCount(Integer.valueOf(count)); + materialInstance.setCount(count); break; } } @@ -8033,7 +8032,7 @@ //材料的数量,如果没修改就使用包定义的数量 Integer miCount = 0; if(td.isForeignTousse() && InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE.equals(ip.getRecyclingStatus())){ - miCount = mi.getApplyAmount() == null?mi.getCount():mi.getApplyAmount(); + miCount = mi.getApplyAmount() == null?Integer.valueOf(mi.getCount()):mi.getApplyAmount(); }else{ miCount = mi.getCount(); } @@ -8149,7 +8148,7 @@ data.put("tousseName", td.getName()); data.put("tousseDefinitionID", td.getId()); data.put("amount", loadedAmount); - data.put("putBasketMaxAmount", maxAmount == null ? 0 : maxAmount); + data.put("putBasketMaxAmount", maxAmount == null ? MathTools.ZERO_INTEGER : maxAmount); data.put("isCleanedEntirely", Constants.STR_YES); } //装配时自动设置标识牌条码验证(前提是一个包实例只能装一个篮筐而且是整包清洗) @@ -8427,8 +8426,7 @@ if(methodOfSplitRecyclingApplication != 0){ if(splitJsonArray != null && splitJsonArray.size() > 0){ // 根据科室分组 - Map departToTousseMap = new HashMap(); - departToTousseMap = splitTousseByDepart(splitJsonArray); + Map departToTousseMap = splitTousseByDepart(splitJsonArray); for(Entry entry : departToTousseMap.entrySet()){ String depart = entry.getKey(); JSONArray tousseArr = entry.getValue(); @@ -8670,7 +8668,7 @@ Integer intoBasketMaxAmount = item.intoBasketMaxAmount(); classifiedItemJson.put("name", item.getName()); //获取未清洗就终止的数量,此数量不计算在内 - Integer numOfUnwashedStops = item.getNumOfUnwashedStops()==null?0:item.getNumOfUnwashedStops(); + Integer numOfUnwashedStops = item.getNumOfUnwashedStops()==null?MathTools.ZERO_INTEGER :item.getNumOfUnwashedStops(); Integer amount = item.getAmount() - numOfUnwashedStops; classifiedItemJson.put("amount", amount); classifiedItemsJson.add(classifiedItemJson); @@ -8776,7 +8774,7 @@ isFixedBarcode = true; } scanBarcodeToRecycleTousseDeliveredToDepartmentMustBeInUsedState = CssdUtils.getSystemSetConfigByNameBool("scanBarcodeToRecycleTousseDeliveredToDepartmentMustBeInUsedState", false); - if(tousseInstance != null && !isFixedBarcode && scanBarcodeToRecycleTousseDeliveredToDepartmentMustBeInUsedState){ + if(!isFixedBarcode && scanBarcodeToRecycleTousseDeliveredToDepartmentMustBeInUsedState){ errorMessage = getScanBarcodeToRecycleTousseDeliveredToDepartmentMustBeInUsedStateErrorMessage(tousseInstance, "包外标签条码",tousseInstance.getBarcode()); if(StringUtils.isNotBlank(errorMessage)){ break out; @@ -8940,19 +8938,17 @@ idCardInstance); if (tousseInstance == null) { // errorMessage = "没有找到和标识牌绑定的器械包!"; - if (idCardDefinition != null) { - errorMessage = checkTousseStatus(idCardInstance.getId()); - if(errorMessage != null){ - errorType = "idCard_statusIllegal"; - break out; - } - tousseInstance = new TousseInstance(); - TousseDefinition td = tousseDefinitionManager.get(idCardDefinition.getTousseDefinitionID()); - tousseInstance.setTousseDefinition(td); - tousseInstance.setStatus(TousseInstance.STATUS_SHIPPED); - tousseInstance.setBarcode(barcode); - //tousseInstance.setLocationForDisplay("新器械包标识牌"); + errorMessage = checkTousseStatus(idCardInstance.getId()); + if(errorMessage != null){ + errorType = "idCard_statusIllegal"; + break out; } + tousseInstance = new TousseInstance(); + TousseDefinition td = tousseDefinitionManager.get(idCardDefinition.getTousseDefinitionID()); + tousseInstance.setTousseDefinition(td); + tousseInstance.setStatus(TousseInstance.STATUS_SHIPPED); + tousseInstance.setBarcode(barcode); + //tousseInstance.setLocationForDisplay("新器械包标识牌"); } else { //验证是否被其他申请单预回收 if(enablePrerecycleAmountScanToAddOrDeleteAmountFunction){ @@ -9038,7 +9034,7 @@ isTousseNeedMaintain = IDCardInstanceUtils.isTousseNeedMaintain(objectDao,idCardInstance); } boolean enableIdCardBasketBinding = CssdUtils.getSystemSetConfigByNameBool("enableIdCardBasketBinding"); - if(enableIdCardBasketBinding && idCardDefinition != null){ + if(enableIdCardBasketBinding){ //标识牌跟篮筐绑定 Container c = containerManager.get(idCardDefinition.getContainerId()); try{ @@ -9070,7 +9066,7 @@ } } //对于已废弃的包,不检查其位置和所属科室的信息 - if(tousseInstance != null && !TousseInstance.STATUS_DISCARD.equals(tousseInstance.getStatus())){ + if(!TousseInstance.STATUS_DISCARD.equals(tousseInstance.getStatus())){ String tousseDepart = StringUtils.isBlank(tousseInstance.getLocationForDisplay2())?tousseInstance.getLocationForDisplay():tousseInstance.getLocationForDisplay2(); if(StringUtils.isNotBlank(tousseDepart)){ shareDeparts = goodsDepartShareConfigManager.getfindGoodsDepartShareConfigByDepartName(tousseDepart);