Browse Source

增加根据水表编码查询客户信息接口

wangli 4 years ago
parent
commit
4a0c443458

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java

@@ -92,7 +92,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/payFee/payFee")
                 .antMatchers("/payFee/payFee","/payFee/checkBill","/payFee/payFeeAmount","/payFee/queryUserInfo")
                 .antMatchers("/amount/synDeviceReplaceRecord")
-                .antMatchers("/pay/synAccountInfo")
+                .antMatchers("/pay/synAccountInfo","/pay/getAccountInfoByMetercode")
                 .antMatchers("/printinvoice/InvoicePrintRequest")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies")

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

@@ -6,6 +6,7 @@ import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -150,5 +151,14 @@ public class PayBaseAccountController {
             return new AjaxMessage(1,"未查询到有效数据","");
         }
     }
+    @GetMapping("/getAccountInfoByMetercode")
+    @ApiOperation("根据水表编码获取客户信息")
+    public AjaxMessage<List<AccountInfo>> getAccountInfoByMetercode(
+            @ApiParam(value = "水表编码") @RequestParam("metercodes") List<String> metercodes){
+        if(metercodes.size()>0){
+            return new AjaxMessage<>(ResultStatus.OK,payBaseAccountService.getAccountInfoByMetercode(metercodes));
+        }
+        return new AjaxMessage(ResultStatus.ERROR,"查询条件为空");
+    }
 
 }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java

@@ -4,6 +4,7 @@ import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
 import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
@@ -65,4 +66,6 @@ public interface PayBaseAccountMapper {
     int updateDeviceAddr(@Param("accountId")BigInteger accountId,@Param("siteId") Integer siteId, @Param("customerId") Integer customerId,@Param("address") String address);
 
     List<PayBaseAccount> getCustIdAndSiteId();
+
+    List<AccountInfo> getAccountInfoByMetercode(@Param("metercodes")List<String> metercodes);
 }

+ 26 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/pay/archives/AccountInfo.java

@@ -0,0 +1,26 @@
+package com.bz.smart_city.entity.pay.archives;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description
+ * @auto wangli
+ * @data 2021/2/21 9:59
+ */
+@Data
+@Api(value = "客户信息")
+public class AccountInfo {
+
+    @ApiModelProperty("水表编码")
+    private String metercode;
+    @ApiModelProperty("客户名称")
+    private String userName;
+    @ApiModelProperty("客户编码")
+    private String accountNumber;
+    @ApiModelProperty("联系电话")
+    private String phone;
+
+
+}

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

@@ -10,6 +10,7 @@ import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 import com.bz.smart_city.service.pay.PayBaseAccountService;
 import com.github.pagehelper.PageHelper;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -403,4 +404,8 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
 
     }
 
+    @Override
+    public List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes){
+        return payBaseAccountMapper.getAccountInfoByMetercode(metercodes);
+    }
 }

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

@@ -1,11 +1,13 @@
 package com.bz.smart_city.service.pay;
 
 
+import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.pay.PayBaseAccount;
 import com.bz.smart_city.entity.pay.PayMeter;
+import com.bz.smart_city.entity.pay.archives.AccountInfo;
 
 import java.math.BigInteger;
 import java.util.List;
@@ -40,4 +42,6 @@ public interface PayBaseAccountService {
     List<SynAccountInfo> getSynAccountInfo(String createDate);
 
     int updateAddrs(BigInteger custoemrId,String newAddress);
+
+    List<AccountInfo> getAccountInfoByMetercode(List<String> metercodes);
 }

+ 16 - 0
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -658,4 +658,20 @@
         c.customer_id is not null  and c.site_id is not null
         group by c.customer_id, c.site_id
     </select>
+
+    <select id="getAccountInfoByMetercode" resultType="com.bz.smart_city.entity.pay.archives.AccountInfo">
+        select
+            d.metercode
+            ,a.`name` as "userName"
+            ,a.accountnumber as "accountNumber"
+            ,a.mobilephone as "phone"
+        from pay_base_customerandmeterrela c
+        left join pay_base_account a on c.account_id = a.id
+        left join sc_device d on c.watermeter_id =d.id
+        where d.metercode in
+        <foreach collection="metercodes" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>