Browse Source

返回数据修改

hym 3 years ago
parent
commit
22a6e7dd80
38 changed files with 290 additions and 342 deletions
  1. 5 1
      zoniot-pay/pom.xml
  2. 2 4
      zoniot-pay/zoniot-pay-core/pom.xml
  3. 3 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/DeviceMapper.java
  4. 0 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayFeeMapper.java
  5. 0 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayTransactiondetailsMapper.java
  6. 0 3
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/LoginUser.java
  7. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/MeterSyncInputDto.java
  8. 0 3
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/PayTransactiondetailsDto.java
  9. 2 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/SynDeviceStatus.java
  10. 15 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/Device.java
  11. 19 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/InstallPlan.java
  12. 8 6
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/DeviceMapper.xml
  13. 8 7
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseAccountMapper.xml
  14. 5 2
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml
  15. 8 0
      zoniot-pay/zoniot-pay-web/pom.xml
  16. 2 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/IotPayApplication.java
  17. 39 4
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/commom/util/UserUtil.java
  18. 29 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/config/FeignConfig.java
  19. 1 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/excel/resolver/InstallPlanResolverExcelTemplate.java
  20. 0 4
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/kafka/ValveStateConsumer.java
  21. 0 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/ChannelServiceImpl.java
  22. 0 3
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/CommunityServiceImpl.java
  23. 0 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/CustomerServiceImpl.java
  24. 0 7
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/UserServiceImpl.java
  25. 2 159
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/DeviceSyncServiceImpl.java
  26. 0 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseAccountServiceImpl.java
  27. 0 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPenaltyrecordServiceImpl.java
  28. 97 113
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PaySyncDataServiceImpl.java
  29. 0 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java
  30. 1 1
      zoniot-pay/zoniot-pay-web/src/main/resources/application-dev.properties
  31. 1 0
      zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/install/MeterSyncDto.java
  32. 2 2
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/mongo/MeterReadRecordDao.java
  33. 6 5
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/MeasurementSettlement.java
  34. 1 1
      zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/TplMeasuringDataDef.java
  35. 8 1
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/MeasurementSettlementController.java
  36. 9 1
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/MeterReadRecordController.java
  37. 6 0
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/MeterReadRecordService.java
  38. 10 0
      zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/MeterReadRecordServiceImpl.java

+ 5 - 1
zoniot-pay/pom.xml

@@ -23,7 +23,11 @@
 
     <dependencyManagement>
         <dependencies>
-
+            <dependency>
+                <groupId>com.zcxk</groupId>
+                <artifactId>zoniot-rmcp-api</artifactId>
+                <version>${zoniot.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.zcxk</groupId>
                 <artifactId>zoniot-pay-core</artifactId>

+ 2 - 4
zoniot-pay/zoniot-pay-core/pom.xml

@@ -21,10 +21,8 @@
         <artifactId>zoniot-core-mysql</artifactId>
     </dependency>
     <dependency>
-        <groupId>org.springframework.security</groupId>
-        <artifactId>spring-security-core</artifactId>
-        <version>5.3.3.RELEASE</version>
-        <scope>compile</scope>
+        <groupId>com.zcxk</groupId>
+        <artifactId>zoniot-core-oauth2</artifactId>
     </dependency>
 </dependencies>
 </project>

+ 3 - 2
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/DeviceMapper.java

@@ -1,5 +1,6 @@
 package com.zcxk.rmcp.pay.dao;
 
+
 import com.zcxk.rmcp.pay.dto.MeterSyncDto;
 import com.zcxk.rmcp.pay.dto.measurementsettlement.MeasurementSettlementDto;
 import com.zcxk.rmcp.pay.entity.Device;
@@ -19,14 +20,14 @@ public interface DeviceMapper {
     int insertList(@Param("devices") List<Device> devices);
 
     //查询未同步的水表
-    List<Device> getNoSyncList(@Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    List<Device> getNoSyncList(@Param("tenantId") String tenantId);
 
     //同步水表信息
     int updateSync(@Param("devices") MeterSyncDto devices);
 
     int updateSyncDeviceStatus(@Param("devices") MeterSyncDto devices);
 
-    List<Device> findList(@Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    List<Device> findList(@Param("tenantId") String tenantId);
 
     List<Device> findMeasurementDevice(MeasurementSettlementDto measurementSettlementDto);
 }

+ 0 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayFeeMapper.java

@@ -3,7 +3,6 @@ package com.zcxk.rmcp.pay.dao.pay;
 import com.zcxk.core.common.pojo.UserCondition;
 import com.zcxk.rmcp.pay.dto.pay.*;
 import com.zcxk.rmcp.pay.dto.pay.payfee.*;
-import com.zcxk.rmcp.pay.entity.ProgramItem;
 import com.zcxk.rmcp.pay.entity.pay.BaseClosingAccountInfo;
 import com.zcxk.rmcp.pay.entity.pay.PayControlRule;
 import com.zcxk.rmcp.pay.entity.pay.PayPayAgentbranch;

+ 0 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayTransactiondetailsMapper.java

@@ -1,6 +1,5 @@
 package com.zcxk.rmcp.pay.dao.pay;
 
-import com.zcxk.core.common.pojo.UserCondition;
 import com.zcxk.rmcp.pay.dto.pay.PayTransactiondetails;
 import com.zcxk.rmcp.pay.dto.pay.PayTransactiondetailsDto;
 import com.zcxk.rmcp.pay.entity.ProgramItem;

+ 0 - 3
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/LoginUser.java

@@ -11,12 +11,9 @@ import lombok.Setter;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.util.Assert;
-import org.springframework.util.StringUtils;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Getter
 @Setter

+ 1 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/MeterSyncInputDto.java

@@ -15,7 +15,7 @@ public class MeterSyncInputDto {
     @ApiModelProperty(value = "创建日期 格式:yyyyMMdd")
     private String createDate;
     @ApiModelProperty(value = "客户编码,即抄表系统中的customer_no")
-    private String customerNo;
+    private String tenantId;
     @ApiModelProperty(value = "水表档案号,即sc_device表中的metercode")
     private List<String> fileNo;
 }

+ 0 - 3
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/PayTransactiondetailsDto.java

@@ -1,8 +1,6 @@
 package com.zcxk.rmcp.pay.dto.pay;
 
-import com.zcxk.rmcp.pay.entity.ProgramItem;
 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;
@@ -10,7 +8,6 @@ import lombok.Data;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
-import java.util.List;
 
 /**
  * @Author wangli

+ 2 - 2
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/SynDeviceStatus.java

@@ -13,9 +13,9 @@ import java.util.List;
 @Data
 public class SynDeviceStatus {
 
-    @ApiModelProperty("客户编码")
-    private String customerNo;
+
 
     @ApiModelProperty("水表电子号")
     private List<String> electronicMeterNos;
+    private String tenantId;
 }

+ 15 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/Device.java

@@ -126,4 +126,19 @@ public class Device {
 
     @ApiModelProperty(value = "阀门状态")
     private Integer controlStatus;
+    /**
+     * 租户id
+     */
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
+    /**
+     * 公司id
+     */
+    @ApiModelProperty(value = "公司id")
+    private Integer companyOrgId;
+    /**
+     * 部门id
+     */
+    @ApiModelProperty(value = "部门id")
+    private Integer deptOrgId;
 }

+ 19 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/InstallPlan.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import javax.validation.constraints.NotNull;
 import java.time.LocalDateTime;
 
 /**
@@ -20,7 +21,9 @@ public class InstallPlan {
 
     @ApiModelProperty(value = "站点id",hidden = true)
     private Integer siteId;
-
+    @NotNull(message = "productId cannot be null")
+    @ApiModelProperty(value="产品")
+    private Integer productId;
     @ApiModelProperty(value = "计划名称",example = "计划名称a")
     private String planName;
 
@@ -119,4 +122,19 @@ public class InstallPlan {
      */
     @ApiModelProperty(value="是否启用下载 0:否 1:是",example = "0")
     private Integer enableDownload;
+    /**
+     * 租户id
+     */
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
+    /**
+     * 公司id
+     */
+    @ApiModelProperty(value = "公司id")
+    private Integer companyOrgId;
+    /**
+     * 部门id
+     */
+    @ApiModelProperty(value = "部门id")
+    private Integer deptOrgId;
 }

+ 8 - 6
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/DeviceMapper.xml

@@ -43,7 +43,7 @@
         account_id,
         curr_status,
         new_meter_start,
-        device_model
+        device_model,tenant_id,company_org_id,dept_org_id
         )VALUES
         <foreach collection="devices" item="device" index="index" separator=",">
             (
@@ -75,7 +75,10 @@
             #{device.accountId,jdbcType=BIGINT},
             #{device.currStatus,jdbcType=INTEGER},
             #{device.newMeterStart,jdbcType=VARCHAR},
-            #{device.deviceModel,jdbcType=VARCHAR}
+            #{device.deviceModel,jdbcType=VARCHAR},
+            #{device.tenantId},
+            #{device.companyOrgId},
+            #{device.deptOrgId}
             )
         </foreach>
     </insert>
@@ -138,8 +141,8 @@
         device_model,
         metercode
         from sc_device where curr_status = 0 and status = 1 and metercode is not null
-        <if test="siteId != null"> and site_id = #{siteId,jdbcType=INTEGER}</if>
-        <if test="customerId != null"> and customer_id = #{customerId,jdbcType=INTEGER}</if>
+        <if test="tenantId != null"> and tenant_id = #{tenantId}</if>
+
     </select>
 
     <select id="findList" resultType="com.zcxk.rmcp.pay.entity.Device">
@@ -173,8 +176,7 @@
         device_model,
         metercode
         from sc_device where status=1 and metercode is not null and curr_status = 1
-        <if test="siteId != null"> and site_id = #{siteId,jdbcType=INTEGER}</if>
-        <if test="customerId != null"> and customer_id = #{customerId,jdbcType=INTEGER}</if>
+        <if test="tenantId != null"> and tenant_id = #{tenantId}</if>
     </select>
 
     <select id="findMeasurementDevice" resultType="com.zcxk.rmcp.pay.entity.Device">

+ 8 - 7
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -33,7 +33,7 @@
         calculateway,
         waterproperty_id,
         site_id,
-        customer_id)
+        customer_id,tenant_id,company_org_id,dept_org_id)
         values
         <foreach collection="list" item="item" separator=",">
             (
@@ -66,7 +66,10 @@
             #{item.calculateway},
             #{item.waterpropertyId},
             #{item.siteId},
-            #{item.customerId}
+            #{item.customerId},
+            #{item.tenantId},
+            #{item.companyOrgId},
+            #{item.deptOrgId}
             )
         </foreach>
     </insert>
@@ -576,12 +579,10 @@
 
     <select id="getCustIdAndSiteId" resultType="com.zcxk.rmcp.pay.entity.pay.PayBaseAccount">
         select
-        c.customer_id customerId,
-        c.site_id siteId
+        distinct
+        c.tenant_id
         from pay_base_account c
-        where
-        c.customer_id is not null  and c.site_id is not null
-        group by c.customer_id, c.site_id
+
     </select>
 
     <select id="getAccountInfoByMetercode" resultType="com.zcxk.rmcp.pay.entity.pay.archives.AccountInfo">

+ 5 - 2
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml

@@ -228,7 +228,8 @@
         del_flag,
         site_id,
         customer_id,
-        office_id
+        office_id,
+        tenant_id
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -247,7 +248,9 @@
             #{item.delFlag},
             #{item.siteId},
             #{item.customerId},
-            #{item.officeId})
+            #{item.officeId},
+            #{item.tenantId}
+            )
 
         </foreach>
     </insert>

+ 8 - 0
zoniot-pay/zoniot-pay-web/pom.xml

@@ -92,6 +92,14 @@
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-quartz</artifactId>
     </dependency>
+    <dependency>
+        <groupId>com.zcxk</groupId>
+        <artifactId>zoniot-rmcp-api</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework.cloud</groupId>
+        <artifactId>spring-cloud-starter-openfeign</artifactId>
+    </dependency>
 </dependencies>
 
 </project>

+ 2 - 0
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/IotPayApplication.java

@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
@@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @EnableScheduling
 @EnableAsync
 @EnableCaching  //开启缓存
+@EnableFeignClients(basePackages="com.zcxk")
 public class IotPayApplication extends SpringBootServletInitializer {
 
     public static void main(String[] args) {

+ 39 - 4
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/commom/util/UserUtil.java

@@ -1,13 +1,17 @@
 package com.zcxk.rmcp.pay.commom.util;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.zcxk.rmcp.pay.dto.LoginUser;
 import com.zcxk.rmcp.pay.entity.ProgramItem;
 import org.springframework.security.authentication.AnonymousAuthenticationToken;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.oauth2.provider.OAuth2Authentication;
 
+import java.util.LinkedHashMap;
 import java.util.List;
 
 import static com.google.common.collect.Lists.newArrayList;
@@ -21,17 +25,48 @@ public class UserUtil {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
         if (authentication != null) {
             if (authentication instanceof AnonymousAuthenticationToken) {
-                return null;
+                return new LoginUser(null);
             }
 
             if (authentication instanceof UsernamePasswordAuthenticationToken) {
                 return (LoginUser) authentication.getPrincipal();
             }
 
-
+            if(authentication instanceof OAuth2Authentication){
+                OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) authentication;
+                if(oAuth2Authentication.getPrincipal() instanceof com.zcxk.core.oauth2.pojo.LoginUser){
+                    return (LoginUser) oAuth2Authentication.getPrincipal();
+                }else {
+                    LinkedHashMap<String,Object> details = (LinkedHashMap<String,Object>) oAuth2Authentication.getUserAuthentication().getDetails();
+                    LinkedHashMap<String,Object> principalMap = (LinkedHashMap<String, Object>) details.get("principal");
+
+                    JSONObject userJson = (JSONObject) JSONObject.toJSON(principalMap);
+
+                    LoginUser loginUser = new LoginUser(null);
+                    loginUser.setId((Integer) userJson.get("id"));
+                    loginUser.setUsername((String) userJson.get("username"));
+                    loginUser.setPhoneNumber((String) userJson.get("phoneNumber"));
+                    loginUser.setType((String) userJson.get("type"));
+                    loginUser.setCompanyId(userJson.getInteger("companyId"));
+                    loginUser.setDepartmentId(userJson.getInteger("departmentId"));
+                    loginUser.setTenantId(userJson.getString("tenantId"));
+                    JSONArray programItemListArray = userJson.getJSONArray("programItemList");
+                    loginUser.setPermissonType(userJson.getInteger("permissonType"));
+                    JSONArray appIds = userJson.getJSONArray("appIds");
+                    if (programItemListArray != null) {
+                        List<com.zcxk.core.common.pojo.ProgramItem> collection =
+                                JSONObject.parseArray(programItemListArray.toJSONString(), com.zcxk.core.common.pojo.ProgramItem.class);
+                        loginUser.setProgramItemList(collection);
+                    }
+                    if(appIds!=null){
+                        List<String> appIdString = JSONObject.parseArray(appIds.toJSONString(), String.class);
+                        loginUser.setAppIds(appIdString);
+                    }
+                    return loginUser;
+                }
+            }
         }
-
-        return null;
+        return new LoginUser(null);
     }
 
     /**

+ 29 - 0
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/config/FeignConfig.java

@@ -0,0 +1,29 @@
+package com.zcxk.rmcp.pay.config;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @description  调用其他模块接口时,带上权限认证
+ * @auto wangli
+ * @data 2020-11-17 8:52
+ */
+@Configuration
+public class FeignConfig implements RequestInterceptor {
+    @Override
+    public void apply(RequestTemplate requestTemplate) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if(attributes != null){
+            HttpServletRequest request = attributes.getRequest();
+            if(request != null){
+                requestTemplate.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION));
+            }
+        }
+    }
+}

+ 1 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/excel/resolver/InstallPlanResolverExcelTemplate.java

@@ -279,7 +279,7 @@ public class InstallPlanResolverExcelTemplate extends AbstractResolverExcelTempl
             }
 
             record.getLoginUser().setSiteType(2);
-            AjaxMessage ajax = paySyncDataService.addJF(installPlanInput,record.getLoginUser());
+            AjaxMessage ajax = null;//paySyncDataService.addJF(installPlanInput,record.getLoginUser());
             if(ajax != null){
                 if(ajax.getStatus()==0){
                     ;//成功

+ 0 - 4
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/kafka/ValveStateConsumer.java

@@ -1,15 +1,11 @@
 package com.zcxk.rmcp.pay.kafka;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.zcxk.rmcp.pay.dao.pay.PayControlRecordMapper;
-import com.zcxk.rmcp.pay.entity.pay.PayControlRecord;
 import lombok.extern.slf4j.Slf4j;
 
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.Optional;
 
 /**
  * @description

+ 0 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/ChannelServiceImpl.java

@@ -21,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.Collections;
 import java.util.List;
 
 

+ 0 - 3
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/CommunityServiceImpl.java

@@ -13,15 +13,12 @@ import com.zcxk.rmcp.pay.dto.CommunityDto;
 import com.zcxk.rmcp.pay.dto.LoginUser;
 import com.zcxk.rmcp.pay.entity.Area;
 import com.zcxk.rmcp.pay.entity.Community;
-import com.zcxk.rmcp.pay.entity.ProgramItem;
 import com.zcxk.rmcp.pay.service.CommunityService;
-import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
 import java.util.List;
 
 import static com.google.common.collect.Lists.newArrayList;

+ 0 - 2
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/CustomerServiceImpl.java

@@ -9,7 +9,6 @@ import com.zcxk.rmcp.pay.dao.CustomerMapper;
 import com.zcxk.rmcp.pay.dto.CustomerDto;
 import com.zcxk.rmcp.pay.dto.LoginUser;
 import com.zcxk.rmcp.pay.entity.Customer;
-import com.zcxk.rmcp.pay.entity.ProgramItem;
 import com.zcxk.rmcp.pay.service.CustomerService;
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
@@ -18,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
 import java.util.List;
 
 @Slf4j

+ 0 - 7
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/UserServiceImpl.java

@@ -1,8 +1,5 @@
 package com.zcxk.rmcp.pay.service.impl;
 
-import com.alibaba.fastjson.JSON;
-
-import com.github.pagehelper.PageHelper;
 import com.zcxk.core.utils.util.RedisUtil;
 import com.zcxk.rmcp.pay.commom.model.Pagination;
 import com.zcxk.rmcp.pay.commom.util.UserUtil;
@@ -16,16 +13,12 @@ import com.zcxk.rmcp.pay.entity.User;
 import com.zcxk.rmcp.pay.service.UserRoleProgramService;
 import com.zcxk.rmcp.pay.service.UserService;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigInteger;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
 import java.util.List;
 
 import static com.google.common.collect.Lists.newArrayList;

+ 2 - 159
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/DeviceSyncServiceImpl.java

@@ -1,42 +1,23 @@
 package com.zcxk.rmcp.pay.service.impl.pay;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.zcxk.rmcp.pay.commom.util.HttpClientUtils;
-import com.zcxk.rmcp.pay.commom.util.HttpRequest;
-import com.zcxk.rmcp.pay.commom.util.JacksonUtil;
 import com.zcxk.rmcp.pay.dao.CustomerMapper;
 import com.zcxk.rmcp.pay.dao.DeviceMapper;
 import com.zcxk.rmcp.pay.dao.pay.AmountWaterUsedAmountMapper;
 import com.zcxk.rmcp.pay.dao.pay.PayBaseAccountMapper;
-import com.zcxk.rmcp.pay.dto.MeterSyncDto;
-import com.zcxk.rmcp.pay.dto.MeterSyncInputDto;
-import com.zcxk.rmcp.pay.dto.pay.SynDeviceResult;
-import com.zcxk.rmcp.pay.dto.pay.SynDeviceStatus;
-import com.zcxk.rmcp.pay.entity.Customer;
-import com.zcxk.rmcp.pay.entity.Device;
-import com.zcxk.rmcp.pay.entity.SyncValveResult;
 import com.zcxk.rmcp.pay.entity.pay.PayBaseAccount;
 import com.zcxk.rmcp.pay.quartz.entity.QuartzEntity;
 import com.zcxk.rmcp.pay.quartz.job.DeviceSyncJob;
 import com.zcxk.rmcp.pay.quartz.service.JobAndTriggerService;
 import com.zcxk.rmcp.pay.service.pay.DeviceSyncService;
 import com.zcxk.rmcp.pay.service.pay.PayBaseConfigService;
-import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Hashtable;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Created by ZJY on 2020-09-28 10:22
@@ -101,152 +82,14 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
 
     public void upMeters(Integer siteId, Integer customerId){
 
-        log.info(String.format("水表安装信息同步siteId:%s,customerId:%s",siteId,customerId));
-        //取客户编号
-        String customerNo= "";
-        Customer customer= customerMapper.findById(customerId);
-        if(customer != null && customer.getCustomerNo() != null){
-            customerNo = customer.getCustomerNo();
-       }
-        else
-            return;
-
-        //查询未同步的数据
-        String url = SyncUrl+"/api/syncData/meterSync";
-        List<Device> deviceList = deviceMapper.getNoSyncList(siteId,customerId);
-        if(deviceList != null && deviceList.size() >0){
-
-            List<List<Device>> lists = Lists.partition(deviceList,500);
-            for(List<Device> subDeviceList : lists){
-                MeterSyncInputDto meterSyncInputDto = new MeterSyncInputDto();
-
-                meterSyncInputDto.setCustomerNo(customerNo);
-                List<String> fileNos = new ArrayList<>();
-                for (Device device:subDeviceList){
-                    fileNos.add(device.getMetercode());
-                }
-                meterSyncInputDto.setFileNo(fileNos);
-
-                //调用接口同步
-                String json= JSON.toJSON(meterSyncInputDto).toString();
-                try {
-                    String result = HttpClientUtils.doPostWithJson(url,json);
-                    JSONObject jsonObject= JSON.parseObject(result);
-                    Integer status= jsonObject.getInteger("status");
-                    if(status.equals(0)){
-                        //更新水表信息
-                        if(1==1){
-                            JSONArray datas = jsonObject.getJSONArray("data");
-                            List<MeterSyncDto> meterSyncDtoList = datas.toJavaList(MeterSyncDto.class);
-                            if(meterSyncDtoList != null){
-                                for(MeterSyncDto meterSyncDto:meterSyncDtoList){
-                                    //水表档案号变更
-                                    if(StringUtils.isNotBlank(meterSyncDto.getFileNo()) && !meterSyncDto.getMeterCode().equals(meterSyncDto.getFileNo())){
-                                        try {
-                                            //更改营业系统水表档案号
-                                            String updateMeterNoUrl = SyncUrl + "/api/platform/updateMeterNo";
-                                            String params = String.format("?customerNo=%s&meterNo=%s&meterCode=%s",customerNo,meterSyncDto.getFileNo(),meterSyncDto.getMeterCode());
-                                            updateMeterNoUrl += params;
-                                            String postResult = HttpRequest.doPost(updateMeterNoUrl ,"");
-                                            SyncValveResult syncValveResult = JacksonUtil.string2Obj(postResult, SyncValveResult.class);
-                                            Integer getResult = Integer.parseInt(syncValveResult.getStatus());
-                                            if(getResult == null || getResult != 0){
-                                                continue; //失败
-                                            }
-                                        }
-                                        catch (Exception e){
-                                            e.printStackTrace();
-                                        }
-                                    }
-
-                                    meterSyncDto.setCurrStatus(1);
-                                    if(StringUtils.isBlank(meterSyncDto.getInitialData()))
-                                        meterSyncDto.setInitialData("0");
-                                    deviceMapper.updateSync(meterSyncDto);
-                                }
-                            }
-                        }
-                    }
-
-                } catch (IOException e) {
-                    log.error(e.getMessage());
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        }
+
         getDeviceSatus(siteId,customerId);
 
     }
 
     //获取设备状态
     public void getDeviceSatus(Integer siteId, Integer customerId){
-        try {
-            log.info(String.format("设备状态同步siteId:%s,customerId:%s",siteId,customerId));
-            //取客户编号
-            String customerNo= "";
-            Customer customer= customerMapper.findById(customerId);
-            if(customer != null && customer.getCustomerNo() != null){
-                customerNo = customer.getCustomerNo();
-            }
-            else
-                return;
-
-            String url = SyncUrl+"/api/platform/getDeviceStatus";
-            int loadNumber = 1000; //批量数量
-            List<Device> deviceList = deviceMapper.findList(siteId,customerId);
-            if(deviceList != null && deviceList.size() > 0){
-                int count = deviceList.size();
-                int number  = (count/loadNumber) ;
-
-                for(int i=0;i<=number;i++){
-                    int leng = loadNumber;
-                    if(i*loadNumber + loadNumber > count)
-                        leng = count - i*loadNumber;
-
-                    if(leng >0){
-                        Map<String,Device> deviceMapmp = new Hashtable<>();
-                        List<Device> subDeviceList = new ArrayList<>();
-                        subDeviceList.addAll(deviceList.subList(i*loadNumber ,i*loadNumber+leng));
-                        SynDeviceStatus synDeviceStatus = new SynDeviceStatus();
-                        synDeviceStatus.setCustomerNo(customerNo);
-                        synDeviceStatus.setElectronicMeterNos(new ArrayList());
-                        for (int k = 0;k < leng ;k++){
-                            synDeviceStatus.getElectronicMeterNos().add(subDeviceList.get(k).getWaterMeterNo());
-                            deviceMapmp.put(subDeviceList.get(k).getWaterMeterNo(),subDeviceList.get(k));
-                        }
-
-                        String json= JSON.toJSON(synDeviceStatus).toString();
-                        String result = HttpClientUtils.doPostWithJson(url,json);
-                        JSONObject jsonObject= JSON.parseObject(result);
-                        Integer status= jsonObject.getInteger("status");
-                        if(status.equals(0)){
-                            JSONArray datas = jsonObject.getJSONArray("data");
-                            List<SynDeviceResult> syncValveResultList = datas.toJavaList(SynDeviceResult.class);
-
-                            for (SynDeviceResult SynResutl:syncValveResultList){
-                                Device device = deviceMapmp.get(SynResutl.getElectronicMeterNo());
-                                if(device != null && device.getDeviceStatus() != null && SynResutl.getDeviceStatus() !=null){
-                                    if(device.getDeviceStatus().intValue() == SynResutl.getDeviceStatus())
-                                        continue; //设备状态未改变不更新数据库
-                                }
-
-                                MeterSyncDto meterSyncDto = new MeterSyncDto();
-                                meterSyncDto.setWaterMeterNo(SynResutl.getElectronicMeterNo());
-                                meterSyncDto.setDays(SynResutl.getDays());
-                                meterSyncDto.setDeviceStatus(SynResutl.getDeviceStatus());
-                                deviceMapper.updateSyncDeviceStatus(meterSyncDto);
-                            }
-                            deviceMapmp.clear();
-
-                        }
-                    }
-                }
-            }
-        }
-        catch(Exception ex){
-            ex.printStackTrace();
-        }
+
     }
 
 }

+ 0 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseAccountServiceImpl.java

@@ -8,7 +8,6 @@ import com.zcxk.core.oauth2.pojo.LoginUser;
 import com.zcxk.rmcp.pay.dao.pay.*;
 
 import com.zcxk.rmcp.pay.dto.pay.*;
-import com.zcxk.rmcp.pay.entity.ProgramItem;
 import com.zcxk.rmcp.pay.entity.pay.PayBaseAccount;
 import com.zcxk.rmcp.pay.entity.pay.PayMeter;
 import com.zcxk.rmcp.pay.entity.pay.archives.AccountInfo;

+ 0 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPenaltyrecordServiceImpl.java

@@ -10,7 +10,6 @@ import com.github.pagehelper.PageHelper;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.util.List;
 

+ 97 - 113
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PaySyncDataServiceImpl.java

@@ -2,6 +2,10 @@ package com.zcxk.rmcp.pay.service.impl.pay;
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
+import com.google.common.collect.Lists;
+import com.zcxk.rmcp.api.dto.install.InstallPlanDataDto;
+import com.zcxk.rmcp.api.dto.install.InstallPlanInputDto;
+import com.zcxk.rmcp.api.feign.SyncDataClient;
 import com.zcxk.rmcp.pay.commom.model.AjaxMessage;
 import com.zcxk.rmcp.pay.commom.model.ResultStatus;
 import com.zcxk.rmcp.pay.commom.util.HttpRequest;
@@ -16,13 +20,13 @@ import com.zcxk.rmcp.pay.dto.pay.InstallPlanDataDTO;
 import com.zcxk.rmcp.pay.dto.pay.InstallPlanInputDTO;
 import com.zcxk.rmcp.pay.dto.pay.PayBaseAccountDto;
 import com.zcxk.rmcp.pay.entity.Community;
-import com.zcxk.rmcp.pay.entity.Customer;
 import com.zcxk.rmcp.pay.entity.Device;
 import com.zcxk.rmcp.pay.entity.WaterMeterReplaceLog;
 import com.zcxk.rmcp.pay.service.CommunityService;
 import com.zcxk.rmcp.pay.service.pay.PayBaseAccountService;
 import com.zcxk.rmcp.pay.service.pay.PayBaseConfigService;
 import com.zcxk.rmcp.pay.service.pay.PaySyncDataService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -40,6 +44,7 @@ import static com.google.common.collect.Lists.newArrayList;
  * Created by ZJY on 2020-09-27 15:29
  */
 @Service
+@Slf4j
 public class PaySyncDataServiceImpl implements PaySyncDataService {
     @Autowired
     private CommunityService communityService;
@@ -58,6 +63,8 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
 
     @Resource
     WaterMeterReplaceLogMapper waterMeterReplaceLogMapper;
+    @Autowired
+    private SyncDataClient syncDataClient;
 
     @Override
     public AjaxMessage<List<AreaDto>> getAllArea(){
@@ -120,7 +127,32 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         return waterMeterReplaceLogMapper.insertSelective(waterMeterReplaceLog);
     }
 
-
+    private void setPayBaseAccount(PayBaseAccountDto payBaseAccountDto,InstallPlanInputDTO installPlanInput,
+                                   String code,String userAddress,String strAccountNumber,InstallPlanDataDTO installPlanDoor){
+        long accountid = idWorker.nextId();
+        payBaseAccountDto.setId(BigInteger.valueOf(accountid));
+        payBaseAccountDto.setCalculateway(installPlanInput.getCalculateway_id());
+        payBaseAccountDto.setWaterpropertyId(installPlanInput.getWaterproperty_id());
+        payBaseAccountDto.setCommunityCode(code);
+        payBaseAccountDto.setAddress(userAddress);
+
+        payBaseAccountDto.setAccountnumber(strAccountNumber);
+
+        //保存模板导入的信息
+        payBaseAccountDto.setRemarks(installPlanDoor.getRemark());
+        payBaseAccountDto.setTelephone(installPlanDoor.getTelephone());
+        payBaseAccountDto.setIdcardno(installPlanDoor.getIdcardno());
+        payBaseAccountDto.setName(installPlanDoor.getUserName());
+    }
+    private String getBuildName(InstallPlanInputDTO installPlanInput,InstallPlanDataDTO installPlanBuilding,InstallPlanDataDTO installPlanUnit){
+        String buildingName = "";
+        if (installPlanInput.getEnableUnit() == 1) {
+            buildingName = installPlanInput.getCommunityName() + installPlanBuilding.getName() + "栋" + installPlanUnit.getName() + "单元";
+        } else {
+            buildingName = installPlanInput.getCommunityName() + installPlanBuilding.getName() + "栋";
+        }
+        return buildingName;
+    }
     @Override
     @Transactional
     public AjaxMessage addJF(InstallPlanInputDTO installPlanInput,LoginUser excelLoginUser){
@@ -130,34 +162,9 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
             //异步批量导入无法获取loginUser
             loginUser = excelLoginUser;
         }
-
-
-        Integer siteId = 1;
-        if (loginUser.getSiteType() == 1) {
-            siteId = loginUser.getSiteId();
-        }
         installPlanInput.setPlatformType(2);
 
         //取客户编号
-        String customerNo= "";
-        Customer customer= customerMapper.findById(loginUser.getCustomerId());
-        if(customer != null && customer.getCustomerNo() != null){
-            customerNo = customer.getCustomerNo();
-        }
-
-/*        //取客户编号
-        String customerNo="";
-        List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",loginUser.getSiteId(),loginUser.getCustomerId());
-        if(payBaseConfigDtos.size() == 1){
-            for (PayBaseConfigDto item : payBaseConfigDtos){
-                customerNo = item.getValue();
-                installPlanInput.setCustomerNo(customerNo);
-            }
-        }
-
-        if(customerNo == "")
-            throw new ServiceException(-900,"客户编号参数未配置"); //客户编号对应抄表系统中的customer_id*/
-
         //1、小区
         Integer communityId ;
         String code = "001";
@@ -165,46 +172,16 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         String communityAndBuildingAndUnitAddress="";  //小区 楼栋 单元地址
         String floorAddress="";
         String doorAddress="";
-        if (installPlanInput.getCommunityId() == null) {
-            Community community = communityService.findByNameV2(siteId,installPlanInput.getProvince(),installPlanInput.getCity(),installPlanInput.getRegion(), installPlanInput.getCommunityName());
-            if (community != null) {
-                communityId=community.getId();
-                installPlanInput.setCommunityId(community.getId());
-                code =String.format("%03d",Integer.valueOf(community.getCode()));
-            } 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);
-                communityId=newCommunity.getId();
-                //installPlanInput.setCommunityId(newCommunity.getId());
-            }
-        }
-        else {
-            communityId=installPlanInput.getCommunityId();
-            Community community = communityService.findById(installPlanInput.getCommunityId());
-            code =String.format("%03d",Integer.valueOf(community.getCode()));
-        }
-
-        //将小区置空,因为抄表系统小区与本系统中小区不一定要同
-        installPlanInput.setCommunityId(null);
+        communityId=installPlanInput.getCommunityId();
+        Community community = communityService.findById(installPlanInput.getCommunityId());
+        String commuintyCode=community.getCode();
+        code =String.format("%03d",Integer.valueOf(commuintyCode));
+        String tenantId = loginUser.getTenantId();
+        Integer companyId = loginUser.getCompanyId();
+        Integer departmentId = loginUser.getDepartmentId();
+        installPlanInput.setTenantId(tenantId);
+        installPlanInput.setCompanyOrgId(companyId);
+        installPlanInput.setDeptOrgId(departmentId);
 
         //取当前小区最大客户编号
         int maxAccountNumber = payBaseAccountService.getMaxAccountNumber(code);
@@ -220,13 +197,9 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                     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;
+
+                        communityAndBuildingAndUnitAddress = getBuildName(installPlanInput,installPlanBuilding,
+                                installPlanUnit);
 
 
                         //安装楼层
@@ -237,29 +210,15 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                                 //安装清单
                                 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);
+                                        //添加客户信息(水表用户)
+                                        doorAddress = (installPlanDoor.getName());
+                                        String userAddress=communityAndBuildingAndUnitAddress + floorAddress + doorAddress;
 
-                                        //保存模板导入的信息
-                                        payBaseAccountDto.setRemarks(installPlanDoor.getRemark());
-                                        payBaseAccountDto.setTelephone(installPlanDoor.getTelephone());
-                                        payBaseAccountDto.setIdcardno(installPlanDoor.getIdcardno());
-                                        payBaseAccountDto.setName(installPlanDoor.getUserName());
+                                        PayBaseAccountDto payBaseAccountDto = new PayBaseAccountDto();
+                                        setPayBaseAccount(payBaseAccountDto,installPlanInput,code,userAddress,
+                                                strAccountNumber,installPlanDoor);
                                         accountLists.add(payBaseAccountDto);
 
 
@@ -268,13 +227,12 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                                         Device device = new Device();
                                         device.setId(deviceId);
                                         device.setCommunityId(communityId);
-
+                                        device.setTenantId(tenantId);
+                                        device.setDeptOrgId(departmentId);
+                                        device.setCompanyOrgId(companyId);
                                         device.setAccountId(payBaseAccountDto.getId());
-                                        device.setSiteId(loginUser.getSiteId());
-                                        device.setCustomerId(loginUser.getCustomerId());
                                         device.setCurrStatus(0);
                                         device.setStatus(1);
-
                                         if(StringUtils.isBlank(installPlanDoor.getFileNo())){
                                             installPlanDoor.setFileNo(strAccountNumber+"01");
                                             device.setMetercode(payBaseAccountDto.getAccountnumber()+"01");
@@ -282,8 +240,6 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                                         else {
                                             device.setMetercode(installPlanDoor.getFileNo());
                                         }
-
-
                                         deviceList.add(device);
                                     }
                                 }
@@ -294,28 +250,56 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
             }
 
             //调用接口
-            String url = SyncUrl + "/api/syncData/syncPlan";
+
             try {
                 installPlanInput.setCustomerId(null);
-                installPlanInput.setCustomerNo(new Integer(customerNo)); //传客户编号
-                String json = JacksonUtil.obj2String(installPlanInput);
-                String result = HttpRequest.doPost(url,json);
-                AjaxMessage ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);
-                if(ajaxMessage != null && ajaxMessage.getStatus() == 0){
 
-                    //生成用户信息和预存账户
-                    accountLists.get(0).setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-                    accountLists.get(0).setCustomerId(BigInteger.valueOf(loginUser.getCurrentSiteId()));
+                String installStr = JSONObject.toJSONString(installPlanInput);
+                InstallPlanInputDto installPlanInputDto=JSONObject.parseObject(installStr,InstallPlanInputDto.class);
+                InstallPlanInputDto dto = new InstallPlanInputDto();
+                dto.setTenantId("487170559310123008");
+                dto.setPlanName("测试");
+                dto.setCommunityId(10);
+                dto.setCompanyOrgId(443);
+                dto.setDeptOrgId(0);
+                dto.setProductId(1);
+                dto.setUnit("单元");
+                dto.setPrincipal("");
+                dto.setPhone("18588888888");
+                dto.setEnableUnit(0);
+                dto.setRemark("");
+                dto.setAdrress("地址");
+
+                InstallPlanDataDto b = new InstallPlanDataDto("建筑1");
 
-                    payBaseAccountService.batchInsert(accountLists, code,null);
+                InstallPlanDataDto u = new InstallPlanDataDto("单元1");
+                b.setChildren(Lists.newArrayList(u));
+
+                InstallPlanDataDto f = new InstallPlanDataDto("楼层1");
+                u.setChildren(Lists.newArrayList(f));
+
+                InstallPlanDataDto a = new InstallPlanDataDto("A1111","846164169");
+                f.setChildren(Lists.newArrayList(a));
+
+
+                syncDataClient.syncPlan(dto);
+                //syncDataClient.syncPlan(installPlanInputDto);
+
+
+
+
+
+
+                    //payBaseAccountService.batchInsert(accountLists, code,null);
 
                     //生成水表信息(sc_device表)
-                    deviceMapper.insertList(deviceList);
+                    //deviceMapper.insertList(deviceList);
+
+                    return new AjaxMessage(ResultStatus.OK);
 
-                    return ajaxMessage;
-                }
             }
             catch (Exception e){
+                log.error("同步安装计划失败",e);
                 return new AjaxMessage(ResultStatus.ERROR);
             }
         }

+ 0 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java

@@ -24,7 +24,6 @@ import com.zcxk.rmcp.pay.service.pay.archives.PayBaseCustomerandmeterrelaService
 import com.github.pagehelper.PageHelper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jxls.util.JxlsHelper;

+ 1 - 1
zoniot-pay/zoniot-pay-web/src/main/resources/application-dev.properties

@@ -154,7 +154,7 @@ Sync.Data.Url=http://114.135.61.188:58080
 
 #ÒøÐдúÊÕ¿Í»§id
 payfee.bank.customerId=47
-
+spring.main.allow-bean-definition-overriding=true
 
 
 

+ 1 - 0
zoniot-rmcp/zoniot-rmcp-api/src/main/java/com/zcxk/rmcp/api/dto/install/MeterSyncDto.java

@@ -43,4 +43,5 @@ public class MeterSyncDto {
     private String deviceType;
     @ApiModelProperty("计费系统档案号")
     private String meterCode;
+    private Integer currStatus;
 }

+ 2 - 2
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/dao/mongo/MeterReadRecordDao.java

@@ -228,9 +228,9 @@ public class MeterReadRecordDao extends BaseDao<MeterReadRecord, String> impleme
      * @updateTime 2021/7/28 10:25
      * @throws
      */
-    public List<MeterReadRecordVo> querySettlementWaterConsumption(Device device, Date clearingStartDate, Date clearingEndDate) {
+    public List<MeterReadRecordVo> querySettlementWaterConsumption(Long id, Date clearingStartDate, Date clearingEndDate) {
         Criteria criteria = new Criteria();
-        criteria.and("deviceId").is(device.getId());
+        criteria.and("deviceId").is(id);
         Criteria criteria1 = Criteria.where("data.readDate").lte(Integer.valueOf(
                 DateUtil.formatDate(clearingEndDate,"yyyyMMdd")));
         Criteria criteria2 = Criteria.where("data.readDate").gte(Integer.valueOf(

+ 6 - 5
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/MeasurementSettlement.java

@@ -32,6 +32,11 @@ public class MeasurementSettlement implements Serializable {
      */
     @ApiModelProperty(value = "结算时间")
     private Date settlementTime;
+    /**
+     * 租户id
+     */
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
     /**
      * 公司id
      */
@@ -82,11 +87,7 @@ public class MeasurementSettlement implements Serializable {
      */
     @ApiModelProperty(value = "定时任务id")
     private Long taskId;
-    /**
-     * 租户id
-     */
-    @ApiModelProperty(value = "租户id")
-    private String tenantId;
+
     /**
      * 水表数目
      */

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-core/src/main/java/com/zcxk/rmcp/core/entity/TplMeasuringDataDef.java

@@ -10,7 +10,7 @@ import java.time.LocalDateTime;
 /**
 * Created by Mybatis Generator 2019/01/17
 */
-@ApiModel(value="com.bz.smart_city.entity.TplMeasuringDataDef")
+@ApiModel(value="com.zcxk.rmcp.pay.entity.TplMeasuringDataDef")
 @Data
 public class TplMeasuringDataDef {
 

+ 8 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/MeasurementSettlementController.java

@@ -38,25 +38,28 @@ public class MeasurementSettlementController {
     }
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增结算计划")
-    @LogAnnotation(module = "【结算计划】新增")
+    @LogAnnotation(params = "添加结算计划:计划名称-{planName}")
     public AjaxMessage<Void> addPlan(@RequestBody @Valid MeasurementSettlementDto measurementSettlementDto) {
         measurementSettlementService.addPlan(measurementSettlementDto);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/update")
     @ApiOperation(value = "修改结算计划")
+    @LogAnnotation(params = "编辑结算计划:计划名称-{planName}")
     public AjaxMessage<Void> updatePlan(@RequestBody @Valid MeasurementSettlementDto measurementSettlementDto) {
         measurementSettlementService.updatePlan(measurementSettlementDto);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/delete")
     @ApiOperation(value = "删除结算计划")
+    @LogAnnotation(params = "删除结算计划:计划名称-{planName}")
     public AjaxMessage<Void> deletePlan(@RequestBody List<MeasurementSettlementDto> ids) {
         measurementSettlementService.deletePlan(ids);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/deleteAll")
     @ApiOperation(value = "删除所有结算计划")
+    @LogAnnotation(module = "【结算计划】删除")
     public AjaxMessage<Void> deleteAllPlan() {
         measurementSettlementService.deleteAll();
         return AjaxMessage.success();
@@ -69,24 +72,28 @@ public class MeasurementSettlementController {
 
     @PostMapping(value = "/audit")
     @ApiOperation(value = "审核水量")
+    //@LogAnnotation(module = "【结算计划】审核水量")
     public AjaxMessage<Void> auditWater(@RequestBody List<MeasurementRecordDto> ids) {
         measurementSettlementService.auditWater(ids);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/auditAll")
     @ApiOperation(value = "审核所有水量")
+    //@LogAnnotation(module = "【结算计划】审核所有水量")
     public AjaxMessage<Void> auditAllWater(@RequestParam Integer planId) {
         measurementSettlementService.auditAllWater(planId);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/modifyTheAmountOfWater")
     @ApiOperation(value = "修改水量")
+    @LogAnnotation(params = "水量修改:水表电子号-{meterNo},修改水量-{waterConsumption}")
     public AjaxMessage<Void> modifyTheAmountOfWater(@RequestBody @Valid WaterConsumptionUpdateDto waterConsumptionUpdateDto) {
         measurementSettlementService.modifyTheAmountOfWater(waterConsumptionUpdateDto);
         return AjaxMessage.success();
     }
     @PostMapping(value = "/setBillingPeriod")
     @ApiOperation(value = "设置账期")
+    @LogAnnotation(params = "结算账期设置:计划名称-{planName}.账期-{billingPeriodStr}")
     public AjaxMessage<Void> setBillingPeriod(@RequestBody @Valid MeasurementSettlementDto measurementSettlementDto) {
         measurementSettlementService.setBillingPeriod(measurementSettlementDto);
         return AjaxMessage.success();

+ 9 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/controller/MeterReadRecordController.java

@@ -27,6 +27,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -103,5 +104,12 @@ public class MeterReadRecordController extends BaseController {
             throw BusinessException.builder(RmcpErrorEnum.RMCP_DOWNLOAD_ERROR);
         }
     }
-
+   @PostMapping("/querySettlementWaterConsumption")
+   public List<MeterReadRecordVo>  querySettlementWaterConsumption(long id, Date clearingStartDate, Date clearingEndDate){
+        return meterReadRecordService.querySettlementWaterConsumption(id,clearingStartDate,clearingEndDate);
+    }
+    @PostMapping("/queryDeviceMeterReadRecordWithCondtion")
+    public List<MeterReadRecordVo>  queryDeviceMeterReadRecordWithCondtion(Long id, int date){
+        return meterReadRecordService.queryDeviceMeterReadRecordWithCondtion(id,date);
+    }
 }

+ 6 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/MeterReadRecordService.java

@@ -8,6 +8,7 @@ import com.zcxk.rmcp.api.dto.meterreadrecord.MeterReadRecordUpdateDto;
 import com.zcxk.rmcp.api.vo.MeterReadRecordVo;
 import com.zcxk.rmcp.core.mongo.MeterReadRecord;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -65,6 +66,11 @@ public interface MeterReadRecordService {
     **/
     List<MeterReadRecordVo> listSingleDeviceTimeWaterConsumption(MeterReadRecordDeviceDto dto);
 
+    List<MeterReadRecordVo> querySettlementWaterConsumption(long id, Date clearingStartDate, Date clearingEndDate);
+
+    List<MeterReadRecordVo> queryDeviceMeterReadRecordWithCondtion(Long id, int date);
+
+
     /**
     * 获取需要同步的数据
     * @author Andy

+ 10 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/MeterReadRecordServiceImpl.java

@@ -114,6 +114,16 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService {
         return meterReadRecordDao.listByBothReadTimeByFileNoByTenantId(startDate, endDate, dto.getFileNos(), dto.getTenantId());
     }
 
+    @Override
+    public List<MeterReadRecordVo> querySettlementWaterConsumption(long id, Date clearingStartDate, Date clearingEndDate) {
+        return meterReadRecordDao.querySettlementWaterConsumption(id,clearingStartDate,clearingEndDate);
+    }
+
+    @Override
+    public List<MeterReadRecordVo> queryDeviceMeterReadRecordWithCondtion(Long id, int date) {
+        return meterReadRecordDao.queryDeviceMeterReadRecordWithCondtion(id,date);
+    }
+
     /**
     * 获取上一个记录
     * @author Andy