|
@@ -26,6 +26,7 @@ import com.rtrh.projects.modules.system.dao.JUnitDao;
|
|
|
import com.rtrh.projects.modules.system.enums.SysTableKind;
|
|
|
import com.rtrh.projects.modules.system.po.JUnit;
|
|
|
import com.rtrh.projects.modules.system.po.TSystable;
|
|
|
+import com.rtrh.projects.modules.system.service.ISubInduService;
|
|
|
import com.rtrh.projects.modules.system.service.TSysTableService;
|
|
|
import com.rtrh.projects.modules.utils.DateUtils;
|
|
|
import com.rtrh.projects.vo.projects.SubFixGetBeginRateVo;
|
|
@@ -88,6 +89,9 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
@Autowired
|
|
|
private SubPreNewService subPreNewService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISubInduService subInduService;
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Integer> getWarningBySubId(String subId) {
|
|
|
|
|
@@ -165,7 +169,7 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
|
|
|
@Override
|
|
|
public List<SubInfoGxj> queryAll(LoginUserVO loginUser, SubInfoQueryTzVO queryVO) {
|
|
|
- queryVO.setMonth(DateUtil.thisYear() + "01");
|
|
|
+ queryVO.setMonth(DateUtil.thisYear() +"");
|
|
|
List<SubInfoGxj> data = subInfoMapper.queryPage(queryVO);
|
|
|
if (CollectionUtil.isEmpty(data)) {
|
|
|
return new ArrayList<>();
|
|
@@ -247,10 +251,13 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
if (StringUtils.isNotBlank(queryVO.getEndAmt())) {
|
|
|
queryVO.setEndAmt(new BigDecimal(queryVO.getEndAmt()).multiply(new BigDecimal("10000")).toString());
|
|
|
}
|
|
|
- Optional.ofNullable(queryVO.getIndusKinds()).ifPresent(s -> {
|
|
|
- String[] split = s.split(",");
|
|
|
- queryVO.setIks(Arrays.asList(split));
|
|
|
- });
|
|
|
+ if (StringUtils.isNotBlank(queryVO.getIndusKinds())){
|
|
|
+ queryVO.setIndusKind(queryVO.getIndusKinds());
|
|
|
+ }
|
|
|
+ // Optional.ofNullable(queryVO.getIndusKinds()).ifPresent(s -> {
|
|
|
+ // String[] split = s.split(",");
|
|
|
+ // queryVO.setIks(Arrays.asList(split));
|
|
|
+ // });
|
|
|
|
|
|
|
|
|
PageHelper.startPage(page.getPageNo(), page.getPageSize());
|
|
@@ -292,10 +299,16 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
.setNum(v));
|
|
|
});
|
|
|
// 行业统计
|
|
|
- List<TSystable> hyflDict = tSysTableService.getByKind(SysTableKind.HYFL);
|
|
|
- Map<String, String> hyflNameMap = hyflDict.stream().collect(Collectors.toMap(TSystable::getCode, TSystable::getTitle));
|
|
|
+ List<SubIndu> hyflDict = subInduService.queryParentAll();
|
|
|
+ Map<String, String> hyflNameMap = hyflDict.stream().collect(Collectors.toMap(SubIndu::getCode, SubIndu::getTitle));
|
|
|
Map<String, Long> indusKind = list.stream()
|
|
|
- .collect(Collectors.groupingBy(e -> StringUtils.defaultIfBlank(e.getIndusKind(), "."), Collectors.counting()));
|
|
|
+ .collect(Collectors.groupingBy(e -> {
|
|
|
+ if (StringUtils.isNotBlank(e.getIndusKind()) && e.getIndusKind().length() >= 2) {
|
|
|
+ return e.getIndusKind().substring(0, 2);
|
|
|
+ }
|
|
|
+ return StringUtils.defaultIfBlank(e.getIndusKind(), ".");
|
|
|
+ },
|
|
|
+ Collectors.counting()));
|
|
|
List<StatisticsVO.KvNum> hyflList = new ArrayList<>();
|
|
|
indusKind.forEach((k, v) -> {
|
|
|
hyflList.add(new StatisticsVO.KvNum()
|
|
@@ -303,7 +316,7 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
.setName(hyflNameMap.getOrDefault(k, ""))
|
|
|
.setNum(v));
|
|
|
});
|
|
|
- return new StatisticsVO()
|
|
|
+ StatisticsVO vo = new StatisticsVO()
|
|
|
.setNum(num)
|
|
|
.setANum(abc.getOrDefault("A", 0L))
|
|
|
.setBNum(abc.getOrDefault("B", 0L))
|
|
@@ -311,6 +324,30 @@ public class SubInfoQueryServiceImpl implements SubInfoQueryService {
|
|
|
.setNNum(abc.getOrDefault(".", 0L))
|
|
|
.setJsddData(jsddList)
|
|
|
.setHyflData(hyflList);
|
|
|
+
|
|
|
+ // 查询所有状态统计 开工数、开复工率、投产率 等
|
|
|
+ queryVO.setStatus(null);
|
|
|
+ List<SubInfoGxj> listTotal = subInfoMapper.queryStatistics(queryVO);
|
|
|
+ Map<String, Long> collect1 = listTotal.stream().collect(Collectors.groupingBy(SubInfoGxj::getStatus, Collectors.counting()));
|
|
|
+ Long zjNum1 = collect1.getOrDefault(SubInfoStatusEnum.ZJ.getCode(), 0L);
|
|
|
+ Long tcNum1 = collect1.getOrDefault(SubInfoStatusEnum.TC.getCode(), 0L);
|
|
|
+ Long xjNum1 = collect1.getOrDefault(SubInfoStatusEnum.XJ.getCode(), 0L);
|
|
|
+ // 开工数、开复工率、投产率
|
|
|
+ Long kgNum = zjNum1 + tcNum1;
|
|
|
+ vo.setYkgNum(kgNum);
|
|
|
+ BigDecimal total = BigDecimal.valueOf(zjNum1 + tcNum1 + xjNum1);
|
|
|
+ BigDecimal kfgRate = BigDecimal.ZERO;
|
|
|
+ if (total.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ kfgRate = BigDecimal.valueOf(zjNum1 + tcNum1).divide(total, 2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
+ vo.setKfgRate(kfgRate);
|
|
|
+ vo.setTcRate(BigDecimal.valueOf(tcNum1).divide(BigDecimal.valueOf(zjNum1 + tcNum1 + xjNum1), 2, RoundingMode.HALF_UP));
|
|
|
+ // 已入规、未入规、入规率
|
|
|
+ long rgNum = listTotal.stream().filter(SubInfoGxj::getBoolRg).count();
|
|
|
+ vo.setYrgNum(rgNum);
|
|
|
+ vo.setWrgNum(listTotal.size() - rgNum);
|
|
|
+ vo.setRgRate(listTotal.size() == 0 ? new BigDecimal("0") : BigDecimal.valueOf(rgNum).divide(BigDecimal.valueOf(xjNum1 + zjNum1 + tcNum1), 2, RoundingMode.HALF_UP));
|
|
|
+ return vo;
|
|
|
}
|
|
|
|
|
|
@Override
|