Просмотр исходного кода

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

lin 3 лет назад
Родитель
Сommit
97382ad180

+ 4 - 0
zoniot-pay/zoniot-pay-core/src/main/java/com/zcxk/rmcp/pay/dao/pay/BaseWaterPropertyMapper.java

@@ -34,4 +34,8 @@ public interface BaseWaterPropertyMapper {
 
 
     List<PayBaseWaterprice> getFeeInfo(@Param("id") BigInteger waterPropertyId, @Param("level") Integer level, @Param("tenantId") String tenantId, @Param("companyOrgId") Integer companyOrgId, @Param("deptOrgId") Integer deptOrgId);
+
+    Integer existData(@Param("id") BigInteger id,
+                      @Param("companyOrgId") Integer companyOrgId,
+                      @Param("name") String name);
 }

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

@@ -29,7 +29,7 @@ public interface PayBaseWatercategoryMapper {
 
     List<PayBaseWatercategoryDto> getAll(@Param("name") String name, @Param("tenantId") String tenantId, @Param("companyId") Integer companyId);
     //判断数据是否存在
-    List<Long> ExitsData(@Param("id") String id, @Param("name") String name, @Param("tenantId") String tenantId);
+    List<Long> ExitsData(@Param("id") String id, @Param("name") String name, @Param("tenantId") String tenantId,@Param("companyId") Integer companyId);
 
     int isUsed(@Param("id") BigInteger id, @Param("tenantId") String tenantId, @Param("companyOrgId") Integer companyOrgId, @Param("deptOrgId") Integer deptOrgId);
 

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

@@ -29,7 +29,7 @@ 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("feeType") String feeType, @Param("tenantId") String tenantId);
+    List<PayBaseWaterprice> ExitsData(@Param("id") String id, @Param("feename") String feename, @Param("feeType") String feeType, @Param("tenantId") String tenantId, @Param("companyOrgId") Integer companyOrgId);
 
     List<PayBaseWaterpriceSelectDto> getPrice(@Param("waterProperId") Long waterProperId, @Param("tenantId") String tenantId);
 }

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

@@ -255,7 +255,7 @@
 
     <update id="updateCustomerState">
         update pay_base_customerandmeterrela set businessstate =#{state},update_by=#{updateBy},update_date =#{date},canceldate =#{date}
-        where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
+        where  id =#{id}
     </update>
 
     <update id="updateDeviceState">
@@ -556,9 +556,8 @@
     </update>
 
     <select id="queryWaterUserdStateCount" resultType="java.lang.Integer">
-        select count(1) from rmcp_measurement_instance a
-		  join rmcp_measurement_record b on a.id=b.plan_id
-		where a.checkout_id=0 and b.device_id = #{id}
+        select count(1) from rmcp_measurement_record b
+		where b.device_id = #{id} and b.approval_status=0
     </select>
 
 
@@ -609,13 +608,13 @@
 
     <update id="updateRechargeAccountState">
         update pay_pay_rechargeaccount set businessstate ='2',update_by=#{updateBy},update_date =#{date}
-        where site_id =#{siteId} and customer_id =#{customerId} and account_id =#{id}
+        where account_id =#{id}
     </update>
 
 
     <update id="updateAccountState">
         update pay_base_account set state =#{state},update_by=#{updateBy},update_date =#{date}
-        where site_id =#{siteId} and customer_id =#{customerId} and id =#{id}
+        where  id =#{id}
     </update>
 
     <select id="getResetLadderList" resultType="com.zcxk.rmcp.pay.dto.pay.PayBaseCustomerandmeterrelaDto">

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

@@ -221,4 +221,9 @@
         select count(1) as num from  pay_base_waterproperty where name =#{name}
         and site_id =#{siteId} and customer_id =#{customerId}
     </select>
+	<select id="existData" resultType="java.lang.Integer">
+		select count(1) as num from  pay_base_waterproperty where name =#{name}
+															  and company_org_id =#{companyOrgId}
+		<if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id}</if>
+	</select>
 </mapper>

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

@@ -274,7 +274,7 @@
         IFNULL(paw.sum_payamount,0) sumPayamount,
         pba.state as state,
         (select label from pay_sys_dict where value = pba.state and type='客户状态' and tenant_id=#{tenantId} ) stateName,
-        IFNULL(rech.balance,0) as remaining,
+        IFNULL(rech.remaining,0) as remaining,
         <!-- dt.remaining ,-->
         (select label from pay_sys_dict where value = pba.idtype and type='证件类型' and tenant_id=#{tenantId}) idTypeName,
         pba.accountnumber,

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

@@ -114,6 +114,7 @@
         select id from pay_base_watercategory pbw
         where pbw.tenant_id=#{tenantId}
         and pbw.name = #{name}
+        and pbw.company_org_id=#{companyId}
         <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">

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

@@ -145,6 +145,7 @@
         from pay_base_waterprice pbw
         where pbw.tenant_id=#{tenantId}
         and pbw.feename = #{feename} and pbw.feetype = #{feeType}
+        and pbw.company_org_id=#{companyOrgId}
         <if test="id != null and id != ''"> and pbw.id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
     <select id="getPrice" resultType="com.zcxk.rmcp.pay.dto.pay.PayBaseWaterpriceSelectDto">

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

@@ -1,5 +1,6 @@
 package com.zcxk.rmcp.pay.service.impl.pay;
 
+import com.zcxk.rmcp.pay.commom.exception.ServiceException;
 import com.zcxk.rmcp.pay.commom.model.Pagination;
 import com.zcxk.rmcp.pay.commom.util.SnowflakeIdWorker;
 
@@ -58,12 +59,12 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public int add(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
         BaseWaterPropertyDto baseWaterPropertyDto = new BaseWaterPropertyDto();
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger id = BigInteger.valueOf(idWorker.nextId());
-
+        isExistData(baseWaterPropertyFormDto);
         baseWaterPropertyDto.setId(id);
         baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());
         baseWaterPropertyDto.setCategoryId(baseWaterPropertyFormDto.getCategoryId());
@@ -133,10 +134,17 @@ public class BaseWaterPropertyServiceImpl implements BaseWaterPropertyService {
     public int getCustomerCountByPropertyId(BigInteger id) {
         return baseWaterPropertyMapper.getCustomerCountByPropertyId(id);
     }
-
+    private void isExistData(BaseWaterPropertyFormDto baseWaterPropertyFormDto){
+        Integer count=baseWaterPropertyMapper.existData(baseWaterPropertyFormDto.getId(),
+                baseWaterPropertyFormDto.getCompanyOrgId(),baseWaterPropertyFormDto.getName());
+        if(count>0){
+            throw new ServiceException(-716,"该名称已存在,请修改。");
+        }
+    }
     @Override
     public int edit(BaseWaterPropertyFormDto baseWaterPropertyFormDto) {
         BigInteger id = baseWaterPropertyFormDto.getId();
+        isExistData(baseWaterPropertyFormDto);
         LoginUser loginUser = UserUtil.getCurrentUser();
         BaseWaterPropertyDto baseWaterPropertyDto =baseWaterPropertyMapper.get(id,loginUser.getTenantId());
         baseWaterPropertyDto.setName(baseWaterPropertyFormDto.getName());

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

@@ -58,7 +58,7 @@ public class PayBaseWatercategoryServiceImpl implements PayBaseWatercategoryServ
 
 
         //判断不能重名
-        List<Long> longs = payBaseWatercategoryMapper.ExitsData(null,payBaseWatercategory.getName(),loginUser.getTenantId());
+        List<Long> longs = payBaseWatercategoryMapper.ExitsData(null,payBaseWatercategory.getName(),loginUser.getTenantId(),payBaseWatercategory.getCompanyOrgId());
         if(longs != null)
         {
             if (longs.size() > 0)
@@ -84,7 +84,8 @@ public class PayBaseWatercategoryServiceImpl implements PayBaseWatercategoryServ
             throw new ServiceException(-717,"该用水类别已被应用,无法编辑。");
 
         //判断不能重名
-        List<Long> longs = payBaseWatercategoryMapper.ExitsData(String.valueOf(payBaseWatercategory.getId()),payBaseWatercategory.getName(),loginUser.getTenantId());
+        List<Long> longs = payBaseWatercategoryMapper.ExitsData(String.valueOf(payBaseWatercategory.getId()),payBaseWatercategory.getName(),
+                loginUser.getTenantId(),payBaseWatercategory.getCompanyOrgId());
         if(longs != null)
         {
             if (longs.size() > 0)

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

@@ -100,7 +100,7 @@ public class PayBaseWaterpriceServiceImpl implements PayBaseWaterpriceService {
 
         //判断是否存在
         List<PayBaseWaterprice> payBaseWaterpriceList = payBaseWaterpriceMapper.ExitsData(null,payBaseWaterpriceRequestDto.getFeename(),
-                String.valueOf(payBaseWaterpriceRequestDto.getFeetype()),loginUser.getTenantId());
+                String.valueOf(payBaseWaterpriceRequestDto.getFeetype()),loginUser.getTenantId(),payBaseWaterpriceRequestDto.getCompanyOrgId());
         if(payBaseWaterpriceList.size() > 0)
             throw new ServiceException(-716,"该名称已存在,请修改。");
 
@@ -140,7 +140,7 @@ public class PayBaseWaterpriceServiceImpl implements PayBaseWaterpriceService {
         //修改后的数据是否重复
         List<PayBaseWaterprice> payBaseWaterpriceList = payBaseWaterpriceMapper.ExitsData(
                 String.valueOf(payBaseWaterprice.getId()),payBaseWaterprice.getFeename(),
-                String.valueOf(payBaseWaterprice.getFeetype()), loginUser.getTenantId());
+                String.valueOf(payBaseWaterprice.getFeetype()), loginUser.getTenantId(), payBaseWaterprice.getCompanyOrgId());
         if(payBaseWaterpriceList.size() > 0)
             throw new ServiceException(-716,"该名称已存在,请修改。");
 

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

@@ -1170,8 +1170,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
         PayBaseCustomerandmeterrela customer = new PayBaseCustomerandmeterrela();
         customer.setId(customerId);
         customer.setMetercode(metercode);
-        customer.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-        customer.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
         List<PayBaseCustomerandmeterrela> customerList = payBaseCustomerandmeterrelaMapper.findList(customer);
         for(int i=0; i<customerList.size(); i++){
 
@@ -1202,6 +1201,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
                 return msg;
             }
         }
+        forceCancel(customerId,metercode);
         return msg;
     }
 
@@ -1212,8 +1212,7 @@ public class PayBaseCustomerandmeterrelaServiceImpl implements PayBaseCustomeran
         PayBaseCustomerandmeterrela customer = new PayBaseCustomerandmeterrela();
         customer.setId(customerId);
         customer.setMetercode(metercode);
-        customer.setSiteId(BigInteger.valueOf(loginUser.getSiteId()));
-        customer.setCustomerId(BigInteger.valueOf(loginUser.getCustomerId()));
+
         List<PayBaseCustomerandmeterrela> customerList = payBaseCustomerandmeterrelaMapper.findList(customer);
         int result = 0;
         if(customerList != null && customerList.size() > 0){