瀏覽代碼

增加相关接口

zhoujiangyuan 4 年之前
父節點
當前提交
6cb6ec9198
共有 27 個文件被更改,包括 1301 次插入17 次删除
  1. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/controller/CommunityManagerController.java
  2. 93 0
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PaySyncDataController.java
  3. 2 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/CommunityMapper.java
  4. 5 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/DeviceMapper.java
  5. 18 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/WaterMeterReplaceLogMapper.java
  6. 18 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/AreaDto.java
  7. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/dto/CommunityDto.java
  8. 142 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceDto.java
  9. 48 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceTypeDto.java
  10. 44 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/InstallPlanDataDTO.java
  11. 32 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/InstallPlanInputDTO.java
  12. 118 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/Device.java
  13. 52 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/DeviceMeasuringPoint.java
  14. 67 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/DeviceType.java
  15. 62 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/WaterMeterReplaceLog.java
  16. 122 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/InstallPlan.java
  17. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/CommunityService.java
  18. 10 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/CommunityServiceImpl.java
  19. 3 3
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  20. 267 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PaySyncDataServiceImpl.java
  21. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java
  22. 27 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PaySyncDataService.java
  23. 2 1
      smart-city-platform/src/main/resources/application-dev.properties
  24. 5 0
      smart-city-platform/src/main/resources/mapper/CommunityMapper.xml
  25. 56 1
      smart-city-platform/src/main/resources/mapper/DeviceMapper.xml
  26. 96 0
      smart-city-platform/src/main/resources/mapper/WaterMeterReplaceLogMapper.xml
  27. 5 9
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

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

@@ -29,7 +29,7 @@ public class CommunityManagerController {
 	CommunityService communityService;
 
 
-	@GetMapping("queryCommunity")
+/*	@GetMapping("queryCommunity")
 	@ApiOperation(value = "查询小区")
 	public AjaxMessage<List<CommunityDto>> queryCommunity(
 			@ApiParam(value = "小区名称", required = false) @RequestParam(required = false) String name,
@@ -53,7 +53,7 @@ public class CommunityManagerController {
         List<CommunityDto> list = communityService.queryList(param);
         
         return new AjaxMessage<>(ResultStatus.OK, list);
-	}
+	}*/
 
 	@GetMapping("getCommunityPage")
 	@ApiOperation(value = "获取小区列表分页", notes = "权限:sys:community:query")

+ 93 - 0
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PaySyncDataController.java

@@ -0,0 +1,93 @@
+package com.bz.smart_city.controller.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.dto.AreaDto;
+import com.bz.smart_city.dto.CommunityDto;
+import com.bz.smart_city.dto.DeviceTypeDto;
+import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.WaterMeterReplaceLog;
+import com.bz.smart_city.service.pay.PaySyncDataService;
+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.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 9:01
+ */
+@RestController
+//@RequestMapping("/SyncData")
+@Api(tags = "计费系统-数据同步接口")
+public class PaySyncDataController {
+
+    @Autowired
+    private PaySyncDataService paySyncDataService;
+
+    @PostMapping("installPlan/addJF")
+    @PreAuthorize("hasAuthority('sys:installPlan:add')")
+    @ApiOperation(value = "添加安装计划", notes = "权限:sys:installPlan:add")
+    public AjaxMessage add(
+            @ApiParam(value = "安装计划", required = true) @RequestBody(required = true) InstallPlanInputDTO installPlanInput
+    ) {
+        return paySyncDataService.addJF(installPlanInput);
+        //return new AjaxMessage(ResultStatus.OK);
+    }
+
+
+    @GetMapping("system/community/queryCommunity")
+    @ApiOperation(value = "查询小区")
+    public AjaxMessage<List<CommunityDto>> queryCommunity(
+            @ApiParam(value = "小区名称", required = false) @RequestParam(required = false) String name,
+            @ApiParam(value = "省", required = false) @RequestParam(required = false) Integer province,
+            @ApiParam(value = "市", required = false) @RequestParam(required = false) Integer city,
+            @ApiParam(value = "区", required = false) @RequestParam(required = false) Integer region,
+            @ApiParam(value = "小区", required = false) @RequestParam(required = false) Integer communityId) {
+
+        Community param = new Community();
+        param.setProvince(province);
+        param.setCity(city);
+        param.setRegion(region);
+        param.setId(communityId);
+        param.setName(name);
+
+
+        return paySyncDataService.queryCommunity(param);
+    }
+
+    @GetMapping("common/getAllArea")
+    @ApiOperation(value = "获取所有的省市区")
+    public AjaxMessage<List<AreaDto>> getAllArea(
+    ) {
+        return paySyncDataService.getAllArea();
+    }
+
+
+    @GetMapping("mobile/assistant/getMeterTypes")
+    @ApiOperation(value = "获取表类型")
+    public AjaxMessage<List<DeviceTypeDto>> getMeterTypes(
+            @ApiParam(value = "分类,1:远传表,2:智能表,9:流量计", required = false) @RequestParam(required = false) Integer parentId
+    ){
+        return paySyncDataService.queryWaterMeterType(parentId);
+    }
+
+    @PostMapping("/amount/synDeviceReplaceRecord")
+    @ApiOperation(value = "同步换表信息")
+    public AjaxMessage syncReplaceRecord(
+            @ApiParam(value = "同步换表信息", required = true) @RequestBody(required = true) WaterMeterReplaceLog waterMeterReplaceLog
+    ) {
+
+        int result = paySyncDataService.addReplaceRecord(waterMeterReplaceLog);
+        if(result > 0)
+            return new AjaxMessage(ResultStatus.OK);
+        else
+            return new AjaxMessage(ResultStatus.ERROR);
+    }
+
+}

+ 2 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/CommunityMapper.java

@@ -35,4 +35,6 @@ public interface CommunityMapper {
     List<Community> getMaxCodeBySiteId(@Param("siteId") Integer siteId);
 
     List<CommunityDto> getListByCustomerIds(@Param("siteId") Integer siteId, @Param("customerIds") List<Integer> customerIds, @Param("communityName") String communityName, @Param("province") Integer province, @Param("city") Integer city, @Param("region") Integer region);
+
+    Community findByNameV2(@Param("siteId") Integer siteId, @Param("province") Integer province, @Param("city") Integer city, @Param("region") Integer region, @Param("communityName") String communityName);
 }

+ 5 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/DeviceMapper.java

@@ -1,8 +1,11 @@
 package com.bz.smart_city.dao;
 
+import com.bz.smart_city.entity.Device;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 @Mapper
 public interface DeviceMapper {
     //通过站点id删除设备
@@ -11,5 +14,7 @@ public interface DeviceMapper {
     //通过场景id删除设备
     int deleteBySysId(@Param("sysId") Integer sysId, @Param("updateBy") String updateBy);
 
+    int insertList(@Param("devices") List<Device> devices);
+
 }
 

+ 18 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/WaterMeterReplaceLogMapper.java

@@ -0,0 +1,18 @@
+package com.bz.smart_city.dao;
+
+import com.bz.smart_city.entity.WaterMeterReplaceLog;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 16:33
+ */
+
+@Mapper
+public interface WaterMeterReplaceLogMapper {
+
+    int insertSelective(WaterMeterReplaceLog record);
+
+}

+ 18 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/AreaDto.java

@@ -0,0 +1,18 @@
+package com.bz.smart_city.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 9:29
+ */
+@Data
+@ApiModel("区域")
+public class AreaDto {
+    private Integer code;
+    private Integer pid;
+    private String name;
+    private List<AreaDto> children;
+}

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/CommunityDto.java

@@ -19,7 +19,7 @@ public class CommunityDto extends Community {
     @ApiModelProperty(value = "区", position = 3)
     private String regionName;
 
-    @ApiModelProperty(value = "片区", position = 4)
+    @ApiModelProperty(value = "片区", position = 4)
     private String districtName;
 
 }

+ 142 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceDto.java

@@ -0,0 +1,142 @@
+package com.bz.smart_city.dto;
+
+import com.bz.smart_city.entity.Device;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
+
+/**
+ * Created by ZJY on 2020-09-27 8:43
+ */
+
+@Data
+@ApiModel
+@EqualsAndHashCode(callSuper=false)
+public class DeviceDto extends Device {
+
+    @ApiModelProperty(value = "系列", position = 100)
+    private String equipmentType;
+
+    @ApiModelProperty(value = "型号", position = 101)
+    private String model;
+
+    @ApiModelProperty(value = "厂商名称", position = 102)
+    private String manufacturerName;
+
+    @ApiModelProperty(value = "建筑名称", position = 103)
+    private String buildingName;
+
+    @ApiModelProperty(value = "系统名称", position = 103)
+    private String systemName;
+
+    @ApiModelProperty(value = "经度", position = 104)
+    private String longitude;
+
+    @ApiModelProperty(value = "纬度", position = 105)
+    private String latitude;
+
+    @ApiModelProperty(value = "状态名称", position = 106)
+    private String deviceStatusName;
+
+    @ApiModelProperty(value = "省", position = 107)
+    private Integer province;
+
+    @ApiModelProperty(value = "省名称", position = 107)
+    private String provinceName ;
+
+    @ApiModelProperty(value = "市", position = 108)
+    private Integer city;
+
+    @ApiModelProperty(value = "市名称", position = 108)
+    private String cityName ;
+
+    @ApiModelProperty(value = "区", position = 109)
+    private Integer region ;
+
+    @ApiModelProperty(value = "区名称", position = 109)
+    private String regionName ;
+
+    @ApiModelProperty(value = "小区", position = 110)
+    private Integer community;
+
+    @ApiModelProperty(value = "小区", position = 110)
+    private String communityName;
+
+    @ApiModelProperty(value = "集中器", position = 111)
+    private String concentratorName;
+
+    @ApiModelProperty(value = "采集器", position = 112)
+    private String collectorName;
+
+    @ApiModelProperty(value = "告警类型", position = 114)
+    private String lastErrorType;
+
+    @ApiModelProperty(value = "连续故障天数", position = 115)
+    private Integer days = 0;
+
+    @ApiModelProperty(value = "客户名称", position = 116)
+    private String customerName;
+
+    @ApiModelProperty(value = "客户id", position = 116)
+    private Integer customerId ;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "计划时间", position = 117)
+    private LocalDateTime planTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "安装时间", position = 118)
+    private LocalDateTime installTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "验收时间", position = 119)
+    private LocalDateTime acceptTime;
+
+    @ApiModelProperty(value = "新表起度", position = 120)
+    private String newMeterStart;
+
+    @ApiModelProperty(value = "水表读数", position = 121)
+    private String meterReading;
+
+    @ApiModelProperty(value = "安装主键", position = 122)
+    private Integer installId ;
+
+    @ApiModelProperty(value = "旧表止度",position = 123)
+    private String oldMeterEnd;
+
+    @ApiModelProperty(value="阀门状态 0:关阀 1:开阀",position = 124)
+    private Integer valveStatus = 1;
+
+    @ApiModelProperty(value="阀门按钮状态 0:关阀 1:开阀",position = 125)
+    private Integer valveButtonStatus = 1;
+
+    @ApiModelProperty(value="是否有无阀门 0:无 1:有",position = 125)
+    private Integer isValve;
+
+    @ApiModelProperty(value="是否需要注册 0:否:是",position = 125)
+    private Integer isRegister;
+
+    @ApiModelProperty(value="参考集中器表",position = 126)
+    private Integer concentratorId;
+
+    @ApiModelProperty(value="参考采集器表",position = 127)
+    private Integer collectorId;
+
+
+    @ApiModelProperty(value="通道号id",position = 128)
+    private Integer channelNumberId;
+
+    @ApiModelProperty(value="通道号",position = 129)
+    private String channelNumberName;
+
+    @ApiModelProperty(value="测量点号",position = 130)
+    private String port;
+
+    @ApiModelProperty(value="下发状态 0:未下发 1:已下发",position = 131)
+    private Integer issueStatus;
+
+}

+ 48 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceTypeDto.java

@@ -0,0 +1,48 @@
+package com.bz.smart_city.dto;
+
+import com.bz.smart_city.entity.DeviceMeasuringPoint;
+import com.bz.smart_city.entity.DeviceType;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 9:42
+ */
+
+@Data
+@EqualsAndHashCode(callSuper=false)
+public class DeviceTypeDto extends DeviceType implements Serializable {
+
+    private static final long serialVersionUID = -4248786000656508924L;
+
+    @ApiModelProperty(value = "厂商名称", position = 100, hidden = true)
+    private String manufacturerName;
+
+    @ApiModelProperty(value = "厂商英文名称", position = 100, hidden = true)
+    private String enManufacturerName;
+
+    @ApiModelProperty(value = "英文系列", position = 100, hidden = true)
+    private String enEquipmentType;
+
+    @ApiModelProperty(value = "英文型号", position = 100, hidden = true)
+    private String enModel;
+
+    @ApiModelProperty(value = "关联Agent", position = 100, hidden = true)
+    private String agentIdentifier;
+
+    @ApiModelProperty(value = "所属系统名称", position = 101, hidden = true)
+    private String channelName;
+
+    @ApiModelProperty(value = "所属场景,水务专用")
+    private Integer channelId;
+
+    @ApiModelProperty(value = "测点", position = 102, hidden = true)
+    private List<DeviceMeasuringPoint> measuringPoint;
+
+    @ApiModelProperty(value = "测点id集合", position = 103)
+    private List<Integer> measuringPointId;
+}

+ 44 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/InstallPlanDataDTO.java

@@ -0,0 +1,44 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-25 13:44
+ */
+
+@Data
+public class InstallPlanDataDTO {
+
+    @JsonIgnore
+    @ApiModelProperty(value="id",hidden = true)
+    private Long id;
+
+    @JsonIgnore
+    @ApiModelProperty(value="父类id",hidden = true)
+    private Long parentId;
+
+    @ApiModelProperty(value="名称",position = 1,example = "测试")
+    private String name;
+
+    @ApiModelProperty(value = "是否已安装,0否1是", position = 2,example = "0")
+    private Integer isInstalled = 0;
+
+    @ApiModelProperty(value = "已安总数", position = 3,example = "0")
+    private Integer installedNumber = 0;
+
+    @ApiModelProperty(value = "总数", position = 4,example = "1")
+    private Integer totalNumber = 0;
+
+    @ApiModelProperty(value = "类型", position = 4,example = "1")
+    private Integer type;
+
+    @ApiModelProperty(value = "水表档案号")
+    private String fileNo;
+
+    @ApiModelProperty(value = "子类", position = 5)
+    private List<InstallPlanDataDTO> children;
+}

+ 32 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/InstallPlanInputDTO.java

@@ -0,0 +1,32 @@
+package com.bz.smart_city.dto.pay;
+
+import com.bz.smart_city.entity.pay.InstallPlan;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-25 13:42
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class InstallPlanInputDTO extends InstallPlan {
+
+    @ApiModelProperty(value="地址", position = 101,example = "广东省深圳市宝安区福永大道")
+    private String adrress;
+
+    @ApiModelProperty(value="水表设备类型", position = 102)
+    List<Integer> deviceTypeIds;
+
+    @ApiModelProperty(value="安装数据", position = 103)
+    List<InstallPlanDataDTO> InstallPlanDataList;
+
+    @ApiModelProperty(value = "结算方式id",position = 104,example = "1")
+    private Integer calculateway_id;
+
+    @ApiModelProperty(value = "用水性质id",position = 105,example = "1")
+    private BigInteger waterproperty_id;
+}

+ 118 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/Device.java

@@ -0,0 +1,118 @@
+package com.bz.smart_city.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 8:43
+ */
+
+@Data
+@ApiModel("设备")
+public class Device {
+    @ApiModelProperty(value = "编号", position = 1)
+    private Long id;
+
+    @ApiModelProperty(value = "设备编号", position = 2)
+    private String deviceNo;
+
+    @ApiModelProperty(value = "设备类型", position = 3)
+    private Integer deviceType;
+
+    @ApiModelProperty(value = "系统id", position = 4)
+    private Integer sysId;
+
+    @ApiModelProperty(value = "系统id数组", position = 4)
+    private List<Integer> sysIds ;
+
+    @ApiModelProperty(value = "站点id", position = 4, hidden = true)
+    private Integer siteId;
+
+    @ApiModelProperty(value = "建筑id", position = 5)
+    private Integer buildingId;
+
+    @ApiModelProperty(value = "楼层", position = 6)
+    private Integer floor;
+
+    @ApiModelProperty(value = "位置描述", position = 7)
+    private String locDesc;
+
+    @ApiModelProperty(value = "关联设备", position = 8)
+    private Long relatedDeviceNo;
+
+    @ApiModelProperty(value = "厂商", position = 9)
+    private Integer manufacturerId;
+
+    //@ApiModelProperty(value = "设备状态  1:正常 2:故障 3:无 4: 预警 5:未启用", position = 11, hidden = true)
+    @ApiModelProperty(value = "设备状态  1:正常 2:故障 3:无 4: 预警 5:未启用", position = 11, hidden = true)
+    private Integer deviceStatus;
+
+    @ApiModelProperty(value = "状态 0:删除 1:正常", position = 12, hidden = true)
+    private Integer status;
+
+    @ApiModelProperty(value = "是否已标记 0:未标记 1:已标记", position = 13)
+    private Integer isTag;
+
+    @ApiModelProperty(value = "坐标x", position = 14)
+    private BigDecimal xCoordinates;
+
+    @ApiModelProperty(value = "坐标y", position = 15)
+    private BigDecimal yCoordinates;
+
+    @ApiModelProperty(value = "创建人", hidden = true)
+    private String createBy = "system";
+
+    @ApiModelProperty(value = "更新人", hidden = true)
+    private String updateBy = "system";
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间", hidden = true)
+    private LocalDateTime dateCreate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间", hidden = true)
+    private LocalDateTime dateUpdate = LocalDateTime.now();
+
+    @ApiModelProperty(value = "平面图id", position = 16)
+    private Integer planId;
+
+    @ApiModelProperty(value = "水表电子号", position = 17)
+    private String waterMeterNo;
+
+    @ApiModelProperty(value = "水表档案号", position = 18)
+    private String waterMeterFileNo;
+
+
+
+    @ApiModelProperty(value = "参考sc_customer表id", position = 19)
+    private Integer customerId;
+
+    @ApiModelProperty(value = "udip平台id", position = 20)
+    private String udipId;
+
+    @ApiModelProperty(value = "是否注册", position = 20)
+    private Integer registerStatus;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "设备最后上报时间", position = 21)
+    private LocalDateTime lastReceiveTime;
+
+    private List<Integer> deviceStatusList;
+
+    @ApiModelProperty(value = "水表档案号", position = 22)
+    private String metercode;
+
+    @ApiModelProperty(value = "客户信息ID", position = 23)
+    private BigInteger accountId;
+
+    @ApiModelProperty(value = "客户编号", position = 24)
+    private String accountnumber;
+
+}

+ 52 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/DeviceMeasuringPoint.java

@@ -0,0 +1,52 @@
+package com.bz.smart_city.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * Created by ZJY on 2020-09-27 9:43
+ */
+
+@Data
+@ApiModel("设备测点")
+public class DeviceMeasuringPoint implements Serializable {
+    @ApiModelProperty(value = "id",position = 1)
+    private Integer id;
+
+    @ApiModelProperty(value = "测点名称",position = 2)
+    private String measuringPointName;
+
+    @ApiModelProperty(value = "代号",position = 3)
+    private String codeName;
+
+    @ApiModelProperty(value = "数据单位",position = 4)
+    private String dataUnit;
+
+    @ApiModelProperty(value = "类型",position = 5)
+    private Integer measuringPointType;
+
+    @JsonIgnore
+    @ApiModelProperty(value = "状态 0:删除 1:正常", position = 6, hidden = true)
+    private Integer status;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间", position = 50, hidden = true)
+    private LocalDateTime createDate;
+
+    @ApiModelProperty(value = "创建人", position = 51, hidden = true)
+    private String createBy;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间", position = 52, hidden = true)
+    private LocalDateTime updateDate;
+
+    @ApiModelProperty(value = "更新用户", position = 53, hidden = true)
+    private String updateBy;
+
+}

+ 67 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/DeviceType.java

@@ -0,0 +1,67 @@
+package com.bz.smart_city.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * Created by ZJY on 2020-09-27 9:42
+ */
+
+@Data
+@ApiModel("设备类型")
+public class DeviceType implements Serializable {
+
+    private static final long serialVersionUID = 987389838608639392L;
+
+    @ApiModelProperty(value = "id", position = 1)
+    private Integer id;
+
+    @ApiModelProperty(value = "系列", position = 2)
+    private String equipmentType;
+
+    @ApiModelProperty(value = "型号", position = 3)
+    private String model;
+
+    @ApiModelProperty(value = "厂商id", position = 5)
+    private Integer manufacturerId;
+
+    @ApiModelProperty(value = "设备类型 1:传感器 2;网关设备", position = 6)
+    private Integer deviceType;
+
+    @JsonIgnore
+    @ApiModelProperty(value = "状态 0:删除 1:正常", position = 8, hidden = true)
+    private Integer status;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间", position = 50, hidden = true)
+    private LocalDateTime createDate;
+
+    @ApiModelProperty(value = "创建人", position = 51, hidden = true)
+    private String createBy;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新时间", position = 52, hidden = true)
+    private LocalDateTime updateDate;
+
+    @ApiModelProperty(value = "更新用户", position = 53, hidden = true)
+    private String updateBy;
+
+    @ApiModelProperty(value = "上报周期,单位小时", position = 53, hidden = true)
+    private Double period ;
+
+    @ApiModelProperty(value = "监控作业表达式,CronExpression", position = 53, hidden = true)
+    private String expression ;
+
+    @ApiModelProperty(value = "有无阀门 0:无 1:有", position = 53, hidden = true)
+    private Integer isValve ;
+
+    @ApiModelProperty(value = "是否需要注册 0:否:是", position = 53, hidden = true)
+    private Integer isRegister ;
+
+}

+ 62 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/WaterMeterReplaceLog.java

@@ -0,0 +1,62 @@
+package com.bz.smart_city.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+
+/**
+ * Created by ZJY on 2020-09-27 16:31
+ */
+
+@ApiModel(value="换表记录")
+@Data
+public class WaterMeterReplaceLog {
+
+    @ApiModelProperty(value="主键")
+    private BigInteger id;
+
+    @ApiModelProperty(value="水表档案号")
+    private String metercode;
+
+    @ApiModelProperty(value="旧表电子号")
+    private String oldEleno;
+
+    @ApiModelProperty(value="新表电子号")
+    private String newEleno;
+
+    @ApiModelProperty(value="旧表上次止度")
+    private BigDecimal oldLastreading;
+
+    @ApiModelProperty(value="旧表止度")
+    private  BigDecimal oldReading;
+
+    @ApiModelProperty(value="旧表水量")
+    private BigDecimal oldAmount;
+
+    @ApiModelProperty(value="新表起度")
+    private BigDecimal newStartcount;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value="创建时间")
+    private LocalDateTime createDate;
+
+    @ApiModelProperty(value="备注")
+    private String remarks;
+
+    @ApiModelProperty(value="站点id")
+    private BigInteger siteId;
+
+    @ApiModelProperty(value="年")
+    private Integer year;
+
+    @ApiModelProperty(value="月")
+    private Integer month;
+
+    @ApiModelProperty(value = "客户Id")
+    private BigInteger customerId;
+}

+ 122 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/InstallPlan.java

@@ -0,0 +1,122 @@
+package com.bz.smart_city.entity.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * Created by ZJY on 2020-09-25 13:43
+ */
+
+@ApiModel(value="安装计划")
+@Data
+public class InstallPlan {
+    @ApiModelProperty(value="主键", position = 1)
+    private Integer id;
+
+    @ApiModelProperty(value = "站点id",hidden = true)
+    private Integer siteId;
+
+    @ApiModelProperty(value = "计划名称",example = "计划名称a")
+    private String planName;
+
+    @ApiModelProperty(value="省",position = 3,example = "440000")
+    private Integer province;
+
+    @ApiModelProperty(value="市",position = 4,example = "518000")
+    private Integer city;
+
+    @ApiModelProperty(value="区",position = 5,example = "518100")
+    private Integer region;
+
+    @ApiModelProperty(value="小区",position = 6,example = "1")
+    private Integer communityId;
+
+    @ApiModelProperty(value="小区名称",position = 7,example = "凤凰小区")
+    private String communityName;
+
+    @ApiModelProperty(value="报装客户数",position = 8,example = "3")
+    private Integer preInstallNumber;
+
+    @ApiModelProperty(value="客户id,参考sc_customer",position = 11,example = "1")
+    private Integer customerId;
+
+    @ApiModelProperty(value="客户编号,参考sc_customer")
+    private String customerNo;
+
+    @ApiModelProperty(value="设备类型id,参考sc_device_type",position = 12,example = "16")
+    private Integer deviceTypeId;
+
+    @ApiModelProperty(value="施工单位",position = 13,example = "恰恰施工公司")
+    private String installGroupName;
+
+    @ApiModelProperty(value="施工负责人",position = 14,example = "张三三")
+    private String installGroupHeader;
+
+    @ApiModelProperty(value="联系电话",example = "13800000001")
+    private String phone;
+
+    @ApiModelProperty(value="计划开始时间",example = "2020-04-20 15:00:01")
+    private LocalDateTime planStartDate;
+
+    @JsonIgnore
+    @ApiModelProperty(value="计划结束时间",position = 16,hidden = true)
+    private LocalDateTime planEndDate;
+
+    @ApiModelProperty(value="计划状态,0:未结束,1:已结束",hidden = true)
+    private Integer planStatus;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value="创建时间", hidden = true)
+    private LocalDateTime dateCreate;
+
+    @JsonIgnore
+    @ApiModelProperty(value="更新时间", hidden = true)
+    private LocalDateTime dateUpdate;
+
+    @JsonIgnore
+    @ApiModelProperty(value="创建人", hidden = true)
+    private String createBy;
+
+    @JsonIgnore
+    @ApiModelProperty(value="更新人", hidden = true)
+    private String updateBy;
+
+    @JsonIgnore
+    @ApiModelProperty(value="状态 0:删除  1:正常", hidden = true)
+    private Integer status;
+
+    @JsonIgnore
+    @ApiModelProperty(value="备注", hidden = true)
+    private String remark;
+
+    @ApiModelProperty(value="是否启用单元 0:否 1:是", position = 17,example = "1")
+    private Integer enableUnit;
+
+
+    @ApiModelProperty(value="楼栋数",position = 18,example = "1")
+    private Integer buildingNumber;
+
+
+    @ApiModelProperty(value="单元数",position = 19,example = "1")
+    private Integer unitNumber;
+
+    @ApiModelProperty(value="操作平台 1:水务平台,2:计费平台",position = 20,example = "1")
+    private Integer platformType;
+
+    /**
+     * 生成压缩包文件路径
+     */
+    @ApiModelProperty(value="生成压缩包文件路径",example = " ")
+    private String filePath;
+
+    /**
+     * 是否启用下载 0:否 1:是
+     */
+    @ApiModelProperty(value="是否启用下载 0:否 1:是",example = "0")
+    private Integer enableDownload;
+}

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/CommunityService.java

@@ -31,4 +31,7 @@ public interface CommunityService {
 
     List<Community> findBySiteId(Integer siteId);
 
+    Community findByNameV2(@Param("siteId") Integer siteId, @Param("province") Integer province, @Param("city") Integer city, @Param("region") Integer region, @Param("communityName") String communityName);
+
+    List<Community> getMaxCodeBySiteId(Integer siteId);
 }

+ 10 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/CommunityServiceImpl.java

@@ -174,4 +174,14 @@ public class CommunityServiceImpl implements CommunityService{
     public List<Community> findBySiteId(Integer siteId) {
         return communityMapper.getBySiteId(siteId);
     }
+
+    @Override
+    public Community findByNameV2(Integer siteId, Integer province, Integer city, Integer region, String communityName) {
+        return communityMapper.findByNameV2(siteId,province,city,region,communityName);
+    }
+
+    @Override
+    public List<Community> getMaxCodeBySiteId(Integer siteId){
+        return  communityMapper.getMaxCodeBySiteId(siteId);
+    }
 }

+ 3 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java

@@ -305,12 +305,12 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     public int batchInsert(List<PayBaseAccountDto> list,String code) {
         //1、从登陆信息中获取站点Id 水司ID
         LoginUser loginUser = getLoginUser();
-        int maxAccountNumber = getMaxAccountNumber(code);
+        //int maxAccountNumber = getMaxAccountNumber(code);
         int codeNumber = Integer.parseInt(code);
         List<PayRechargeaccountDto> rechList = new ArrayList<PayRechargeaccountDto>();
         for (PayBaseAccountDto  payBaseAccount : list) {
-            ++maxAccountNumber;
-            payBaseAccount.setAccountnumber(String.format("%03d%07d",codeNumber,(maxAccountNumber)));
+            //++maxAccountNumber;
+            //payBaseAccount.setAccountnumber(String.format("%03d%07d",codeNumber,(maxAccountNumber)));
             payBaseAccount.setCreateBy(new BigInteger(String.valueOf(loginUser.getId())));
             payBaseAccount.setCreateDate(LocalDateTime.now());
             payBaseAccount.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));

+ 267 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PaySyncDataServiceImpl.java

@@ -0,0 +1,267 @@
+package com.bz.smart_city.service.impl.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.commom.util.HttpRequest;
+import com.bz.smart_city.commom.util.JacksonUtil;
+import com.bz.smart_city.commom.util.SnowflakeIdWorker;
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.DeviceMapper;
+import com.bz.smart_city.dao.WaterMeterReplaceLogMapper;
+import com.bz.smart_city.dto.AreaDto;
+import com.bz.smart_city.dto.CommunityDto;
+import com.bz.smart_city.dto.DeviceTypeDto;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.pay.InstallPlanDataDTO;
+import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
+import com.bz.smart_city.dto.pay.PayBaseAccountDto;
+import com.bz.smart_city.dto.pay.PayBaseConfigDto;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.WaterMeterReplaceLog;
+import com.bz.smart_city.service.CommunityService;
+import com.bz.smart_city.service.pay.PayBaseAccountService;
+import com.bz.smart_city.service.pay.PayBaseConfigService;
+import com.bz.smart_city.service.pay.PaySyncDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.google.common.collect.Lists.newArrayList;
+
+/**
+ * Created by ZJY on 2020-09-27 15:29
+ */
+@Service
+public class PaySyncDataServiceImpl implements PaySyncDataService {
+    @Autowired
+    private CommunityService communityService;
+    @Autowired
+    private SnowflakeIdWorker idWorker;
+    @Autowired
+    private PayBaseAccountService payBaseAccountService;
+    @Autowired
+    private PayBaseConfigService payBaseConfigService;
+    @Resource
+    DeviceMapper deviceMapper;
+    @Value("${Sync.Data.Url}")
+    String SyncUrl;
+
+    @Resource
+    WaterMeterReplaceLogMapper waterMeterReplaceLogMapper;
+
+    @Override
+    public AjaxMessage<List<AreaDto>> getAllArea(){
+
+        //调用接口
+        String url=SyncUrl + "/api/common/getAllArea";
+        try {
+            String result = HttpRequest.doGet(url);
+
+            AjaxMessage<List<AreaDto>> ajaxMessage = JacksonUtil.string2Obj(result, AjaxMessage.class);
+
+            return ajaxMessage;
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+
+            return new AjaxMessage(ResultStatus.ERROR);
+        }
+
+    }
+
+    @Override
+    public AjaxMessage<List<DeviceTypeDto>> queryWaterMeterType(Integer parentId){
+        String url = SyncUrl + "/api/mobile/assistant/getMeterTypes";
+
+        try {
+            if(parentId != null){
+                url += String.format("?parentId=%d",parentId);
+            }
+            String result = HttpRequest.doGet(url);
+
+            AjaxMessage<List<DeviceTypeDto>> ajaxMessage =JacksonUtil.string2Obj(result,AjaxMessage.class);
+            return ajaxMessage;
+        }
+        catch (Exception e){
+            return new AjaxMessage(ResultStatus.ERROR);
+        }
+
+    }
+
+    @Override
+    public AjaxMessage<List<CommunityDto>> queryCommunity(Community param){
+
+        String url = SyncUrl+"/api/syncData/queryCommunityByName";
+        try {
+            String json = JacksonUtil.obj2String(param);
+            String result = HttpRequest.doPost(url,json);
+            AjaxMessage<List<CommunityDto>> ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);
+            return ajaxMessage;
+        }
+        catch (Exception e){
+            return new AjaxMessage(ResultStatus.ERROR);
+        }
+    }
+
+    @Override
+    public int addReplaceRecord(WaterMeterReplaceLog waterMeterReplaceLog){
+        return waterMeterReplaceLogMapper.insertSelective(waterMeterReplaceLog);
+    }
+
+
+    @Override
+    @Transactional
+    public AjaxMessage addJF(InstallPlanInputDTO installPlanInput){
+
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        Integer siteId = 1;
+        if (loginUser.getSiteType() == 1) {
+            siteId = loginUser.getSiteId();
+        }
+        installPlanInput.setPlatformType(2);
+
+        //取客户编码
+        String customerNo="";
+        List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",loginUser.getSiteId(),loginUser.getCustomerId());
+        for (PayBaseConfigDto item : payBaseConfigDtos){
+            if(item.getName().trim()=="CUSTOMER_NO"){
+                customerNo = item.getValue();
+                installPlanInput.setCustomerNo(customerNo);
+            }
+        }
+
+        //1、小区
+        String code = "001";
+        String address = "";
+        String communityAndBuildingAndUnitAddress="";  //小区 楼栋 单元地址
+        String floorAddress="";
+        String doorAddress="";
+        if (1==1) {
+            Community community = communityService.findByNameV2(siteId,installPlanInput.getProvince(),installPlanInput.getCity(),installPlanInput.getRegion(), installPlanInput.getCommunityName());
+            if (community != null) {
+                installPlanInput.setCommunityId(community.getId());
+            } else {
+                Community newCommunity = new Community();
+                //获取小区最大值,然后加1
+                List<Community> communities = communityService.getMaxCodeBySiteId(siteId);
+                if(communities.size()==1)
+                {
+                    if (communities.get(0) != null) {
+                        code =String.format("%03d",Integer.valueOf(communities.get(0).getCode()));
+                    }else {
+                        code = String.format("%03d",Integer.valueOf("1"));
+                    }
+                }
+                newCommunity.setCode(code);
+                newCommunity.setSiteId(siteId);
+                newCommunity.setName(installPlanInput.getCommunityName());
+                newCommunity.setProvince(installPlanInput.getProvince());
+                newCommunity.setCity(installPlanInput.getCity());
+                newCommunity.setRegion(installPlanInput.getRegion());
+                newCommunity.setAddress(installPlanInput.getAdrress());
+                newCommunity.setCustomerId(installPlanInput.getCustomerId());
+                newCommunity.setStatus(1);
+                communityService.insert(newCommunity);
+                //installPlanInput.setCommunityId(newCommunity.getId());
+            }
+        }
+
+        int maxAccountNumber = payBaseAccountService.getMaxAccountNumber(code);
+
+        //楼栋
+        if (installPlanInput.getInstallPlanDataList() != null && installPlanInput.getInstallPlanDataList().size() > 0) {
+            List<PayBaseAccountDto> accountLists = newArrayList();
+
+            for (InstallPlanDataDTO installPlanBuilding : installPlanInput.getInstallPlanDataList()) {
+                //单元
+                if (installPlanBuilding.getChildren() != null && installPlanBuilding.getChildren().size() > 0) {
+                    for (InstallPlanDataDTO installPlanUnit : installPlanBuilding.getChildren()) {
+
+                        //判断是否启动单元
+                        String buildingName = "";
+                        if (installPlanInput.getEnableUnit() == 1) {
+                            buildingName = installPlanInput.getCommunityName() + installPlanBuilding.getName() + "栋" + installPlanUnit.getName() + "单元";
+                        } else {
+                            buildingName = installPlanInput.getCommunityName() + installPlanBuilding.getName() + "栋";
+                        }
+                        communityAndBuildingAndUnitAddress = buildingName;
+
+
+                        //安装楼层
+                        if (installPlanUnit.getChildren() != null && installPlanUnit.getChildren().size() > 0) {
+                            for (InstallPlanDataDTO installPlanFloor : installPlanUnit.getChildren()) {
+                                floorAddress = (installPlanFloor.getName() + "层");
+
+                                //安装清单
+                                if (installPlanFloor.getChildren() != null && installPlanFloor.getChildren().size() > 0) {
+                                    for (InstallPlanDataDTO installPlanDoor : installPlanFloor.getChildren()) {
+
+                                        //添加客户信息(水表用户)
+                                        doorAddress = (installPlanDoor.getName());
+                                        long accountid = idWorker.nextId();
+                                        PayBaseAccountDto payBaseAccountDto = new PayBaseAccountDto();
+                                        payBaseAccountDto.setId(BigInteger.valueOf(accountid));
+                                        payBaseAccountDto.setCalculateway(installPlanInput.getCalculateway_id());
+                                        if (installPlanInput.getWaterproperty_id() != null)
+                                            payBaseAccountDto.setWaterpropertyId(installPlanInput.getWaterproperty_id());
+                                        else
+                                            payBaseAccountDto.setWaterpropertyId(null);
+                                        payBaseAccountDto.setCommunityCode(code);
+                                        payBaseAccountDto.setAddress(communityAndBuildingAndUnitAddress + floorAddress + doorAddress);
+
+                                        ++maxAccountNumber;
+                                        String strAccountNumber = String.format("%s%07d", code, (maxAccountNumber));
+                                        payBaseAccountDto.setAccountnumber(strAccountNumber);
+                                        accountLists.add(payBaseAccountDto);
+
+                                        installPlanDoor.setFileNo(strAccountNumber);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+            //调用接口
+            String url = SyncUrl + "/api/syncData/syncPlan";
+            try {
+                String json = JacksonUtil.obj2String(installPlanInput);
+                String result = HttpRequest.doPost(url,json);
+                AjaxMessage ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);
+                if(ajaxMessage != null && ajaxMessage.getStatus() == 0){
+
+                    //生成用户信息和预存账户
+                    payBaseAccountService.batchInsert(accountLists, code);
+
+                    //生成水表信息(sc_device表)
+                    List<Device> deviceList = new ArrayList<>();
+                    for (PayBaseAccountDto  payBaseAccount : accountLists){
+                        long deviceId = idWorker.nextId();
+                        Device device = new Device();
+                        device.setId(deviceId);
+                        device.setMetercode(payBaseAccount.getAccountnumber());
+                        device.setAccountId(payBaseAccount.getId());
+                        deviceList.add(device);
+                    }
+                    deviceMapper.insertList(deviceList);
+
+                    return ajaxMessage;
+                }
+            }
+            catch (Exception e){
+                return new AjaxMessage(ResultStatus.ERROR);
+            }
+
+
+
+        }
+        return  new AjaxMessage(ResultStatus.ERROR);
+    }
+}

+ 1 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java

@@ -39,4 +39,5 @@ public interface PayBaseAccountService {
     //根据安装计划ID删除用户信息
     int delByPlanId(BigInteger planId);
 
+    int getMaxAccountNumber(String CommunityCode);
 }

+ 27 - 0
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PaySyncDataService.java

@@ -0,0 +1,27 @@
+package com.bz.smart_city.service.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.dto.AreaDto;
+import com.bz.smart_city.dto.CommunityDto;
+import com.bz.smart_city.dto.DeviceTypeDto;
+import com.bz.smart_city.dto.pay.InstallPlanInputDTO;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.WaterMeterReplaceLog;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-27 15:27
+ */
+public interface PaySyncDataService {
+
+    AjaxMessage<List<AreaDto>> getAllArea();
+
+    AjaxMessage<List<DeviceTypeDto>> queryWaterMeterType(Integer parentId);
+
+    AjaxMessage<List<CommunityDto>> queryCommunity(Community param);
+
+    int addReplaceRecord(WaterMeterReplaceLog waterMeterReplaceLog);
+
+    AjaxMessage addJF(InstallPlanInputDTO installPlanInput);
+}

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

@@ -106,4 +106,5 @@ service.domain=http:/127.0.0.1
 invoice.print.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/cxfKp/cxfServerKpOrderSync.action
 invoice.query.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/ecOd/queryElectricKp.action
 
-
+#抄表数据同步接口
+Sync.Data.Url=http://114.135.61.188:58080

+ 5 - 0
smart-city-platform/src/main/resources/mapper/CommunityMapper.xml

@@ -358,5 +358,10 @@
         order by sc.date_create desc
     </select>
 
+    <select id="findByNameV2" resultMap="BaseResultMap">
+        SELECT <include refid="Base_Column_List"></include> from sc_community where status = 1 and site_id = #{siteId}
+        and province = #{province} and city = #{city} and region = #{region} and name = #{communityName}
+    </select>
+
 </mapper>
 

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

@@ -13,7 +13,62 @@
         where status = 1 and sys_id = #{sysId}
     </update>
 
-
+    <insert id="insertList">
+        INSERT INTO sc_device(
+        id,
+        device_no,
+        device_type,
+        sys_id,
+        site_id,
+        building_id,
+        `floor`,
+        loc_desc,
+        related_device_no,
+        manufacturer_id,
+        device_status,
+        `status`,
+        is_tag,
+        x_coordinates,
+        y_coordinates,
+        create_by,
+        update_by,
+        date_create,
+        date_update,
+        plan_id,
+        water_meter_no,
+        water_meter_file_no,
+        customer_id,
+        udip_id
+        )VALUES
+        <foreach collection="devices" item="device" index="index" separator=",">
+            (
+            #{device.id,jdbcType=BIGINT},
+            #{device.deviceNo,jdbcType=VARCHAR},
+            #{device.deviceType,jdbcType=BIGINT},
+            #{device.sysId,jdbcType=BIGINT},
+            #{device.siteId,jdbcType=BIGINT},
+            #{device.buildingId,jdbcType=BIGINT},
+            #{device.floor,jdbcType=INTEGER},
+            #{device.locDesc,jdbcType=VARCHAR},
+            #{device.relatedDeviceNo,jdbcType=BIGINT},
+            #{device.manufacturerId,jdbcType=BIGINT},
+            #{device.deviceStatus,jdbcType=INTEGER},
+            #{device.status,jdbcType=INTEGER},
+            #{device.isTag,jdbcType=INTEGER},
+            #{device.xCoordinates,jdbcType=DECIMAL},
+            #{device.yCoordinates,jdbcType=DECIMAL},
+            #{device.createBy,jdbcType=VARCHAR},
+            #{device.updateBy,jdbcType=VARCHAR},
+            #{device.dateCreate,jdbcType=TIMESTAMP},
+            #{device.dateUpdate,jdbcType=TIMESTAMP},
+            #{device.planId,jdbcType=INTEGER},
+            #{device.waterMeterNo,jdbcType=VARCHAR},
+            #{device.waterMeterFileNo,jdbcType=VARCHAR},
+            #{device.customerId,jdbcType=INTEGER},
+            #{device.udipId,jdbcType=VARCHAR}
+            )
+        </foreach>
+    </insert>
 
 </mapper>
 

+ 96 - 0
smart-city-platform/src/main/resources/mapper/WaterMeterReplaceLogMapper.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.bz.smart_city.dao.WaterMeterReplaceLogMapper">
+
+    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.WaterMeterReplaceLog" useGeneratedKeys="true">
+        <!--@mbg.generated-->
+        insert into pay_device_replace_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="siteId != null">
+                site_id,
+            </if>
+            <if test="metercode != null">
+                metercode,
+            </if>
+            <if test="oldEleno != null">
+                old_eleno,
+            </if>
+            <if test="newEleno != null">
+                new_eleno,
+            </if>
+            <if test="oldLastreading != null">
+                old_lastreading,
+            </if>
+            <if test="oldReading != null">
+                old_reading,
+            </if>
+            <if test="oldAmount != null">
+                old_amount,
+            </if>
+            <if test="newStartcount != null">
+                new_startcount,
+            </if>
+            <if test="createDate != null">
+                create_date,
+            </if>
+            <if test="remarks != null">
+                remarks,
+            </if>
+            <if test="customerId != null">
+                customer_id,
+            </if>
+            <if test="year != null">
+                year,
+            </if>
+            <if test="month != null">
+                month,
+            </if>
+
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="siteId != null">
+                #{siteId},
+            </if>
+            <if test="metercode != null">
+                #{metercode},
+            </if>
+            <if test="oldEleno != null">
+                #{oldEleno},
+            </if>
+            <if test="newEleno != null">
+                #{newEleno},
+            </if>
+            <if test="oldLastreading != null">
+                #{oldLastreading},
+            </if>
+            <if test="oldReading != null">
+                #{oldReading},
+            </if>
+            <if test="oldAmount != null">
+                #{oldAmount},
+            </if>
+            <if test="newStartcount != null">
+                #{newStartcount},
+            </if>
+            <if test="createDate != null">
+                #{createDate},
+            </if>
+            <if test="remarks != null">
+                #{remarks},
+            </if>
+            <if test="customerId != null">
+                #{customerId},
+            </if>
+            <if test="year != null">
+                #{year},
+            </if>
+            <if test="month != null">
+                #{month},
+            </if>
+
+        </trim>
+    </insert>
+
+
+
+</mapper>

+ 5 - 9
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -472,20 +472,16 @@
             scd.water_meter_no as waterMeterNo,
             scd.metercode,
             pba.address as installAddress,
-            scinstall.new_meter_start as initialData,
-            scinstall.is_accepted ,
-            scinstall.install_time as installDate,
-            concat(sdm.`name`,'/',sdt.equipment_type,'/',sdt.model) as deviceType,
+            scd.new_meter_start as initialData,
+            scd.date_create as installDate,
+            scd.device_model as deviceType,
             pba.accountnumber as accountnumber,
             pba.id as accountId,
             scd.id as deviceId,
-            scinstall.is_accepted state,
-            (case scinstall.is_accepted  WHEN  2 then '已开户' when 1 then '待开户' else '待验收' end) stateName,
+            scd.is_accepted state,
+            (case scd.is_accepted  WHEN  2 then '已开户' when 1 then '待开户' else '待验收' end) stateName,
             IFNULL(rd.reading,0) as CurrData
         from  sc_device scd
-        left join sc_install_list scinstall on scd.id = scinstall.device_id  and scinstall.customer_id=#{customerId}
-        left JOIN sc_device_type sdt on sdt.id = scd.device_type
-        left join sc_device_manufacturer sdm on sdm.id = sdt.manufacturer_id and sdm.`status`=1
         left join pay_base_account pba on pba.id = scd.account_id  and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
         left join pay_base_customerandmeterrela ppr on ppr.metercode = scd.metercode and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
         left join