Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java =================================================================== diff -u -r36360 -r36423 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 36360) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 36423) @@ -5582,7 +5582,6 @@ if (tIInfoJSONArray == null || CollectionUtils.isEmpty(tousseInstanceList)) { return tIInfoJSONArray; } - Map tousseAmountMap = new HashMap(); List tousseDefinitionIdList = new ArrayList(); List allTousseInstanceList = new ArrayList(); allTousseInstanceList.addAll(tousseInstanceList); @@ -5600,6 +5599,9 @@ } //已经签收的器械包实例ID List signedTousseInstanceIdList = new ArrayList(); + boolean enableUrgentFunction = ConfigUtils.getSystemSetConfigByNameBool("enableUrgentFunction"); + //已签收包实例条码加加急等级map + Map signedTousseInstanceBarcodeUrgentLevelMap = new HashMap(); for (TousseInstance ti : allTousseInstanceList) { if (null != ti) { TousseDefinition td = ti.getTousseDefinition(); @@ -5609,50 +5611,245 @@ objectDao.saveOrUpdate(ti); if(ti.isSigned()){ signedTousseInstanceIdList.add(ti.getId()); + if(enableUrgentFunction){ + UrgentLevel urgentLevel = ti.getUrgentLevel(); + if(urgentLevel != null){ + signedTousseInstanceBarcodeUrgentLevelMap.put(ti.getBarcode(), urgentLevel); + } + } } } } if(CollectionUtils.isEmpty(tousseDefinitionIdList)){ return tIInfoJSONArray; } - String sql = String.format("select ti.tousseName, count(0) waitSignAmount from %s ti " + + //待签收数量 + Map tousseAmountMap = loadTousseWaitSignAmount(orgUnitCoding, beginDate, endDate, tousseDefinitionIdList, signedTousseInstanceIdList); + //加急数量 + Map tousseUrgentAmountMap = new HashMap(); + //加急等级 + Map tousseMaxUrgentLevelMap = new HashMap(); + //查询待签收器械包的加急信息 + loadTousseWaitSignUrgentInfo(tousseUrgentAmountMap, tousseMaxUrgentLevelMap, orgUnitCoding, beginDate, endDate, tousseDefinitionIdList, signedTousseInstanceIdList); + + for (int i = 0; i < tIInfoJSONArray.size(); i++) { + JSONObject json = tIInfoJSONArray.getJSONObject(i); + String tousseName = json.optString("tousseName", ""); + Integer waitSignAmount = tousseAmountMap.get(tousseName); + if (waitSignAmount == null) { + json.put("waitSignAmount", 0); + } else { + json.put("waitSignAmount", waitSignAmount); + } + Integer urgentAmount = tousseUrgentAmountMap.get(tousseName); + if (urgentAmount == null) { + json.put("urgentAmount", 0); + } else { + json.put("urgentAmount", urgentAmount); + } + UrgentLevel maxUrgentLevel = tousseMaxUrgentLevelMap.get(tousseName); + if(maxUrgentLevel != null){ + json.put("maxUrgentLevel", maxUrgentLevel); + } + UrgentLevel urgentLevel = signedTousseInstanceBarcodeUrgentLevelMap.get(json.optString("tousseBarcode")); + if(urgentLevel != null){ + json.put("urgentLevel", urgentLevel); + } + } + return tIInfoJSONArray; + } + + /** + * 查询待签收器械包的加急信息 + * @param tousseUrgentAmountMap + * @param tousseUrgentLevelMap + * @param orgUnitCoding + * @param beginDate + * @param endDate + * @param tousseDefinitionIdList + * @param signedTousseInstanceIdList + */ + private void loadTousseWaitSignUrgentInfo(Map tousseUrgentAmountMap, Map tousseUrgentLevelMap, + String orgUnitCoding, String beginDate, String endDate, + List tousseDefinitionIdList, + List signedTousseInstanceIdList) { + //是否启用加急 + boolean enableUrgentFunction = ConfigUtils.getSystemSetConfigByNameBool("enableUrgentFunction"); + if(!enableUrgentFunction){ + return; + } + //一次发货 + String sql1 = String.format("select ti.tousseName, ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade" + + " from %s ti " + + " join %s i on i.id = ti.invoice_id" + + " join %s ul on ul.id = ti.urgentLevel_id" + " where (1=1) and %s " + " and ti.status = '%s' " - + " and ((ti.location='%s' and ti.location_2 is null) or (ti.location_2 = '%s')) " + + " and ti.location='%s' " + + " and %s " + + " and ti.invoice2_id is null ", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + UrgentLevel.class.getSimpleName(), + SqlUtils.getNonStringFieldInLargeCollectionsPredicate("ti.tousseDefinition_id", tousseDefinitionIdList), + TousseInstance.STATUS_SHIPPED, + orgUnitCoding, + dateQueryAdapter.dateAreaSql("i.sendTime", beginDate, endDate)); + if(CollectionUtils.isNotEmpty(signedTousseInstanceIdList)){ + sql1 += " and " + SqlUtils.getNonStringFieldNotInCollectionsPredicate("ti.id", signedTousseInstanceIdList); + } + + //二次发货 + String sql2 = String.format("select ti.tousseName, ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade " + + " from %s ti " + + " join %s i on i.id = ti.invoice2_id" + + " join %s ul on ul.id = ti.urgentLevel_id" + + " where (1=1) and %s " + + " and ti.status = '%s' " + + " and ti.location_2='%s' " + " and %s ", TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + UrgentLevel.class.getSimpleName(), SqlUtils.getNonStringFieldInLargeCollectionsPredicate("ti.tousseDefinition_id", tousseDefinitionIdList), TousseInstance.STATUS_SHIPPED, orgUnitCoding, - orgUnitCoding, - dateQueryAdapter.dateAreaSql("ti.invoiceSendTime", beginDate, endDate)); + dateQueryAdapter.dateAreaSql("i.sendTime", beginDate, endDate)); if(CollectionUtils.isNotEmpty(signedTousseInstanceIdList)){ - sql += " and " + SqlUtils.getNonStringFieldNotInCollectionsPredicate("ti.id", signedTousseInstanceIdList); + sql2 += " and " + SqlUtils.getNonStringFieldNotInCollectionsPredicate("ti.id", signedTousseInstanceIdList); } - sql += " group by ti.tousseName"; + List waitSignTousseInstanceList = new ArrayList(); + String sql = String.format("select * from (%s union all %s ) rs", sql1, sql2); ResultSet result = null; try { result = objectDao.executeSql(sql); while (result.next()) { - tousseAmountMap.put(result.getString("tousseName"), result.getString("waitSignAmount")); + String tousseName = result.getString("tousseName"); + Long urgentLevelId = result.getLong("urgentLevelId"); + String urgentLevelname = result.getString("urgentLevelname"); + String colorCode = result.getString("colorCode"); + String colorName = result.getString("colorName"); + Integer grade = result.getInt("grade"); + TousseInstance tousseInstance = new TousseInstance(); + tousseInstance.setTousseName(tousseName); + if(DatabaseUtil.isPoIdValid(urgentLevelId)){ + UrgentLevel urgentLevel = new UrgentLevel(); + urgentLevel.setName(urgentLevelname); + urgentLevel.setColorCode(colorCode); + urgentLevel.setColorName(colorName); + urgentLevel.setGrade(grade); + tousseInstance.setUrgentLevel(urgentLevel); + } + waitSignTousseInstanceList.add(tousseInstance); } } catch (Exception e) { e.printStackTrace(); } finally { DatabaseUtil.closeResultSetAndStatement(result); } - for (int i = 0; i < tIInfoJSONArray.size(); i++) { - JSONObject json = tIInfoJSONArray.getJSONObject(i); - String tousseName = json.optString("tousseName", ""); - String waitSignAmount = tousseAmountMap.get(tousseName); - if (waitSignAmount == null) { - json.put("waitSignAmount", 0); - } else { - json.put("waitSignAmount", waitSignAmount); + if(CollectionUtils.isNotEmpty(waitSignTousseInstanceList)){ + for (TousseInstance tousseInstance : waitSignTousseInstanceList) { + String tousseName = tousseInstance.getTousseName(); + UrgentLevel urgentLevel = tousseInstance.getUrgentLevel(); + if(urgentLevel != null){ + UrgentLevel maxUrgentLevel = tousseUrgentLevelMap.get(tousseName); + if(maxUrgentLevel != null){ + Integer maxGrade = maxUrgentLevel.getGrade(); + Integer grade = urgentLevel.getGrade(); + if(grade != null){ + if(maxGrade != null){ + if(maxGrade.intValue() < grade.intValue()){ + maxUrgentLevel = urgentLevel; + } + }else{ + maxUrgentLevel = urgentLevel; + } + } + }else{ + maxUrgentLevel = urgentLevel; + } + tousseUrgentLevelMap.put(tousseName, maxUrgentLevel); + Integer urgentAmount = tousseUrgentAmountMap.get(tousseName); + if(urgentAmount == null){ + urgentAmount = 0; + } + tousseUrgentAmountMap.put(tousseName, urgentAmount+1); + } } } - return tIInfoJSONArray; } + + /** + * 查询待签收数量 + * @param orgUnitCoding + * @param beginDate + * @param endDate + * @param tousseDefinitionIdList + * @param signedTousseInstanceIdList + * @return + */ + private Map loadTousseWaitSignAmount(String orgUnitCoding, String beginDate, String endDate, + List tousseDefinitionIdList, + List signedTousseInstanceIdList) { + Map tousseAmountMap = new HashMap(); + //一次发货 + String sql1 = String.format("select ti.tousseName, count(0) waitSignAmount from %s ti " + + " join %s i on i.id = ti.invoice_id" + + " where (1=1) and %s " + + " and ti.status = '%s' " + + " and ti.location='%s' " + + " and %s " + + " and ti.invoice2_id is null ", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + SqlUtils.getNonStringFieldInLargeCollectionsPredicate("ti.tousseDefinition_id", tousseDefinitionIdList), + TousseInstance.STATUS_SHIPPED, + orgUnitCoding, + dateQueryAdapter.dateAreaSql("i.sendTime", beginDate, endDate)); + if(CollectionUtils.isNotEmpty(signedTousseInstanceIdList)){ + sql1 += " and " + SqlUtils.getNonStringFieldNotInCollectionsPredicate("ti.id", signedTousseInstanceIdList); + } + sql1 += " group by ti.tousseName"; + + //二次发货 + String sql2 = String.format("select ti.tousseName, count(0) waitSignAmount from %s ti " + + " join %s i on i.id = ti.invoice2_id" + + " where (1=1) and %s " + + " and ti.status = '%s' " + + " and ti.location_2='%s' " + + " and %s ", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + SqlUtils.getNonStringFieldInLargeCollectionsPredicate("ti.tousseDefinition_id", tousseDefinitionIdList), + TousseInstance.STATUS_SHIPPED, + orgUnitCoding, + dateQueryAdapter.dateAreaSql("i.sendTime", beginDate, endDate)); + if(CollectionUtils.isNotEmpty(signedTousseInstanceIdList)){ + sql2 += " and " + SqlUtils.getNonStringFieldNotInCollectionsPredicate("ti.id", signedTousseInstanceIdList); + } + sql2 += " group by ti.tousseName"; + + String sql = String.format("select * from (%s union all %s ) rs", sql1, sql2); + ResultSet result = null; + try { + result = objectDao.executeSql(sql); + while (result.next()) { + String tousseName = result.getString("tousseName"); + int waitSignAmount = result.getInt("waitSignAmount"); + Integer tousseAmount = tousseAmountMap.get(tousseName); + if(tousseAmount == null){ + tousseAmount = 0; + } + tousseAmountMap.put(tousseName, waitSignAmount + tousseAmount); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(result); + } + return tousseAmountMap; + } /** * 根据申请单号或发货单号,批量签收器械包的返回信息 Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java =================================================================== diff -u -r36399 -r36423 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java (.../SignRecordManagerImpl.java) (revision 36399) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/signRecord/service/SignRecordManagerImpl.java (.../SignRecordManagerImpl.java) (revision 36423) @@ -33,6 +33,7 @@ import com.forgon.disinfectsystem.entity.invoicemanager.Invoice; import com.forgon.disinfectsystem.entity.invoicemanager.InvoiceItem; import com.forgon.disinfectsystem.entity.sterilizationTransition.SterilizationTransitionItem; +import com.forgon.disinfectsystem.entity.urgent.UrgentLevel; import com.forgon.disinfectsystem.signRecord.vo.SignRecordPrintTousseVo; import com.forgon.disinfectsystem.signRecord.vo.SignRecordVo; import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseInstanceManager; @@ -47,6 +48,7 @@ import com.forgon.tools.hibernate.BasePoManagerImpl; import com.forgon.tools.json.JSONUtil; import com.forgon.tools.string.StringTools; +import com.forgon.tools.util.ConfigUtils; import com.forgon.tools.util.ForgonDateUtils; public class SignRecordManagerImpl extends BasePoManagerImpl @@ -406,67 +408,225 @@ timeSql = " and " + dateQueryAdapter.dateAreaSql("invoiceSendTime", beginDate, endDate); } - // 汇总 - String sql = "select ti.tousseName, count(0) amount, min(case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end) as invoiceSendTime from " + TousseInstance.class.getSimpleName() + " ti " - + "left join " + Invoice.class.getSimpleName() + " i1 on ti.invoice_id = i1.id " - + "left join " + Invoice.class.getSimpleName() + " i2 on ti.invoice2_id = i2.id " - + "where ((ti.location='" + departCoding + "' and ti.location_2 is null) or (ti.location_2 = '" + departCoding + "')) and ti.status='" + TousseInstance.STATUS_SHIPPED + "'" - + timeSql - + " group by ti.tousseName" - + " order by ti.tousseName"; - ResultSet result = null; - try { - result = objectDao.executeSql(sql); - while (result.next()) { - Map map = new HashMap(); - map.put("tousseName", StringTools.defaultString(result.getString("tousseName"))); - map.put("amount", result.getInt("amount")); - map.put("invoiceSendTime", result.getString("invoiceSendTime")); - list.add(map); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - DatabaseUtil.closeResultSetAndStatement(result); + //是否启用加急 + boolean enableUrgentFunction = ConfigUtils.getSystemSetConfigByNameBool("enableUrgentFunction"); + if(!enableUrgentFunction){ + //查询待签收物品,不需要关联查询加急信息 + list = getWaitSignTousseInstanceWithoutUrgentInfo(departCoding, timeSql); + }else{ + //查询待签收物品,并关联查询加急信息 + list = getWaitSignTousseInstanceWithUrgentInfo(departCoding, timeSql); } // 比较发货时间和当前时间 try { - Date today = new Date(); - Date now = new Date(); - now.setTime(today.getTime()); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - today = sdf.parse(sdf.format(today)); + Date currentDateTime = new Date(); + Date currentDate = DateTools.startOfDate(currentDateTime); // 待签收物品过期提醒 String procedure = TimeoutManager.PROCEDURE_DELIVERY_TO_SIGN; int hour = keyValueManager.getIntValue(procedure + "Hour", 0); int minute = keyValueManager.getIntValue(procedure + "Minute", 0); for (Map map : list) { - String invoiceSendTimeStr = (String)map.get("invoiceSendTime"); - Date invoiceSendTime = DateTools.coverStrToDate(invoiceSendTimeStr, "yyyy-MM-dd"); - if(invoiceSendTime == null){ - invoiceSendTime = today; + Date invoiceSendDate = null; + Date invoiceSendDateTime = null; + String invoiceSendTimeStr = ""; + if(map.get("invoiceSendTime") != null){ + invoiceSendTimeStr = (String)map.get("invoiceSendTime"); + invoiceSendDate = DateTools.coverStrToDate(invoiceSendTimeStr, "yyyy-MM-dd"); + invoiceSendDateTime = DateTools.coverStrToDate(invoiceSendTimeStr, DateTools.COMMON_DATE_HMS); } + if(invoiceSendDate == null){ + invoiceSendDate = currentDate; + } // 前台根据此字段做颜色设置 // (0表示待签收的物品的发货日期全部都是今天的(白色),1表示待签收的物品的发货日期有不是今天的日期的(黄色)) - map.put("signTime", today.compareTo(invoiceSendTime)); + map.put("signTime", currentDate.compareTo(invoiceSendDate)); // (1表示待签收的物品不需要过期提醒,0表示待签收的物品已经超时需要过期提醒(红色)) - if(invoiceSendTimeStr != null && (hour != 0 || minute != 0)){ + if(invoiceSendDateTime != null && (hour != 0 || minute != 0)){ Date warningTime = new Date(); - long time = DateTools.coverStrToDate(invoiceSendTimeStr, DateTools.COMMON_DATE_HMS).getTime(); + long time = invoiceSendDateTime.getTime(); time += hour*60*60*1000l + minute*60*1000l; warningTime.setTime(time); - map.put("warnTime", warningTime.after(now) ? 1 : 0); + map.put("warnTime", warningTime.after(currentDateTime) ? 1 : 0); }else{ map.put("warnTime", 1); } } - } catch (ParseException e) { + } catch (Exception e) { e.printStackTrace(); } return list; } + /** + * 查询待签收物品,并关联查询加急信息 + * @param departCoding + * @param timeSql + * @return + */ + private List> getWaitSignTousseInstanceWithUrgentInfo(String departCoding, String timeSql) { + List> list = new ArrayList>(); + + List waitSignTousseInstanceList = new ArrayList(); + String sql = String.format("select ti.id tiId, ti.tousseName" + + ", case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end invoiceSendTime" + + ", ul.id urgentLevelId, ul.name urgentLevelname, ul.colorCode, ul.colorName, ul.grade " + + "from %s ti " + + "left join %s i1 on i1.id = ti.invoice_id " + + "left join %s i2 on i2.id = ti.invoice2_id " + + "left join %s ul on ul.id = ti.urgentLevel_id " + + "where ((ti.location = '%s' and ti.location_2 is null) or (ti.location_2 = '%s')) " + + "and ti.status='%s' " + + timeSql + + " order by ul.grade desc, ti.tousseName ", + TousseInstance.class.getSimpleName(), + Invoice.class.getSimpleName(), + Invoice.class.getSimpleName(), + UrgentLevel.class.getSimpleName(), + departCoding, + departCoding, + TousseInstance.STATUS_SHIPPED); + ResultSet result = null; + try { + result = objectDao.executeSql(sql); + while (result.next()) { + String tousseName = result.getString("tousseName"); + Date invoiceSendTime = result.getTimestamp("invoiceSendTime"); + Long urgentLevelId = result.getLong("urgentLevelId"); + String urgentLevelname = result.getString("urgentLevelname"); + String colorCode = result.getString("colorCode"); + String colorName = result.getString("colorName"); + Integer grade = result.getInt("grade"); + TousseInstance tousseInstance = new TousseInstance(); + tousseInstance.setTousseName(tousseName); + tousseInstance.setInvoiceSendTime(invoiceSendTime); + if(DatabaseUtil.isPoIdValid(urgentLevelId)){ + UrgentLevel urgentLevel = new UrgentLevel(); + urgentLevel.setName(urgentLevelname); + urgentLevel.setColorCode(colorCode); + urgentLevel.setColorName(colorName); + urgentLevel.setGrade(grade); + tousseInstance.setUrgentLevel(urgentLevel); + } + waitSignTousseInstanceList.add(tousseInstance); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(result); + } + + //待签收数量map + Map tousseAmountMap = new HashMap(); + //待签收加急数量map + Map tousseUrgentAmountMap = new HashMap(); + //待签收物品最大加急等级map + Map tousseUrgentLevelMap = new HashMap(); + //待签收物品最早发货时间map + Map tousseInvoiceSendTimeMap = new HashMap(); + if(CollectionUtils.isNotEmpty(waitSignTousseInstanceList)){ + for (TousseInstance tousseInstance : waitSignTousseInstanceList) { + String tousseName = tousseInstance.getTousseName(); + Integer amount = tousseAmountMap.get(tousseName); + if(amount == null){ + amount = 0; + } + tousseAmountMap.put(tousseName, amount+1); + UrgentLevel urgentLevel = tousseInstance.getUrgentLevel(); + if(urgentLevel != null){ + UrgentLevel maxUrgentLevel = tousseUrgentLevelMap.get(tousseName); + if(maxUrgentLevel != null){ + Integer maxGrade = maxUrgentLevel.getGrade(); + Integer grade = urgentLevel.getGrade(); + if(grade != null){ + if(maxGrade != null){ + if(maxGrade.intValue() < grade.intValue()){ + maxUrgentLevel = urgentLevel; + } + }else{ + maxUrgentLevel = urgentLevel; + } + } + }else{ + maxUrgentLevel = urgentLevel; + } + tousseUrgentLevelMap.put(tousseName, maxUrgentLevel); + Integer urgentAmount = tousseUrgentAmountMap.get(tousseName); + if(urgentAmount == null){ + urgentAmount = 0; + } + tousseUrgentAmountMap.put(tousseName, ++urgentAmount); + } + Date invoiceSendTime = tousseInstance.getInvoiceSendTime(); + if(invoiceSendTime != null){ + Date minInvoiceSendTime = tousseInvoiceSendTimeMap.get(tousseName); + if(minInvoiceSendTime == null || invoiceSendTime.before(minInvoiceSendTime)){ + minInvoiceSendTime = invoiceSendTime; + } + tousseInvoiceSendTimeMap.put(tousseName, minInvoiceSendTime); + } + } + + List tousseNameList = new ArrayList(); + for (TousseInstance tousseInstance : waitSignTousseInstanceList) { + String tousseName = tousseInstance.getTousseName(); + if(tousseNameList.contains(tousseName)){ + continue; + } + Map map = new HashMap(); + map.put("tousseName", tousseName); + map.put("amount", tousseAmountMap.get(tousseName)); + map.put("urgentAmount", tousseUrgentAmountMap.get(tousseName)); + String invoiceSendTime = ""; + Date minInvoiceSendTime = tousseInvoiceSendTimeMap.get(tousseName); + if(minInvoiceSendTime != null){ + invoiceSendTime = DateTools.getFormatDateStr(minInvoiceSendTime, DateTools.COMMON_DATE_HMS); + } + map.put("invoiceSendTime", invoiceSendTime); + UrgentLevel urgentLevel = tousseUrgentLevelMap.get(tousseName); + map.put("maxUrgentLevel", urgentLevel); + list.add(map); + tousseNameList.add(tousseName); + } + } + + return list; + } + /** + * 查询待签收物品,不需要关联查询加急信息 + * @param departCoding + * @param timeSql + * @return + */ + private List> getWaitSignTousseInstanceWithoutUrgentInfo(String departCoding, String timeSql) { + List> list = new ArrayList>(); + // 汇总 + String sql = "select ti.tousseName, count(0) amount, min(case when ti.invoice2_id is not null then i2.sendTime else i1.sendTime end) as invoiceSendTime from " + TousseInstance.class.getSimpleName() + " ti " + + "left join " + Invoice.class.getSimpleName() + " i1 on ti.invoice_id = i1.id " + + "left join " + Invoice.class.getSimpleName() + " i2 on ti.invoice2_id = i2.id " + + "where ((ti.location='" + departCoding + "' and ti.location_2 is null) or (ti.location_2 = '" + departCoding + "')) and ti.status='" + TousseInstance.STATUS_SHIPPED + "'" + + timeSql + + " group by ti.tousseName" + + " order by ti.tousseName"; + ResultSet result = null; + try { + result = objectDao.executeSql(sql); + while (result.next()) { + Map map = new HashMap(); + map.put("tousseName", StringTools.defaultString(result.getString("tousseName"))); + map.put("amount", result.getInt("amount")); + map.put("invoiceSendTime", result.getString("invoiceSendTime")); + list.add(map); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(result); + } + return list; + } + + /** * 根据签收记录的时间来获取数据 */ @Override