ComponentStatisticsController.java 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package com.persagy.proxy.adm.controller;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.web.bind.annotation.RequestBody;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import com.alibaba.fastjson.JSONObject;
  8. import com.fasterxml.jackson.databind.ObjectMapper;
  9. import com.fasterxml.jackson.databind.node.ObjectNode;
  10. import com.persagy.dmp.basic.model.QueryCriteria;
  11. import com.persagy.dmp.common.helper.SpringHelper;
  12. import com.persagy.dmp.common.model.response.CommonResult;
  13. import com.persagy.dmp.digital.client.DigitalObjectFacade;
  14. import com.persagy.dmp.digital.client.DigitalRelationFacade;
  15. import com.persagy.dmp.digital.entity.ObjectRelation;
  16. import com.persagy.proxy.adm.constant.AdmCommonConstant;
  17. import com.persagy.proxy.adm.constant.AdmObjectType;
  18. import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
  19. import com.persagy.proxy.adm.request.AdmCountResponse;
  20. /**
  21. * 统计接口
  22. *
  23. * @version 1.0.0
  24. * @company persagy
  25. * @author zhangqiankun
  26. * @date 2021年9月8日 下午7:51:56
  27. */
  28. @RestController
  29. @RequestMapping("/statistics")
  30. public class ComponentStatisticsController {
  31. /**
  32. * 台账中待删除的对象
  33. * <p>条件:"filters": "taskState = -1"</p>
  34. * @param queryCriteria
  35. * @param request
  36. * @return
  37. */
  38. @RequestMapping(value = "/object-delete-count")
  39. public AdmCountResponse objectDeleteCount(@RequestBody JSONObject params, HttpServletRequest request) {
  40. return AdmCountResponse.success(0L);
  41. }
  42. /**
  43. * 不能同步到物理世界的关系数据
  44. *
  45. * @param params
  46. * @param request
  47. * @return
  48. */
  49. @RequestMapping(value = "/unsyn-relation-count")
  50. public AdmCountResponse unsynRelationCount(HttpServletRequest request) {
  51. return AdmCountResponse.success(0L);
  52. }
  53. /**
  54. * 岗位和关联的资产信息点值不一致
  55. *
  56. * @param request
  57. * @return
  58. */
  59. @RequestMapping(value = "/eq2pe-count")
  60. public AdmCountResponse eq2peCount(HttpServletRequest request) {
  61. return AdmCountResponse.success(0L);
  62. }
  63. /**
  64. * 岗位和关联的资产信息点值不一致的数据
  65. *
  66. * @param request
  67. * @return
  68. */
  69. @RequestMapping(value = "/eq2pe-different")
  70. public AdmCountResponse eq2peDifferent(HttpServletRequest request) {
  71. return AdmCountResponse.success(0L);
  72. }
  73. /**
  74. * 设备-未关联资产的设备,这里返回所有的设备
  75. *
  76. * @param params
  77. * @param request
  78. * @return
  79. */
  80. @RequestMapping(value = "/uneq2pe-count")
  81. public AdmCountResponse uneq2peCount(HttpServletRequest request) {
  82. String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  83. String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  84. QueryCriteria queryCriteria = new QueryCriteria();
  85. ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
  86. ObjectNode objectNode = objectMapper.createObjectNode();
  87. objectNode.put("classCode", AdmObjectType.EQUIPMENT.getIndex());
  88. queryCriteria.setCriteria(objectNode);
  89. queryCriteria.setOnlyCount(true);
  90. CommonResult<List<ObjectNode>> result = DigitalObjectFacade.queryPrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
  91. long count = result == null ? 0 : (result.getCount() == null ? 0 : result.getCount());
  92. return AdmCountResponse.success(count);
  93. }
  94. /**
  95. * 业务空间-各分区占比
  96. *
  97. * @param request
  98. * @return
  99. */
  100. @RequestMapping(value = "/sp-objecttype-count")
  101. public AdmCountResponse spObjectTypeCount(HttpServletRequest request) {
  102. //String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  103. //String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  104. return AdmCountResponse.success(0L);
  105. }
  106. /**
  107. * 业务空间-默认分区功能类型占比
  108. *
  109. * @param request
  110. * @return
  111. */
  112. @RequestMapping(value = "/general-sp-functype-count")
  113. public AdmCountResponse generalSpFunctypeCount(HttpServletRequest request) {
  114. //String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  115. //String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  116. return AdmCountResponse.success(0L);
  117. }
  118. /**
  119. * 租户-关联业务空间完成度
  120. *
  121. * @param request
  122. * @return
  123. */
  124. @RequestMapping(value = "/tenant2sp-count")
  125. public AdmCountResponse tenant2spCount(HttpServletRequest request) {
  126. String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  127. String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  128. QueryCriteria queryCriteria = new QueryCriteria();
  129. ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
  130. ObjectNode objectNode = objectMapper.createObjectNode();
  131. objectNode.put("graphCode", AdmRelationTypeEnum.TN2SP.getGraphCode());
  132. objectNode.put("relCode", AdmRelationTypeEnum.TN2SP.getRelCode());
  133. queryCriteria.setCriteria(objectNode);
  134. queryCriteria.setOnlyCount(true);
  135. CommonResult<List<ObjectRelation>> result = DigitalRelationFacade.queryPrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
  136. long count = result == null ? 0 : (result.getCount() == null ? 0 : result.getCount());
  137. return AdmCountResponse.success(count);
  138. }
  139. /**
  140. * 竖井-关联业务空间完成度
  141. *
  142. * @param request
  143. * @return
  144. */
  145. @RequestMapping(value = "/shaft2sp-count")
  146. public AdmCountResponse shaft2spCount(HttpServletRequest request) {
  147. String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  148. String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  149. QueryCriteria queryCriteria = new QueryCriteria();
  150. ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
  151. ObjectNode objectNode = objectMapper.createObjectNode();
  152. objectNode.put("graphCode", AdmRelationTypeEnum.SH2SP.getGraphCode());
  153. objectNode.put("relCode", AdmRelationTypeEnum.SH2SP.getRelCode());
  154. queryCriteria.setCriteria(objectNode);
  155. queryCriteria.setOnlyCount(true);
  156. CommonResult<List<ObjectRelation>> result = DigitalRelationFacade.queryPrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
  157. long count = result == null ? 0 : (result.getCount() == null ? 0 : result.getCount());
  158. return AdmCountResponse.success(count);
  159. }
  160. /**
  161. * 竖井-按功能类型占比
  162. *
  163. * @param request
  164. * @return
  165. */
  166. @RequestMapping(value = "/shaft-functype-count")
  167. public AdmCountResponse shaftFunctypeCount(HttpServletRequest request) {
  168. //String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
  169. //String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
  170. return AdmCountResponse.success(0L);
  171. }
  172. }