|
@@ -1,13 +1,25 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.rongwei.bsentity.domain.ZhcxProjectDeviceIndicatorDo;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxProjectDeviceIndicatorDao;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxProjectDeviceIndicatorService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
|
|
|
+import com.rongwei.bsentity.dto.ZhcxProjectDeviceIndicatorDto;
|
|
|
import com.rongwei.bsentity.dto.project.indicator.DelPhysicalParam;
|
|
|
+import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
+import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 单项目机号指标 服务实现类
|
|
@@ -31,4 +43,48 @@ public class ZhcxProjectDeviceIndicatorServiceImpl extends ServiceImpl<ZhcxProje
|
|
|
public void delPhysical(DelPhysicalParam param) {
|
|
|
dao.delPhysical(param);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ZhcxProjectDeviceIndicatorDto> getListData(Map<String, Object> map) {
|
|
|
+ Object projectIdObj = map.get("projectId");
|
|
|
+ Object machinenoObj = map.get("machineno");
|
|
|
+ if(projectIdObj == null || machinenoObj == null){
|
|
|
+ throw new CustomException("缺少项目或机号参数");
|
|
|
+ }
|
|
|
+ String projectId = projectIdObj.toString();
|
|
|
+ String machineno = machinenoObj.toString();
|
|
|
+ final LambdaQueryWrapper<ZhcxProjectDeviceIndicatorDo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.eq(ZhcxProjectDeviceIndicatorDo::getProjectid, projectId);
|
|
|
+ queryWrapper.eq(ZhcxProjectDeviceIndicatorDo::getMachineno, machineno);
|
|
|
+ List<ZhcxProjectDeviceIndicatorDo> list = this.list(queryWrapper);
|
|
|
+ List<ZhcxProjectDeviceIndicatorDto> dtoList = new ArrayList<>();
|
|
|
+ list.forEach(item -> {
|
|
|
+ ZhcxProjectDeviceIndicatorDto dto = new ZhcxProjectDeviceIndicatorDto();
|
|
|
+ dto.setIndicatorname(item.getIndicatorname());
|
|
|
+ dto.setDisplayboard(item.getDisplayboard());
|
|
|
+ dto.setSort(item.getSort());
|
|
|
+ dto.setTotal(item.getTotal());
|
|
|
+ dto.setCompleted(item.getCompleted());
|
|
|
+ dto.setCompletionrate(item.getCompletionrate());
|
|
|
+ if(StringUtils.isNotBlank(item.getRoption())){
|
|
|
+ String[] data = item.getRoption().split("-;-");
|
|
|
+ List<ZhcxProjectDeviceIndicatorDto> childrenList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < data.length; i++) {
|
|
|
+ String[] split = data[i].split(",");
|
|
|
+ ZhcxProjectDeviceIndicatorDto children = new ZhcxProjectDeviceIndicatorDto();
|
|
|
+ children.setIndicatorname(split[0]);
|
|
|
+ children.setDisplayboard(item.getDisplayboard());
|
|
|
+ children.setCompleted(Integer.parseInt(split[1].split("/")[0]));
|
|
|
+ children.setTotal(Integer.parseInt(split[1].split("/")[1]));
|
|
|
+ children.setCompletionrate(new BigDecimal(split[2]));
|
|
|
+ childrenList.add(children);
|
|
|
+ }
|
|
|
+ dto.setChildren(childrenList);
|
|
|
+ }
|
|
|
+ dtoList.add(dto);
|
|
|
+ });
|
|
|
+ dtoList.sort(Comparator.comparingInt(ZhcxProjectDeviceIndicatorDto::getSort));
|
|
|
+
|
|
|
+ return dtoList;
|
|
|
+ }
|
|
|
}
|