|
@@ -0,0 +1,108 @@
|
|
|
+package com.welampiot.controller;
|
|
|
+
|
|
|
+import com.welampiot.common.BaseResult;
|
|
|
+import com.welampiot.common.InterfaceResultEnum;
|
|
|
+import com.welampiot.dto.ContravariantDevInfoDTO;
|
|
|
+import com.welampiot.service.ContravariantDevInfoService;
|
|
|
+import com.welampiot.utils.ToolUtils;
|
|
|
+import com.welampiot.vo.ContravariantDevInfoVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * ClassName: ContravariantController
|
|
|
+ * Package: com.welampiot.controller
|
|
|
+ * Description:
|
|
|
+ *
|
|
|
+ * @Author: zhj_Start
|
|
|
+ * @Create: 2023/8/15 - 16:27
|
|
|
+ * @Version: v1.0
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@CrossOrigin
|
|
|
+@RequestMapping("/contravariant")
|
|
|
+public class ContravariantController {
|
|
|
+ @Autowired
|
|
|
+ private ToolUtils toolUtils;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ContravariantDevInfoService contravariantDevInfoService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 储能逆变设备列表
|
|
|
+ * @param request sectionList
|
|
|
+ * @return 储能逆变设备列表
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/devList", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> devList(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer page = (Integer) toolUtils.getRequestContent(request,"page",1);
|
|
|
+ Integer count = (Integer) toolUtils.getRequestContent(request,"count",1);
|
|
|
+ String online = (String) toolUtils.getRequestContent(request,"online",2);
|
|
|
+ String keyword = (String) toolUtils.getRequestContent(request,"keyword",2);
|
|
|
+ if (page == 0) page = 1;
|
|
|
+ if (count == 0) count = 16;
|
|
|
+ ContravariantDevInfoVO contravariantDevInfoVO = new ContravariantDevInfoVO();
|
|
|
+ contravariantDevInfoVO.setAreaId(areaId);
|
|
|
+ contravariantDevInfoVO.setSectionId(sectionId);
|
|
|
+ contravariantDevInfoVO.setPage(count * (page - 1));
|
|
|
+ contravariantDevInfoVO.setCount(count);
|
|
|
+ contravariantDevInfoVO.setOnline(online);
|
|
|
+ contravariantDevInfoVO.setKeyword(keyword);
|
|
|
+ contravariantDevInfoVO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+ List<ContravariantDevInfoDTO> list = contravariantDevInfoService.getContravariantList(contravariantDevInfoVO);
|
|
|
+ Integer total = contravariantDevInfoService.getContravariantDevTotal(contravariantDevInfoVO);
|
|
|
+ Integer onlineCount = contravariantDevInfoService.getContravariantDevOnlineTotal(contravariantDevInfoVO);
|
|
|
+ ContravariantDevInfoVO contravariantDevInfoVO1 = new ContravariantDevInfoVO();
|
|
|
+ contravariantDevInfoVO1.setList(list);
|
|
|
+ contravariantDevInfoVO1.setTotal(total);
|
|
|
+ contravariantDevInfoVO1.setTotalOnline(onlineCount);
|
|
|
+ ContravariantDevInfoDTO dto = contravariantDevInfoService.getContravariantTotalData(contravariantDevInfoVO);
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ if (dto == null) {
|
|
|
+ contravariantDevInfoVO1.setTotalCom(0f);
|
|
|
+ contravariantDevInfoVO1.setTotalWindEne(0f);
|
|
|
+ contravariantDevInfoVO1.setTotalSolarEne(0f);
|
|
|
+ contravariantDevInfoVO1.setTotalUpsEne(0f);
|
|
|
+ } else {
|
|
|
+ if (dto.getTotalCom() == null) {
|
|
|
+ contravariantDevInfoVO1.setTotalCom(0f);
|
|
|
+ } else {
|
|
|
+ Float totalCom = dto.getTotalCom();
|
|
|
+ String format = decimalFormat.format(totalCom);
|
|
|
+ contravariantDevInfoVO1.setTotalCom(Float.valueOf(format));
|
|
|
+ }
|
|
|
+ if (dto.getWindEne() == null) {
|
|
|
+ contravariantDevInfoVO1.setTotalWindEne(0f);
|
|
|
+ } else {
|
|
|
+ Float windEne = dto.getWindEne();
|
|
|
+ String format = decimalFormat.format(windEne);
|
|
|
+ contravariantDevInfoVO1.setTotalWindEne(Float.valueOf(format));
|
|
|
+ }
|
|
|
+ if (dto.getSolarEne() == null) {
|
|
|
+ contravariantDevInfoVO1.setTotalSolarEne(0f);
|
|
|
+ } else {
|
|
|
+ Float solarEne = dto.getSolarEne();
|
|
|
+ String format = decimalFormat.format(solarEne);
|
|
|
+ contravariantDevInfoVO1.setTotalSolarEne(Float.valueOf(format));
|
|
|
+ }
|
|
|
+ if (dto.getUpsEne() == null) {
|
|
|
+ contravariantDevInfoVO1.setTotalUpsEne(0f);
|
|
|
+ } else {
|
|
|
+ Float upsEne = dto.getUpsEne();
|
|
|
+ String format = decimalFormat.format(upsEne);
|
|
|
+ contravariantDevInfoVO1.setTotalUpsEne(Float.valueOf(format));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,contravariantDevInfoVO1);
|
|
|
+ }
|
|
|
+}
|