|
@@ -18,6 +18,8 @@ import com.qmth.sop.business.service.SysUserService;
|
|
|
import com.qmth.sop.business.service.TBUserArchivesSupplierService;
|
|
|
import com.qmth.sop.common.enums.CrmStatusEnum;
|
|
|
import com.qmth.sop.common.enums.DeviceStatusEnum;
|
|
|
+import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
|
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -25,6 +27,7 @@ import javax.annotation.Resource;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper, TBService> implements ServiceAnalyseService {
|
|
@@ -38,11 +41,12 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
|
|
|
private SysUserService sysUserService;
|
|
|
|
|
|
@Override
|
|
|
- public List<TBService> list(Long startTime,Long endTime) {
|
|
|
+ public List<TBService> list(Long startTime, Long endTime) {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
|
|
|
- return this.baseMapper.list(startTime,endTime,dpr);
|
|
|
+ return this.baseMapper.list(startTime, endTime, dpr);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 4.服务单元概览
|
|
|
* ①项目执行进度=服务单元下已完成的派单(研究生派单下SOP已完结;教务处派单下已有完成的SOP,无在执行的SOP。可能存在教务处多个SOP之间空窗期导致数据的误差,这个指标允许少量误差存在);
|
|
@@ -54,14 +58,36 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
|
|
|
@Override
|
|
|
public Map<String, Object> overview(Long serviceUnitId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("projectProgress", this.baseMapper.projectProgress(serviceUnitId));
|
|
|
+ List<Map<String, Object>> list = this.baseMapper.projectProgress(serviceUnitId);
|
|
|
+ int crmNum = list.stream().collect(Collectors.groupingBy(map1 -> map1.get("crm_no"))).size();
|
|
|
+ final int[] finish = {0, 0};
|
|
|
+ list.stream().collect(Collectors.groupingBy(map1 -> map1.get("crm_no")))
|
|
|
+ .forEach((k, v) -> {
|
|
|
+ v.stream().collect(Collectors.groupingBy(map2 -> map2.get("type"))).forEach((k1, v1) -> {
|
|
|
+ if (ProductTypeEnum.OFFICE.toString().equals(k1)) {
|
|
|
+ if (v1.stream().anyMatch(map3 -> "FINISH".equals(map3.get("status"))) && v1.stream().noneMatch(map3 -> "FINISH".equals(map3.get("START")))) {
|
|
|
+ finish[1] = finish[1] + 1;
|
|
|
+ }
|
|
|
+ } else if (ProductTypeEnum.CLOUD_MARK.toString().equals(k1)) {
|
|
|
+ if (v1.stream().filter(map3 -> map3.get("sop_no") != null).count() == v1.stream().filter(map3 -> "FINISH".equals(map3.get("status"))).count()) {
|
|
|
+ finish[1] = finish[1] + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ map.put("projectProgress", (finish[0] + finish[1])*100 / crmNum);
|
|
|
map.put("equipmentOutboundTotal", this.baseMapper.equipmentOutboundTotal(serviceUnitId));
|
|
|
+ Integer outboundTotal = this.baseMapper.equipmentOutboundTotal(null);
|
|
|
int totalDevices = sysDeviceService.count(new LambdaQueryWrapper<SysDevice>().eq(SysDevice::getStatus, DeviceStatusEnum.NORMAL));
|
|
|
- map.put("equipmentOccupancyRate",totalDevices==0?0: ((Integer) map.get("equipmentOutboundTotal")) * 100 / totalDevices);
|
|
|
+ map.put("equipmentOccupancyRate", totalDevices == 0 ? 0 : outboundTotal* 100 / totalDevices);
|
|
|
map.put("servicePersonnelTotal", this.baseMapper.servicePersonnelTotal(serviceUnitId));
|
|
|
//认证有效的人员总数
|
|
|
+ Integer personnelTotal = this.baseMapper.servicePersonnelTotal(null);
|
|
|
int totalUserArchives = tbUserArchivesSupplierService.countAuthentication();
|
|
|
- map.put("sitePersonnelOccupancyRate",totalUserArchives==0?0: ((Integer) map.get("servicePersonnelTotal")) * 100 / totalUserArchives);
|
|
|
+ map.put("sitePersonnelOccupancyRate", totalUserArchives == 0 ? 0 : personnelTotal* 100 / totalUserArchives);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -80,16 +106,16 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
|
|
|
|
|
|
@Override
|
|
|
public IPage<TBCrmResult> supplierDetail(Page<Object> iPage, Long serviceUnitId, Long supplierId) {
|
|
|
- return this.baseMapper.crmDetail(iPage, serviceUnitId,supplierId);
|
|
|
+ return this.baseMapper.crmDetail(iPage, serviceUnitId, supplierId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> supplierRole(Long supplierId) {
|
|
|
+ public List<Map<String, Object>> supplierRole(Long supplierId) {
|
|
|
return this.baseMapper.supplierRole(supplierId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> supplierRegion(Long serviceUnitId, Long supplierId) {
|
|
|
+ public List<Map<String, Object>> supplierRegion(Long serviceUnitId, Long supplierId) {
|
|
|
return this.baseMapper.supplierRegion(serviceUnitId, supplierId);
|
|
|
}
|
|
|
|