فهرست منبع

Merge remote-tracking branch 'origin/20210716' into 20210716

lihui001 3 سال پیش
والد
کامیت
e6875f56da
64فایلهای تغییر یافته به همراه475 افزوده شده و 287 حذف شده
  1. 1 1
      zoniot-pay/pom.xml
  2. 1 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/BaseWaterPropertyMapper.java
  3. 6 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/MeasurementInstanceMapper.java
  4. 2 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayBaseConfigMapper.java
  5. 5 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayBaseWatercategoryMapper.java
  6. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayBaseWaterpriceMapper.java
  7. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayControlRuleMapper.java
  8. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayMessagesendrecordMapper.java
  9. 4 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayPayCheckbalanceMapper.java
  10. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayPayReceivedMapper.java
  11. 2 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayReportMapper.java
  12. 2 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PaySysDictMapper.java
  13. 1 1
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/PayBaseAccountSelectDto.java
  14. 20 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/WaterCostsDTO.java
  15. 1 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/MeasurementInstance.java
  16. 2 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PayBaseConfig.java
  17. 15 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PayInvoice.java
  18. 2 2
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PayInvoiceprinted.java
  19. 1 0
      zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PaySysDict.java
  20. 2 2
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/DeviceMapper.xml
  21. 6 7
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml
  22. 5 7
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/BaseWaterPropertyMapper.xml
  23. 39 3
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/MeasurementInstanceMapper.xml
  24. 1 1
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/MeasurementSettlementMapper.xml
  25. 1 1
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseConfigMapper.xml
  26. 9 5
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseWatercategoryMapper.xml
  27. 5 5
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseWaterpriceMapper.xml
  28. 7 2
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayControlRuleMapper.xml
  29. 20 17
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayInvoiceMapper.xml
  30. 2 2
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayInvoicePrintMapper.xml
  31. 5 5
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayPayAgentbranchMapper.xml
  32. 6 6
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayPayCheckbalanceMapper.xml
  33. 10 12
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayPayReceivedMapper.xml
  34. 4 3
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml
  35. 6 4
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PaySysDictMapper.xml
  36. 8 14
      zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/payFeeMapper.xml
  37. 1 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/IotPayApplication.java
  38. 13 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/PayBaseAccountController.java
  39. 1 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/PayControlRuleController.java
  40. 2 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/PaySyncDataController.java
  41. 20 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/MeasurementSettlementServiceImpl.java
  42. 3 4
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/BaseWaterPropertyServiceImpl.java
  43. 15 11
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/IssueElectronicInvoiceServiceImpl.java
  44. 43 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseAccountServiceImpl.java
  45. 6 10
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseConfigServiceImpl.java
  46. 6 6
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseWatercategoryServiceImpl.java
  47. 5 5
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayControlRuleServiceImpl.java
  48. 3 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayFeeServiceImp.java
  49. 3 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayInvoiceServiceImpl.java
  50. 10 5
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayMessagesendrecordServiceImp.java
  51. 1 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayMessagetemplateServiceImp.java
  52. 2 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPayAgentbranchServiceImpl.java
  53. 26 14
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPayCheckbalanceServiceImpl.java
  54. 2 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPayReceivedServiceImpl.java
  55. 1 2
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PaySyncDataServiceImpl.java
  56. 13 19
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PaySysDictServiceImpl.java
  57. 1 4
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayTransactiondetailsServiceImp.java
  58. 72 67
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PrintInvoiceQueryResultServiceImpl.java
  59. 2 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/MeasurementSettlementService.java
  60. 3 0
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/PayBaseAccountService.java
  61. 1 1
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/PayPayReceivedService.java
  62. 12 10
      zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/archives/impl/PayBaseCustomerandmeterrelaServiceImpl.java
  63. 2 3
      zoniot-pay/zoniot-pay-xxljob-client/src/main/java/com/zcxk/rmcp/pay/job/DeviceSyncServiceHander.java
  64. 1 0
      zoniot-pay/zoniot-pay-xxljob-client/src/main/java/com/zcxk/rmcp/pay/job/MeasurementSettlementRecordHander.java

+ 1 - 1
zoniot-pay/pom.xml

@@ -12,8 +12,8 @@
     <artifactId>zoniot-pay</artifactId>
     <packaging>pom</packaging>
     <modules>
-        <module>zoniot-pay-web</module>
         <module>zoniot-pay-core</module>
+        <module>zoniot-pay-web</module>
         <module>zoniot-pay-xxljob-client</module>
         <module>zoniot-pay-app</module>
 

+ 1 - 2
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/BaseWaterPropertyMapper.java

@@ -15,8 +15,7 @@ public interface BaseWaterPropertyMapper {
     public BaseWaterPropertyDto get(@Param("id") BigInteger id, @Param("tenantId") String tenantId);
 
 
-    public List<BaseWaterPropertyDto> getList(@Param("name") String name, @Param("customerId") BigInteger customerId,
-                                              @Param("siteId") BigInteger siteId);
+    public List<BaseWaterPropertyDto> getList(@Param("name") String name,@Param("tenantId") String tenantId);
 
     public int delete(@Param("id") BigInteger id);
 

+ 6 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/MeasurementInstanceMapper.java

@@ -4,6 +4,7 @@ import com.bz.zoneiot.core.common.pojo.UserCondition;
 
 import com.zcxk.rmcp.pay.dto.measurementsettlement.MeasurementSettlementDto;
 import com.zcxk.rmcp.pay.dto.pay.EstimatedDayDto;
+import com.zcxk.rmcp.pay.dto.pay.WaterCostsDTO;
 import com.zcxk.rmcp.pay.entity.pay.MeasurementInstance;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -121,4 +122,9 @@ public interface MeasurementInstanceMapper {
     List<MeasurementInstance> findHistory(@Param("id") Integer id, @Param("companyId") Integer companyId, @Param("departId") Integer departId);
 
     List<EstimatedDayDto> getEstimatedDay(@Param("beforDate") String beforDate, @Param("billingPeriod") Date billingPeriod, @Param("tenantId") String tenantId);
+
+    List<WaterCostsDTO> findBillingPeriodData(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("companyId") Integer companyId, @Param("tenantId") String tenantId);
+
+    List<MeasurementInstance> findAllHistory(@Param("id") Integer id,  @Param("companyId") Integer companyId, @Param("departId") Integer departId);
+
 }

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

@@ -17,7 +17,7 @@ public interface PayBaseConfigMapper {
 
     List<PayBaseConfigDto> getNameCnname(@Param("queryInfo") String queryInfo,  @Param("tenantId") String tenantId);
 
-    @Insert("insert into pay_base_config(value,name,cnname,type,create_by,create_date,update_by,update_date,remarks,del_flag,site_id,customer_id) values(#{value},#{name},#{cnname},#{type},#{create_by},#{create_date},#{update_by},#{update_date},#{remarks},#{del_flag},#{site_id},#{customer_id}) ")
+    @Insert("insert into pay_base_config(value,name,cnname,type,create_by,create_date,update_by,update_date,remarks,del_flag,tenant_id) values(#{value},#{name},#{cnname},#{type},#{create_by},#{create_date},#{update_by},#{update_date},#{remarks},#{del_flag},#{tenantId}) ")
     int insertList(PayBaseConfig payBaseConfig);
 
     @Delete("delete from  pay_base_config where id=#{id}")
@@ -27,6 +27,6 @@ public interface PayBaseConfigMapper {
     int update(@Param("payBaseConfig") PayBaseConfig payBaseConfig);
 
     //判断数据是否存在
-    List<Long> ExitsData(@Param("id") String id, @Param("name") String name, @Param("cnname") String cnname, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+    List<Long> ExitsData(@Param("id") String id, @Param("name") String name, @Param("cnname") String cnname, @Param("tenantId") String  tenantId);
 
 }

+ 5 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayBaseWatercategoryMapper.java

@@ -21,7 +21,7 @@ public interface PayBaseWatercategoryMapper {
     int update(@Param("payBaseWatercategory") PayBaseWatercategory payBaseWatercategory);
 
     //判断是否使
-    int isUsed(@Param("id") BigInteger id, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+
 
     int delete(@Param("id") BigInteger id, @Param("updateBy") BigInteger updateBy, @Param("updateDate") LocalDateTime updateDate);
 
@@ -30,4 +30,8 @@ public interface PayBaseWatercategoryMapper {
     List<PayBaseWatercategoryDto> getAll(@Param("name") String name, @Param("tenantId") String tenantId);
     //判断数据是否存在
     List<Long> ExitsData(@Param("id") String id, @Param("name") String name, @Param("tenantId") String tenantId);
+
+    int isUsed(@Param("id") BigInteger id, @Param("tenantId") String tenantId, @Param("companyOrgId") Integer companyOrgId, @Param("deptOrgId") Integer deptOrgId);
+
+    PayBaseWatercategory get(BigInteger id);
 }

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

@@ -29,5 +29,5 @@ public interface PayBaseWaterpriceMapper {
     //是否使用
     int isUsed(@Param("id") BigInteger id, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
     //是否存在 用水价格名称(name)、费用类型(type),同一类型下不能有相同的名称
-    List<PayBaseWaterprice> ExitsData(@Param("id") String id, @Param("feename") String feename, @Param("valueOf") String valueOf, @Param("tenantId") String tenantId);
+    List<PayBaseWaterprice> ExitsData(@Param("id") String id, @Param("feename") String feename, @Param("feeType") String feeType, @Param("tenantId") String tenantId);
 }

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

@@ -28,7 +28,7 @@ public interface PayControlRuleMapper {
     String isUsed(@Param("id") Integer id, @Param("customerId") BigInteger customerId);
 
     //数据是否存在
-    List<PayControlRule>ExitsData(@Param("id") String id, @Param("name") String name, @Param("customerId") BigInteger customerId);
+    List<PayControlRule>ExitsData(@Param("id") String id, @Param("name") String name, @Param("tenantId") String tenantId);
 
     //用户欠费金额
     BigDecimal findDebtMoney(@Param("accountId") String accountId);

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

@@ -1,6 +1,6 @@
 package com.zcxk.rmcp.pay.dao.pay;
 
-import com.zcxk.core.common.pojo.UserCondition;
+import com.bz.zoneiot.core.common.pojo.UserCondition;
 import com.zcxk.rmcp.pay.dto.pay.PayDebtMessageDto;
 import com.zcxk.rmcp.pay.dto.pay.PayMessagesendrecordDto;
 import com.zcxk.rmcp.pay.entity.ProgramItem;

+ 4 - 2
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayPayCheckbalanceMapper.java

@@ -1,6 +1,7 @@
 package com.zcxk.rmcp.pay.dao.pay;
 
 
+import com.bz.zoneiot.core.common.pojo.UserCondition;
 import com.zcxk.rmcp.pay.dto.pay.PayBaseAccountTransactionsDto;
 import com.zcxk.rmcp.pay.dto.pay.PayPayCheckbalanceItemDto;
 import com.zcxk.rmcp.pay.entity.pay.BaseClosingAccountInfo;
@@ -21,10 +22,11 @@ public interface PayPayCheckbalanceMapper {
     List<BaseClosingAccountInfo>findClosingAccount(@Param("year") String year, @Param("month") String month, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
     //按月帐期取系统总额
-    List<PayPayCheckbalanceItemDto>findSysMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+    List<PayPayCheckbalanceItemDto>findSysMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime,
+                                                     @Param("endTime") LocalDateTime endTime, @Param("tenantId") String tenantId, @Param("userCondition") UserCondition userCondition);
 
     //按帐期取交易总额
-    List<PayPayCheckbalanceItemDto>findTradeMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+    List<PayPayCheckbalanceItemDto>findTradeMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime , @Param("tenantId") String tenantId, @Param("userCondition") UserCondition userCondition);
 
     //按帐期取每天系统总额
     List<PayPayCheckbalanceItemDto>findSysDay2Cycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);

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

@@ -43,5 +43,5 @@ public interface PayPayReceivedMapper {
 
     void update(PayPayReceived payReceived);
 
-    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(@Param("payseriesno") String payseriesno, @Param("siteId") Integer siteId, @Param("customerId") Integer customerId);
+    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(@Param("payseriesno") String payseriesno, @Param("tenantId") String tenantId);
 }

+ 2 - 1
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/PayReportMapper.java

@@ -1,6 +1,7 @@
 package com.zcxk.rmcp.pay.dao.pay;
 
-import com.zcxk.core.common.pojo.UserCondition;
+
+import com.bz.zoneiot.core.common.pojo.UserCondition;
 import com.zcxk.rmcp.pay.dto.pay.PayArrearagedetailsReportDto;
 import com.zcxk.rmcp.pay.dto.pay.PayOperatordetailsReportDto;
 import com.zcxk.rmcp.pay.dto.pay.PayTransactiondetailsReportDto;

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

@@ -19,7 +19,7 @@ public interface PaySysDictMapper {
     List<PaySysDictSelectDto> getAll(@Param("value") String value, @Param("label") String label, @Param("type") String type, @Param("tenantId") String tenantId);
 
     //根据值、标签模糊查询
-    List<PaySysDictSelectDto> findValueLabel(@Param("queryInfo") String queryInfo, @Param("type") String type, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+    List<PaySysDictSelectDto> findValueLabel(@Param("queryInfo") String queryInfo, @Param("type") String type , @Param("tenantId") String tenantId);
 
     int insert(@Param("paySysDict") PaySysDict paySysDict);
 
@@ -38,7 +38,7 @@ public interface PaySysDictMapper {
     String getDiceLabel(@Param("value") Integer value, @Param("type") String type, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
     //判断数据是否存在 同一类型下,标签和值不能有相同
-    List<Long> ExitsData(@Param("id") String id, @Param("type") String type, @Param("value") String value, @Param("label") String label, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
+    List<Long> ExitsData(@Param("id") String id, @Param("type") String type, @Param("value") String value, @Param("label") String label, @Param("tenantId") String tenantId);
 
     Integer getDictValueByTenantId(@Param("type") String type, @Param("label") String label, @Param("tenantId") String tenantId);
 }

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

@@ -25,7 +25,7 @@ public class PayBaseAccountSelectDto {
     @ApiModelProperty(example = "深圳宝安",notes = "客户地址")
     private String address	;
     @ApiModelProperty(example = "1",notes = "水表数")
-    private int waterNumber;
+    private Integer waterNumber;
     @ApiModelProperty(example = "12.2",notes = "用水余额(元)")
     private BigDecimal remaining;
     @ApiModelProperty(example = "20.5",notes = "本期用水量(吨)")

+ 20 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dto/pay/WaterCostsDTO.java

@@ -0,0 +1,20 @@
+package com.zcxk.rmcp.pay.dto.pay;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author heyumin
+ * @version 1.0
+ * @date 2021/10/28 11:35
+ */
+@Data
+public class WaterCostsDTO {
+    private Float waterConsumption;
+    private Float amountReceivable;
+    private Float actualAmount;
+    private String tenantId;
+    private Integer companyId;
+    private Date billperiodDate;
+}

+ 1 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/MeasurementInstance.java

@@ -17,6 +17,7 @@ import java.util.Date;
 @ApiModel
 public class MeasurementInstance implements Serializable {
     private static final long serialVersionUID = 348949429881023711L;
+    private String planName;
     @ApiModelProperty(value = "")
     private Integer id;
     /**

+ 2 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PayBaseConfig.java

@@ -45,5 +45,7 @@ public class PayBaseConfig {
     private BigInteger site_id;
     @ApiModelProperty(example = "1",notes = "水司ID")
     private BigInteger customer_id;
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
 
 }

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

@@ -43,4 +43,19 @@ public class PayInvoice extends PayBaseInfo{
     private Integer month;
     @ApiModelProperty(value = "id")
     private BigInteger id;
+    /**
+     * 租户id
+     */
+    @ApiModelProperty(value = "租户id")
+    private String tenantId;
+    /**
+     * 公司id
+     */
+    @ApiModelProperty(value = "公司id")
+    private Integer companyOrgId;
+    /**
+     * 部门id
+     */
+    @ApiModelProperty(value = "部门id")
+    private Integer deptOrgId;
 }

+ 2 - 2
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PayInvoiceprinted.java

@@ -89,8 +89,8 @@ public class PayInvoiceprinted extends PayBaseInfo {
 	@ApiModelProperty(value = "邮箱")
 	private  String email;
 	private String tenantId;
-	private Integer companyId;
-	private Integer departmentId;
+	private Integer companyOrgId;
+	private Integer deptOrgId;
 }
 
 

+ 1 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/entity/pay/PaySysDict.java

@@ -45,5 +45,6 @@ public class PaySysDict {
     private long siteId;
     @ApiModelProperty(example = "1",notes = "水司ID",hidden = true)
     private long customerId;
+    private String tenantId;
 
 }

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

@@ -111,7 +111,7 @@
         where water_meter_no = #{devices.waterMeterNo}
     </update>
     <update id="updateCustomerDevice">
-        update pay_base_customerandmeterrela set watermeter_id=#{deviceId} and metercode=#{fileNo}
+        update pay_base_customerandmeterrela set watermeter_id=#{deviceId} where metercode=#{fileNo}
     </update>
 
     <select id="getNoSyncList" resultType="com.zcxk.rmcp.pay.entity.Device">
@@ -186,7 +186,7 @@
     <select id="findMeasurementDevice" resultType="com.zcxk.rmcp.pay.entity.Device">
         select * from sc_device rd
         <where>
-            status=1
+            status=1 and curr_status=2
             <if test="companyOrgId != null">and rd.company_org_id = #{companyOrgId}</if>
             <if test="deptOrgId != null">and rd.dept_org_id = #{deptOrgId}</if>
             <if test="communityId != null">and rd.community_id = #{communityId}</if>

+ 6 - 7
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -51,14 +51,10 @@
             <if test="metercode != null">
                 and customer.metercode =#{metercode}
             </if>
-            <if test="siteId != null">
-                and customer.site_id = #{siteId}
-            </if>
-            <if test="customerId != null">
-                and  customer.customer_id = #{customerId}
-            </if>
-            order by customer.create_date desc
+
+
         </where>
+        order by customer.create_date desc
     </select>
 
     <select id="getAccountId" resultType="com.zcxk.rmcp.pay.entity.pay.PayBaseAccount">
@@ -231,6 +227,9 @@
             <if test="updateDate != null">update_date =#{updateDate},</if>
             <if test="valveRuleId != null">valve_rule_id =#{valveRuleId},</if>
             <if test="valveRuleName != null">valve_rule_name =#{valveRuleName},</if>
+            <if test="companyOrgId != null">company_org_id=#{companyOrgId},</if>
+            <if test="deptOrgId != null">dept_org_id=#{deptOrgId},</if>
+
         </set>
         <where>
             <if test="id != null">id =#{id}</if>

+ 5 - 7
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/BaseWaterPropertyMapper.xml

@@ -56,11 +56,9 @@
 		FROM pay_base_waterproperty a
 		<include refid="baseWaterpropertyJoins"/>
 		WHERE
-		a.customer_id = #{customerId}
-		<if test="siteId!= null" > and a.site_id = #{siteId} </if>
-		<if test="name!=null">and a.name like concat('%',#{name},'%')</if>
+		a.tenant_id = #{tenantId}
 
-		<if test="siteId!=null">and a.site_id = #{siteId}</if>
+		<if test="name!=null">and a.name like concat('%',#{name},'%')</if>
 		order by a.create_date desc
 	</select>
 
@@ -140,9 +138,9 @@
 			#{baseWaterPropertyDto.delFlag},
 			#{baseWaterPropertyDto.siteId},
 			#{baseWaterPropertyDto.customerId},
-			#{baseWaterPropertyDto.tenant_id},
-			#{baseWaterPropertyDto.company_org_id},
-			#{baseWaterPropertyDto.dept_org_id}
+			#{baseWaterPropertyDto.tenantId},
+			#{baseWaterPropertyDto.companyOrgId},
+			#{baseWaterPropertyDto.deptOrgId}
 		)
 	</insert>
 

+ 39 - 3
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/MeasurementInstanceMapper.xml

@@ -202,9 +202,7 @@
             <if test="companyId !=null">
                 and company_org_id=#{companyId}
             </if>
-            <if test="departId !=null">
-                and dept_org_id=#{departId}
-            </if>
+
         </where>
         order by billing_period desc
         limit 2
@@ -238,6 +236,44 @@
             </if>
 
         </where>
+    </select>
+    <select id="findBillingPeriodData" resultType="com.zcxk.rmcp.pay.dto.pay.WaterCostsDTO">
+        select amountReceivable,actualAmount ,waterConsumption ,a.tenant_id,a.company_org_id companyId from
+            (select sum(receivablefee) amountReceivable ,tenant_id,company_org_id from pay_pay_receivable
+            where company_org_id=#{companyId} and tenant_id=#{tenantId}
+            and  create_date &gt;#{startTime} and create_date &lt;#{endTime}
+            GROUP BY tenant_id,company_org_id) a
+                left join
+            (select sum(receivedamount) actualAmount,tenant_id,company_org_id
+            from pay_pay_received where company_org_id=#{companyId} and tenant_id=#{tenantId} and
+                                        create_date &gt;#{startTime} and create_date &lt;#{endTime}
+            GROUP BY tenant_id,company_org_id) b
+            on a.tenant_id=b.tenant_id and a.company_org_id=b.company_org_id join
+            (select sum(water_consumption)waterConsumption , b.company_org_id,c.tenant_id
+            from rmcp_measurement_record a join rmcp_measurement_instance b on a.plan_id=b.id
+                join rmcp_measurement_settlement c
+                  on c.id=b.plan_id where b.company_org_id=#{companyId} and  create_date &gt;=#{startTime}
+                                      and create_date &lt;=#{endTime}
+                   and c.tenant_id=#{tenantId} GROUP BY b.company_org_id,c.tenant_id ) c
+            on a.tenant_id=c.tenant_id and a.company_org_id=c.company_org_id
+    </select>
+    <select id="findAllHistory" resultType="com.zcxk.rmcp.pay.entity.pay.MeasurementInstance">
+        select a.*,b.plan_name from rmcp_measurement_instance a join rmcp_measurement_settlement b
+        on a.plan_id=b.id
+        <where>
+            status=1
+            <if test="id !=null">
+                and plan_id=#{id}
+            </if>
+            <if test="companyId !=null">
+                and company_org_id=#{companyId}
+            </if>
+            <if test="departId !=null">
+                and dept_org_id=#{departId}
+            </if>
+        </where>
+
+
     </select>
     <sql id="permissionCondition">
         <if test="userCondition.tenantId != null">and ms.tenant_id = #{userCondition.tenantId}</if>

+ 1 - 1
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/MeasurementSettlementMapper.xml

@@ -49,7 +49,7 @@
         from rmcp_measurement_settlement ms
         join rmcp_org company on ms.company_org_id=company.ID
         left join rmcp_org depart on ms.dept_org_id=depart.ID
-        left join  rmcp_community commuity on ms.community_id=commuity.id
+        left join  sc_community commuity on ms.community_id=commuity.id
         <where>
             ms.status=1
             <if test="measurement.id != null">

+ 1 - 1
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseConfigMapper.xml

@@ -67,7 +67,7 @@
 
     <select id="ExitsData" resultType="java.lang.Long">
        select id from  pay_base_config config
-       where site_id =#{siteId} and customer_id =#{customerId} and (name = #{name} or cnname = #{cnname})
+       where tenant_id =#{tenantId} and (name = #{name} or cnname = #{cnname})
         <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
 

+ 9 - 5
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayBaseWatercategoryMapper.xml

@@ -26,9 +26,9 @@
             #{payBaseWatercategory.delFlag,jdbcType=VARCHAR},
             #{payBaseWatercategory.siteId,jdbcType=BIGINT},
             #{payBaseWatercategory.customerId,jdbcType=BIGINT},
-                #{payPayAgentbranch.tenant_id},
-            #{payPayAgentbranch.company_org_id},
-            #{payPayAgentbranch.dept_org_id}
+            #{payBaseWatercategory.tenantId},
+            #{payBaseWatercategory.companyOrgId},
+            #{payBaseWatercategory.deptOrgId}
         )
     </insert>
 
@@ -55,7 +55,8 @@
     <select id="isUsed" resultType="int">
         select count(id)
         from pay_base_waterproperty
-        where category_id = #{id} and site_id=#{siteId,jdbcType=BIGINT} and customer_id=#{customerId,jdbcType=BIGINT}
+        where category_id = #{id} and tenant_id=#{tenantId}
+          and company_org_id=#{companyOrgId} and dept_org_id=#{deptOrgId}
     </select>
 
     <select id="getAll" resultType="com.zcxk.rmcp.pay.dto.pay.PayBaseWatercategoryDto">
@@ -109,9 +110,12 @@
     </sql>
     <select id="ExitsData" resultType="long">
         select id from pay_base_watercategory pbw
-        where pbw.site_id=#{siteId,jdbcType=BIGINT} and pbw.customer_id=#{customerId,jdbcType=BIGINT}
+        where pbw.tenant_id=#{tenantId}
         and pbw.name = #{name}
         <if test="id != null and id != ''"> and pbw.id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
+    <select id="get" resultType="com.zcxk.rmcp.pay.entity.pay.PayBaseWatercategory">
+        select * from pay_base_watercategory where  id=#{id}
+    </select>
 
 </mapper>

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

@@ -36,9 +36,9 @@
             #{payBaseWaterprice.delFlag,jdbcType=VARCHAR},
             #{payBaseWaterprice.siteId,jdbcType=BIGINT},
             #{payBaseWaterprice.customerId,jdbcType=BIGINT},
-            #{payBaseWaterprice.tenant_id},
-            #{payBaseWaterprice.company_org_id},
-            #{payBaseWaterprice.dept_org_id}
+            #{payBaseWaterprice.tenantId},
+            #{payBaseWaterprice.companyOrgId},
+            #{payBaseWaterprice.deptOrgId}
         )
     </insert>
 
@@ -143,8 +143,8 @@
         pbw.growthrate,
         pbw.remarks
         from pay_base_waterprice pbw
-        where pbw.site_id=#{siteId,jdbcType=BIGINT} and pbw.customer_id=#{customerId,jdbcType=BIGINT}
-        and pbw.feename = #{name} and pbw.feetype = #{type}
+        where pbw.tenant_id=#{tenantId}
+        and pbw.feename = #{feename} and pbw.feetype = #{feeType}
         <if test="id != null and id != ''"> and pbw.id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
 

+ 7 - 2
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayControlRuleMapper.xml

@@ -19,7 +19,7 @@
         remarks,
         del_flag,
         site_id,
-        customer_id
+        customer_id,tenant_id,company_org_id,dept_org_id
         )
         values (
         #{payControlRule.name,jdbcType=VARCHAR},
@@ -38,6 +38,8 @@
         #{payControlRule.delFlag,jdbcType=VARCHAR},
         #{payControlRule.siteId,jdbcType=BIGINT},
         #{payControlRule.customerId,jdbcType=BIGINT}
+                   ,#{payControlRule.tenantId},#{payControlRule.companyOrgId}
+                   ,#{payControlRule.deptOrgId}
         )
     </insert>
 
@@ -119,7 +121,7 @@
             customer_id
         from pay_control_rule
         <where>
-            del_flag = 0 and customer_id = #{customerId}
+            del_flag = 0 and tenant_id = #{tenantId}
             and name = #{name}
             <if test="id != null"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
         </where>
@@ -153,6 +155,9 @@
             <if test="payControlRule.updateDate != null"> pcr.update_date = #{payControlRule.updateDate},</if>
             <if test="payControlRule.remarks != null and payControlRule.remarks != ''"> pcr.remarks = #{payControlRule.remarks},</if>
             <if test="payControlRule.delFlag != null"> pcr.del_flag = #{payControlRule.delFlag}</if>
+            <if test="payControlRule.companyOrgId != null">company_org_id=#{payControlRule.companyOrgId},</if>
+            <if test="payControlRule.deptOrgId != null">dept_org_id=#{payControlRule.deptOrgId},</if>
+
         </set>
         where id = #{payControlRule.id}
     </update>

+ 20 - 17
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayInvoiceMapper.xml

@@ -24,7 +24,8 @@
             type,
             office_id,
             cancelperson,
-            canceltime
+            canceltime,
+            tenant_id,company_org_id,dept_org_id
         )
         values(
             #{siteId},
@@ -47,7 +48,8 @@
             #{type},
             #{officeId},
             #{cancelperson},
-            #{canceltime}
+            #{canceltime},#{tenantId},#{companyOrgId}
+                  ,#{deptOrgId}
         )
     </insert>
 
@@ -152,9 +154,11 @@
             account_id as "accountId",
             invoice_id as "invoiceId",
             accountname,
-            accountnumber
+            accountnumber,
+            company_org_id,
+            dept_org_id
         from pay_pay_transactiondetails
-        where payseriesno= #{payseriesno} and site_id=#{siteId} and customer_id=#{customerId}
+        where payseriesno= #{payseriesno}
 
     </select>
 
@@ -250,22 +254,21 @@
 
     <select id="getDateRangeInfoPrint" resultType="com.zcxk.rmcp.pay.dto.pay.payfee.PrintInvoiceData">
         select
-            amount.account_id as "accountId",
-            ifnull(max(amount.year*12+amount.`month`),0) as  "maxPeriod",
-            ifnull(min(amount.year*12+amount.`month`),0) as  "minPeriod",
-            max(amount.recorddate) as "recorddate",
-            min(amount.lastrecorddate) as "lastrecorddate",
-            max(amount.reading) as "reading",
-            min(amount.lastreading) as "lastreading",
+            reced.account_id as "accountId",
+            ifnull(max(year(amount.create_date)*12+month(amount.create_date)),0) as  "maxPeriod",
+            ifnull(min(year(amount.create_date)*12+month(amount.create_date)),0) as  "minPeriod",
+            max(amount.current_period_date) as "recorddate",
+            min(amount.last_period_date) as "lastrecorddate",
+            max(amount.current_reading) as "reading",
+            min(amount.last_reading) as "lastreading",
             max(reced.create_date) as "createDate",
             sum(case when rece.feetype = 1 then rece.payamount else 0 end )as "payamount",
-            (select name from sc_user where id=max(reced.create_by)) as "createBy",
-            (select  customer_name from sc_customer where id=max(reced.customer_id)) as "customerName"
+            (select name from sc_user where id=max(reced.create_by)) as "createBy"
         from pay_pay_received reced
         left join pay_pay_receivable rece on reced.receivable_id=rece.id
-        left join pay_amount_waterusedamount amount on amount.id=rece.usedamount_id
+        left join rmcp_measurement_record amount on amount.id=rece.usedamount_id
         where reced.payseriesno=#{payseriesno}
-        group by amount.account_id
+        group by reced.account_id
 
     </select>
 
@@ -464,13 +467,13 @@
     <select id="getPayInvoiceType" resultType="com.zcxk.rmcp.pay.dto.pay.payfee.PrintInvoiceData">
         select
             max(printType) printType
-            ,max(c.pay_invoice_type) payInvoiceType
+            ,0 payInvoiceType
         from (
         select account_id , 1 printType ,customer_id from pay_pay_transactiondetails   where payseriesno = #{payseriesno}
         union all
         select account_id , 2 printType ,customer_id from pay_pay_received   where payseriesno = #{payseriesno}
         ) t
-        left join sc_customer c on c.id =t.customer_id
+
 
     </select>
 

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

@@ -93,7 +93,7 @@
     <select id="findInvoiceByPayseriesno" resultType="com.zcxk.rmcp.pay.entity.pay.PayInvoiceprinted">
 		select a.id, a.invoice_code as invoiceCode,a.invoice_no as invoiceNo,a.payseriesno
         from pay_invoice_printed a
-		where  a.id=#{invoicePrintId} and a.state=1 and a.site_id=#{siteId} and a.customer_id=#{customerId}
+		where  a.id=#{invoicePrintId} and a.state=1
 		limit 1
 	</select>
 	<update id="update">
@@ -128,7 +128,7 @@
 	</select>
 	<update id="updateReceivedIsPrint">
 		update  pay_pay_received  set isprint=#{isPrint}
-		where payseriesno=#{payseriesno} and customer_id=#{customerId}
+		where payseriesno=#{payseriesno}
 	</update>
 
 	<select id="findList" resultType="com.zcxk.rmcp.pay.dto.pay.payfee.PayfeeInvoicePrintDto">

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

@@ -39,9 +39,9 @@
             #{payPayAgentbranch.delFlag,jdbcType=VARCHAR},
             #{payPayAgentbranch.siteId,jdbcType=BIGINT},
             #{payPayAgentbranch.customerId,jdbcType=BIGINT},
-            #{payPayAgentbranch.tenant_id},
-            #{payPayAgentbranch.company_org_id},
-            #{payPayAgentbranch.dept_org_id}
+            #{payPayAgentbranch.tenantId},
+            #{payPayAgentbranch.companyOrgId},
+            #{payPayAgentbranch.deptOrgId}
 
 
         )
@@ -62,7 +62,7 @@
             <if test="payPayAgentbranch.updateBy != null"> update_by = #{payPayAgentbranch.updateBy,jdbcType = BIGINT},</if>
             <if test="payPayAgentbranch.updateDate != null"> update_date = #{payPayAgentbranch.updateDate,jdbcType=TIMESTAMP}</if>
             <if test="payPayAgentbranch.companyOrgId != null"> company_org_id = #{payPayAgentbranch.companyOrgId}</if>
-            <if test="payPayAgentbranch.deptOrgId != null"> dept_org_id = #{payPayAgentbranch.deptOrgId}</if>
+            <if test="payPayAgentbranch.deptOrgId != -1"> dept_org_id = #{payPayAgentbranch.deptOrgId}</if>
 
         </set>
         where
@@ -164,7 +164,7 @@
     </sql>
     <select id="ExitsData" resultType="java.lang.Long">
         select id from pay_pay_agentbranch
-        where site_id =#{siteId} and customer_id =#{customerId}
+        where tenant_id =#{tenantId}
         and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
         <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>

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

@@ -8,10 +8,10 @@
             psd.`value` as typeCode,
             SUM(ppac.amount) sumAmount
         from pay_pay_agenttransaction ppac
-        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
-        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.tenant_id=#{tenantId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.tenant_id =#{tenantId}
         where ppac.transtime>= #{stTime} and ppac.transtime <![CDATA[<=]]> #{endTime} and ppac.state not in(0,4)
-        and ppac.customer_id=#{customerId}
+        and ppac.tenant_id=#{tenantId}
         group by psd.label,psd.`value`
     </select>
 
@@ -27,11 +27,11 @@
             machid,
             IFNULL(sum(trans_fee),0) sumAmount
             from pay_pay_checkbalance
-            where transtime>=#{stTime} and transtime <![CDATA[<=]]> #{endTime} and site_id=#{siteId} and customer_id=#{customerId} and state not in(0,4)
+            where transtime>=#{stTime} and transtime <![CDATA[<=]]> #{endTime} and tenant_id=#{tenantId}  and state not in(0,4)
             group by machid
         ) ppc
-        left join pay_pay_agentbranch ppa on ppc.machid = ppa.mchid and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
-        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        left join pay_pay_agentbranch ppa on ppc.machid = ppa.mchid and ppa.tenant_id=#{tenantId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.tenant_id=#{tenantId}
 
     </select>
 

+ 10 - 12
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayPayReceivedMapper.xml

@@ -76,8 +76,10 @@
             sum(rece.receivedamount) as "receivedamount",
             max(rece.state) as "state",
             min(rece.payway) as "payway",
-        (select label from pay_sys_dict where type = '支付方式' and value = min(rece.payway) and site_id = #{siteId} and customer_id =#{customerId}) as "paywayname",
-        (select label from pay_sys_dict where type = '交易状态' and value = max(rece.state) and site_id = #{siteId} and customer_id =#{customerId}) as "statename",
+        (select label from pay_sys_dict where type = '支付方式' and value = min(rece.payway)
+                                          and tenant_id=#{userCondition.tenantId}) as "paywayname",
+        (select label from pay_sys_dict where type = '交易状态' and value = max(rece.state)
+                                          and tenant_id =#{userCondition.tenantId} ) as "statename",
             max(users.name) as "createbyname",
             max(rece.create_date) as "transtime",
             max(rece.invoice_id) as "invoiceId",
@@ -91,12 +93,8 @@
         left join pay_base_watercategory groy on groy.id = pro.category_id
         left join sc_user users on users.id = rece.create_by
         <where>
-            <if test="received.siteId != null">
-                and rece.site_id=#{received.siteId}
-            </if>
-            <if test="received.customerId != null">
-                and rece.customer_id=#{received.customerId}
-            </if>
+
+
             <if test="received.year != null">
                 rece.`year`=#{received.year}
             </if>
@@ -357,12 +355,12 @@
             dict.label as "feetypename"
         from pay_pay_received rece
         inner join pay_sys_dict dict on dict.type="收费类型" and dict.`value`= rece.feetype
-               and dict.site_id = #{siteId}
-               and dict.customer_id = #{customerId}
+               and dict.tenant_id = #{tenantId}
+
         where rece.canceledrecord_id is null and rece.iscanceled =0 and rece.receivedamount>0
               and rece.payseriesno= #{payseriesno}
-              and rece.site_id = #{siteId}
-              and rece.customer_id = #{customerId}
+              and rece.tenant_id = #{tenantId}
+
         group by rece.payseriesno,rece.create_date,rece.ladderlevel,rece.price,rece.feetype,dict.label
 
     </select>

+ 4 - 3
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PayRechargeaccountMapper.xml

@@ -35,10 +35,10 @@
                 or  cust.accountname like concat('%',#{payRechargeaccountDto.accountnumber},'%'))
             </if>
             <if test="payRechargeaccountDto.tenantId != null">
-                and a.tenant_id=#{tenantId}
+                and a.tenant_id=#{payRechargeaccountDto.tenantId}
             </if>
             <if test="payRechargeaccountDto.accountId != null">
-                and a.account_id =#{accountId}
+                and a.account_id =#{payRechargeaccountDto.accountId}
             </if>
          <include refid="permissionCondition"/>
         </where>
@@ -229,7 +229,7 @@
         site_id,
         customer_id,
         office_id,
-        tenant_id
+        tenant_id,company_org_id,dept_org_id
         )
         values
         <foreach collection="list" item="item" separator=",">
@@ -250,6 +250,7 @@
             #{item.customerId},
             #{item.officeId},
             #{item.tenantId}
+            ,#{item.companyOrgId},#{item.deptOrgId}
             )
 
         </foreach>

+ 6 - 4
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/PaySysDictMapper.xml

@@ -14,7 +14,8 @@
             remarks,
             del_flag,
             site_id,
-            customer_id
+            customer_id,
+            tenant_id
         ) value (
             #{paySysDict.value,jdbcType=VARCHAR},
             #{paySysDict.label,jdbcType=VARCHAR},
@@ -27,7 +28,8 @@
             #{paySysDict.remarks,jdbcType=VARCHAR},
             #{paySysDict.delFlag,jdbcType=VARCHAR},
             #{paySysDict.siteId,jdbcType=BIGINT},
-            #{paySysDict.customerId,jdbcType=BIGINT}
+            #{paySysDict.customerId,jdbcType=BIGINT},
+            #{paySysDict.tenantId}
         )
     </insert>
 
@@ -93,7 +95,7 @@
         su.name as createByName
         from pay_sys_dict psd
         left join  sc_user su on psd.create_by = su.id
-        where psd.del_flag='0' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        where psd.del_flag='0' and psd.tenant_id=#{tenantId}
         <if test="queryInfo != null and queryInfo != '' ">
          and (psd.value LIKE concat('%',#{queryInfo,jdbcType = VARCHAR},'%') or psd.label LIKE concat('%',#{queryInfo,jdbcType = VARCHAR},'%'))
         </if>
@@ -137,7 +139,7 @@
 
     <select id="ExitsData" resultType="java.lang.Long">
         select id from pay_sys_dict
-        where site_id =#{siteId} and customer_id =#{customerId} and type =#{type} and (value =#{value} or label = #{label})
+        where tenant_id=#{tenantId} and type =#{type} and (value =#{value} or label = #{label})
             <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
     <select id="getDictValueByTenantId" resultType="java.lang.Integer">

+ 8 - 14
zoniot-pay/zoniot-pay-core/src/main/resources/mapper/pay/payFeeMapper.xml

@@ -276,20 +276,14 @@
         order by max(create_date) desc
     </select>
     <select id="getWaterusedamount" resultType="com.zcxk.rmcp.pay.dto.pay.payfee.PayfeeWaterusedamount">
-        select
-                a.metercode AS "metercode",
-                a.lastreading AS "lastreading",
-                a.lastrecorddate AS "lastrecorddate",
-                a.reading AS "reading",
-                a.recorddate AS "recorddate",
-                a.amount AS "amount",
-                a.payamount AS "payamount",
-                 CONCAT(a.`year`,'年',LPAD(a.month, 2, 0),'月') as "closingName",
-                (select label from pay_sys_dict where type = '水量状态' and value = a.state and tenant_id=#{tenantId}) stateLabel,
-                (case when a.state = 2 then '是' else '否' end ) isReceivable
-        from pay_amount_waterusedamount a
-        where a.`year`=#{year} and a.account_id=#{accountId}
-        order by a.year desc ,a.month desc
+        select a.file_meter_no AS "metercode", a.last_reading AS "lastreading", a.last_period_date AS "lastrecorddate", a.current_reading AS "reading", a.current_period_date AS "recorddate", a.water_consumption AS "payamount",
+               CONCAT(year(a.create_date),'年',month(a.create_date),'月') as "closingName",real_water_consumption as amount,
+               (select label
+                      FROM pay_sys_dict
+               WHERE type = '水量状态' and value = a.approval_status and tenant_id=#{tenantId}) stateLabel, (case when a.approval_status = 1 then '是' else '否' end ) isReceivable
+        FROM rmcp_measurement_record a join pay_base_customerandmeterrela b on a.device_id=b.watermeter_id
+        WHERE year(a.create_date)=#{year} and b.account_id=#{accountId} order by a.create_date
+
     </select>
 
     <select id="getPayinvoiceInfo" resultType="com.zcxk.rmcp.pay.dto.pay.PayInvoiceDto">

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

@@ -10,7 +10,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
-@SpringBootApplication(scanBasePackages="com.zcxk")
+@SpringBootApplication(scanBasePackages={"com.zcxk","com.bz.zoneiot"})
 @EnableScheduling
 @EnableAsync
 @EnableCaching  //开启缓存

+ 13 - 0
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/PayBaseAccountController.java

@@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
@@ -164,4 +166,15 @@ public class PayBaseAccountController {
         }
         return new AjaxMessage(ResultStatus.ERROR,"查询条件为空");
     }
+    @GetMapping("/getCustomerListExcel")
+    @ApiOperation(value = "计费系统-导出客户列表excel")
+    public void getCustomerListExcel(
+            @ApiParam(value = "客户编号、证件号码、手机号、地址", required = false) @RequestParam(required = false) String  queryInfo,
+            @ApiParam(value = "状态(数据字典中的value)", required = false) @RequestParam(required = false) String  state,
+            @ApiParam(value = "排序参数,对应列表字段", required = false) @RequestParam(required = false) String sortColumn,
+            @ApiParam(value = "排序方式,顺序:ASC  倒序:DESC", required = false) @RequestParam(required = false) String sortOrder
+            , HttpServletResponse httpServletResponse){
+
+                  payBaseAccountService.getCustomerExcel(queryInfo,state,sortColumn,sortOrder,httpServletResponse);
+       }
 }

+ 1 - 0
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/controller/pay/PayControlRuleController.java

@@ -78,6 +78,7 @@ public class PayControlRuleController {
             return new AjaxMessage(ResultStatus.ERROR);
         }
         catch (Exception ex){
+            ex.printStackTrace();
             return  new AjaxMessage<>(-99,ex.getMessage(),null);
         }
     }

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

@@ -3,6 +3,7 @@ package com.zcxk.rmcp.pay.controller.pay;
 import com.alibaba.fastjson.JSONObject;
 import com.zcxk.rmcp.pay.commom.model.AjaxMessage;
 import com.zcxk.rmcp.pay.commom.model.ResultStatus;
+import com.zcxk.rmcp.pay.commom.util.UserUtil;
 import com.zcxk.rmcp.pay.dto.DeviceTypeDto;
 import com.zcxk.rmcp.pay.dto.pay.DeviceReplaceRecordDto;
 import com.zcxk.rmcp.pay.dto.pay.InstallPlanInputDTO;
@@ -36,6 +37,7 @@ public class PaySyncDataController {
     public AjaxMessage add(
             @ApiParam(value = "安装计划", required = true) @RequestBody(required = true) InstallPlanInputDTO installPlanInput
     ) {
+        installPlanInput.setTenantId(UserUtil.getCurrentUser().getTenantId());
         return paySyncDataService.addJF(installPlanInput,null);
         //return new AjaxMessage(ResultStatus.OK);
     }

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

@@ -677,7 +677,7 @@ public class MeasurementSettlementServiceImpl implements MeasurementSettlementSe
                 }else{
                     //新安装户,取安装时间比较
                     theLastOne = amountWaterUsedAmounts.get(0);
-                    Date createDate = theLastOne.getInstalldate();
+                    Date createDate = theLastOne.getCreateDate();
                     if(createDate!=null) {
                         Double sDay = DateTimeUtil.getDistanceOfTwoDate(createDate, new Date());
                         if (sDay > 31) {
@@ -784,6 +784,25 @@ public class MeasurementSettlementServiceImpl implements MeasurementSettlementSe
         measurementInstanceMapper.update(measurementInstance);
 
     }
+    private void pushBillingPeriodData(Date billingPeriod, Date startTime,Date endTime){
+        LoginUser currentUser = UserUtil.getCurrentUser();
+       List<WaterCostsDTO>waterCostsDTOS= measurementInstanceMapper.findBillingPeriodData(startTime,endTime,
+               currentUser.getCompanyId(),currentUser.getTenantId());
+        waterCostsDTOS.forEach(waterCostsDTO -> waterCostsDTO.setBillperiodDate(billingPeriod));
+    }
+    @Override
+    public BaseClosingAccountInfo findHistory() {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BaseClosingAccountInfo baseClosingAccountInfo=null;
+        List<MeasurementInstance> history = measurementInstanceMapper.findHistory(null, loginUser.getCompanyId(), loginUser.getDepartmentId());
+        if(!CollectionUtils.isEmpty(history)){
+            MeasurementInstance measurementInstance = history.get(0);
+            baseClosingAccountInfo=new BaseClosingAccountInfo();
+            baseClosingAccountInfo.setYear(DateUtil.getYear(measurementInstance.getBillingPeriod()));
+            baseClosingAccountInfo.setMonth(DateUtil.getMonth(measurementInstance.getBillingPeriod()));
+        }
+        return baseClosingAccountInfo;
+    }
 
     private void insetAmountInfo(Integer year, Integer month, MeasurementSettlementDto measurementSettlementDto) {
         LoginUser loginUser = UserUtil.getCurrentUser();

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

@@ -45,8 +45,8 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
         LoginUser loginUser = UserUtil.getCurrentUser();
 
         PageHelper.startPage(pageNum, pageSize);
-        List<BaseWaterPropertyDto> baseWaterProperties =  baseWaterPropertyMapper.getList(name,BigInteger.valueOf(loginUser.getCustomerId()),
-                BigInteger.valueOf(loginUser.getSiteId()));
+        List<BaseWaterPropertyDto> baseWaterProperties =  baseWaterPropertyMapper.getList(name,loginUser.getTenantId())
+                ;
         return new Pagination<BaseWaterPropertyDto>(baseWaterProperties);
     }
 
@@ -85,8 +85,7 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
         basePriceOfWaterProperty.setCreateDate(LocalDateTime.now());
         basePriceOfWaterProperty.setUpdateBy(BigInteger.valueOf(loginUser.getId()));
         basePriceOfWaterProperty.setUpdateDate(LocalDateTime.now());
-        basePriceOfWaterProperty.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-        basePriceOfWaterProperty.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
         basePriceOfWaterProperty.setDelFlag("0");
         basePriceOfWaterProperty.setWaterPropertyId(id);
 

+ 15 - 11
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/IssueElectronicInvoiceServiceImpl.java

@@ -3,12 +3,11 @@ package com.zcxk.rmcp.pay.service.impl.pay;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.zcxk.rmcp.pay.commom.util.*;
+import com.zcxk.rmcp.pay.dao.pay.MeasurementInstanceMapper;
 import com.zcxk.rmcp.pay.dto.LoginUser;
 import com.zcxk.rmcp.pay.dto.pay.*;
 import com.zcxk.rmcp.pay.entity.User;
-import com.zcxk.rmcp.pay.entity.pay.BaseClosingAccountInfo;
-import com.zcxk.rmcp.pay.entity.pay.PayInvoiceParam;
-import com.zcxk.rmcp.pay.entity.pay.PayInvoiceprinted;
+import com.zcxk.rmcp.pay.entity.pay.*;
 import com.zcxk.rmcp.pay.entity.pay.archives.PayBaseCustomerandmeterrela;
 import com.zcxk.rmcp.pay.service.UserService;
 import com.zcxk.rmcp.pay.service.pay.*;
@@ -16,7 +15,9 @@ import com.zcxk.rmcp.pay.service.pay.archives.PayBaseCustomerandmeterrelaService
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
@@ -56,6 +57,8 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
     private String printUrl;
     @Autowired
     private BaseClosingAccountInfoService baseClosingAccountInfoService;
+    @Resource
+    private MeasurementSettlementService measurementSettlementService;
 
     private Map<String, String> getPrintParam(String tenantId) {
         Map<String, String> map = new HashMap<>();
@@ -131,9 +134,9 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
             loginUser.setCustomerId(Integer.valueOf(customerId));
             loginUser.setSiteId(Integer.valueOf(siteId));
         }
-        String name = loginUser.getName();//操作员姓名
-        BaseClosingAccountInfo baseClosingAccountInfo = baseClosingAccountInfoService.getCurrentCloseInfo(loginUser.getSiteId(), loginUser.getCustomerId());
-        if (baseClosingAccountInfo == null) {
+        String name = loginUser.getUsername();//操作员姓名
+        BaseClosingAccountInfo baseClosingAccountInfo=measurementSettlementService.findHistory();
+        if (baseClosingAccountInfo==null) {
             returnPrintResultDto.setResult("1");//开票失败
             returnPrintResultDto.setMsg("开票失败,失败原因:账期信息查询失败");
             return returnPrintResultDto;
@@ -169,7 +172,7 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
         }
 
         if (kpType.equals("2")) {//红票按蓝票票ID查询
-            oldInvoiceprinted = printInvoicePrintService.findInvoiceByPayseriesno(invoicePrintId, BigInteger.valueOf(loginUser.getSiteId()), BigInteger.valueOf(loginUser.getCustomerId()));
+            oldInvoiceprinted = printInvoicePrintService.findInvoiceByPayseriesno(invoicePrintId, null, null);
             if (oldInvoiceprinted != null && oldInvoiceprinted.getInvoiceCode() != null) {
                 payInvoiceOrderDto.setFpdm(oldInvoiceprinted.getInvoiceCode());
                 payInvoiceOrderDto.setFphm(oldInvoiceprinted.getInvoiceNo());
@@ -197,7 +200,7 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
         payInvoiceOrderDto.setTaxnum(payBaseAccount.getVatno());//购方税号
 
         //循环加入明细
-        List<PayReceivedInvoiceDto> payReceivedInvoiceDtos = payPayReceivedService.findInvoiceReceivedByPayseriesno(payseriesno, loginUser.getSiteId(), loginUser.getCustomerId());
+        List<PayReceivedInvoiceDto> payReceivedInvoiceDtos = payPayReceivedService.findInvoiceReceivedByPayseriesno(payseriesno, loginUser.getTenantId());
         for (PayReceivedInvoiceDto item : payReceivedInvoiceDtos) {
             PayInvoiceOrderDetailDto orderDetailDto = new PayInvoiceOrderDetailDto();
             PayInvoiceParam payInvoiceParam = invoiceMap.get(item.getFeetype());
@@ -228,7 +231,7 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
                     orderDetailDto.setTaxfreeamt(String.valueOf(saveTwoDecimal(receAmount.add(taxAmount).multiply(BigDecimal.valueOf(-1)))));//不含税金额
                 } else {
                     orderDetailDto.setTax(String.valueOf(saveTwoDecimal(taxAmount)));//税额
-                    orderDetailDto.setTaxfreeamt(String.valueOf(saveTwoDecimal(receAmount.add(taxAmount).multiply(BigDecimal.valueOf(-1)))));//不含税金额
+                    orderDetailDto.setTaxfreeamt(String.valueOf(saveTwoDecimal(receAmount.add(taxAmount))));//不含税金额
                 }
             }
             if (item.getPrice() != null) {
@@ -303,8 +306,7 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
             payInvoiceprinted.setCreateDate(LocalDateTime.now());
             payInvoiceprinted.setUpdateBy(BigInteger.valueOf(loginUser.getId()));
             payInvoiceprinted.setUpdateDate(LocalDateTime.now());
-            payInvoiceprinted.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-            payInvoiceprinted.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
             payInvoiceprinted.setDelFlag("0");
             payInvoiceprinted.setRemarks(jsonObject.getString("message"));
             payInvoiceprinted.setType(1); //发票
@@ -314,6 +316,8 @@ public class IssueElectronicInvoiceServiceImpl implements IssueElectronicInvoice
             payInvoiceprinted.setEmail(payInvoiceOrderDto.getEmail());
             payInvoiceprinted.setSaleIdentity(invoiceParam.get("saleIdentity"));
             payInvoiceprinted.setTenantId(loginUser.getTenantId());
+            payInvoiceprinted.setCompanyOrgId(loginUser.getCompanyId());
+            payInvoiceprinted.setDeptOrgId(loginUser.getDepartmentId());
             if (kpType.equals("2")) {
                 payInvoiceprinted.setInvoiceType(2);//红票
                 payInvoiceprinted.setCancelInvoiceId(BigInteger.valueOf(Long.parseLong(invoicePrintId)));

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

@@ -3,6 +3,7 @@ package com.zcxk.rmcp.pay.service.impl.pay;
 import com.bz.zoneiot.core.oauth2.util.UserUtil;
 import com.zcxk.rmcp.pay.commom.exception.ServiceException;
 import com.zcxk.rmcp.pay.commom.model.Pagination;
+import com.zcxk.rmcp.pay.commom.util.ExcelUtil;
 import com.zcxk.rmcp.pay.commom.util.SnowflakeIdWorker;
 import com.bz.zoneiot.core.oauth2.pojo.LoginUser;
 import com.zcxk.rmcp.pay.dao.pay.*;
@@ -11,18 +12,23 @@ import com.zcxk.rmcp.pay.dto.pay.*;
 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;
+import com.zcxk.rmcp.pay.entity.pay.archives.PayBaseCustomerandmeterrela;
 import com.zcxk.rmcp.pay.service.pay.PayBaseAccountService;
 import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.google.common.collect.Lists.newArrayList;
+
 /**
  * Crated by Zjy on 2020-04-22 14:59
  */
@@ -298,6 +304,8 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
             payRechargeaccountDto.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
             payRechargeaccountDto.setUpdateDate(LocalDateTime.now());
             payRechargeaccountDto.setTenantId(loginUser.getTenantId());
+            payRechargeaccountDto.setCompanyOrgId(loginUser.getCompanyId());
+            payRechargeaccountDto.setDeptOrgId(loginUser.getDepartmentId());
             rechList.add(payRechargeaccountDto);
 
         }
@@ -386,4 +394,39 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     public List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes){
         return payBaseAccountMapper.getAccountInfoByMetercode(metercodes);
     }
+
+    @Override
+    public void getCustomerExcel(String queryInfo, String state, String sortColumn, String sortOrder, HttpServletResponse httpServletResponse) {
+        com.zcxk.rmcp.pay.dto.LoginUser loginUser = com.zcxk.rmcp.pay.commom.util.UserUtil.getCurrentUser();
+        String title = "客户信息列表";
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String[] rowsName = new String[]{"序号","客户编号","客户名称","手机号","证件编号","地址","水表个数","用水余额",
+                "本期用水量","状态"};
+        List<PayBaseAccountSelectDto> payBaseAccountSelectDtoList= payBaseAccountMapper.findList(queryInfo,state,sortColumn,sortOrder,
+                0,0,loginUser.getUserCondition(),loginUser.getTenantId());
+        List<Object[]> dataList = newArrayList();
+        Object[] objs = null;
+        for(int i=0; i<payBaseAccountSelectDtoList.size() ; i++
+        ){
+            PayBaseAccountSelectDto customer = payBaseAccountSelectDtoList.get(i);
+            objs = new Object[rowsName.length];
+            objs[0] = i;
+            objs[1] = customer.getAccountnumber() != null ? customer.getAccountnumber() : "";//客户编号
+            objs[2] = customer.getName() != null ? customer.getName() : "";//客户名称
+            objs[3] = customer.getTelephone() != null ? customer.getTelephone() : "";//手机号
+            objs[4] = customer.getIdcardno()!= null ? customer.getIdcardno() :"";//水表电子号
+            objs[5] = customer.getAddress() != null ? customer.getAddress() : "";//水表档案号
+            objs[6] = customer.getWaterNumber() != null ? customer.getWaterNumber() : "";//用水性质
+            objs[7] = customer.getRemaining()!= null ? customer.getRemaining() : "";//结算方式
+            objs[8] = customer.getSumPayamount() != null ? customer.getSumPayamount() : "";//安装地址
+            objs[9] = customer.getState() != null ? customer.getState() : "";//开户时间
+            dataList.add(objs);
+        }
+        ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
+        try {
+            excelUtil.export(httpServletResponse);
+        } catch (Exception e) {
+            throw new ServiceException(-900, "导出异常");
+        }
+    }
 }

+ 6 - 10
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseConfigServiceImpl.java

@@ -35,10 +35,9 @@ public class PayBaseConfigServiceImpl implements PayBaseConfigService {
     @Override
     public int add(PayBaseConfigDto payBaseConfigDto) {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+
         //数据是否存在(name,cnname)
-        List<Long> longs = payBaseConfigMapper.ExitsData(null,payBaseConfigDto.getName(),payBaseConfigDto.getCnname(),siteId,customerId);
+        List<Long> longs = payBaseConfigMapper.ExitsData(null,payBaseConfigDto.getName(),payBaseConfigDto.getCnname(),loginUser.getTenantId());
         if(longs.size() > 0)
             throw new ServiceException(-716,"您设置的参数已存相同的名称与标识,请重新设置。");
 
@@ -52,8 +51,7 @@ public class PayBaseConfigServiceImpl implements PayBaseConfigService {
         payBaseConfig.setCreate_date(LocalDateTime.now());
         payBaseConfig.setUpdate_by(new BigInteger(String.valueOf(loginUser.getId())));
         payBaseConfig.setUpdate_date(LocalDateTime.now());
-        payBaseConfig.setSite_id(siteId);
-        payBaseConfig.setCustomer_id(customerId);
+        payBaseConfig.setTenantId(loginUser.getTenantId());
         payBaseConfig.setDel_flag("0");
         return payBaseConfigMapper.insertList(payBaseConfig);
     }
@@ -80,10 +78,9 @@ public class PayBaseConfigServiceImpl implements PayBaseConfigService {
     @Override
     public int edit(PayBaseConfigDto payBaseConfigDto) {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+
         //数据是否存在(name,cnname)
-        List<Long> longs = payBaseConfigMapper.ExitsData(String.valueOf(payBaseConfigDto.getId()),payBaseConfigDto.getName(),payBaseConfigDto.getCnname(),siteId,customerId);
+        List<Long> longs = payBaseConfigMapper.ExitsData(String.valueOf(payBaseConfigDto.getId()),payBaseConfigDto.getName(),payBaseConfigDto.getCnname(),loginUser.getTenantId());
         if(longs.size() > 0)
             throw new ServiceException(-716,"您设置的参数已存相同的名称与标识,请重新设置。");
 
@@ -98,8 +95,7 @@ public class PayBaseConfigServiceImpl implements PayBaseConfigService {
         payBaseConfig.setUpdate_date(LocalDateTime.now());
         int result =  payBaseConfigMapper.update(payBaseConfig);
         if(result>0 ){
-            payBaseConfigDto.setCustomerId(customerId);
-            payBaseConfigDto.setSiteId(siteId);
+
             if(payBaseConfigDto.getName().equals("AUTO_SYNUAMOUNT_TIME")) {
                 amountSynService.deleteQrtzTask(payBaseConfigDto.getCustomerId());
                 amountSynService.saveQrtzTask(payBaseConfigDto);

+ 6 - 6
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayBaseWatercategoryServiceImpl.java

@@ -54,6 +54,7 @@ public class PayBaseWatercategoryServiceImpl implements PayBaseWatercategoryServ
         payBaseWatercategory.setDelFlag("0");
         payBaseWatercategory.setTenantId(loginUser.getTenantId());
 
+
         //判断不能重名
         List<Long> longs = payBaseWatercategoryMapper.ExitsData(null,payBaseWatercategory.getName(),loginUser.getTenantId());
         if(longs != null)
@@ -70,14 +71,13 @@ public class PayBaseWatercategoryServiceImpl implements PayBaseWatercategoryServ
     public int edit(PayBaseWatercategory payBaseWatercategory)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
 
         payBaseWatercategory.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
         payBaseWatercategory.setUpdateDate(LocalDateTime.now());
 
         //已使用不能修改
-        int useCount = payBaseWatercategoryMapper.isUsed(payBaseWatercategory.getId(),siteId,customerId);
+        int useCount = payBaseWatercategoryMapper.isUsed(payBaseWatercategory.getId(),loginUser.getTenantId(),
+                payBaseWatercategory.getCompanyOrgId(),payBaseWatercategory.getDeptOrgId());
         if(useCount > 0)
             throw new ServiceException(-717,"该用水类别已被应用,无法编辑。");
 
@@ -96,10 +96,10 @@ public class PayBaseWatercategoryServiceImpl implements PayBaseWatercategoryServ
     public int delete(BigInteger id)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        PayBaseWatercategory payBaseWatercategory= payBaseWatercategoryMapper.get(id);
         //使用不能删除
-        int useCount = payBaseWatercategoryMapper.isUsed(id,siteId,customerId);
+        int useCount = payBaseWatercategoryMapper.isUsed(id,payBaseWatercategory.getTenantId(),
+                payBaseWatercategory.getCompanyOrgId(),payBaseWatercategory.getDeptOrgId());
         if(useCount > 0)
             throw new ServiceException(-717,"该用水类别已被应用,无法删除。");
 

+ 5 - 5
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayControlRuleServiceImpl.java

@@ -39,7 +39,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
     @Override
     public Integer add(PayControlRule payControlRule){
         LoginUser loginUser = UserUtil.getCurrentUser();
-        if(ExitsData(null,payControlRule.getName(),new BigInteger(String.valueOf(loginUser.getCustomerId()))))
+        if(ExitsData(null,payControlRule.getName(),loginUser.getTenantId()))
             throw new ServiceException(-99,"该阀控规则已存在!");
 
 
@@ -85,13 +85,13 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
     @Override
     public Integer edit(PayControlRule payControlRule){
         LoginUser loginUser = UserUtil.getCurrentUser();
-        if(ExitsData(payControlRule.getId().toString(),payControlRule.getName(),new BigInteger(String.valueOf(loginUser.getCustomerId()))))
+        if(ExitsData(payControlRule.getId().toString(),payControlRule.getName(),loginUser.getTenantId()))
             throw new ServiceException(-99,"该阀控规则已存在!");
 
         /*if(IsUsed(payControlRule.getId().intValue(),new BigInteger(loginUser.getCustomerId().toString()))){
             throw new ServiceException(-99,"该阀控规则已有客户使用,如编辑会对应用客户有影响,是否继续?");
         }*/
-        payControlRule.setCustomerId(new BigInteger(loginUser.getCustomerId().toString()));
+
         Integer result = payControlRuleMapper.edit(payControlRule);
         return  result;
     }
@@ -162,9 +162,9 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
      * @param name 规则名称
      * @return true数据存在 false数据不存在
      */
-    public boolean ExitsData(String id,String name,BigInteger customerId){
+    public boolean ExitsData(String id,String name,String tenantId){
         if(name != null){
-            List<PayControlRule> payControlRules = payControlRuleMapper.ExitsData(id,name,customerId);
+            List<PayControlRule> payControlRules = payControlRuleMapper.ExitsData(id,name,tenantId);
             if(payControlRules != null && payControlRules.size() > 0)
                 return true;
         }

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

@@ -791,11 +791,12 @@ public class PayFeeServiceImp implements PayFeeService {
                 , payCustomRechargeDto.getAccountnumber());
         //获取账期
         PayBaseAccount payBaseAccount = payBaseAccountMapper.get(payCustomRechargeDto.getAccountId());
-        if (payBaseAccount == null) {
+        Date billingPeriod = payBaseAccount.getBillingPeriod();
+        if (billingPeriod == null) {
             //获取账期信息失败
             throw new ServiceException(ResultStatus.PAYFEE_QUERY_NO_CLOSINGACCOUNT);
         }
-        Date billingPeriod = payBaseAccount.getBillingPeriod();
+
         int month = DateUtil.getMonth(billingPeriod);
         int year = DateUtil.getYear(billingPeriod);
         //余额

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

@@ -103,8 +103,6 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
         invoice.setUpdateBy(BigInteger.valueOf(loginUser.getId()));
         invoice.setUpdateDate(LocalDateTime.now());
         invoice.setDelFlag("0");
-        invoice.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-        invoice.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
         invoice.setRemarks("");
 
         //获取同批次号的交易明细
@@ -114,6 +112,9 @@ public class PayInvoiceServiceImpl implements PayinvoiceService {
             if(payTransactiondetails.getInvoiceId()!=null){
                 throw new ServiceException(ResultStatus.PAY_INVOICE_EXISTED);
             }
+            invoice.setTenantId(payTransactiondetails.getTenantId());
+            invoice.setCompanyOrgId(payTransactiondetails.getCompanyOrgId());
+            invoice.setDeptOrgId(payTransactiondetails.getDeptOrgId());
             invoice.setAccountId(payTransactiondetails.getAccountId());
             invoice.setAccountname(payTransactiondetails.getAccountname());
             invoice.setAccountnumber(payTransactiondetails.getAccountnumber());

+ 10 - 5
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayMessagesendrecordServiceImp.java

@@ -1,6 +1,7 @@
 package com.zcxk.rmcp.pay.service.impl.pay;
 
-import com.zcxk.core.utils.DateUtil;
+
+import com.bz.zoneiot.core.utils.DateUtil;
 import com.zcxk.rmcp.pay.commom.exception.ServiceException;
 import com.zcxk.rmcp.pay.commom.model.AjaxMessage;
 import com.zcxk.rmcp.pay.commom.model.Pagination;
@@ -144,7 +145,7 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
         Integer year=null;
         Integer month=null;
         if(billingPeriod!=null){
-            year=DateUtil.getYear(billingPeriod);
+            year= DateUtil.getYear(billingPeriod);
             month=DateUtil.getMonth(billingPeriod);
         }
         //分页
@@ -684,10 +685,14 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
             throw new ServiceException(ResultStatus.MESSAGE_CONFIGURATION_ISEMPTY);
         }
         //获取最新账期
-        BaseClosingAccountInfoDto baseClosingAccountInfoDto=baseClosingAccountInfoMapper.getLastClosingAccount(loginUser.getSiteId(),loginUser.getCustomerId());
-        if(baseClosingAccountInfoDto == null){
+        BaseClosingAccountInfoDto baseClosingAccountInfoDto=new BaseClosingAccountInfoDto();
+        List<MeasurementInstance> history = measurementInstanceMapper.findHistory(null, loginUser.getCompanyId(), loginUser.getDepartmentId());
+        if(CollectionUtils.isEmpty(history)){
             throw new ServiceException(ResultStatus.ClOSING_ACCCOUNT_NOT_EXIT);
         }
+        MeasurementInstance measurementInstance = history.get(0);
+        baseClosingAccountInfoDto.setYear(DateUtil.getYear(measurementInstance.getBillingPeriod()));
+        baseClosingAccountInfoDto.setMonth(DateUtil.getMonth(measurementInstance.getBillingPeriod()));
 
         List<Integer> types =new ArrayList<>();
         types.add(1);   //欠费天数
@@ -871,7 +876,7 @@ public class PayMessagesendrecordServiceImp implements PayMessagesendrecordServi
         sendReq.setSign(templateList.getSign());
         //
         //短信推送:1成功 0失败
-        int result = SMSClient.sendMsg(sendReq);
+        int result = 1;//SMSClient.sendMsg(sendReq);
         if(result == 1){
             payMessagesendrecordDto.setState("成功");
         }else{

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

@@ -47,8 +47,7 @@ public class PayMessagetemplateServiceImp implements PayMessagetemplateService {
         payMessageTemplateDto.setCreateDate(LocalDateTime.now());
         payMessageTemplateDto.setUpdateDate(LocalDateTime.now());
         payMessageTemplateDto.setDelFlag("0");
-        payMessageTemplateDto.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-        payMessageTemplateDto.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
 
         //
 

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

@@ -51,8 +51,8 @@ public class PayPayAgentbranchServiceImpl implements PayPayAgentbranchService {
         payPayAgentbranch.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
         payPayAgentbranch.setUpdateDate(LocalDateTime.now());
         payPayAgentbranch.setDelFlag("0");
-        payPayAgentbranch.setSiteId(loginUser.getSiteId());
-        payPayAgentbranch.setCustomerId(loginUser.getCustomerId());
+        payPayAgentbranch.setTenantId(loginUser.getTenantId());
+
 
         return payPayAgentbranchMapper.insert(payPayAgentbranch);
     }

+ 26 - 14
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PayPayCheckbalanceServiceImpl.java

@@ -1,12 +1,15 @@
 package com.zcxk.rmcp.pay.service.impl.pay;
 
+import com.bz.zoneiot.core.utils.DateUtil;
 import com.zcxk.rmcp.pay.commom.model.Pagination;
 import com.zcxk.rmcp.pay.commom.util.UserUtil;
 import com.zcxk.rmcp.pay.dao.pay.BaseClosingAccountInfoMapper;
+import com.zcxk.rmcp.pay.dao.pay.MeasurementInstanceMapper;
 import com.zcxk.rmcp.pay.dao.pay.PayPayAgentbranchMapper;
 import com.zcxk.rmcp.pay.dao.pay.PayPayCheckbalanceMapper;
 import com.zcxk.rmcp.pay.dto.LoginUser;
 import com.zcxk.rmcp.pay.dto.pay.*;
+import com.zcxk.rmcp.pay.entity.pay.MeasurementInstance;
 import com.zcxk.rmcp.pay.service.pay.PayPayCheckbalanceService;
 import com.github.pagehelper.PageHelper;
 import com.mysql.jdbc.StringUtils;
@@ -34,6 +37,8 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
     BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
     @Resource
     PayPayAgentbranchMapper payPayAgentbranchMapper;
+    @Resource
+    MeasurementInstanceMapper measurementInstanceMapper;
 
 
     @Override
@@ -41,8 +46,8 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
 
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        BigInteger siteId = null;
+        BigInteger customerId = null;
         Pagination<PayPayCheckbalanceDto> pg = new Pagination<>();
 
         //获取查询范围
@@ -58,10 +63,10 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
         if(!StringUtils.isNullOrEmpty(month))
             iMonth = Integer.valueOf(month);
         //查询全部帐期(未结账的结束日期为当前时间) state 0未结账,1已结帐
-        List<BaseClosingAccountInfoDto> baseClosingAccountInfoList = baseClosingAccountInfoMapper.getList(iYear,iMonth,loginUser.getTenantId(),null);
-        if(baseClosingAccountInfoList != null)
+        List<MeasurementInstance> history = measurementInstanceMapper.findAllHistory(null, loginUser.getCompanyId(), loginUser.getDepartmentId());
+       if(history != null)
         {
-            count = baseClosingAccountInfoList.size();
+            count = history.size();
             ZoneId zoneId = ZoneId.systemDefault();
             for(int i=stPoint;i<=endPoint;i++)
             {
@@ -69,18 +74,24 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
                     break;
 
                 PayPayCheckbalanceDto payPayCheckbalanceDto = new PayPayCheckbalanceDto();
-                payPayCheckbalanceDto.setYear(baseClosingAccountInfoList.get(i).getYear());
-                payPayCheckbalanceDto.setMonth(baseClosingAccountInfoList.get(i).getMonth());
+                MeasurementInstance measurementInstance = history.get(i);
+                Date billingPeriod = measurementInstance.getBillingPeriod();
+                payPayCheckbalanceDto.setYear(DateUtil.getYear(billingPeriod));
+                payPayCheckbalanceDto.setMonth(DateUtil.getMonth(billingPeriod));
 
-                String cycle = baseClosingAccountInfoList.get(i).getName();
+                String cycle =measurementInstance.getPlanName();
                 LocalDateTime endTime = null;
-                LocalDateTime stTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getStartTime().toInstant(), zoneId);
-                if(baseClosingAccountInfoList.get(i).getEndTime() != null)
-                    endTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getEndTime().toInstant(), zoneId);
-                else
+                LocalDateTime stTime = LocalDateTime.ofInstant(measurementInstance.getClearingStartDate().toInstant(), zoneId);
+                if(measurementInstance.getClearingEndDate() != null){
+                    endTime = LocalDateTime.ofInstant(measurementInstance.getClearingEndDate().toInstant(), zoneId);
+
+                }
+               else{
                     endTime = LocalDateTime.now();
+                }
+
                 //取每月系统总额
-                List<PayPayCheckbalanceItemDto> sysItem1 = payPayCheckbalanceMapper.findSysMonthCycle(cycle,stTime,endTime,siteId,customerId);
+                List<PayPayCheckbalanceItemDto> sysItem1 = payPayCheckbalanceMapper.findSysMonthCycle(cycle,stTime,endTime,loginUser.getTenantId(),loginUser.getUserCondition());
                 if(sysItem1 != null)
                 {
                     for (int k=0;k<sysItem1.size();k++){
@@ -106,7 +117,8 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
                 }
 
                 //取每月交易总额
-                List<PayPayCheckbalanceItemDto> tradeItem1 = payPayCheckbalanceMapper.findTradeMonthCycle(cycle,stTime,endTime,siteId,customerId);
+                List<PayPayCheckbalanceItemDto> tradeItem1 = payPayCheckbalanceMapper.findTradeMonthCycle(cycle,stTime,endTime,loginUser.getTenantId(),
+                        loginUser.getUserCondition());
                 if(tradeItem1 != null)
                 {
                     for (int k=0;k<tradeItem1.size();k++){

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

@@ -184,8 +184,8 @@ public class PayPayReceivedServiceImpl implements PayPayReceivedService {
     }
 
     @Override
-    public List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno, Integer siteId, Integer customerId) {
-        return payPayReceivedMapper.findInvoiceReceivedByPayseriesno(payseriesno,siteId,customerId);
+    public List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno, String tenantId) {
+        return payPayReceivedMapper.findInvoiceReceivedByPayseriesno(payseriesno,tenantId);
     }
 
     @Transactional(rollbackFor = Exception.class)

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

@@ -176,6 +176,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         installPlanInput.setTenantId(tenantId);
         installPlanInput.setCompanyOrgId(companyId);
         installPlanInput.setDeptOrgId(departmentId);
+        installPlanInput.setCommunityName(community.getAddress());
 
         //取当前小区最大客户编号
         int maxAccountNumber = payBaseAccountService.getMaxAccountNumber(code);
@@ -256,8 +257,6 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                 String installStr = JSONObject.toJSONString(installPlanInput);
                 InstallPlanInputDto installPlanInputDto=JSONObject.parseObject(installStr,InstallPlanInputDto.class);
 
-
-                //syncDataClient.syncPlan(installStr);
                 syncDataClient.syncPlan(installPlanInputDto);
                 com.bz.zoneiot.core.oauth2.pojo.LoginUser user = new com.bz.zoneiot.core.oauth2.pojo.LoginUser(new HashSet<>());
                 if(excelLoginUser!=null){

+ 13 - 19
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PaySysDictServiceImpl.java

@@ -40,14 +40,12 @@ public class PaySysDictServiceImpl implements PaySysDictService {
     public List<PaySysDictSelectDto> findList(String value, String label ,String type)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        if (loginUser.getCustomerId() != null) {
-            BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+
+
 
             List<PaySysDictSelectDto> paySysDictSelectDtoList = paySysDictMapper.getAll(value,label,type,loginUser.getTenantId());
             return  paySysDictSelectDtoList;
-        }else {
-            return null;
-        }
+
 
     }
 
@@ -55,11 +53,10 @@ public class PaySysDictServiceImpl implements PaySysDictService {
     public Pagination<PaySysDictSelectDto>findValueLabel(String queryInfo,String type, int pageNum, int pageSize)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
+
 
         PageHelper.startPage(pageNum,pageSize);
-        List<PaySysDictSelectDto> paySysDictSelectDtoList = paySysDictMapper.findValueLabel(queryInfo,type,siteId,customerId);
+        List<PaySysDictSelectDto> paySysDictSelectDtoList = paySysDictMapper.findValueLabel(queryInfo,type,loginUser.getTenantId());
         return new Pagination<>(paySysDictSelectDtoList);
 
     }
@@ -88,25 +85,23 @@ public class PaySysDictServiceImpl implements PaySysDictService {
     public int add(PaySysDict paySysDict)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
 
         //是否存在
-        List<Long> idList = paySysDictMapper.ExitsData(null,paySysDict.getType(),paySysDict.getValue(),paySysDict.getLabel(),siteId,customerId);
+        List<Long> idList = paySysDictMapper.ExitsData(null,paySysDict.getType(),paySysDict.getValue(),paySysDict.getLabel(),loginUser.getTenantId());
         if(idList != null)
         {
             if(idList.size() > 0)
                 throw new ServiceException(-716,"您设置的类型已存相同的键值或标签,请重新设置。");
         }
 
-        paySysDict.setCreateBy(siteId);
+
         paySysDict.setCreateDate(LocalDateTime.now());
-        paySysDict.setUpdateBy(customerId);
+
         paySysDict.setUpdateDate(LocalDateTime.now());
-        paySysDict.setSiteId(loginUser.getSiteId().longValue());
-        paySysDict.setCustomerId(loginUser.getCustomerId().longValue());
+        paySysDict.setCreateBy(new BigInteger(String.valueOf(loginUser.getId())));
+        paySysDict.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
         paySysDict.setDelFlag("0");
-
+        paySysDict.setTenantId(loginUser.getTenantId());
         return paySysDictMapper.insert(paySysDict);
     }
 
@@ -119,11 +114,10 @@ public class PaySysDictServiceImpl implements PaySysDictService {
     public int edit(PaySysDict paySysDict)
     {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+
 
         //同类型下值不可重复
-        List<Long> idList = paySysDictMapper.ExitsData(String.valueOf(paySysDict.getId()),paySysDict.getType(),paySysDict.getValue(),paySysDict.getLabel(),siteId,customerId);
+        List<Long> idList = paySysDictMapper.ExitsData(String.valueOf(paySysDict.getId()),paySysDict.getType(),paySysDict.getValue(),paySysDict.getLabel(),loginUser.getTenantId());
         if(idList != null)
         {
             if(idList.size() > 0)

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

@@ -238,10 +238,7 @@ public class PayTransactiondetailsServiceImp implements PayTransactiondetailsSer
         LoginUser loginUser = UserUtil.getCurrentUser();
         //站点为空则加入用户站点查询
         if( loginUser !=null){
-            //站点权限
-            payTransactiondetailsDto.setSiteId(loginUser.getSiteId());
-            //客户权限
-            payTransactiondetailsDto.setCustomerId(loginUser.getCustomerId());
+
             //数据权限
             payTransactiondetailsDto.setTenantId(loginUser.getTenantId());
 

+ 72 - 67
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/impl/pay/PrintInvoiceQueryResultServiceImpl.java

@@ -38,80 +38,85 @@ public class PrintInvoiceQueryResultServiceImpl {
     PayBaseConfigService payBaseConfigService;
 
     @Async
-    public void queryPrintInvoiceInfo(PayInvoiceprinted payInvoiceprinted) throws Exception {
+    public void queryPrintInvoiceInfo(PayInvoiceprinted payInvoiceprinted) {
         //创建票据打印记录信息
-        if (payInvoiceprinted.getFpqqlsh() != null && payInvoiceprinted.getFpqqlsh().length() > 0) {
-            Thread.sleep(30 * 1000);
-            PayEleInvoiceRequestDto payEleInvoiceRequestDto = new PayEleInvoiceRequestDto();
-            payEleInvoiceRequestDto.setIdentity(payInvoiceprinted.getSaleIdentity());
-            payEleInvoiceRequestDto.setFpqqlsh(new String[]{payInvoiceprinted.getFpqqlsh()});
-            String resultString = DESDZFP.encrypt(JSON.toJSONString(payEleInvoiceRequestDto));
-            Map<String, String> invoiceResult = new HashMap<String, String>();
-            invoiceResult.put("order", resultString);
-            //查询开票地址
+        try {
+            if (payInvoiceprinted.getFpqqlsh() != null && payInvoiceprinted.getFpqqlsh().length() > 0) {
+                //Thread.sleep(30 * 1000);
+                PayEleInvoiceRequestDto payEleInvoiceRequestDto = new PayEleInvoiceRequestDto();
+                payEleInvoiceRequestDto.setIdentity(payInvoiceprinted.getSaleIdentity());
+                payEleInvoiceRequestDto.setFpqqlsh(new String[]{payInvoiceprinted.getFpqqlsh()});
+                String resultString = DESDZFP.encrypt(JSON.toJSONString(payEleInvoiceRequestDto));
+                Map<String, String> invoiceResult = new HashMap<String, String>();
+                invoiceResult.put("order", resultString);
+                //查询开票地址
 
-            List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("PRINT_INVOICE_QUERYURL",payInvoiceprinted.getTenantId());
-            String invoiceUrl = "";
-            if (payBaseConfigDtos.size() == 0) {
-               return;
-            } else {
-                invoiceUrl = payBaseConfigDtos.get(0).getValue();
-            }
-            String invoiceInfo = HttpClientUtils.doPost(invoiceUrl, invoiceResult);
-            PayInvoiceResultDto payInvoiceResultDto = JSON.parseObject(invoiceInfo, PayInvoiceResultDto.class);
-            if (payInvoiceResultDto != null && payInvoiceResultDto.getList().size() > 0) {
-                InvoicePrintInfoResult item = payInvoiceResultDto.getList().get(0);
-                {
-                    if (item.getC_status().equals("2")) {
-                        payInvoiceprinted.setState(1);//已生成
-                        payInvoiceprinted.setOrderNo(item.getC_orderno());
-                        if (StringUtils.isNotBlank(item.getC_kprq()))
-                            payInvoiceprinted.setPrintDate(new Date(new Long(item.getC_kprq())));
-                        payInvoiceprinted.setInvoiceCode(item.getC_fpdm());
-                        payInvoiceprinted.setInvoiceNo(item.getC_fphm());
-                        payInvoiceprinted.setMessage(item.getC_msg());
-                        payInvoiceprinted.setTotalAmount(Double.valueOf(item.getC_bhsje()));
-                        payInvoiceprinted.setInvoiceAmount(Double.valueOf(item.getC_hjse()));
-                        if (StringUtils.isNotBlank(item.getC_bhsje()) && StringUtils.isNotBlank(item.getC_hjse())) {
-                            Double totalPrintAmount = Double.valueOf(item.getC_bhsje()) + Double.valueOf(item.getC_hjse());
-                            payInvoiceprinted.setTotalPrintAmount(totalPrintAmount);
+                List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("PRINT_INVOICE_QUERYURL",payInvoiceprinted.getTenantId());
+                String invoiceUrl = "";
+                if (payBaseConfigDtos.size() == 0) {
+                    return;
+                } else {
+                    invoiceUrl = payBaseConfigDtos.get(0).getValue();
+                }
+                String invoiceInfo = HttpClientUtils.doPost(invoiceUrl, invoiceResult);
+                PayInvoiceResultDto payInvoiceResultDto = JSON.parseObject(invoiceInfo, PayInvoiceResultDto.class);
+                if (payInvoiceResultDto != null && payInvoiceResultDto.getList().size() > 0) {
+                    InvoicePrintInfoResult item = payInvoiceResultDto.getList().get(0);
+                    {
+                        if (item.getC_status().equals("2")) {
+                            payInvoiceprinted.setState(1);//已生成
+                            payInvoiceprinted.setOrderNo(item.getC_orderno());
+                            if (StringUtils.isNotBlank(item.getC_kprq()))
+                                payInvoiceprinted.setPrintDate(new Date(new Long(item.getC_kprq())));
+                            payInvoiceprinted.setInvoiceCode(item.getC_fpdm());
+                            payInvoiceprinted.setInvoiceNo(item.getC_fphm());
+                            payInvoiceprinted.setMessage(item.getC_msg());
+                            payInvoiceprinted.setTotalAmount(Double.valueOf(item.getC_bhsje()));
+                            payInvoiceprinted.setInvoiceAmount(Double.valueOf(item.getC_hjse()));
+                            if (StringUtils.isNotBlank(item.getC_bhsje()) && StringUtils.isNotBlank(item.getC_hjse())) {
+                                Double totalPrintAmount = Double.valueOf(item.getC_bhsje()) + Double.valueOf(item.getC_hjse());
+                                payInvoiceprinted.setTotalPrintAmount(totalPrintAmount);
+                            }
+                            payInvoiceprinted.setCheckCode(item.getC_jym());
+                            payInvoiceprinted.setImgUrl(item.getC_imgUrls());
+                            payInvoiceprinted.setPdfUrl(item.getC_url());
+                            payInvoiceprinted.setJpgUrl(item.getC_jpg_url());
+                            payInvoiceprinted.setRemarks(item.getC_resultmsg());
+                            payInvoiceprinted.setBuyername(item.getC_buyername());
+                            payInvoiceprinted.setTaxnum(item.getC_taxnum());
+                            payInvoiceprinted.setQrCode(item.getQrCode());
+                        }
+                        if (item.getC_status().equals("20") || item.getC_status().equals("21")) {
+                            payInvoiceprinted.setState(0);//开票中 也标注为待生成
+                        }
+                        if (item.getC_status().equals("22") || item.getC_status().equals("24")) {
+                            payInvoiceprinted.setState(4);//开票失败
+                        }
+                        if (item.getC_status().equals("3") || item.getC_status().equals("31")) {
+                            payInvoiceprinted.setState(5);//已作废
                         }
-                        payInvoiceprinted.setCheckCode(item.getC_jym());
-                        payInvoiceprinted.setImgUrl(item.getC_imgUrls());
-                        payInvoiceprinted.setPdfUrl(item.getC_url());
-                        payInvoiceprinted.setJpgUrl(item.getC_jpg_url());
-                        payInvoiceprinted.setRemarks(item.getC_resultmsg());
-                        payInvoiceprinted.setBuyername(item.getC_buyername());
-                        payInvoiceprinted.setTaxnum(item.getC_taxnum());
-                        payInvoiceprinted.setQrCode(item.getQrCode());
-                    }
-                    if (item.getC_status().equals("20") || item.getC_status().equals("21")) {
-                        payInvoiceprinted.setState(0);//开票中 也标注为待生成
-                    }
-                    if (item.getC_status().equals("22") || item.getC_status().equals("24")) {
-                        payInvoiceprinted.setState(4);//开票失败
-                    }
-                    if (item.getC_status().equals("3") || item.getC_status().equals("31")) {
-                        payInvoiceprinted.setState(5);//已作废
                     }
+                    printInvoicePrintService.update(payInvoiceprinted);
                 }
-                printInvoicePrintService.update(payInvoiceprinted);
-            }
-        }
-        //开票失败则恢复实收及蓝票的状态
-        if (payInvoiceprinted.getInvoiceType() == 1) {//开具蓝票
-            if (payInvoiceprinted.getState() == 4 || payInvoiceprinted.getState() == 5) {
-                printInvoicePrintService.updateReceivedIsPrint(false, payInvoiceprinted.getPayseriesno(), payInvoiceprinted.getCustomerId());
             }
-        } else {//蓝票冲红  需明确状态后才更新
-            if (payInvoiceprinted.getState() == 1) {
-                printInvoicePrintService.updateReceivedIsPrint(false, payInvoiceprinted.getPayseriesno(), payInvoiceprinted.getCustomerId());
-                //标记原始蓝票为已冲红 状态3
-                PayInvoiceprinted oldPayInvoiceprinted = new PayInvoiceprinted();
-                oldPayInvoiceprinted.setId(payInvoiceprinted.getCancelInvoiceId());
-                oldPayInvoiceprinted.setState(3);//正常
-                printInvoicePrintService.update(oldPayInvoiceprinted);
+            //开票失败则恢复实收及蓝票的状态
+            if (payInvoiceprinted.getInvoiceType() == 1) {//开具蓝票
+                if (payInvoiceprinted.getState() == 4 || payInvoiceprinted.getState() == 5) {
+                    printInvoicePrintService.updateReceivedIsPrint(false, payInvoiceprinted.getPayseriesno(), payInvoiceprinted.getCustomerId());
+                }
+            } else {//蓝票冲红  需明确状态后才更新
+                if (payInvoiceprinted.getState() == 1) {
+                    printInvoicePrintService.updateReceivedIsPrint(false, payInvoiceprinted.getPayseriesno(), payInvoiceprinted.getCustomerId());
+                    //标记原始蓝票为已冲红 状态3
+                    PayInvoiceprinted oldPayInvoiceprinted = new PayInvoiceprinted();
+                    oldPayInvoiceprinted.setId(payInvoiceprinted.getCancelInvoiceId());
+                    oldPayInvoiceprinted.setState(3);//正常
+                    printInvoicePrintService.update(oldPayInvoiceprinted);
+                }
             }
+        }catch (Exception e){
+            e.printStackTrace();
         }
+
     }
 }

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

@@ -2,6 +2,7 @@ package com.zcxk.rmcp.pay.service.pay;
 
 import com.bz.zoneiot.core.mysql.pageing.Pagination;
 import com.zcxk.rmcp.pay.dto.measurementsettlement.*;
+import com.zcxk.rmcp.pay.entity.pay.BaseClosingAccountInfo;
 
 import java.util.List;
 
@@ -112,4 +113,5 @@ public interface MeasurementSettlementService {
     void setBillingPeriod(MeasurementSettlementDto measurementSettlementDto);
 
     void billPlease(MeasurementSettlementDto measurementSettlementDto);
+    BaseClosingAccountInfo findHistory();
 }

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

@@ -9,6 +9,7 @@ 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;
 
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigInteger;
 import java.util.List;
 
@@ -44,4 +45,6 @@ public interface PayBaseAccountService {
     int updateAddrs(BigInteger custoemrId, String newAddress);
 
     List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes);
+
+    void getCustomerExcel(String queryInfo, String state, String sortColumn, String sortOrder, HttpServletResponse httpServletResponse);
 }

+ 1 - 1
zoniot-pay/zoniot-pay-web/src/main/java/com/zcxk/rmcp/pay/service/pay/PayPayReceivedService.java

@@ -24,6 +24,6 @@ public interface PayPayReceivedService {
 
     void cancelReceivedByPayseriesno(String payseriesno);
 
-    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno, Integer siteId, Integer customerId);
+    List<PayReceivedInvoiceDto> findInvoiceReceivedByPayseriesno(String payseriesno, String tenantId);
 
 }

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

@@ -725,6 +725,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
         LoginUser loginUser = UserUtil.getCurrentUser();
 
         //根据客户编码寻找客户id
+
         PayBaseAccount accounts = payBaseCustomerandmeterrelaMapper.getAccountId(loginUser.getTenantId()
                 ,payBaseCustomerandmeterrela.getAccountnumber());
 
@@ -732,9 +733,8 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             //修改客户信息
             PayBaseAccount saveAccount  = payBaseAccountMapper.get(accounts.getId());
             PayBaseCustomerandmeterrela cus = new PayBaseCustomerandmeterrela();
-            cus.setId(payBaseCustomerandmeterrela.getId());
-            cus.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-            cus.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
+
             List<PayBaseCustomerandmeterrela> cusList = payBaseCustomerandmeterrelaMapper.findList(cus);
             if(cusList == null && cusList.size() ==0){
                 throw new ServiceException(-900, "修改失败,开户信息有误。");
@@ -761,13 +761,14 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             saveAccount.setTelephone(payBaseCustomerandmeterrela.getTelephone());
             saveAccount.setMobilephone(payBaseCustomerandmeterrela.getTelephone());
             saveAccount.setId(accounts.getId());
-            saveAccount.setSiteId(new BigInteger(String.valueOf(loginUser.getSiteId())));
-            saveAccount.setCustomerId(new BigInteger(String.valueOf(loginUser.getCustomerId())));
+
             saveAccount.setUpdateBy(new BigInteger(String.valueOf(loginUser.getId())));
             saveAccount.setUpdateDate(LocalDateTime.now());
             saveAccount.setEmail(payBaseCustomerandmeterrela.getEmail()); //邮箱
             saveAccount.setWaterpropertyId(newWaterPropertyId);
             saveAccount.setAddress(payBaseCustomerandmeterrela.getInstallAddress());
+            saveAccount.setCompanyOrgId(payBaseCustomerandmeterrela.getCompanyOrgId());
+            saveAccount.setDeptOrgId(payBaseCustomerandmeterrela.getDeptOrgId());
             payBaseAccountService.edit(saveAccount);
 
             //修改预存账户名称
@@ -776,8 +777,8 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             rechargeaccountDto.setOfficeId(payBaseCustomerandmeterrela.getOfficeId());
             rechargeaccountDto.setBusinessstate(1);
             rechargeaccountDto.setAccountname(payBaseCustomerandmeterrela.getAccountname());
-            rechargeaccountDto.setSiteId(new BigInteger(String.valueOf(loginUser.getSiteId())));
-            rechargeaccountDto.setCustomerId(new BigInteger(String.valueOf(loginUser.getCustomerId())));
+            rechargeaccountDto.setCompanyOrgId(payBaseCustomerandmeterrela.getCompanyOrgId());
+            rechargeaccountDto.setDeptOrgId(payBaseCustomerandmeterrela.getDeptOrgId());
             payRechargeaccountMapper.update(rechargeaccountDto);
 
             //修改开户信息
@@ -792,8 +793,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             customer.setHousetype(payBaseCustomerandmeterrela.getHousetype());
             customer.setCustomergroup(payBaseCustomerandmeterrela.getCustomergroup());
             customer.setFixedamount(payBaseCustomerandmeterrela.getFixedamount());
-            customer.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-            customer.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
             customer.setUpdateBy(loginUser.getId());
             customer.setUpdateDate(LocalDateTime.now());
             customer.setId(payBaseCustomerandmeterrela.getId());
@@ -814,6 +814,8 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
                 }
             }
             customer.setValveRuleName(RName);
+            customer.setCompanyOrgId(payBaseCustomerandmeterrela.getCompanyOrgId());
+            customer.setDeptOrgId(payBaseCustomerandmeterrela.getDeptOrgId());
             payBaseCustomerandmeterrelaMapper.update(customer);
 
             //编辑开户修改其它地方客户名称
@@ -848,7 +850,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
             //查找待开户信息
             List<PayMeter> meterInfoList = payBaseAccountMapper.findMeterInfo(null,null,"1",null,null,loginUser.getTenantId(),null,null,loginUser.getUserCondition());
             //2.查找用水性质集合
-            List<BaseWaterPropertyDto> propertyList = baseWaterPropertyMapper.getList(null,customerId,siteId);
+            List<BaseWaterPropertyDto> propertyList = baseWaterPropertyMapper.getList(null,loginUser.getTenantId());
             //3.查找结算方式集合
             List<PaySysDictSelectDto> settlementList  = paySysDictMapper.getAll(null,null,"结算方式",loginUser.getTenantId());
             //4.查找证件类型集合

+ 2 - 3
zoniot-pay/zoniot-pay-xxljob-client/src/main/java/com/zcxk/rmcp/pay/job/DeviceSyncServiceHander.java

@@ -114,15 +114,14 @@ public class DeviceSyncServiceHander  {
                                     BeanCopyUtils.copyProperties(meterSyncDto,meterSyncDtoEntity, com.zcxk.rmcp.pay.dto.MeterSyncDto.class);
 
                                     if(StringUtils.isBlank(meterSyncDto.getInitialData())){
-                                        meterSyncDto.setInitialData("0");
+                                        meterSyncDtoEntity.setInitialData("0");
                                     }
                                     LocalDateTime installDate = meterSyncDto.getInstallDate();
                                     if(installDate !=null){
                                         meterSyncDtoEntity.setDateCreate(DateUtil.format(installDate));
                                     }
                                     deviceMapper.updateSync(meterSyncDtoEntity);
-                                    deviceMapper.updateCustomerDevice(meterSyncDtoEntity.getDeviceId(),meterSyncDto.getFileNo());
-                                }
+                               }
                             }
                         }
 

+ 1 - 0
zoniot-pay/zoniot-pay-xxljob-client/src/main/java/com/zcxk/rmcp/pay/job/MeasurementSettlementRecordHander.java

@@ -86,6 +86,7 @@ public class MeasurementSettlementRecordHander {
 
         }catch (Exception e){
             log.info("结算任务出错",e);
+            return ReturnT.FAIL;
         }