|
@@ -13,10 +13,7 @@ import com.fjhx.utils.BigDecimalUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -72,11 +69,25 @@ public class ApplyPurchaseServiceImpl extends ServiceImpl<ApplyPurchaseMapper, A
|
|
|
initMap.put("purchaseQty", BigDecimal.ZERO);
|
|
|
initMap.put("num", BigDecimal.ZERO);
|
|
|
|
|
|
- technologyType.putIfAbsent("0", initMap);
|
|
|
- technologyType.putIfAbsent("1", initMap);
|
|
|
- technologyType.putIfAbsent("2", initMap);
|
|
|
- technologyType.putIfAbsent("3", initMap);
|
|
|
- technologyType.putIfAbsent("4", initMap);
|
|
|
+ Map<String, Object> initMap0 = ObjectUtil.clone(initMap);
|
|
|
+ initMap0.put("technologyType", 0);
|
|
|
+ technologyType.putIfAbsent("0", initMap0);
|
|
|
+
|
|
|
+ Map<String, Object> initMap1 = ObjectUtil.clone(initMap);
|
|
|
+ initMap1.put("technologyType", 1);
|
|
|
+ technologyType.putIfAbsent("1", initMap1);
|
|
|
+
|
|
|
+ Map<String, Object> initMap2 = ObjectUtil.clone(initMap);
|
|
|
+ initMap2.put("technologyType", 2);
|
|
|
+ technologyType.putIfAbsent("2", initMap2);
|
|
|
+
|
|
|
+ Map<String, Object> initMap3 = ObjectUtil.clone(initMap);
|
|
|
+ initMap3.put("technologyType", 3);
|
|
|
+ technologyType.putIfAbsent("3", initMap3);
|
|
|
+
|
|
|
+ Map<String, Object> initMap4 = ObjectUtil.clone(initMap);
|
|
|
+ initMap4.put("technologyType", 4);
|
|
|
+ technologyType.putIfAbsent("4", initMap4);
|
|
|
|
|
|
// 统计面料(0直喷,1热转,2打纸,4其他)之和
|
|
|
HashMap<String, Object> fabricMap = new HashMap<>();
|
|
@@ -102,6 +113,52 @@ public class ApplyPurchaseServiceImpl extends ServiceImpl<ApplyPurchaseMapper, A
|
|
|
return technologyType;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> numStatistics(Map<String, String> condition) {
|
|
|
+
|
|
|
+ String technologyType = condition.get("technologyType");
|
|
|
+
|
|
|
+ QueryWrapper<Object> wrapper = getApplyPurchaseTimeWrapper(condition);
|
|
|
+
|
|
|
+ String keyword = condition.get("keyword");
|
|
|
+ if (ObjectUtil.isNotEmpty(keyword)) {
|
|
|
+ wrapper.and(q -> q.like("m.Code", keyword).or().like("m.Name", keyword));
|
|
|
+ }
|
|
|
+
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(technologyType), "m.TechnologyType", technologyType);
|
|
|
+
|
|
|
+ wrapper.groupBy("ap.ApproveBillState");
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = baseMapper.numStatistics(wrapper);
|
|
|
+
|
|
|
+ Map<Integer, Long> collect = list.stream().collect(Collectors.toMap(
|
|
|
+ item -> (Integer) item.get("approveBillState"),
|
|
|
+ item -> (Long) item.get("count")
|
|
|
+ ));
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, Object> approvedMap = new HashMap<>();
|
|
|
+ approvedMap.put("key", "审批中");
|
|
|
+ approvedMap.put("value", 1);
|
|
|
+ approvedMap.put("count", (collect.get(0) == null ? 0 : collect.get(0)) + (collect.get(1) == null ? 0 : collect.get(1)));
|
|
|
+
|
|
|
+ Map<String, Object> passedMap = new HashMap<>();
|
|
|
+ passedMap.put("key", "已通过");
|
|
|
+ passedMap.put("value", 2);
|
|
|
+ passedMap.put("count", collect.get(2) == null ? 0 : collect.get(2));
|
|
|
+
|
|
|
+ Map<String, Object> rejectedMap = new HashMap<>();
|
|
|
+ rejectedMap.put("key", "已驳回");
|
|
|
+ rejectedMap.put("value", 3);
|
|
|
+ rejectedMap.put("count", collect.get(3) == null ? 0 : collect.get(3));
|
|
|
+
|
|
|
+ Map<String, Object> wholeMap = new HashMap<>();
|
|
|
+ wholeMap.put("key", "全部");
|
|
|
+ wholeMap.put("count", (Long) approvedMap.get("count") + (Long) passedMap.get("count") + (Long) rejectedMap.get("count"));
|
|
|
+
|
|
|
+ return Arrays.asList(wholeMap, approvedMap, rejectedMap, passedMap);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 领料追踪统计获取wrapper
|