Browse Source

菜单修改增加英文名称和动态图标

wangyangyang 4 years ago
parent
commit
a4f7ee3120

+ 55 - 0
sms_water/src/main/java/com/huaxu/controller/AppDataController.java

@@ -0,0 +1,55 @@
+package com.huaxu.controller;
+
+import com.huaxu.dto.AppSmsDataDto;
+import com.huaxu.model.AjaxMessage;
+import com.huaxu.model.ResultStatus;
+import com.huaxu.service.MonitorDataReportService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+
+@RestController
+@RequestMapping("/appData")
+@Api(tags = "App数据")
+public class AppDataController {
+    @Autowired
+    private MonitorDataReportService monitorDataReportService;
+
+    @RequestMapping(value = "getProductionDataForSameMonth", method = RequestMethod.GET)
+    @ApiOperation(value = "综合调度——本月供水情况")
+    public AjaxMessage<AppSmsDataDto> getMonthWaterSupply(@ApiParam(value = "类型名称(水源、水厂、泵站、售水)") @RequestParam(required = true) String typeName) {
+        //3用水量or供水量or制水量  4 取水量or进水量 5耗电量 6耗药量
+        AppSmsDataDto appSmsDataDto = new AppSmsDataDto();
+        switch (typeName) {
+            case "水源":
+                appSmsDataDto.setIntakeWaterUsage(monitorDataReportService.getAmountCount(null, null, typeName, 4, 2).doubleValue());
+                appSmsDataDto.setPowerUsage(monitorDataReportService.getAmountCount(null, null, typeName, 5, 2).doubleValue());
+                break;
+            case "水厂":
+                appSmsDataDto.setIntakeWaterUsage(monitorDataReportService.getAmountCount(null, null, typeName, 3, 2).doubleValue());
+                appSmsDataDto.setPowerUsage(monitorDataReportService.getAmountCount(null, null, typeName, 5, 2).doubleValue());
+                appSmsDataDto.setDrugUsage(monitorDataReportService.getAmountCount(null, null, typeName, 6, 2).doubleValue());
+                break;
+            case "泵站":
+                appSmsDataDto.setYieldWaterUsage(monitorDataReportService.getAmountCount(null, null, typeName, 3, 2).doubleValue());
+                appSmsDataDto.setPowerUsage(monitorDataReportService.getAmountCount(null, null, typeName, 5, 2).doubleValue());
+                break;
+            case "售水":
+                appSmsDataDto.setYieldWaterUsage(monitorDataReportService.getAmountCount(null, null, "水厂", 3, 2).doubleValue());
+                appSmsDataDto.setWaterUsage(monitorDataReportService.getUseAmount(null, 1).doubleValue());
+                double amount = appSmsDataDto.getYieldWaterUsage() - appSmsDataDto.getWaterUsage();
+                if (appSmsDataDto.getYieldWaterUsage() != null && appSmsDataDto.getYieldWaterUsage() != 0d) {
+                    appSmsDataDto.setWaterFeeRecoveryRate(BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(appSmsDataDto.getYieldWaterUsage()), 3, BigDecimal.ROUND_HALF_UP).doubleValue() * 100);
+                }
+                break;
+        }
+        return new AjaxMessage<>(ResultStatus.OK, appSmsDataDto);
+    }
+}

+ 2 - 0
sms_water/src/main/java/com/huaxu/dao/MonitorDataReportMapper.java

@@ -133,4 +133,6 @@ public interface MonitorDataReportMapper {
                                                     @Param("programItems")List<ProgramItem> programItems);
     List<WaterSupplyData> getWaterSupplyDataByMonthForCurrentMonth(@Param("tenantId")String tenantId,@Param("companyOrgId")Integer companyOrgId,@Param("sceneTypeName")String sceneTypeName,@Param("userType")String userType,@Param("permissonType")Integer permissonType,
                                                                    @Param("programItems")List<ProgramItem> programItems);
+
+    BigDecimal getUseAmount(@Param("companyOrgId")Integer companyOrgId, @Param("tenantId")String tenantId, @Param("searchType")Integer searchType, @Param("userType")String userType, @Param("permissonType")Integer permissonType, @Param("programItems")List<ProgramItem> programItems);
 }

+ 25 - 0
sms_water/src/main/java/com/huaxu/dto/AppSmsDataDto.java

@@ -0,0 +1,25 @@
+package com.huaxu.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AppSmsDataDto {
+    @ApiModelProperty("供水量or制水量")
+    private Double yieldWaterUsage;
+    @ApiModelProperty("取水量or进水量")
+    private Double intakeWaterUsage;
+    @ApiModelProperty("耗电量")
+    private Double powerUsage;
+    @ApiModelProperty("耗药量")
+    private Double drugUsage;
+    @ApiModelProperty(value = "售水量")
+    private Double waterUsage;
+    @ApiModelProperty(value = "产销差")
+    private Double waterFeeRecoveryRate;
+
+}

+ 8 - 0
sms_water/src/main/java/com/huaxu/service/MonitorDataReportService.java

@@ -78,6 +78,14 @@ public interface MonitorDataReportService {
      * @return
      */
     BigDecimal getAmountCount(Integer companyOrgId, Integer sceneId, String sceneTypeName, Integer parmType, Integer searchType);
+
+    /**
+     * 获取用水量
+     * @param companyOrgId
+     * @param searchType
+     * @return 查询类型:1月 2年
+     */
+    BigDecimal getUseAmount(Integer companyOrgId,Integer searchType);
 }
 
 

+ 11 - 0
sms_water/src/main/java/com/huaxu/service/impl/MonitorDataReportServiceImpl.java

@@ -57,6 +57,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
     @Autowired
     private DeviceService deviceService;
 
+
     @Override
     public List<MonitorDataChartReportDeviceDto> monitorDataChartReportByDay(Long sceneId, Integer year, Integer month , Integer day) {
         LoginUser loginUser = UserUtil.getCurrentUser();
@@ -1137,4 +1138,14 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
         }
         return BigDecimal.ZERO;
     }
+
+    @Override
+    public BigDecimal getUseAmount(Integer companyOrgId, Integer searchType) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigDecimal amountMonth = BigDecimal.ZERO;
+        amountMonth = monitorDataReportMapper.getUseAmount(companyOrgId, loginUser.getTenantId(), searchType, loginUser.getType(), loginUser.getPermissonType(), loginUser.getProgramItemList());
+        if (amountMonth == null)
+            amountMonth = BigDecimal.ZERO;
+        return amountMonth;
+    }
 }

+ 34 - 0
sms_water/src/main/resources/mapper/MonitorDataReportMapper.xml

@@ -1416,4 +1416,38 @@
         </if>
         group by r.year,r.month,dp.PARM_TYPE
     </select>
+    <select id="getUseAmount" resultType="java.math.BigDecimal">
+        select  sum(ifnull(a.WATER_USAGE,0)) as "amount"
+        from sms_month_sellwater a
+        <if test="companyOrgId != null">
+            and a.COMPANY_ORG_ID = #{companyOrgId}
+        </if>
+        and a.TENANT_ID=#{tenantId}
+        <if test="searchType ==1">
+            date_format(a.COLLECT_DATE, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m')
+        </if>
+        <if test="searchType ==2">
+            date_format(a.COLLECT_DATE, '%Y') = DATE_FORMAT(now(), '%Y')
+        </if>
+        <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
+            <if test="permissonType == 5 or permissonType == 2">
+               and a.COMPANY_ORG_ID in
+                <foreach collection="programItems" item="item" open="(" close=")" separator=",">
+                    #{item.orgId}
+                </foreach>
+            </if>
+            <if test="permissonType == 4 or permissonType == 3">
+                and a.COMPANY_ORG_ID in
+                <foreach collection="programItems" item="item" open="(" close=")" separator=",">
+                    #{item.orgId}
+                </foreach>
+            </if>
+            <if test="permissonType == 1">
+                and a.COMPANY_ORG_ID in
+                <foreach collection="programItems" item="item" open="(" close=")" separator=",">
+                    #{item.orgId}
+                </foreach>
+            </if>
+        </if>
+    </select>
 </mapper>

+ 16 - 16
user_center/src/main/resources/mapper/MenuMapper.xml

@@ -258,10 +258,10 @@
         select
         a.id as "id" ,
         a.parent_menu_id as "parentMenuId" ,
-        b.MENU_NAME as "name" ,
-        b.MENU_IMAGE as "menuImage" ,
-        b.ENGLISH_NAME as "englishName",
-        b.MENU_DYNAMIC_IMAGE as "menuDynamicImage",
+        ifnull(b.MENU_NAME,a.`NAME`) as "name" ,
+        IFNULL(b.MENU_IMAGE,a.MENU_IMAGE) as "menuImage" ,
+        IFNULL(b.ENGLISH_NAME,a.ENGLISH_NAME) as "englishName",
+        IFNULL(b.MENU_DYNAMIC_IMAGE,a.MENU_DYNAMIC_IMAGE) as "menuDynamicImage",
         a.permission_flag as "permissionFlag" ,
         b.LINK_PATH as "linkPath" ,
         b.MENU_SEQ as "seq" ,
@@ -287,10 +287,10 @@
         SELECT
         a.id as "id" ,
         a.parent_menu_id as "parentMenuId" ,
-        b.MENU_NAME as "name" ,
-        b.MENU_IMAGE as "menuImage" ,
-        b.ENGLISH_NAME as "englishName",
-        b.MENU_DYNAMIC_IMAGE as "menuDynamicImage",
+        ifnull(b.MENU_NAME,a.`NAME`) as "name" ,
+        IFNULL(b.MENU_IMAGE,a.MENU_IMAGE) as "menuImage" ,
+        IFNULL(b.ENGLISH_NAME,a.ENGLISH_NAME) as "englishName",
+        IFNULL(b.MENU_DYNAMIC_IMAGE,a.MENU_DYNAMIC_IMAGE) as "menuDynamicImage",
         a.permission_flag as "permissionFlag" ,
         b.LINK_PATH as "linkPath" ,
         b.MENU_SEQ as "seq" ,
@@ -335,10 +335,10 @@
         select
         a.id as "id" ,
         a.parent_menu_id as "parentMenuId" ,
-        b.MENU_NAME as "name" ,
-        b.MENU_IMAGE as "menuImage" ,
-        b.ENGLISH_NAME as "englishName",
-        b.MENU_DYNAMIC_IMAGE as "menuDynamicImage",
+        ifnull(b.MENU_NAME,a.`NAME`) as "name" ,
+        IFNULL(b.MENU_IMAGE,a.MENU_IMAGE) as "menuImage" ,
+        IFNULL(b.ENGLISH_NAME,a.ENGLISH_NAME) as "englishName",
+        IFNULL(b.MENU_DYNAMIC_IMAGE,a.MENU_DYNAMIC_IMAGE) as "menuDynamicImage",
         a.permission_flag as "permissionFlag" ,
         b.LINK_PATH as "linkPath" ,
         b.MENU_SEQ as "seq" ,
@@ -367,10 +367,10 @@
         SELECT
         a.id as "id" ,
         a.parent_menu_id as "parentMenuId" ,
-        b.MENU_NAME as "name" ,
-        b.MENU_IMAGE as "menuImage" ,
-        b.ENGLISH_NAME as "englishName",
-        b.MENU_DYNAMIC_IMAGE as "menuDynamicImage",
+        ifnull(b.MENU_NAME,a.`NAME`) as "name" ,
+        IFNULL(b.MENU_IMAGE,a.MENU_IMAGE) as "menuImage" ,
+        IFNULL(b.ENGLISH_NAME,a.ENGLISH_NAME) as "englishName",
+        IFNULL(b.MENU_DYNAMIC_IMAGE,a.MENU_DYNAMIC_IMAGE) as "menuDynamicImage",
         a.permission_flag as "permissionFlag" ,
         b.LINK_PATH as "linkPath" ,
         b.MENU_SEQ as "seq" ,