Bläddra i källkod

Merge branch '20210223' of http://114.135.61.188:53000/UIMS/Code into 20210223

lihui007 4 år sedan
förälder
incheckning
b7ddfa2331

+ 4 - 1
readme.md

@@ -116,6 +116,7 @@ CREATE TABLE `sc_evaluation_item_value` (
   `TENANT_ID` varchar(100) DEFAULT NULL COMMENT '租户标识',
   `EVALUATION_ITEM_ID` int(11) NOT NULL COMMENT '考评项ID',
   `TYPE` int(11) DEFAULT NULL COMMENT '类型(0大于等于 1小于 2介于)',
+  `VALUE` DECIMAL(18,2) DEFAULT NULL COMMENT '分值',
   `VALUE_ONE` DECIMAL(18,2) DEFAULT NULL COMMENT '分值1',
   `VALUE_TWO` DECIMAL(18,2) DEFAULT NULL COMMENT '分值2',
   `STATUS` smallint(6) DEFAULT NULL COMMENT '数据删除标记',
@@ -193,9 +194,10 @@ CREATE TABLE `sc_evaluation_result_details` (
   `DATE_UPDATE` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
   `UPDATE_BY` varchar(100) CHARACTER SET utf8mb4 DEFAULT NULL COMMENT '更新人',
   PRIMARY KEY (`ID`)
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COMMENT='考评结果任务详情';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1 COMMENT='考评结果详情';
 CREATE TABLE `sms_device_setup_record` (
   `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `DEVICE_ID` int(11) DEFAULT NULL COMMENT '设备ID',
   `ATTRIBUTE_ID` int(11) DEFAULT NULL COMMENT '属性ID',
   `SETUP_METHOD_ID` int(11) DEFAULT NULL COMMENT '设置指令ID',
   `STATE` varchar(200) DEFAULT NULL COMMENT '执行状态(0执行中 1执行成功 2执行失败)',
@@ -209,6 +211,7 @@ CREATE TABLE `sms_device_setup_record` (
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='参数设置指令记录';
 CREATE TABLE `sms_device_setup_method` (
   `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `DEVICE_ID` int(11) DEFAULT NULL COMMENT '设备ID',
   `ATTRIBUTE_ID` int(11) DEFAULT NULL COMMENT '属性ID',
   `TYPE` int(11) DEFAULT NULL COMMENT '类型(0水泵控制 1压力调节 2水表开关阀)',
   `METHOD` varchar(200) DEFAULT NULL COMMENT '方法名',

+ 2 - 17
sms_water/src/main/java/com/huaxu/controller/AppPageReportController.java

@@ -374,11 +374,6 @@ public class AppPageReportController {
         map.put("amount","-");
         map.put("sceneTypeName","大用户表");
         amount.add(map);
-
-        Map<String,Object> map2 = new HashMap<String,Object>();
-        map2.put("amount","-");
-        map2.put("sceneTypeName","户表");
-        amount.add(map2);
         return new AjaxMessage<>(ResultStatus.OK,amount);
     }
 
@@ -388,14 +383,9 @@ public class AppPageReportController {
         LocalDate now = LocalDate.now();
         List<Map<String,Object>> amount = appPageReportService.findSceneAmount(companyOrgId,now.getMonthValue());
         Map<String,Object> map = new HashMap<String,Object>();
-        map.put("amount","-");
+        map.put("amount","0");
         map.put("sceneTypeName","大用户表");
         amount.add(map);
-
-        Map<String,Object> map2 = new HashMap<String,Object>();
-        map2.put("amount","-");
-        map2.put("sceneTypeName","户表");
-        amount.add(map2);
         return new AjaxMessage<>(ResultStatus.OK,amount);
     }
 
@@ -404,14 +394,9 @@ public class AppPageReportController {
     public AjaxMessage<Object> getSceneAmountForLast12Month(@ApiParam(value = "公司id,总公司传空值") @RequestParam(required = false) Long companyOrgId){
         List<Map<String,Object>> amount = appPageReportService.findSceneAmount(companyOrgId,12);
         Map<String,Object> map = new HashMap<String,Object>();
-        map.put("amount","-");
+        map.put("amount","0");
         map.put("sceneTypeName","大用户表");
         amount.add(map);
-
-        Map<String,Object> map2 = new HashMap<String,Object>();
-        map2.put("amount","-");
-        map2.put("sceneTypeName","户表");
-        amount.add(map2);
         return new AjaxMessage<>(ResultStatus.OK,amount);
     }
 }

+ 4 - 2
sms_water/src/main/java/com/huaxu/service/impl/OnlineMonitorImpl.java

@@ -610,7 +610,8 @@ public class OnlineMonitorImpl implements OnlineMonitorService {
                         monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
                 }
                 if(monitorDataEntity != null) {
-                    monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
+                    if(monDataCol.getCollectDate()==null || monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime() )
+                        monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
                     SimpleDateFormat formatdate = new SimpleDateFormat("YYYY-MM-dd");//日期算换格式
                     //筛选该设备相同属性的值
                     List<MonitorDataValueEntity>  attributeEntities=monitorDataEntity.getDataValues().stream().filter((MonitorDataValueEntity m)
@@ -712,7 +713,8 @@ public class OnlineMonitorImpl implements OnlineMonitorService {
                                 monitorDataEntity = (MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get();}
                         }
                         if(monitorDataEntity != null) {
-                            monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
+                            if(monDataCol.getCollectDate()==null||monitorDataEntity.getCollectDate().getTime()>monDataCol.getCollectDate().getTime())
+                                monDataCol.setCollectDate(monitorDataEntity.getCollectDate());
                             //筛选该设备相同属性的值
                             List<MonitorDataValueEntity> attributeEntities = monitorDataEntity.getDataValues().stream().filter((MonitorDataValueEntity m)
                                     -> m.getAttributeId().equals(monitorData.getAttributeId())).collect(Collectors.toList());

+ 1 - 1
sms_water/src/main/resources/mapper/DeviceParmMapper.xml

@@ -77,7 +77,7 @@
                     ,p.CREATE_BY as "createBy"
                     ,p.DATE_UPDATE as "dateUpdate"
                     ,p.UPDATE_BY as "updateBy"
-                    ,b.`NAME` as "attributeName"
+                    ,ifnull(p.REMARK,b.`NAME`) as "attributeName"
                     ,p.PARM_TYPE as "parmType"
                     ,a.device_code as "deviceCode"
         from sms_device_parm p

+ 25 - 2
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -402,7 +402,30 @@
             group by b.SCENE_TYPE_NAME
         ) b
         on a.sceneTypeName = b.sceneTypeName
+        union all
+        select '户表' , ifnull(sum(user_meter_count),0) amount,sum(user_meter_add_count) newAmount
+        from sms_month_revenue a
+        <where>
+            <if test="months != null">
+                and a.collect_date>=date_sub(date_format(curdate(), '%y-%m-1' ), interval #{months}-1 month)
+            </if>
+            <if test="scene.tenantId != null  and scene.tenantId != ''">
+                and a.tenant_id = #{scene.tenantId}
+            </if>
+            <if test="scene.userType!=null and scene.userType!=-999 and scene.userType!=-9999 and  scene.programItems != null and scene.programItems.size() > 0">
+                <if test="scene.permissonType == 5 or scene.permissonType == 2">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+                <if test="scene.permissonType == 1">
+                    and a.COMPANY_ORG_ID in
+                    <foreach collection="scene.programItems" item="item" open="(" close=")" separator=",">
+                        #{item.orgId}
+                    </foreach>
+                </if>
+            </if>
+        </where>
     </select>
-
-
 </mapper>