Index: ssts-web/src/main/java/com/forgon/disinfectsystem/excel/service/CommonImportManagerImpl.java =================================================================== diff -u -r12331 -r13835 --- ssts-web/src/main/java/com/forgon/disinfectsystem/excel/service/CommonImportManagerImpl.java (.../CommonImportManagerImpl.java) (revision 12331) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/excel/service/CommonImportManagerImpl.java (.../CommonImportManagerImpl.java) (revision 13835) @@ -25,12 +25,16 @@ import com.forgon.attachfile.service.AttachFileManager; import com.forgon.directory.model.OrgUnit; import com.forgon.directory.service.OrgUnitManager; +import com.forgon.disinfectsystem.entity.basedatamanager.cleanmethod.CleanMethod; import com.forgon.disinfectsystem.entity.basedatamanager.container.Container; +import com.forgon.disinfectsystem.entity.basedatamanager.sterilisation.Sterilisation; +import com.forgon.disinfectsystem.entity.basedatamanager.supplier.Supplier; import com.forgon.excel.model.ValidateInfo; import com.forgon.excel.service.CommonImportManager; import com.forgon.excel.service.ExcelImportAndExportHelper; import com.forgon.reflect.ReflectUtil; import com.forgon.tools.excel.ParerUtils; +import com.forgon.tools.hibernate.ObjectDao; /** * @author Terry @@ -42,7 +46,14 @@ private AttachFileManager attachFileManager; private OrgUnitManager orgUnitManager; + + private ObjectDao objectDao; + + public void setObjectDao(ObjectDao objectDao) { + this.objectDao = objectDao; + } + public void setOrgUnitManager(OrgUnitManager orgUnitManager) { this.orgUnitManager = orgUnitManager; } @@ -211,6 +222,45 @@ json.put("errorType", result); json.put("errorColumnNumber", i + 1); } + Boolean bResult = json.optBoolean("isSuccess"); + int errType = json.optInt("errorType"); + // 如果是容器名称,重复要更新属性,不报错 + if( po.getClass() == Container.class + && currentPropertyName == "containerName" && bResult == false + && errType == com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_DUPLICATE) + { + po = objectDao.getByProperty(Container.class.getSimpleName(), "containerName", value); + json.put("isSuccess", true); + json.put("errorType", com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_SUCCESS); + } + // + // 如果是供应商名称重复,更新 + if( po.getClass() == Supplier.class + && currentPropertyName == "companyName" && bResult == false + && errType == com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_DUPLICATE) + { + po = objectDao.getByProperty(Supplier.class.getSimpleName(), "companyName", value); + json.put("isSuccess", true); + json.put("errorType", com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_SUCCESS); + } + // 如果是清洗程序名称重复,更新 + if( po.getClass() == CleanMethod.class + && currentPropertyName == "cleanMethod" && bResult == false + && errType == com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_DUPLICATE) + { + po = objectDao.getByProperty(CleanMethod.class.getSimpleName(), "cleanMethod", value); + json.put("isSuccess", true); + json.put("errorType", com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_SUCCESS); + } + // 如果是灭菌程序名称重复,更新 + if( po.getClass() == Sterilisation.class + && currentPropertyName == "sterilisation" && bResult == false + && errType == com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_DUPLICATE) + { + po = objectDao.getByProperty(Sterilisation.class.getSimpleName(), "sterilisation", value); + json.put("isSuccess", true); + json.put("errorType", com.forgon.disinfectsystem.common.Constants.ERROR_TYPE_SUCCESS); + } try { if (value != null && value.endsWith(".00")) { value = value.substring(0, value.length() - 3);