Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r22719 -r22857 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 22719) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 22857) @@ -646,7 +646,7 @@ Collection departCodes, String applyDate) { List expressInvoiceInvoicePlanVoList = new ArrayList(); String sql = buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType( - departCodes, applyDate, null); + departCodes, applyDate, null,"getExpensiveGoodsInvoicePlanVOs"); String hql = String .format("select distinct po from %s po inner join fetch po.applicationItems %s and po.type='%s' and po.haveUseRecord=false ", InvoicePlan.class.getSimpleName(), sql, @@ -683,7 +683,7 @@ } Set tousseDefinitionIdSet = new HashSet(tousseDefinitionIdList); String sql = - buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(departCodes, applyDate, tousseTypeArg); + buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(departCodes, applyDate, tousseTypeArg,null); // String tousseSql = String.format(" po.id in (select invoicePlan.id from TousseItem where (%s and isTraceable='%s' and (tousseType!='%s' or (tousseType='%s' and isApplyEntireTousse='%s'))) )",SqlUtils.getStringFieldPredicate("expressInvoice", Constants.STR_YES) // ,TousseDefinition.STR_NO,TousseDefinition.PACKAGE_TYPE_DISINFECTION,TousseDefinition.PACKAGE_TYPE_DISINFECTION,TousseDefinition.STR_YES); String tousseSql = String.format(" po.id in (select invoicePlan.id from TousseItem where (%s) )",SqlUtils.getStringFieldPredicate("expressInvoice", Constants.STR_YES)); @@ -1472,7 +1472,7 @@ String orgUnitCoding , String applyDate , String tousseType) { List retList = null; String sql = - buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(Collections.singleton(orgUnitCoding), applyDate, tousseType); + buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(Collections.singleton(orgUnitCoding), applyDate, tousseType,null); sql += " ORDER BY sequence, applicationTime"; retList = objectDao.findBySql_ForUpdate(InvoicePlan.class.getSimpleName(), sql); return retList; @@ -1482,7 +1482,7 @@ String orgUnitCoding , String applyDate , String tousseType) { List retList = null; String sql = - buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(Collections.singleton(orgUnitCoding), applyDate, tousseType); + buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(Collections.singleton(orgUnitCoding), applyDate, tousseType,null); String sqlNoOrder = sql; sql += " order by sequence, applicationTime"; @@ -1639,7 +1639,7 @@ * @since 2015-09-22 */ private String buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType( - Collection orgUnitCodings, String applyDate , String tousseType) { + Collection orgUnitCodings, String applyDate , String tousseType,String useCase) { String where1 = String.format( "(deliverStatus='%s' or deliverStatus='%s') and (endStatus is null or endStatus!='%s')", InvoicePlan.DELIVERSTATUS_AWAITDELIVER, @@ -1677,7 +1677,10 @@ } } excludeTypelist.add(InvoicePlan.TYPE_OPERATION_RESERVATION_APPLICATION); - excludeTypelist.add(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); + if(!("getExpensiveGoodsInvoicePlanVOs".equals(useCase))){ + excludeTypelist.add(InvoicePlan.TYPE_EXPENSIVEGOODS_FORM); + } + where3 = SqlBuilder.build_IN_Statement("type", SqlBuilder.NOT_IN, excludeTypelist); @@ -1789,7 +1792,7 @@ public List getInvoicePlanListByOrgUnitCodingsAndTousseType( Collection orgUnitCodings, String applyDate , String tousseType) { String sql = - buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(orgUnitCodings, applyDate, tousseType); + buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(orgUnitCodings, applyDate, tousseType,null); // sql += " ORDER BY sequence, applicationTime"; // return objectDao.findBySql(InvoicePlan.class.getSimpleName(), sql); String hql = String.format("select distinct po from %s po inner join fetch po.applicationItems %s ORDER BY sequence, applicationTime", InvoicePlan.class.getSimpleName(),sql); @@ -1810,7 +1813,7 @@ }else{ idSql = String.format(" %s ",SqlUtils.getNonStringFieldPredicate("disposableGoodsId", disposableGoodsId)); } - String sql = buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(departCodes, applyDate, tousseType); + String sql = buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(departCodes, applyDate, tousseType,null); // 根据tousseitem当时的状态 String tousseSql = String.format(" po.id in (select invoicePlan.id from TousseItem where (%s) and %s )",idSql,SqlUtils.getStringFieldPredicate("expressInvoice", Constants.STR_YES)); // 根据最新包定义 @@ -1834,7 +1837,7 @@ public List getInvoicePlanListByOrgUnitCodingsAndTousseTypeOnlyForInvoicePlanList( Collection orgUnitCodings, String applyDate , String tousseType){ String sql = - buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(orgUnitCodings, applyDate, tousseType); + buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(orgUnitCodings, applyDate, tousseType,null); String hql = String.format("select po from %s po %s ORDER BY applicationTime", InvoicePlan.class.getSimpleName(),sql); return objectDao.findByHql(hql); } @@ -2803,7 +2806,7 @@ if(ArrayUtils.isNotEmpty(departCodings)){ list = Arrays.asList(departCodings); } - String sql = buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(list, applyDate, tousseType); + String sql = buildSqlForGetInvoicePlanByOrgUnitCodingsAndTousseType(list, applyDate, tousseType,null); sql += " and serialNumber='" + barcode + "'"; InvoicePlan invoicePlan = (InvoicePlan) objectDao.getBySql(InvoicePlan.class.getSimpleName(),sql); // InvoicePlan invoicePlan = (InvoicePlan) objectDao.getByProperty(InvoicePlan.class.getSimpleName(), "serialNumber", barcode);