hym пре 4 година
родитељ
комит
4ecc199ac0

+ 7 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/PlatformApiController.java

@@ -43,8 +43,13 @@ public class PlatformApiController {
     public AjaxMessage sendCommond (
             @ApiParam(value = "客户id", required = true)  @RequestParam String customerNo,
             @RequestParam String meterNo,Integer type) {
-        platformAapiService.sendCommond(meterNo,type,customerNo);
-        return new AjaxMessage<>(ResultStatus.OK);
+        int result=platformAapiService.sendCommond(meterNo,type,customerNo);
+        if(result==0){
+            return new AjaxMessage<>(ResultStatus.OK);
+        }else{
+            return new AjaxMessage<>(ResultStatus.TASK_OPERATE_FAILED);
+        }
+
     }
     @GetMapping  ("/getWaterMeterNo")
     @ApiOperation(value = "获取电子号")

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/PlatformAapiService.java

@@ -6,7 +6,7 @@ import java.util.Map;
 public interface PlatformAapiService {
     void updateMeterNo(String meterNo, String meterCode, String customerNo);
 
-    void sendCommond(String meterNo, Integer type, String customerNo);
+    int sendCommond(String meterNo, Integer type, String customerNo);
 
     String getWaterMeterNo(String meterNo, String customerNo);
 

+ 4 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/sync/PlatformAapiServiceImpl.java

@@ -43,9 +43,9 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
     }
 
     @Override
-    public void sendCommond(String meterNo, Integer type, String customerNo) {
-
+    public int sendCommond(String meterNo, Integer type, String customerNo) {
 
+            int result=-1;
             Device device = getDevice(meterNo, customerNo);
             if(device!=null){
                 deviceService.setValveV2(device.getId(),type+"");
@@ -57,11 +57,12 @@ public class PlatformAapiServiceImpl implements PlatformAapiService {
                 operatingValveRecord.setWaterFileNo(device.getMetercode());
                 operatingValveRecord.setWaterNo(device.getWaterMeterNo());
                 operatingValveRecord.setOperation(type);
+                result=0;
                 operatingValveRecordMapper.insert(operatingValveRecord);
 
             }
 
-
+            return  result;
 
     }
 

+ 1 - 1
smart-city-platform/src/main/resources/application-dev.properties

@@ -49,7 +49,7 @@ spring.redis.jedis.pool.max-active=8
 spring.redis.jedis.pool.max-idle=8
 spring.redis.jedis.pool.max-wait=-1ms
 spring.redis.jedis.pool.min-idle=2
- 
+
 spring.activiti.database-schema-update=true
 spring.activiti.check-process-definitions=false
 spring.activiti.job-executor-activate=false

+ 2 - 1
smart-city-platform/src/main/resources/mapper/DeviceMapper.xml

@@ -1214,7 +1214,8 @@
         and sd.customer_id = #{customerId}
         and sil.is_installed=1
         <if test="createDate != null and createDate != ''"> and DATE_FORMAT(sd.date_create, '%Y%m%d' ) = #{createDate}</if>
-        and sil.metercode in <foreach collection="fileNo" item="item" open="(" separator="," close=")">#{item}</foreach>
+        and sil.metercode in
+            <foreach collection="fileNo" item="item" open="(" separator="," close=")">#{item}</foreach>
     </select>
     <update id="updateMeterNo">
         update sc_device set metercode=#{meterNo}

+ 3 - 5
smart-city-platform/src/main/resources/mapper/WarningLogMapper.xml

@@ -130,9 +130,9 @@
   <select id="getList" resultType="com.bz.smart_city.dto.WarningLogDto">
     select
     swl.*,
-    pba.accountnumber as account_number,
-    pba.name as account_name,
-    pba.mobilephone as account_phone,
+    swl.account_number as account_number,
+    swl.user_name as account_name,
+    swl.phone as account_phone,
     sd.device_no,
     sd.water_meter_no,
     sd.loc_desc,
@@ -142,8 +142,6 @@
     from sc_warning_log swl
     left join sc_device sd on(sd.id = swl.device_id)
     left join sc_building sb on(sb.id = sd.building_id)
-    left join pay_base_customerandmeterrela pbc on(pbc.watermeter_id = swl.device_id)
-    left join pay_base_account pba on(pba.id = pbc.account_id)
     left join sc_device_type sdt1 on(sdt1.id = sd.device_type)
     left join sc_device_manufacturer sdm1 on(sdm1.id = sdt1.manufacturer_id)
     <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>

+ 32 - 0
water_query_api/src/main/java/com/zcxk/controller/WaterApiController.java

@@ -10,6 +10,7 @@ import com.zcxk.dto.WarningMessageDto;
 import com.zcxk.dto.WarningMessageStatusDto;
 import com.zcxk.entity.WarningMessage;
 import com.zcxk.entity.WarningRule;
+import com.zcxk.scheduled.WarningMessageJob;
 import com.zcxk.service.MeterReadRecordService;
 import com.zcxk.service.WarningMessageService;
 import com.zcxk.service.WarningRuleService;
@@ -38,6 +39,8 @@ public class WaterApiController {
     private WarningRuleService warningRuleService;
     @Autowired
     private WarningMessageService warningMessageService;
+    @Autowired
+    private WarningMessageJob warningMessageJob;
 
     /**
      * 查询用户用水量
@@ -182,5 +185,34 @@ public class WaterApiController {
         Double deviceVolume = warningRuleService.delWaringRule(id,userName);
         return new AjaxMessage<>(ResultStatus.OK, deviceVolume);
     }
+    /**
+     * 删除警告规则
+     *
+     * @param
+     *
+     * @return Response对象
+     */
+    @RequestMapping(value = "setWaringData", method = RequestMethod.POST)
+    @ApiOperation(value = "用水量")
+    public AjaxMessage< Double> setWaringData(
+
+    ) {
+        warningMessageJob.warningMessage();
+        return new AjaxMessage<>(ResultStatus.OK);
+    }
+    @ResponseBody
+    @PostMapping("/feedback")
+    @ApiOperation(value = "反馈")
+    public AjaxMessage feedback(
+            @ApiParam(value = "id", required = true) @RequestParam(required = true) Integer id,
+            @ApiParam(value = "反馈状态 0:待反馈 1:已确认无异常 2:已反馈信息", required = true) @RequestParam(required = true) Integer feedbackStatus,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String feedbackContent,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String phoneNumber,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String accountNumber,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String userName
+    ){
+        warningRuleService.feedback(userName,id,feedbackStatus,feedbackContent,phoneNumber,accountNumber);
+        return new AjaxMessage<>(ResultStatus.OK);
+    }
 
 }

+ 3 - 0
water_query_api/src/main/java/com/zcxk/entity/WarningLog.java

@@ -63,4 +63,7 @@ public class WarningLog {
 
     @ApiModelProperty(value="")
     private LocalDateTime dateUpdate;
+    private String userName;
+    private String phoneNumber;
+    private String accountNumber;
 }

+ 1 - 0
water_query_api/src/main/java/com/zcxk/service/WarningRuleService.java

@@ -22,4 +22,5 @@ public interface WarningRuleService {
 
     Double delWaringRule(Integer id, String userName);
 
+    void feedback(String name, Integer id, Integer feedbackStatus, String content, String phoneNumber, String accountNumber);
 }

+ 27 - 0
water_query_api/src/main/java/com/zcxk/service/impl/WarningRuleServiceImpl.java

@@ -1,12 +1,17 @@
 package com.zcxk.service.impl;
 
+import com.zcxk.dao.WarningLogMapper;
+import com.zcxk.dao.WarningMessageMapper;
 import com.zcxk.dao.WarningRuleMapper;
 import com.zcxk.entity.Device;
+import com.zcxk.entity.WarningLog;
+import com.zcxk.entity.WarningMessage;
 import com.zcxk.entity.WarningRule;
 import com.zcxk.service.WarningRuleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -21,6 +26,10 @@ import java.util.List;
 public class WarningRuleServiceImpl implements WarningRuleService {
     @Autowired
     private WarningRuleMapper warningRuleMapper;
+    @Autowired
+    private WarningLogMapper warningLogMapper;
+    @Autowired
+    private WarningMessageMapper warningMessageMapper;
 
 
     @Override
@@ -73,4 +82,22 @@ public class WarningRuleServiceImpl implements WarningRuleService {
         warningRuleMapper.updateByPrimaryKeySelective(warningRule);
         return null;
     }
+
+    @Override
+    public void feedback(String name, Integer id, Integer feedbackStatus, String feedbackContent, String phoneNumber
+            , String accountNumber) {
+
+        WarningMessage warningMessage = warningMessageMapper.findById(id);
+
+        WarningLog warningLog = new WarningLog();
+        warningLog.setId(warningMessage.getWarningLogId());
+        warningLog.setFeedbackStatus(feedbackStatus);
+        warningLog.setFeedbackContent(feedbackContent);
+        warningLog.setUpdateBy(name);
+        warningLog.setDateUpdate(LocalDateTime.now());
+        warningLog.setUserName(name);
+        warningLog.setAccountNumber(accountNumber);
+        warningLog.setPhoneNumber(phoneNumber);
+        warningLogMapper.updateByPrimaryKeySelective(warningLog);
+    }
 }

+ 9 - 0
water_query_api/src/main/resources/mapper/WarningLogMapper.xml

@@ -133,6 +133,15 @@
       <if test="dateUpdate != null">
         date_update = #{dateUpdate},
       </if>
+      <if test="dateUpdate != null">
+        user_name = #{userName},
+      </if>
+      <if test="dateUpdate != null">
+        account_number = #{accountNumber},
+      </if>
+      <if test="dateUpdate != null">
+        phone = #{phoneNumber},
+      </if>
     </set>
     where id = #{id}
   </update>

+ 4 - 2
water_query_api/src/main/resources/mapper/WarningRuleMapper.xml

@@ -106,10 +106,12 @@
     select count(1) from sc_warning_rule where status = 1 and device_id = #{deviceId} and warning_type = #{warningType}
   </select>
     <select id="findByFileNo" resultType="com.zcxk.entity.Device">
-      select b.water_meter_file_no ,b.id from sc_customer a left join  sc_device b on a.id=b.customer_id
+      select b.water_meter_file_no ,b.id from sc_customer a
+          left join  sc_device b on a.id=b.customer_id
+      left join sc_install_list sil on(sil.device_id = b.id)
       where
       a.customer_no=#{customerNo}
-      and b.water_meter_file_no in
+      and sil.metercode in
       <foreach collection="fileNos" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>