Explorar o código

Merge branch '0727' of http://114.135.61.188:53000/ZONIOT/water-iot into 0727

Xiaojh %!s(int64=4) %!d(string=hai) anos
pai
achega
a1ce605a18

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

@@ -0,0 +1,81 @@
+package com.bz.smart_city.controller.pay;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
+import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
+import com.bz.smart_city.service.pay.PayReportService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 10:17
+ */
+@RestController
+@RequestMapping("/payreport")
+@Api(tags = "计费系统-报表")
+public class PayReportController {
+    @Autowired
+    PayReportService payReportService;
+
+    @ApiOperation(value="交易明细报表")
+    @GetMapping("/getPayTransactiondetailsReport")
+    public AjaxMessage<Pagination<PayTransactiondetailsReportDto>> getPayTransactiondetailsReport(
+            @ApiParam(value = "部门ID", required = false) @RequestParam(required = false) Integer officeId,
+            @ApiParam(value = "支付方式,字典类:type=支付方式", required = false) @RequestParam(required = false) Integer payway,
+            @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
+            @ApiParam(value = "开始时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String beginTime,
+            @ApiParam(value = "结束时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String endTime,
+            @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
+            @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize
+
+    ){
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
+        PayTransactiondetailsReportDto inParams = new PayTransactiondetailsReportDto();
+
+        inParams.setOfficeId(officeId);
+        inParams.setPayWay(payway);
+        if(operateId != null)
+        inParams.setCreateBy(new BigInteger(String.valueOf(operateId)));
+
+        if(StringUtils.isNotBlank(beginTime)){
+            inParams.setBeginTime( LocalDateTime.parse(beginTime,df));
+        }
+        if(StringUtils.isNotBlank(endTime)){
+            inParams.setEndTime(LocalDateTime.parse(endTime, df));
+        }
+
+        Pagination<PayTransactiondetailsReportDto> pagination = payReportService.getPayTransactiondetailsReport(inParams,pageNum,pageSize);
+        return new AjaxMessage<>(ResultStatus.OK,pagination);
+    }
+
+    @ApiOperation(value="操作员明细报表")
+    @GetMapping("/getPayOperatordetailsReport")
+    public AjaxMessage<Pagination<PayOperatordetailsReportDto>> getPayOperatordetailsReport(
+            @ApiParam(value = "小区ID", required = false) @RequestParam(required = false) Integer communityId,
+            @ApiParam(value = "收费员ID",required = false)@RequestParam(required = false) Integer operateId,
+            @ApiParam(value = "小计",required = false) @RequestParam(required = false) Integer subtotal,
+            @ApiParam(value = "小计状态,0等于,1小于,2大于",required = false) @RequestParam(required = false) Integer subtotalSt,
+            @ApiParam(value = "开始时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String beginTime,
+            @ApiParam(value = "结束时间yyyyMMddhhmmss", required = false) @RequestParam(required = false) String endTime,
+            @ApiParam(value = "页数,非必传,默认第一页", required = false, defaultValue = "1") @RequestParam(required = false, defaultValue = "1") int pageNum,
+            @ApiParam(value = "条数,非必传,默认10条", required = false, defaultValue = "10") @RequestParam(required = false, defaultValue = "10") int pageSize
+
+    ){
+        return null;
+    }
+
+}

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

@@ -2,6 +2,7 @@ package com.bz.smart_city.dao.pay;
 
 import com.bz.smart_city.dto.pay.AmountWaterUsedAmountDto;
 import com.bz.smart_city.dto.pay.MeterReadRecordDto;
+import com.bz.smart_city.dto.pay.ReplaceMeterDto;
 import com.bz.smart_city.entity.MeterReadRecord;
 import com.bz.smart_city.entity.ProgramItem;
 import com.bz.smart_city.entity.pay.AmountWaterUsedAmount;
@@ -64,4 +65,8 @@ public interface AmountWaterUsedAmountMapper {
     List<BigInteger> getWaterMeterIdByDay(@Param("siteId") Integer siteId, @Param("customerId")Integer customerId);
 
     List<PayBaseCustomerandmeterrela> getCustIdAndSiteId();
+
+    @MapKey("deviceId")
+    HashMap<BigInteger, ReplaceMeterDto> getRepalceRecord(@Param("list")List<BigInteger> list);
+
 }

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

@@ -0,0 +1,21 @@
+package com.bz.smart_city.dao.pay;
+
+import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
+import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 13:49
+ */
+@Mapper
+public interface PayReportMapper {
+
+    List<PayTransactiondetailsReportDto>getPayTransactiondetailsReportList(PayTransactiondetailsReportDto inParams);
+
+    PayTransactiondetailsReportDto getPayTransactiondetailsReportCount(PayTransactiondetailsReportDto inParams);
+
+    List<PayOperatordetailsReportDto>getPayOperatordetailsReportList(PayOperatordetailsReportDto inParams);
+}

+ 49 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayArrearagedetailsReportDto.java

@@ -0,0 +1,49 @@
+package com.bz.smart_city.dto.pay;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javafx.scene.control.cell.PropertyValueFactory;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 10:39
+ */
+@Data
+@ApiModel("欠费明细报表")
+public class PayArrearagedetailsReportDto {
+    @ApiModelProperty(value = "客户编码")
+    private String accountNumber;
+
+    @ApiModelProperty(value = "客户名称")
+    private String accountName;
+
+    @ApiModelProperty(value = "客户地址")
+    private String accountAddr;
+
+    @ApiModelProperty(example = "13800000001",notes = "手机号码")
+    private String	telephone	;
+
+    @ApiModelProperty(value = "水量")
+    private Integer payamount;
+
+    @ApiModelProperty(value = "水费")
+    private BigDecimal payamountFee;
+
+    @ApiModelProperty(value = "污水费")
+    private BigDecimal polluteFee;
+
+    @ApiModelProperty(value = "不征税")
+    private BigDecimal taxExempt;
+
+    @ApiModelProperty(value = "违约金")
+    private BigDecimal lateFee;
+
+    @ApiModelProperty(value = "超计划水费")
+    private BigDecimal cjhFee;
+
+    @ApiModelProperty("小计")
+    private BigDecimal subtotal;
+}

+ 57 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayOperatordetailsReportDto.java

@@ -0,0 +1,57 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 10:38
+ */
+@Data
+@ApiModel("收费员明细报表")
+public class PayOperatordetailsReportDto {
+    @ApiModelProperty(value = "客户编码")
+    private String accountNumber;
+
+    @ApiModelProperty(value = "客户名称")
+    private String accountName;
+
+    @ApiModelProperty(value = "客户地址")
+    private String accountAddr;
+
+    @ApiModelProperty(value = "小区ID")
+    private Integer community;
+
+    @ApiModelProperty(value = "小区名称")
+    private  String communityName;
+
+    @ApiModelProperty(value = "实收")
+    private BigDecimal received;
+
+    @ApiModelProperty(value = "应收")
+    private BigDecimal receivable;
+
+    @ApiModelProperty("小计")
+    private BigDecimal subtotal;
+
+    @ApiModelProperty(value = "交易时间")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private LocalDateTime transTime;
+
+    @ApiModelProperty(value = "收费员id")
+    private BigInteger createBy;
+
+    @ApiModelProperty(value = "收费员姓名")
+    private String createByName;
+
+    @ApiModelProperty(value = "开始时间",  hidden = true)
+    private LocalDateTime beginTime;
+    @ApiModelProperty(value = "结束时间",  hidden = true)
+    private LocalDateTime endTime;
+}

+ 72 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/PayTransactiondetailsReportDto.java

@@ -0,0 +1,72 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 10:26
+ */
+@Data
+@ApiModel("交易明细报表")
+public class PayTransactiondetailsReportDto {
+
+    @ApiModelProperty(value = "客户编码")
+    private String accountNumber;
+
+    @ApiModelProperty(value = "客户名称")
+    private String accountName;
+
+    @ApiModelProperty(value = "客户地址")
+    private String accountAddr;
+
+    @ApiModelProperty(value = "交易金额")
+    private BigDecimal transAmount;
+
+    @ApiModelProperty(value = "交易时间")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private LocalDateTime transTime;
+
+    @ApiModelProperty(value = "交易类型")
+    @JsonIgnore
+    private Integer transType;
+
+    @ApiModelProperty(value = "交易类型标签值")
+    @JsonIgnore
+    private String transTypeLabel;
+
+    @ApiModelProperty(value = "支付方式")
+    private Integer payWay;
+
+    @ApiModelProperty(value = "支付方式标签值")
+    private String paywayLabel;
+
+    @ApiModelProperty(value = "收费员id")
+    private BigInteger createBy;
+
+    @ApiModelProperty(value = "收费员姓名")
+    private String createByName;
+
+    @ApiModelProperty(value = "部门ID",  hidden = true)
+    @JsonIgnore
+    private Integer officeId;
+    @ApiModelProperty(value = "开始时间",  hidden = true)
+    @JsonIgnore
+    private LocalDateTime beginTime;
+    @ApiModelProperty(value = "结束时间",  hidden = true)
+    @JsonIgnore
+    private LocalDateTime endTime;
+    @ApiModelProperty(value ="站点id",  hidden = true)
+    @JsonIgnore
+    private BigInteger siteId;
+    @ApiModelProperty(value ="客户id",  hidden = true)
+    @JsonIgnore
+    private BigInteger customerId;
+}

+ 30 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/ReplaceMeterDto.java

@@ -0,0 +1,30 @@
+package com.bz.smart_city.dto.pay;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigInteger;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-27 16:13
+ */
+@Data
+public class ReplaceMeterDto {
+
+    @ApiModelProperty(value="设备ID")
+    private BigInteger deviceId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value="换表时间")
+    private LocalDateTime replaceTime;
+
+    @ApiModelProperty(value="新表起度")
+    private String newBegin;
+
+    @ApiModelProperty(value="旧表止度")
+    private String oldEnd;
+}

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

@@ -7,10 +7,7 @@ import com.bz.smart_city.dao.pay.AmountWaterUsedAmountMapper;
 import com.bz.smart_city.dao.pay.BaseClosingAccountInfoMapper;
 import com.bz.smart_city.dao.pay.PayBaseConfigMapper;
 import com.bz.smart_city.dto.ClearingDataDTO;
-import com.bz.smart_city.dto.pay.AmountWaterUsedAmountDto;
-import com.bz.smart_city.dto.pay.BaseClosingAccountInfoDto;
-import com.bz.smart_city.dto.pay.MeterReadRecordDto;
-import com.bz.smart_city.dto.pay.PayBaseConfigDto;
+import com.bz.smart_city.dto.pay.*;
 import com.bz.smart_city.entity.ClearingRecord;
 import com.bz.smart_city.entity.MeterReadRecord;
 import com.bz.smart_city.entity.pay.AmountWaterUsedAmountByDay;
@@ -22,6 +19,7 @@ import com.bz.smart_city.quartz.service.JobAndTriggerService;
 import com.bz.smart_city.service.pay.AmountSynByDayService;
 import com.bz.smart_city.service.pay.AmountSynService;
 import com.google.common.collect.Lists;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Value;
@@ -30,8 +28,10 @@ import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.time.Duration;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.time.ZoneId;
 
 /**
  * @author Administrator
@@ -125,12 +125,17 @@ public class AmountSynByDayServiceImpl implements AmountSynByDayService, Initial
         if (idList != null && idList.size() > 0) {
             //获取同步数据
             HashMap<BigInteger, MeterReadRecordDto> meterReadRecordHashMap = new HashMap<>();
+            HashMap<BigInteger, ReplaceMeterDto> replaceMap = new HashMap<>();
 
             List<List<BigInteger>> lists = Lists.partition(idList, 500);
             for (List<BigInteger> bigIntegers :
                     lists) {
-                HashMap<BigInteger, MeterReadRecordDto> childMap = amountWaterUsedAmountMapper.getMeterReadRecord(idList);
+                HashMap<BigInteger, MeterReadRecordDto> childMap = amountWaterUsedAmountMapper.getMeterReadRecord(bigIntegers);
                 meterReadRecordHashMap.putAll(childMap);
+
+                //查询换表信息(取最近一次换表)
+                HashMap<BigInteger, ReplaceMeterDto> childReplaceMap =amountWaterUsedAmountMapper.getRepalceRecord(bigIntegers);
+                replaceMap.putAll(childReplaceMap);
             }
             if(meterReadRecordHashMap.size()>0) {
                 //批量更新水量信息
@@ -138,7 +143,6 @@ public class AmountSynByDayServiceImpl implements AmountSynByDayService, Initial
                 //更新数据
                 List<AmountWaterUsedAmountByDay> amountWaterUsedAmountDtos = amountWaterUsedAmountMapper.getAllAmountRecordByDay(siteId, customerId);
 
-
                 for (AmountWaterUsedAmountByDay amountWaterUsedAmountDto : amountWaterUsedAmountDtos) {
                     BigInteger watermeterId = amountWaterUsedAmountDto.getWatermeterId();
                     if (watermeterId != null && meterReadRecordHashMap.containsKey(watermeterId)) {
@@ -153,8 +157,38 @@ public class AmountSynByDayServiceImpl implements AmountSynByDayService, Initial
                             Date readDate = meterReadRecord.getReadTime() != null ? meterReadRecord.getReadTime() : new Date();
                             Integer calculateway = amountWaterUsedAmountDto.getCalculateway();
 
-                            if (readingNew.compareTo(tempReading) > 0)
-                                Amount = Amount.add(readingNew.subtract(tempReading));
+                            //取换表记录
+                            ReplaceMeterDto replaceMeterDto = null;
+                            if(replaceMap.containsKey(watermeterId)){
+                                replaceMeterDto = replaceMap.get(watermeterId);
+                            }
+
+                            //有换表记录且换表时间在两次同步之间 用水量=(换表中的旧表止度-上次抄表止度) + (本次止度-换表中的新表起度)
+                            Boolean replace = false;
+                            if(replaceMeterDto != null){
+
+                                LocalDateTime currTime = LocalDateTime.ofInstant(meterReadRecord.getReadTime().toInstant(),ZoneId.systemDefault()); //本次抄表时间
+                                LocalDateTime previousTime = LocalDateTime.ofInstant(amountWaterUsedAmountDto.getLastrecorddate().toInstant(),ZoneId.systemDefault()); //上次抄表时间
+                                LocalDateTime replaceTime = replaceMeterDto.getReplaceTime();   //换表时间
+                                Duration duration1 = Duration.between(previousTime,replaceTime);
+                                Duration duration2 = Duration.between(replaceTime,currTime);
+                                if(duration1.toMillis() > 0  && duration2.toMinutes() > 0){
+                                    BigDecimal replaceEndData = new BigDecimal(replaceMeterDto.getOldEnd()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的旧表止度
+                                    BigDecimal repllaceNewbegin = new BigDecimal(replaceMeterDto.getNewBegin()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的新表起度
+
+                                    BigDecimal oldMeterUse = replaceEndData.subtract(tempReading); //旧表用量
+                                    BigDecimal newMeterUse = readingNew.subtract(repllaceNewbegin);//新表用量
+                                    Amount = oldMeterUse.add(newMeterUse);
+
+                                    replace = true;
+                                }
+                            }
+
+                            if(!replace.booleanValue()){
+                                if (readingNew.compareTo(tempReading) > 0){
+                                    Amount = Amount.add(readingNew.subtract(tempReading));
+                                }
+                            }
 
                             //计量方式判断
 

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

@@ -0,0 +1,62 @@
+package com.bz.smart_city.service.impl.pay;
+
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.pay.PayReportMapper;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
+import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
+import com.bz.smart_city.service.pay.PayReportService;
+import com.github.pagehelper.PageHelper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 11:18
+ */
+@Service
+public class PayReportServiceImpl implements PayReportService {
+
+    @Resource
+    PayReportMapper payReportMapper;
+
+    /**
+     * 交易明细报表
+     * @param payTransactiondetailsReportDto
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public Pagination<PayTransactiondetailsReportDto> getPayTransactiondetailsReport(PayTransactiondetailsReportDto payTransactiondetailsReportDto, int pageNum, int pageSize)
+    {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
+        payTransactiondetailsReportDto.setCustomerId(customerId);
+
+        PageHelper.startPage(pageNum, pageSize);
+        List<PayTransactiondetailsReportDto> reList = payReportMapper.getPayTransactiondetailsReportList(payTransactiondetailsReportDto);
+        PayTransactiondetailsReportDto subDto = payReportMapper.getPayTransactiondetailsReportCount(payTransactiondetailsReportDto);
+        reList.add(0,subDto);
+
+        return new Pagination<>(reList);
+    }
+
+    /**
+     * 操作员交易明细
+     * @param payOperatordetailsReportDto
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public Pagination<PayOperatordetailsReportDto> getPayOperatordetailsReport(PayOperatordetailsReportDto payOperatordetailsReportDto, int pageNum, int pageSize)
+    {
+        return  null;
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.bz.smart_city.service.pay;
+
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.dto.pay.PayOperatordetailsReportDto;
+import com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto;
+
+/**
+ * @Author: ZJY
+ * @DATE: 2020-07-28 11:17
+ */
+public interface PayReportService {
+
+    Pagination<PayTransactiondetailsReportDto> getPayTransactiondetailsReport(PayTransactiondetailsReportDto payTransactiondetailsReportDto,int pageNum,int pageSize);
+
+    Pagination<PayOperatordetailsReportDto> getPayOperatordetailsReport(PayOperatordetailsReportDto payOperatordetailsReportDto,int pageNum,int pageSize);
+}

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

@@ -407,6 +407,7 @@ SELECT
 	<select id="getAllAmountRecordByDay"  resultType="com.bz.smart_city.entity.pay.AmountWaterUsedAmountByDay">
 		select  amount.id,
 		amount.lastreading,
+		amount.lastrecorddate,
 		rela.calculateway,
 		rela.fixedamount,
 		amount.watermeter_id watermeterId,
@@ -442,4 +443,31 @@ SELECT
 	group by c.customer_id, c.site_id
 	</select>
 
+	<resultMap id="ReplaceMeterMap" type="com.bz.smart_city.dto.pay.ReplaceMeterDto">
+
+	</resultMap>
+
+	<select id ="getRepalceRecord" resultMap="ReplaceMeterMap">
+		SELECT
+		pc.device_id as deviceId,
+		pc.date_create as replaceTime,
+		pc.new_begin_wsv as newBegin,
+		pc.old_end_wsv as oldEnd
+		FROM sc_water_meter_replace_log pc
+		left JOIN
+			(select
+			pc2.id,pc2.device_id,MAX(pc2.date_create) as dateCreate
+			FROM sc_water_meter_replace_log pc2
+			WHERE pc2.device_id in
+			<foreach collection="list" item="listItem" open="(" close=")" separator=",">
+				<if test="listItem != null and listItem != ''">
+					#{listItem}
+				</if>
+			</foreach>
+
+			GROUP BY pc2.device_id,pc2.id) b
+		on pc.id=b.id
+
+	</select>
+
 </mapper>

+ 55 - 0
smart-city-platform/src/main/resources/mapper/pay/PayReportMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.bz.smart_city.dao.pay.PayReportMapper">
+    <select id="getPayTransactiondetailsReportList" resultType="com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto">
+    SELECT
+        ppt.accountnumber as accountNumber,
+        ppt.accountname as accountName,
+        ppt.transamount as transAmount,
+        ppt.transtime as transTime,
+        ppt.create_by as createBy,
+        ppt.office_id as officeId,
+        ppt.transtype as transTypee,
+        ppt.transtypelabel as transTypeLabel,
+        ppt.payway as payWay,
+        ppt.paywayLabel as paywayLabel,
+        scu.NAME as createByName,
+        ppa.address as accountAddr
+    FROM
+        pay_pay_transactiondetails ppt
+        LEFT JOIN pay_base_account ppa ON ppt.accountnumber = ppa.accountnumber
+        LEFT JOIN sc_user scu ON ppt.create_by = scu.id
+    WHERE
+        ppt.transtype =1
+        <if test ="officeId != null"> and ppt.office_id = #{officeId}</if>
+        <if test="createBy != null"> and ppt.create_by = #{createBy}</if>
+        <if test="beginTime != null"> and ppt.transtime >= #{beginTime}</if>
+        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime}</if>
+        <if test="payWay != null"> and ppt.payway = #{payWay}</if>
+
+    </select>
+
+    <select id="getPayTransactiondetailsReportCount" resultType="com.bz.smart_city.dto.pay.PayTransactiondetailsReportDto">
+        SELECT
+        '合计' as accountName,
+        SUM(ppt.transamount) as transAmount
+        FROM
+        pay_pay_transactiondetails ppt
+        LEFT JOIN pay_base_account ppa ON ppt.accountnumber = ppa.accountnumber
+        LEFT JOIN sc_user scu ON ppt.create_by = scu.id
+        WHERE
+        ppt.transtype =1
+        <if test ="officeId != null"> and ppt.office_id = #{officeId}</if>
+        <if test="createBy != null"> and ppt.create_by = #{createBy}</if>
+        <if test="beginTime != null"> and ppt.transtime >= #{beginTime}</if>
+        <if test="endTime != null"> and ppt.transtime &lt;= #{endTime}</if>
+        <if test="payWay != null"> and ppt.payway = #{payWay}</if>
+
+    </select>
+
+    <select id="getPayOperatordetailsReportList" resultType="com.bz.smart_city.dto.pay.PayOperatordetailsReportDto">
+
+    </select>
+
+
+</mapper>