Browse Source

版本更新

lihui001 3 years ago
parent
commit
d8cd7ff2b7

+ 1 - 1
zoniot-rmcp/pom.xml

@@ -15,10 +15,10 @@
         <module>zoniot-rmcp-api</module>
         <module>zoniot-rmcp-core</module>
         <module>zoniot-rmcp-web</module>
-        <module>zoniot-xxljob-client</module>
         <module>zoniot-rmcp-sync</module>
         <module>zoniot-rmcp-dap</module>
         <module>zoniot-rmcp-alarm</module>
+        <module>zoniot-xxljob-client</module>
     </modules>
 
     <properties>

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/meterreadrecord/MeterReadRecordDto.java

@@ -21,7 +21,7 @@ public class MeterReadRecordDto extends BasePageDto {
     private Integer categoryId;
 
     @ApiModelProperty(value="分类名字")
-    private String o;
+    private String categoryName;
 
     @ApiModelProperty(value="电子号/设备编号")
     private String deviceMeterNo;

+ 6 - 2
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/vo/DeviceCommandVo.java

@@ -44,12 +44,16 @@ public class DeviceCommandVo {
     private String operationType;
 
     @ApiModelProperty(value="处理/完成时间")
-    @ExcelProperty(value = {"完成时间"},index = 7)
+    @ExcelProperty(value = {"完成时间"},index = 6)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     private Date finishDate;
 
+    @ApiModelProperty(value="操作人")
+    @ExcelProperty(value = {"操作人"},index = 7)
+    private String createBy;
+
     @ApiModelProperty(value="下发/操作时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
-    @ExcelProperty(value = {"操作时间"},index = 6)
+    @ExcelProperty(value = {"操作时间"},index = 8)
     private Date issueDate;
 }

+ 9 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/DeviceCommandMapper.java

@@ -54,5 +54,14 @@ public interface DeviceCommandMapper {
     **/
     DeviceCommandVo findDeviceCommand(Long id);
 
+    /**
+    * 更新状态
+    * @author Andy
+    * @date 14:22 2021/8/16
+    * @param ids:
+    * @param status:
+    * @return void
+    **/
+    void updateStatus(List<Long> ids, Integer status);
 
 }

+ 10 - 0
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/MeterReplaceLogMapper.java

@@ -56,5 +56,15 @@ public interface MeterReplaceLogMapper {
     **/
     List<MeterReplaceVo> listMeterReplace(@Param("dto") MeterReplacePageDto dto, @Param("userCondition") UserCondition query);
 
+    /**
+     * 更新状态
+     * @author Andy
+     * @date 14:22 2021/8/16
+     * @param ids:
+     * @param status:
+     * @return void
+     **/
+    void updateStatus(List<Long> ids, Integer status);
+
 
 }

+ 14 - 5
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/DeviceCommandMapper.xml

@@ -267,16 +267,25 @@
     dc.command_type,
     dc.operation_type,
     dc.finish_date,
-    dc.issue_date
+    dc.issue_date,
+    dc.create_by
     from rmcp_device_command dc
     left join rmcp_device rd  on (dc.device_id = rd.id)
     left join rmcp_product rp on (rp.id = rd.product_id)
     left join rmcp_manufacturer rm on (rm.id = rp.manufacturer_id)
     where dc.status = 1 and rd.status = 1
-    <if test="dto.meterNo != null">and rd.meter_no = #{dto.meterNo}</if>
-    <if test="dto.type != null">and dc.command_type = #{dto.commandType}</if>
-    <if test="dto.startDate != null"> and dc.issue_date <![CDATA[ >= ]]> #{dto.startDate}</if>
-    <if test="dto.endDate != null"> and dc.issue_date <![CDATA[ <= ]]> #{dto.endDate}</if>
+    <if test="dto.meterNo != null and dto.meterNo != ''">and rd.meter_no = #{dto.meterNo}</if>
+    <if test="dto.type != null">and dc.command_type = #{dto.type}</if>
+    <if test="dto.startDate != null and dto.startDate != ''"> and dc.issue_date <![CDATA[ >= ]]> #{dto.startDate}</if>
+    <if test="dto.endDate != null and dto.endDate != ''"> and dc.issue_date <![CDATA[ <= ]]> #{dto.endDate}</if>
     <include refid="permissionCondition"/>
   </select>
+
+  <update id="updateStatus">
+    update rmcp_device_command set status = #{status} where id in
+    <foreach collection="ids" item="id" index="index"  open="(" separator="," close=")">
+        #{id}
+    </foreach>
+  </update>
+
 </mapper>

+ 10 - 3
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/mapper/MeterReplaceLogMapper.xml

@@ -309,8 +309,15 @@
       d.file_no LIKE concat('%',#{dto.deviceNo},'%'))
     </if>
     <if test="dto.replaceMethod != null"> and rl.replace_method = #{dto.replaceMethod}</if>
-    <if test="dto.startDate != null"> and rl.create_date <![CDATA[ >= ]]> #{dto.startDate}</if>
-    <if test="dto.endDate != null"> and rl.create_date <![CDATA[ <= ]]> #{dto.endDate}</if>
+    <if test="dto.startDate != null and dto.startDate!= ''"> and rl.create_date <![CDATA[ >= ]]> #{dto.startDate}</if>
+    <if test="dto.endDate != null and dto.endDate != ''"> and rl.create_date <![CDATA[ <= ]]> #{dto.endDate}</if>
     <include refid="permissionCondition"/>
   </select>
-</mapper>
+
+  <update id="updateStatus">
+    update rmcp_meter_replace_log set status = #{status} where id in
+    <foreach collection="ids" item="id" index="index"  open="(" separator="," close=")">
+      #{id}
+    </foreach>
+  </update>
+</mapper>

+ 15 - 5
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/DeviceCommandController.java

@@ -1,10 +1,15 @@
 package com.zcxk.rmcp.web.controller;
 
+import com.zcxk.core.common.exception.BusinessException;
 import com.zcxk.core.common.pojo.AjaxMessage;
 import com.zcxk.core.mysql.pageing.Pagination;
 import com.zcxk.core.utils.export.EasyExcelUtil;
 import com.zcxk.rmcp.api.dto.devicecommand.DeviceCommandPageDto;
+import com.zcxk.rmcp.api.dto.readrate.ReadRateDto;
+import com.zcxk.rmcp.api.enums.ReadRateEnum;
+import com.zcxk.rmcp.api.enums.RmcpErrorEnum;
 import com.zcxk.rmcp.api.vo.DeviceCommandVo;
+import com.zcxk.rmcp.api.vo.ReadRateVo;
 import com.zcxk.rmcp.web.service.DeviceCommandService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -14,6 +19,7 @@ import org.springframework.stereotype.Controller;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.util.List;
 
@@ -43,14 +49,18 @@ public class DeviceCommandController extends BaseController{
         return AjaxMessage.success(deviceCommandService.findDeviceCommand(id));
     }
 
-    @RequestMapping(value="export/excel" , method = RequestMethod.POST)
+
+    @RequestMapping(value="export/excel" , method = RequestMethod.GET)
     @ApiOperation(value = "excel导出")
-    public AjaxMessage<String> exportExcel(@RequestBody @Valid DeviceCommandPageDto deviceCommandPageDto) {
+    public void exportExcel(DeviceCommandPageDto deviceCommandPageDto, HttpServletResponse response) {
         List<DeviceCommandVo> list = deviceCommandService.listDeviceCommand(deviceCommandPageDto);
         if (CollectionUtils.isEmpty(list)) {
-            return AjaxMessage.success(null);
+            throw BusinessException.builder(RmcpErrorEnum.RMCP_NOT_FOUND);
+        }
+        try {
+            EasyExcelUtil.excelWrite(response, DeviceCommandVo.class, "阀控管理记录", list);
+        } catch (Exception e) {
+            throw BusinessException.builder(RmcpErrorEnum.RMCP_DOWNLOAD_ERROR);
         }
-        String filePath = EasyExcelUtil.excelWrite(baseDir, DeviceCommandVo.class, "阀控管理记录", list);
-        return AjaxMessage.success(filePath);
     }
 }

+ 12 - 5
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/MeterReplaceController.java

@@ -1,10 +1,13 @@
 package com.zcxk.rmcp.web.controller;
 
+import com.zcxk.core.common.exception.BusinessException;
 import com.zcxk.core.common.pojo.AjaxMessage;
 import com.zcxk.core.mysql.pageing.Pagination;
 import com.zcxk.core.utils.export.EasyExcelUtil;
 import com.zcxk.rmcp.api.dto.meterreplace.MeterReplacePageDto;
 import com.zcxk.rmcp.api.dto.meterreplace.WaterMeterReplaceInputDto;
+import com.zcxk.rmcp.api.enums.RmcpErrorEnum;
+import com.zcxk.rmcp.api.vo.DeviceCommandVo;
 import com.zcxk.rmcp.api.vo.MeterReplaceVo;
 import com.zcxk.rmcp.web.service.MeterReplaceLogService;
 import io.swagger.annotations.Api;
@@ -15,6 +18,7 @@ import org.springframework.stereotype.Controller;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.util.List;
 
@@ -46,15 +50,18 @@ public class MeterReplaceController  extends BaseController {
         return AjaxMessage.success(meterReplaceLogService.pageMeterReplace(pageDto));
     }
 
-    @RequestMapping(value="export/excel" , method = RequestMethod.POST)
+    @RequestMapping(value="export/excel" , method = RequestMethod.GET)
     @ApiOperation(value = "excel导出")
-    public AjaxMessage<String> exportExcel(@RequestBody @Valid MeterReplacePageDto pageDto) {
+    public void exportExcel(MeterReplacePageDto pageDto, HttpServletResponse response) {
         List<MeterReplaceVo> list = meterReplaceLogService.listMeterReplace(pageDto);
         if (CollectionUtils.isEmpty(list)) {
-            return AjaxMessage.success(null);
+            throw BusinessException.builder(RmcpErrorEnum.RMCP_NOT_FOUND);
+        }
+        try {
+            EasyExcelUtil.excelWrite(response, MeterReplaceVo.class, "换表记录", list);
+        } catch (Exception e) {
+            throw BusinessException.builder(RmcpErrorEnum.RMCP_DOWNLOAD_ERROR);
         }
-        String filePath = EasyExcelUtil.excelWrite(baseDir, MeterReplaceVo.class, "换表记录", list);
-        return AjaxMessage.success(filePath);
     }
 
 

+ 18 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/DeviceCommandService.java

@@ -59,4 +59,22 @@ public interface DeviceCommandService{
     **/
     List<DeviceCommandVo> listDeviceCommand(DeviceCommandPageDto pageDto);
 
+    /**
+    * 删除
+    * @author Andy
+    * @date 14:26 2021/8/16
+    * @param id:
+    * @return void
+    **/
+    void delete(Long id);
+
+    /**
+    * 删除全部
+    * @author Andy
+    * @date 14:27 2021/8/16
+    * @param ids:
+    * @return void
+    **/
+    void deleteAll(List<Long> ids);
+
 }

+ 18 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/MeterReplaceLogService.java

@@ -70,4 +70,22 @@ public interface MeterReplaceLogService{
     **/
     void submitWaterMeterReplace(WaterMeterReplaceInputDto waterMeterReplaceDto);
 
+    /**
+     * 删除
+     * @author Andy
+     * @date 14:26 2021/8/16
+     * @param id:
+     * @return void
+     **/
+    void delete(Long id);
+
+    /**
+     * 删除全部
+     * @author Andy
+     * @date 14:27 2021/8/16
+     * @param ids:
+     * @return void
+     **/
+    void deleteAll(List<Long> ids);
+
 }

+ 14 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceCommandServiceImpl.java

@@ -1,11 +1,13 @@
 package com.zcxk.rmcp.web.service.impl;
 
 import com.github.pagehelper.PageHelper;
+import com.zcxk.core.common.enums.StatusEnum;
 import com.zcxk.core.oauth2.util.UserUtil;
 import com.zcxk.core.mysql.pageing.Pagination;
 import com.zcxk.rmcp.api.dto.devicecommand.DeviceCommandPageDto;
 import com.zcxk.rmcp.api.enums.CommandStatusEnum;
 import com.zcxk.rmcp.api.enums.CommandTypeEnum;
+import com.zcxk.rmcp.api.enums.DeviceStatusEnum;
 import com.zcxk.rmcp.api.enums.OperationTypeEnum;
 import com.zcxk.rmcp.api.vo.DeviceCommandVo;
 import com.zcxk.rmcp.web.service.DeviceCommandService;
@@ -16,6 +18,7 @@ import com.zcxk.rmcp.core.entity.DeviceCommand;
 import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -64,8 +67,19 @@ public class DeviceCommandServiceImpl implements DeviceCommandService {
             deviceCommandVo.setCommandStatus(CommandStatusEnum.getMessage(deviceCommandVo.getCommandStatus()));
             deviceCommandVo.setCommandType(CommandTypeEnum.getMessage(deviceCommandVo.getCommandType()));
             deviceCommandVo.setOperationType(OperationTypeEnum.getMessage(Integer.parseInt(deviceCommandVo.getOperationType())));
+            deviceCommandVo.setDeviceStatus(DeviceStatusEnum.getMessage(deviceCommandVo.getDeviceStatus()));
         }
         return list;
     }
 
+    @Override
+    public void delete(Long id) {
+        deviceCommandMapper.updateStatus(Arrays.asList(id), StatusEnum.DELETE.getCode());
+    }
+
+    @Override
+    public void deleteAll(List<Long> ids) {
+        deviceCommandMapper.updateStatus(ids, StatusEnum.DELETE.getCode());
+    }
+
 }

+ 12 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/MeterReplaceLogServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -48,6 +49,7 @@ public class MeterReplaceLogServiceImpl implements MeterReplaceLogService {
     @Resource
     private ProductMapper productMapper;
 
+
     @Override
     public int insertSelective(MeterReplaceLog record) {
         return meterReplaceLogMapper.insertSelective(record);
@@ -151,6 +153,16 @@ public class MeterReplaceLogServiceImpl implements MeterReplaceLogService {
         log.info("end submitWaterMeterReplace remoteMeterFlag = {}", remoteMeterFlag);
     }
 
+    @Override
+    public void delete(Long id) {
+        meterReplaceLogMapper.updateStatus(Arrays.asList(id), StatusEnum.DELETE.getCode());
+    }
+
+    @Override
+    public void deleteAll(List<Long> ids) {
+        meterReplaceLogMapper.updateStatus(ids, StatusEnum.DELETE.getCode());
+    }
+
     /**
     * @author Andy
     * @description 添加换表记录

+ 2 - 7
zoniot-rmcp/zoniot-xxljob-client/src/main/java/com/zcxk/xxljob/service/impl/MeterReadRecordServiceImpl.java

@@ -1,8 +1,5 @@
 package com.zcxk.xxljob.service.impl;
-import java.time.Instant;
-import java.time.LocalDateTime;
 
-import cn.hutool.core.bean.OptionalBean;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.PageUtil;
@@ -10,13 +7,10 @@ import com.alibaba.fastjson.JSON;
 import com.zcxk.core.common.enums.StatusEnum;
 import com.zcxk.core.common.util.SnowflakeIdWorker;
 import com.zcxk.core.utils.DateUtil;
-import com.zcxk.core.utils.ZoniotStringUtils;
 import com.zcxk.rmcp.api.dto.meterreadrecord.MeterReadRecordDetailDto;
-import com.zcxk.rmcp.api.dto.readmeter.MeterData;
+import com.zcxk.rmcp.api.dto.readmeter.WaterMeterDto;
 import com.zcxk.rmcp.api.enums.ReadStatusEnum;
-import com.zcxk.rmcp.api.vo.MeterReadRecordVo;
 import com.zcxk.rmcp.core.dao.DeviceMapper;
-import com.zcxk.rmcp.api.dto.readmeter.WaterMeterDto;
 import com.zcxk.rmcp.core.dao.MeterReadRecordMapper;
 import com.zcxk.rmcp.core.mongo.MeterReadRecord;
 import com.zcxk.xxljob.common.Constants;
@@ -32,6 +26,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;