Procházet zdrojové kódy

水表同步、换表接口权限

zhoujiangyuan před 4 roky
rodič
revize
ee7933ede9

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

@@ -94,7 +94,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies")
                 .antMatchers("/druid/**")
-                .antMatchers("/SyncData/synReplaceRecord");
+                .antMatchers("/amount/synDeviceReplaceRecord");
     }
 
 

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

@@ -18,7 +18,7 @@ public interface DeviceMapper {
     int insertList(@Param("devices") List<Device> devices);
 
     //查询未同步的水表
-    List<Device> getNoSyncList();
+    List<Device> getNoSyncList(@Param("siteId") Integer siteId,@Param("customerId") Integer customerId);
 
     //同步水表信息
     int updateSync(@Param("devices") MeterSyncDto devices);

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

@@ -94,7 +94,7 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
         String customerNo="";
         List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",siteId,customerId);
         for (PayBaseConfigDto item : payBaseConfigDtos){
-            if(item.getName().trim()=="CUSTOMER_NO"){
+            if("CUSTOMER_NO".equals(item.getName().trim())){
                 customerNo = item.getValue();
             }
         }
@@ -103,12 +103,13 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
 
         //查询未同步的数据
         String url = SyncUrl+"/api/syncData/meterSync";
-        List<Device> deviceList = deviceMapper.getNoSyncList();
+        List<Device> deviceList = deviceMapper.getNoSyncList(siteId,customerId);
         if(deviceList != null && deviceList.size() >0){
 
             List<List<Device>> lists = Lists.partition(deviceList,500);
             for(List<Device> subDeviceList : lists){
                 MeterSyncInputDto meterSyncInputDto = new MeterSyncInputDto();
+
                 meterSyncInputDto.setCustomerNo(customerNo);
                 List<String> fileNos = new ArrayList<>();
                 for (Device device:subDeviceList){
@@ -125,8 +126,12 @@ public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBea
                     if(ajaxMessage != null){
                         //更新水表信息
                         if(ajaxMessage.getStatus() == 0){
+                            List<MeterSyncDto> meterSyncDtoList = ajaxMessage.getData();
+
+                            for(int i=0;i<meterSyncDtoList.size();i++){
 
-                            for(MeterSyncDto meterSyncDto:ajaxMessage.getData()){
+                                String strList = JacksonUtil.obj2String(meterSyncDtoList.get(i));
+                                MeterSyncDto meterSyncDto = JacksonUtil.string2Obj(strList,MeterSyncDto.class);
                                 meterSyncDto.setCurrStatus(1);
                                 deviceMapper.updateSync(meterSyncDto);
                             }

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

@@ -127,7 +127,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         }
         installPlanInput.setPlatformType(2);
 
-        //取客户编号
+/*        //取客户编号
         String customerNo="";
         List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",loginUser.getSiteId(),loginUser.getCustomerId());
         if(payBaseConfigDtos.size() == 1){
@@ -138,7 +138,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         }
 
         if(customerNo == "")
-            throw new ServiceException(-900,"客户编号参数未配置"); //客户编号对应抄表系统中的customer_id
+            throw new ServiceException(-900,"客户编号参数未配置"); //客户编号对应抄表系统中的customer_id*/
 
         //1、小区
         String code = "001";
@@ -259,7 +259,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                         device.setMetercode(payBaseAccount.getAccountnumber()+"01");
                         device.setAccountId(payBaseAccount.getId());
                         device.setSiteId(loginUser.getSiteId());
-                        device.setCustomerId(Integer.parseInt(customerNo));
+                        device.setCustomerId(loginUser.getCustomerId());
                         device.setCurrStatus(0);
                         deviceList.add(device);
                     }

+ 6 - 2
smart-city-platform/src/main/resources/mapper/DeviceMapper.xml

@@ -87,6 +87,7 @@
             <if test="devices.deviceType != null"> device_model = #{devices.deviceType,jdbcType=INTEGER},</if>
             <if test="devices.locDesc != null">loc_desc = #{devices.locDesc,jdbcType=VARCHAR},</if>
             <if test="devices.waterMeterNo != null">water_meter_no = #{devices.waterMeterNo,jdbcType=VARCHAR},</if>
+            <if test="devices.dateCreate != null">date_create = #{devices.dateCreate,jdbcType=VARCHAR},</if>
             <if test="devices.dateUpdate != null">date_update = #{devices.dateUpdate,jdbcType=VARCHAR},</if>
             <if test="devices.status != null">status = #{devices.status,jdbcType=INTEGER},</if>
             <if test="devices.currStatus != null">curr_status = #{devices.currStatus,jdbcType=INTEGER},</if>
@@ -123,8 +124,11 @@
         udip_id,
         curr_status,
         new_meter_start,
-        device_model
-        from sc_device where curr_status = 0
+        device_model,
+        metercode
+        from sc_device where curr_status = 0 and metercode is not null
+        <if test="siteId != null"> and site_id = #{siteId,jdbcType=INTEGER}</if>
+        <if test="customerId != null"> and customer_id = #{customerId,jdbcType=INTEGER}</if>
     </select>
 </mapper>