|
@@ -3,6 +3,7 @@ package com.qmth.sop.business.service.impl;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
import com.qmth.sop.business.bean.dto.DataPermissionDto;
|
|
import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
|
|
import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
import com.qmth.sop.business.entity.SysUser;
|
|
@@ -29,12 +30,11 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private SysUserService sysUserService;
|
|
private SysUserService sysUserService;
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
- public List<TBService> list(Long startTime, Long endTime) {
|
|
|
|
|
|
+ public List<TBService> list(Long startTime,Long endTime) {
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
- return this.baseMapper.list(startTime, endTime, dpr);
|
|
|
|
|
|
+ return this.baseMapper.list(startTime,endTime,dpr);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -44,31 +44,53 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Map<String, Map<String, Object>> influence(Long serviceUnitId, QualityAnalyseGroupEnum group) {
|
|
|
|
|
|
+ public JSONObject influence(Long serviceUnitId, QualityAnalyseGroupEnum group) {
|
|
List<Map<String, Object>> influence = this.baseMapper.influence(serviceUnitId);
|
|
List<Map<String, Object>> influence = this.baseMapper.influence(serviceUnitId);
|
|
- Map<String, Map<String, Object>> result = new HashMap<>();
|
|
|
|
|
|
+// Map<String, Map<String, Object>> result = new HashMap<>();
|
|
|
|
+ JSONObject result=new JSONObject();
|
|
|
|
+
|
|
if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_REGION)) {
|
|
if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_REGION)) {
|
|
- influence.stream().filter(map -> map.get("region_name") != null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- v.stream().filter(map1 -> map1.get("Influence_degree") != null).collect(Collectors.groupingBy(map1 -> map1.get("Influence_degree"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
|
|
|
|
|
|
+ influence.stream().filter(map->map.get("region_name")!=null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
|
+ JSONObject map=new JSONObject();
|
|
|
|
+ v.stream().filter(map1->map1.get("Influence_degree")!=null).collect(Collectors.groupingBy(map1 -> map1.get("Influence_degree"))).forEach((k1, v1) -> {
|
|
|
|
+ map.put(k1.toString(), v1.size());
|
|
|
|
+ });
|
|
|
|
+ map.put("id",v.get(0).get("region_id"));
|
|
result.put(k.toString(), map);
|
|
result.put(k.toString(), map);
|
|
});
|
|
});
|
|
} else if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_SUPPLIER)) {
|
|
} else if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_SUPPLIER)) {
|
|
- influence.stream().filter(map -> map.get("Influence_degree") != null).collect(Collectors.groupingBy(map -> map.get("Influence_degree"))).forEach((k, v) -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- v.stream().filter(map1 -> map1.get("supplier") != null).collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
|
|
|
|
|
|
+ influence.stream().filter(map->map.get("Influence_degree")!=null).collect(Collectors.groupingBy(map -> map.get("Influence_degree"))).forEach((k, v) -> {
|
|
|
|
+ JSONObject map=new JSONObject();
|
|
|
|
+
|
|
|
|
+ v.stream().filter(map1->map1.get("supplier")!=null).collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> {
|
|
|
|
+ JSONObject map1=new JSONObject();
|
|
|
|
+ map1.put("value",v1.size());
|
|
|
|
+ map1.put("id",v.get(0).get("supplier_id"));
|
|
|
|
+ map.put(k1.toString(), map1);
|
|
|
|
+ });
|
|
result.put(k.toString(), map);
|
|
result.put(k.toString(), map);
|
|
});
|
|
});
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
|
|
- influence.stream().filter(map -> map.get("region_name") != null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- v.stream().filter(map1 -> map1.get("reason") != null).collect(Collectors.groupingBy(map1 -> map1.get("reason"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
|
|
|
|
|
|
+ influence.stream().filter(map->map.get("region_name")!=null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
|
|
+// Map<String, Object> map = new HashMap<>();
|
|
|
|
+ JSONObject map=new JSONObject();
|
|
|
|
+ v.stream().filter(map1->map1.get("Influence_degree")!=null).collect(Collectors.groupingBy(map1 -> map1.get("Influence_degree"))).forEach((k1, v1) -> {
|
|
|
|
+ map.put(k1.toString(), v1.size());
|
|
|
|
+ });
|
|
|
|
+ map.put("id",v.get(0).get("region_id"));
|
|
result.put(k.toString(), map);
|
|
result.put(k.toString(), map);
|
|
});
|
|
});
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_SUPPLIER)) {
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_SUPPLIER)) {
|
|
- influence.stream().filter(map -> map.get("reason") != null).collect(Collectors.groupingBy(map -> map.get("reason"))).forEach((k, v) -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- v.stream().filter(map1 -> map1.get("supplier") != null).collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
|
|
|
|
|
|
+ influence.stream().filter(map->map.get("reason")!=null).collect(Collectors.groupingBy(map -> map.get("reason"))).forEach((k, v) -> {
|
|
|
|
+ JSONObject map=new JSONObject();
|
|
|
|
+
|
|
|
|
+ v.stream().filter(map1->map1.get("supplier")!=null).collect(Collectors.groupingBy(map1 -> map1.get("supplier"))).forEach((k1, v1) -> {
|
|
|
|
+ JSONObject map1=new JSONObject();
|
|
|
|
+ map1.put("value",v1.size());
|
|
|
|
+ map1.put("id",v.get(0).get("supplier_id"));
|
|
|
|
+ map.put(k1.toString(), map1);
|
|
|
|
+ });
|
|
result.put(k.toString(), map);
|
|
result.put(k.toString(), map);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -80,49 +102,48 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
|
|
public Map<String, Object> pie(Long serviceUnitId) {
|
|
public Map<String, Object> pie(Long serviceUnitId) {
|
|
List<Map<String, Object>> pie = this.baseMapper.pie(serviceUnitId, null);
|
|
List<Map<String, Object>> pie = this.baseMapper.pie(serviceUnitId, null);
|
|
Map<String, Object> result = new HashMap<>();
|
|
Map<String, Object> result = new HashMap<>();
|
|
- pie.stream().filter(map1 -> map1.get("Influence_degree") != null).collect(Collectors.groupingBy(map -> map.get("Influence_degree"))).forEach((k, v) -> result.put(k.toString(), v.stream().filter(map1 -> map1.get("count") != null).mapToLong(map1 -> (long) map1.get("count")).sum()));
|
|
|
|
|
|
+ pie.stream().filter(map1->map1.get("Influence_degree")!=null).collect(Collectors.groupingBy(map -> map.get("Influence_degree"))).forEach((k, v) -> result.put(k.toString(),v.stream().filter(map1->map1.get("count")!=null).mapToLong(map1-> (long) map1.get("count")).sum()));
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Map<String, Object>> radar(Long serviceUnitId, QualityAnalyseGroupEnum group) {
|
|
public Map<String, Map<String, Object>> radar(Long serviceUnitId, QualityAnalyseGroupEnum group) {
|
|
|
|
+
|
|
|
|
+
|
|
List<Map<String, Object>> radar = this.baseMapper.radar(serviceUnitId, null);
|
|
List<Map<String, Object>> radar = this.baseMapper.radar(serviceUnitId, null);
|
|
Map<String, Map<String, Object>> result = new HashMap<>();
|
|
Map<String, Map<String, Object>> result = new HashMap<>();
|
|
- radar.stream().filter(map1 -> map1.get("reason") != null).collect(Collectors.groupingBy(map -> map.get("reason"))).forEach((k, v) -> {
|
|
|
|
- Map<String, Object> countMap = new HashMap<>(), map = new HashMap<>();
|
|
|
|
- countMap.put(k.toString(), v.stream().filter(map1 -> map1.get("count") != null).mapToLong(map1 -> (long) map1.get("count")).sum());
|
|
|
|
- if (result.containsKey("all")) {
|
|
|
|
- map = result.get("all");
|
|
|
|
- map.put(k.toString(), countMap.get(k.toString()));
|
|
|
|
- } else {
|
|
|
|
- map.put(k.toString(), countMap.get(k.toString()));
|
|
|
|
- }
|
|
|
|
|
|
+ radar.stream().filter(map1->map1.get("reason")!=null).collect(Collectors.groupingBy(map -> map.get("reason"))).forEach((k, v) -> {
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put(k.toString(),v.stream().filter(map1->map1.get("count")!=null).mapToLong(map1-> (long) map1.get("count")).sum());
|
|
result.put("all", map);
|
|
result.put("all", map);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+
|
|
if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
|
|
if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
|
|
- radar.stream().filter(map1 -> map1.get("region_name") != null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
|
|
|
|
+
|
|
|
|
+ radar.stream().filter(map1->map1.get("region_name")!=null).collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
|
|
Map<String, Object> z = new HashMap<>();
|
|
Map<String, Object> z = new HashMap<>();
|
|
- v.stream().filter(map1 -> map1.get("reason") != null).collect(Collectors.groupingBy(map2 -> map2.get("reason"))).forEach((k1, v1) -> z.put(k1.toString(), v1.stream().filter(map1 -> map1.get("count") != null).mapToLong(map1 -> (long) map1.get("count")).sum()));
|
|
|
|
|
|
+ v.stream().filter(map1->map1.get("reason")!=null).collect(Collectors.groupingBy(map2 -> map2.get("reason"))).forEach((k1, v1) -> z.put(k1.toString(),v1.stream().filter(map1->map1.get("count")!=null).mapToLong(map1-> (long) map1.get("count")).sum()));
|
|
result.put(k.toString(), z);
|
|
result.put(k.toString(), z);
|
|
});
|
|
});
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_SUPPLIER)) {
|
|
} else if (group.equals(QualityAnalyseGroupEnum.REASON_SUPPLIER)) {
|
|
- radar.stream().filter(map1 -> map1.get("supplier") != null).collect(Collectors.groupingBy(map -> map.get("supplier"))).forEach((k, v) -> {
|
|
|
|
|
|
+ radar.stream().filter(map1->map1.get("supplier")!=null).collect(Collectors.groupingBy(map -> map.get("supplier"))).forEach((k, v) -> {
|
|
Map<String, Object> z = new HashMap<>();
|
|
Map<String, Object> z = new HashMap<>();
|
|
- v.stream().filter(map1 -> map1.get("reason") != null).collect(Collectors.groupingBy(map2 -> map2.get("reason"))).forEach((k1, v1) -> z.put(k1.toString(), v1.stream().filter(map1 -> map1.get("count") != null).mapToLong(map1 -> (long) map1.get("count")).sum()));
|
|
|
|
|
|
+ v.stream().filter(map1->map1.get("reason")!=null).collect(Collectors.groupingBy(map2 -> map2.get("reason"))).forEach((k1, v1) -> z.put(k1.toString(),v1.stream().filter(map1->map1.get("count")!=null).mapToLong(map1-> (long) map1.get("count")).sum()));
|
|
result.put(k.toString(), z);
|
|
result.put(k.toString(), z);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, Long serviceUnitId, InfluenceDegreeEnum degree) {
|
|
|
|
- return this.baseMapper.detail(objectPage, serviceUnitId, Objects.nonNull(degree) ? degree.name() : null);
|
|
|
|
|
|
+ public IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, Long serviceUnitId,InfluenceDegreeEnum degree) {
|
|
|
|
+ return this.baseMapper.detail(objectPage, serviceUnitId, Objects.nonNull(degree)?degree.toString():null );
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, Long region_id, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason) {
|
|
public IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, Long region_id, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason) {
|
|
- return this.baseMapper.influenceDetail(tPage, serviceUnitId, supplierId, region_id, Objects.nonNull(influenceDegree) ? influenceDegree.name() : null, Objects.nonNull(reason) ? reason.name() : null);
|
|
|
|
|
|
+ return this.baseMapper.influenceDetail(tPage, serviceUnitId, supplierId,region_id, Objects.nonNull(influenceDegree)?influenceDegree.toString():null, Objects.nonNull(reason)?reason.toString():null);
|
|
}
|
|
}
|
|
}
|
|
}
|