zhoujiangyuan 4 lat temu
rodzic
commit
6b8b71297e
21 zmienionych plików z 395 dodań i 56 usunięć
  1. 1 1
      smart-city-platform/build.gradle
  2. 2 1
      smart-city-platform/src/main/java/com/bz/smart_city/commom/security/WebSecurityConfig.java
  3. 2 2
      smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PaySyncDataController.java
  4. 7 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/DeviceMapper.java
  5. 0 3
      smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayBaseAccountMapper.java
  6. 43 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceSyncDto.java
  7. 46 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/MeterSyncDto.java
  8. 21 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/MeterSyncInputDto.java
  9. 9 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/Device.java
  10. 28 0
      smart-city-platform/src/main/java/com/bz/smart_city/quartz/job/DeviceSyncJob.java
  11. 147 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/DeviceSyncServiceImpl.java
  12. 0 21
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayBaseAccountServiceImpl.java
  13. 9 3
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PaySyncDataServiceImpl.java
  14. 10 0
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/DeviceSyncService.java
  15. 0 3
      smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayBaseAccountService.java
  16. 1 1
      smart-city-platform/src/main/resources/application-dev.properties
  17. 7 3
      smart-city-platform/src/main/resources/application-sit.properties
  18. 54 2
      smart-city-platform/src/main/resources/mapper/DeviceMapper.xml
  19. 1 1
      smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml
  20. 4 4
      smart-city-platform/src/main/resources/mapper/pay/AmountWaterUsedAmountMapper.xml
  21. 3 11
      smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

+ 1 - 1
smart-city-platform/build.gradle

@@ -15,7 +15,7 @@ apply plugin: 'java'
 apply plugin: 'org.springframework.boot'
 apply plugin: 'io.spring.dependency-management'
 
-archivesBaseName = "water-api-${releaseTime()}"
+archivesBaseName = "water-api-jf-${releaseTime()}"
 group = 'com.bz'
 //version = '0.0.1-SNAPSHOT'
 sourceCompatibility = 1.8

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

@@ -93,7 +93,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/printinvoice/InvoicePrintRequest")
                 .antMatchers("/waterMeter/getMeterByDeviceNo")
                 .antMatchers("/device/synArchies")
-                .antMatchers("/druid/**");
+                .antMatchers("/druid/**")
+                .antMatchers("/SyncData/synReplaceRecord");
     }
 
 

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/pay/PaySyncDataController.java

@@ -69,7 +69,7 @@ public class PaySyncDataController {
     }
 
 
-    @GetMapping("mobile/assistant/getMeterTypes")
+    @GetMapping("/install/getMeterTypes")
     @ApiOperation(value = "获取表类型")
     public AjaxMessage<List<DeviceTypeDto>> getMeterTypes(
             @ApiParam(value = "分类,1:远传表,2:智能表,9:流量计", required = false) @RequestParam(required = false) Integer parentId
@@ -77,7 +77,7 @@ public class PaySyncDataController {
         return paySyncDataService.queryWaterMeterType(parentId);
     }
 
-    @PostMapping("/amount/synDeviceReplaceRecord")
+    @PostMapping("/SyncData/synReplaceRecord")
     @ApiOperation(value = "同步换表信息")
     public AjaxMessage syncReplaceRecord(
             @ApiParam(value = "同步换表信息", required = true) @RequestBody(required = true) WaterMeterReplaceLog waterMeterReplaceLog

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.dao;
 
+import com.bz.smart_city.dto.MeterSyncDto;
 import com.bz.smart_city.entity.Device;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -16,5 +17,11 @@ public interface DeviceMapper {
 
     int insertList(@Param("devices") List<Device> devices);
 
+    //查询未同步的水表
+    List<Device> getNoSyncList();
+
+    //同步水表信息
+    int updateSync(@Param("devices") MeterSyncDto devices);
+
 }
 

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

@@ -34,9 +34,6 @@ public interface PayBaseAccountMapper {
 
     int batchDel(@Param("accountIds") List<BigInteger> accountIds);
 
-    //根据安装计划ID,获取关联的客户ID、预存帐户ID
-    List<BigInteger> findPlanAccount(@Param("planId") BigInteger planId,@Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
-
     List<PayBaseAccountSelectDto>findList(@Param("queryInfo") String queryInfo,@Param("state") String state, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId,@Param("year") Integer year,@Param("month") Integer month,@Param("programItemList") List<ProgramItem> programItemList);
 
     List<PayBaseAccountSelectAccountnumberDto>findAccountnumberList(@Param("queryInfo") String queryInfo,@Param("payment") BigDecimal payment, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);

+ 43 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/DeviceSyncDto.java

@@ -0,0 +1,43 @@
+package com.bz.smart_city.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by ZJY on 2020-09-28 11:27
+ */
+@Data
+@ApiModel
+public class DeviceSyncDto {
+
+    @ApiModelProperty(value = "设备编号")
+    private	String	deviceNo;
+
+    @ApiModelProperty(value = "地址")
+    private	String	locDesc;
+
+    @ApiModelProperty(value = "客户ID")
+    private	Integer	customerId;
+
+    @ApiModelProperty(value = "水表电子号")
+    private	String	waterMeterNo;
+
+    @ApiModelProperty(value = "状态")
+    private	Integer	status;
+
+    @ApiModelProperty(value = "创建日期")
+    private	String	dateCreate;
+
+    @ApiModelProperty(value = "更新日期")
+    private	String	dateUpdate;
+
+    @ApiModelProperty(value = "水表档案")
+    private	String	fileNo;
+
+    @ApiModelProperty(value = "初始读数")
+    private	String	initialData;
+
+    @ApiModelProperty(value = "设备类型")
+    private	String	deviceType;
+}

+ 46 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/MeterSyncDto.java

@@ -0,0 +1,46 @@
+package com.bz.smart_city.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * Created by ZJY on 2020-09-28 15:15
+ */
+@Data
+@ApiModel
+public class MeterSyncDto {
+    @ApiModelProperty(value = "设备编号")
+    private	String	deviceNo;
+
+    @ApiModelProperty(value = "地址")
+    private	String	locDesc;
+
+    @ApiModelProperty(value = "客户ID")
+    private	Integer	customerId;
+
+    @ApiModelProperty(value = "水表电子号")
+    private	String	waterMeterNo;
+
+    @ApiModelProperty(value = "状态")
+    private	Integer	status;
+
+    @ApiModelProperty(value = "创建时间")
+    private	String	dateCreate;
+
+    @ApiModelProperty(value = "更新时间")
+    private	String	dateUpdate;
+
+    @ApiModelProperty(value = "水表档案号")
+    private	String	fileNo;
+
+    @ApiModelProperty(value = "水表起度")
+    private	String	initialData;
+
+    @ApiModelProperty(value = "设备型号")
+    private	String	deviceType;
+
+    @ApiModelProperty(value = "水表当前状态,0未安装1已安装2已开户")
+    private Integer currStatus;
+
+}

+ 21 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/MeterSyncInputDto.java

@@ -0,0 +1,21 @@
+package com.bz.smart_city.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-28 14:44
+ */
+@Data
+@ApiModel
+public class MeterSyncInputDto {
+    @ApiModelProperty(value = "创建日期 格式:yyyyMMdd")
+    private String createDate;
+    @ApiModelProperty(value = "客户编码,即抄表系统中的customer_id")
+    private String customerNo;
+    @ApiModelProperty(value = "水表档案号,即sc_device表中的metercode")
+    private List<String> fileNo;
+}

+ 9 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/Device.java

@@ -115,4 +115,13 @@ public class Device {
     @ApiModelProperty(value = "客户编号", position = 24)
     private String accountnumber;
 
+    @ApiModelProperty(value = "设备型号,格式示例:华旭/预付费监控表/水表")
+    private String deviceModel;
+
+    @ApiModelProperty(value = "当前状态,0未安装,1已安装,2已开户")
+    private Integer currStatus;
+
+    @ApiModelProperty(value = "水表起度")
+    private String newMeterStart;
+
 }

+ 28 - 0
smart-city-platform/src/main/java/com/bz/smart_city/quartz/job/DeviceSyncJob.java

@@ -0,0 +1,28 @@
+package com.bz.smart_city.quartz.job;
+
+import com.bz.smart_city.service.pay.DeviceSyncService;
+import lombok.extern.slf4j.Slf4j;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.io.Serializable;
+
+/**
+ * Created by ZJY on 2020-09-28 11:01
+ */
+@Slf4j
+@Component
+public class DeviceSyncJob implements Job, Serializable {
+
+    private static final long serialVersionUID = -9195641419825172672L;
+
+    @Autowired
+    DeviceSyncService deviceSyncService;
+
+    @Override
+    public void execute(JobExecutionContext context){
+        deviceSyncService.start();
+    }
+}

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

@@ -0,0 +1,147 @@
+package com.bz.smart_city.service.impl.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.util.HttpRequest;
+import com.bz.smart_city.commom.util.JacksonUtil;
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.DeviceMapper;
+import com.bz.smart_city.dao.pay.AmountWaterUsedAmountMapper;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.MeterSyncDto;
+import com.bz.smart_city.dto.MeterSyncInputDto;
+import com.bz.smart_city.dto.pay.PayBaseConfigDto;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.pay.archives.PayBaseCustomerandmeterrela;
+import com.bz.smart_city.quartz.entity.QuartzEntity;
+import com.bz.smart_city.quartz.job.DeviceSyncJob;
+import com.bz.smart_city.quartz.service.JobAndTriggerService;
+import com.bz.smart_city.service.pay.DeviceSyncService;
+import com.bz.smart_city.service.pay.PayBaseConfigService;
+import com.google.common.collect.Lists;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by ZJY on 2020-09-28 10:22
+ */
+@Slf4j
+@Component
+public class DeviceSyncServiceImpl implements DeviceSyncService, InitializingBean {
+
+    @Resource
+    private JobAndTriggerService jobAndTriggerService;
+    @Autowired
+    private PayBaseConfigService payBaseConfigService;
+    @Value("${Sync.Data.Url}")
+    String SyncUrl;
+
+    @Resource
+    private AmountWaterUsedAmountMapper amountWaterUsedAmountMapper;
+
+    @Resource
+    private DeviceMapper deviceMapper;
+
+    @Override
+    public void afterPropertiesSet() {
+        init();
+    }
+
+    public void init(){
+        //1.构建定时任务,若任务不存在则创建
+        QuartzEntity entity = new QuartzEntity();
+        entity.setJobGroup("设备同步任务");
+        entity.setJobName("DeviceSyncJob");
+        entity.setDescription("同步水表安装信息");
+
+        boolean exists = jobAndTriggerService.isExists(entity);
+
+        if(exists){
+            exists = false;
+            jobAndTriggerService.deleteJob(entity);
+        }
+
+        if(!exists){
+
+            //每隔X分钟一次
+            String cron = "0 */1 * * * ?";
+            log.info("水表安装信息同步"+cron);
+            entity.setCronExpression(cron);
+            entity.setJobClassName(DeviceSyncJob.class.getName());
+            jobAndTriggerService.save(entity);
+        }
+    }
+
+    @Override
+    public void start(){
+        List<PayBaseCustomerandmeterrela> payBaseCustomerandmeterrelas = amountWaterUsedAmountMapper.getCustIdAndSiteId();
+        for (PayBaseCustomerandmeterrela payBaseCustomerandmeterrela: payBaseCustomerandmeterrelas){
+            this.upMeters(payBaseCustomerandmeterrela.getSiteId().intValue(),payBaseCustomerandmeterrela.getCustomerId().intValue());
+        }
+    }
+
+    public void upMeters(Integer siteId, Integer customerId){
+
+        log.info(String.format("水表安装信息同步siteId:%s,customerId:%s",siteId,customerId));
+        //取客户编号
+        String customerNo="";
+        List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",siteId,customerId);
+        for (PayBaseConfigDto item : payBaseConfigDtos){
+            if(item.getName().trim()=="CUSTOMER_NO"){
+                customerNo = item.getValue();
+            }
+        }
+        if(customerNo == "")
+            return;
+
+        //查询未同步的数据
+        String url = SyncUrl+"/api/syncData/meterSync";
+        List<Device> deviceList = deviceMapper.getNoSyncList();
+        if(deviceList != null && deviceList.size() >0){
+
+            List<List<Device>> lists = Lists.partition(deviceList,500);
+            for(List<Device> subDeviceList : lists){
+                MeterSyncInputDto meterSyncInputDto = new MeterSyncInputDto();
+                meterSyncInputDto.setCustomerNo(customerNo);
+                List<String> fileNos = new ArrayList<>();
+                for (Device device:subDeviceList){
+                    fileNos.add(device.getMetercode());
+                }
+                meterSyncInputDto.setFileNo(fileNos);
+
+                //调用接口同步
+                String json = JacksonUtil.obj2String(meterSyncInputDto);
+                try {
+                    String result = HttpRequest.doPost(url,json);
+                    AjaxMessage<List<MeterSyncDto>> ajaxMessage = JacksonUtil.string2Obj(result,AjaxMessage.class);
+
+                    if(ajaxMessage != null){
+                        //更新水表信息
+                        if(ajaxMessage.getStatus() == 0){
+
+                            for(MeterSyncDto meterSyncDto:ajaxMessage.getData()){
+                                meterSyncDto.setCurrStatus(1);
+                                deviceMapper.updateSync(meterSyncDto);
+                            }
+                        }
+                    }
+
+                } catch (IOException e) {
+                    log.error(e.getMessage());
+                }
+            }
+        }
+
+
+
+    }
+
+
+}

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

@@ -86,27 +86,6 @@ public class PayBaseAccountServiceImpl implements PayBaseAccountService {
     }
 
 
-    @Override
-    public  int delByPlanId(BigInteger planId)
-    {
-        LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        if (loginUser.getCustomerId() != null) {
-            BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
-            List<BigInteger> accountIds = payBaseAccountMapper.findPlanAccount(planId,siteId,customerId);
-            if(accountIds != null && accountIds.size() > 0)
-            {
-                //删除预存帐户
-                payRechargeaccountMapper.batchDelete(accountIds);
-
-                //删除客户信息
-                batchDel(accountIds);
-            }
-        }
-
-        return  1;
-    }
-
     //批量删除
     public void batchDel(List<BigInteger> accountIds)
     {

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

@@ -1,5 +1,6 @@
 package com.bz.smart_city.service.impl.pay;
 
+import com.bz.smart_city.commom.exception.ServiceException;
 import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.HttpRequest;
@@ -126,7 +127,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
         }
         installPlanInput.setPlatformType(2);
 
-        //取客户编
+        //取客户编
         String customerNo="";
         List<PayBaseConfigDto> payBaseConfigDtos = payBaseConfigService.getPrintInfo("CUSTOMER_NO",loginUser.getSiteId(),loginUser.getCustomerId());
         for (PayBaseConfigDto item : payBaseConfigDtos){
@@ -135,6 +136,8 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                 installPlanInput.setCustomerNo(customerNo);
             }
         }
+        if(customerNo == "")
+            throw new ServiceException(-900,"客户编号参数未配置"); //客户编号对应抄表系统中的customer_id
 
         //1、小区
         String code = "001";
@@ -220,7 +223,7 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                                         payBaseAccountDto.setAccountnumber(strAccountNumber);
                                         accountLists.add(payBaseAccountDto);
 
-                                        installPlanDoor.setFileNo(strAccountNumber);
+                                        installPlanDoor.setFileNo(strAccountNumber+"01");
                                     }
                                 }
                             }
@@ -246,8 +249,11 @@ public class PaySyncDataServiceImpl implements PaySyncDataService {
                         long deviceId = idWorker.nextId();
                         Device device = new Device();
                         device.setId(deviceId);
-                        device.setMetercode(payBaseAccount.getAccountnumber());
+                        device.setMetercode(payBaseAccount.getAccountnumber()+"01");
                         device.setAccountId(payBaseAccount.getId());
+                        device.setSiteId(loginUser.getSiteId());
+                        device.setCustomerId(Integer.parseInt(customerNo));
+                        device.setCurrStatus(0);
                         deviceList.add(device);
                     }
                     deviceMapper.insertList(deviceList);

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

@@ -0,0 +1,10 @@
+package com.bz.smart_city.service.pay;
+
+/**
+ * Created by ZJY on 2020-09-28 10:21
+ */
+
+public interface DeviceSyncService {
+
+    void start();
+}

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

@@ -36,8 +36,5 @@ public interface PayBaseAccountService {
 
     Pagination<PayMeter>findMeter(String queryInfo, String state, Integer pageNum, Integer pageSize);
 
-    //根据安装计划ID删除用户信息
-    int delByPlanId(BigInteger planId);
-
     int getMaxAccountNumber(String CommunityCode);
 }

+ 1 - 1
smart-city-platform/src/main/resources/application-dev.properties

@@ -1,4 +1,4 @@
-server.port=8090
+server.port=8084
 server.servlet.context-path=/api
 
 spring.thymeleaf.prefix=classpath:/templates/

+ 7 - 3
smart-city-platform/src/main/resources/application-sit.properties

@@ -1,4 +1,4 @@
-server.port=8080
+server.port=8084
 server.servlet.context-path=/api
 
 #日志配置
@@ -9,8 +9,9 @@ spring.thymeleaf.prefix=classpath:/templates/
 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 #使用druid数据源
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
-spring.datasource.url=jdbc:mysql://10.0.0.161:3306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
+#spring.datasource.url=jdbc:mysql://10.0.0.161:3306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&failOverReadOnly=false
 #spring.datasource.url=jdbc:mysql://114.135.61.188:23305/smart_city?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.url=jdbc:mysql://10.0.0.161:3306/smart_city_sit_toll_system?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
 spring.datasource.username=root
 spring.datasource.password=100Zone@123
 spring.datasource.druid.initial-size=5
@@ -133,4 +134,7 @@ udip.unit.url=http://114.135.61.188:48322
 invoice.print.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/cxfKp/cxfServerKpOrderSync.action
 invoice.query.url=http://nnfpbox.nuonuocs.cn/shop/buyer/allow/ecOd/queryElectricKp.action
 #光电直读agent url
-gd.agent.url=http://10.0.0.160:6377
+gd.agent.url=http://10.0.0.160:6377
+
+#抄表数据同步接口
+Sync.Data.Url=http://114.135.61.188:58080

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

@@ -38,7 +38,10 @@
         water_meter_no,
         water_meter_file_no,
         customer_id,
-        udip_id
+        udip_id,
+        curr_status,
+        new_meter_start,
+        device_model
         )VALUES
         <foreach collection="devices" item="device" index="index" separator=",">
             (
@@ -65,10 +68,59 @@
             #{device.waterMeterNo,jdbcType=VARCHAR},
             #{device.waterMeterFileNo,jdbcType=VARCHAR},
             #{device.customerId,jdbcType=INTEGER},
-            #{device.udipId,jdbcType=VARCHAR}
+            #{device.udipId,jdbcType=VARCHAR},
+            #{device.currStatus,jdbcType=INTEGER},
+            #{device.newMeterStart,jdbcType=VARCHAR},
+            #{device.deviceModel,jdbcType=VARCHAR}
             )
         </foreach>
     </insert>
 
+    <update id="updateSync">
+        update sc_device
+        <set>
+            <if test="devices.deviceNo != null "> device_no = #{devices.deviceNo,jdbcType=VARCHAR},</if>
+            <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.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>
+            <if test="devices.initialData != null">new_meter_start = #{devices.initialData,jdbcType=VARCHAR},</if>
+        </set>
+        where metercode = #{devices.fileNo,jdbcType=VARCHAR}
+    </update>
+
+    <select id="getNoSyncList" resultType="com.bz.smart_city.entity.Device">
+        select
+        id,
+        device_no,
+        device_type,
+        sys_id,
+        site_id,
+        building_id,
+        `floor`,
+        loc_desc,
+        related_device_no,
+        manufacturer_id,
+        device_status,
+        `status`,
+        is_tag,
+        x_coordinates,
+        y_coordinates,
+        create_by,
+        update_by,
+        date_create,
+        date_update,
+        plan_id,
+        water_meter_no,
+        water_meter_file_no,
+        customer_id,
+        udip_id,
+        curr_status,
+        new_meter_start,
+        device_model
+        from sc_device where curr_status = 0
+    </select>
 </mapper>
 

+ 1 - 1
smart-city-platform/src/main/resources/mapper/PayBaseCustomerandmeterrelaMapper.xml

@@ -513,7 +513,7 @@
     </select>
 
     <update id="updateMeterInstallOpen">
-        update sc_install_list set is_accepted =#{isAccepted},date_update=#{date},update_by =#{updateBy} where device_id =#{id}
+        update sc_device set curr_status =#{isAccepted},date_update=#{date} where id =#{id}
     </update>
 
     <select id="getOfficeId" resultType="com.bz.smart_city.entity.Organization">

+ 4 - 4
smart-city-platform/src/main/resources/mapper/pay/AmountWaterUsedAmountMapper.xml

@@ -133,10 +133,10 @@
 	</update>
 
 	<select id="getWaterUsedAmountByMeterId" resultType="com.bz.smart_city.dto.pay.AmountWaterUsedAmountDto">
-		select a.create_date,w.install_time installdate,a.year,a.month
-		from sc_install_list w
-		left join pay_amount_waterusedamount a on a.watermeter_id = w.device_id
-   		 where w.device_id = #{waterMeterId}
+		select a.create_date,w.date_create installdate,a.year,a.month
+		from sc_device w
+		left join pay_amount_waterusedamount a on a.watermeter_id = w.id
+   		 where w.id = #{waterMeterId}
 		order by a.year desc,a.month desc
 	</select>
 

+ 3 - 11
smart-city-platform/src/main/resources/mapper/pay/PayBaseAccountMapper.xml

@@ -78,14 +78,6 @@
         </foreach>
     </delete>
 
-    <select id="findPlanAccount" resultType="java.math.BigInteger">
-        select
-        pba.id
-        from sc_install_list sil
-        left join pay_base_account pba on pba.id = sil.account_id and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
-        left join pay_pay_rechargeaccount ppr on ppr.account_id = pba.id and ppr.site_id=#{siteId} and ppr.customer_id=#{customerId}
-          where  sil.install_plan_id=#{planId}
-    </select>
 
     <update id="update">
         update pay_base_account
@@ -478,8 +470,8 @@
             pba.accountnumber as accountnumber,
             pba.id as accountId,
             scd.id as deviceId,
-            scd.is_accepted state,
-            (case scd.is_accepted  WHEN  2 then '已开户' when 1 then '待开户' else '待验收' end) stateName,
+            scd.curr_status state,
+            (case scd.curr_status  WHEN  2 then '已开户' when 1 then '待开户' else '待验收' end) stateName,
             IFNULL(rd.reading,0) as CurrData
         from  sc_device scd
         left join pay_base_account pba on pba.id = scd.account_id  and pba.site_id=#{siteId} and pba.customer_id=#{customerId}
@@ -499,7 +491,7 @@
             )
         </if>
         <if test="state != null and state != '' ">
-            and IFNULL(scinstall.is_accepted,0) = #{state,jdbcType=INTEGER}
+            and IFNULL(scinstall.curr_status,0) = #{state,jdbcType=INTEGER}
         </if>
         <if test="programItemList != null and programItemList.size() > 0">
             and ( ppr.office_id is null