Ver código fonte

新增所有公出统计

anderx 1 ano atrás
pai
commit
f64389a81e

+ 38 - 28
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -1445,42 +1445,52 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 	@Override
 	public Object publicReleaseAndCount(InputPublicDtails in) {
 		List<OutPublicDtails> list = publicReleaseListDtailsList(in);
-		//公出次数
-		int count=0;
-		BigDecimal durationCount=BigDecimal.ZERO;
-		List<String> aList =new ArrayList<>();
-		for (OutPublicDtails e : list) {
-			if (e.getType()==0||e.getType()==1||e.getType()==2){
-				count++;
-				durationCount=durationCount.add(new BigDecimal(e.getDuration()));
-				if (!aList.contains(e.getAname())){
-					aList.add(e.getAname());
-				}
-				if (StringUtils.isNotEmpty(e.getAssistAidName())){
-					String[] split = e.getAssistAidName().split(",");
-					for (String s : split) {
-						if (!aList.contains(s)){
-							aList.add(s);
+			Map<String,Object> map=new HashMap<String, Object>();
+		if (list.isEmpty()){
+			map.put("list",list);
+			map.put("count",0);
+			map.put("durationCount",0);
+			map.put("peopleCount",0);
+		}else {
+			//公出次数
+			int count=0;
+			BigDecimal durationCount=BigDecimal.ZERO;
+			List<String> aList =new ArrayList<>();
+			for (OutPublicDtails e : list) {
+				if (e.getType()==0||e.getType()==1||e.getType()==2){
+					count++;
+					if (e.getDuration()!=null){
+						durationCount=durationCount.add(new BigDecimal(e.getDuration()));
+					}
+					if (!aList.contains(e.getAname())){
+						aList.add(e.getAname());
+					}
+					if (StringUtils.isNotEmpty(e.getAssistAidName())){
+						String[] split = e.getAssistAidName().split(",");
+						for (String s : split) {
+							if (!aList.contains(s)){
+								aList.add(s);
+							}
 						}
 					}
-				}
-				if (StringUtils.isNotEmpty(e.getAssistantName())){
-					String[] split = e.getAssistantName().split(",");
-					for (String s : split) {
-						if (!aList.contains(s)){
-							aList.add(s);
+					if (StringUtils.isNotEmpty(e.getAssistantName())){
+						String[] split = e.getAssistantName().split(",");
+						for (String s : split) {
+							if (!aList.contains(s)){
+								aList.add(s);
+							}
 						}
 					}
 				}
-			}
 
 
+			}
+			map.put("list",list);
+			map.put("count",count);
+			map.put("durationCount",durationCount);
+			map.put("peopleCount",aList.size());
 		}
-		Map<String,Object> map=new HashMap<String, Object>();
-		map.put("list",list);
-		map.put("count",count);
-		map.put("durationCount",durationCount);
-		map.put("peopleCount",aList.size());
+
 		return map;
 	}