瀏覽代碼

zjy 对帐、支付管理修改

zhoujiangyuan 4 年之前
父節點
當前提交
1f6a029dd0

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

@@ -65,7 +65,7 @@ public class PayPayCheckbalanceController {
         List<PayPayCheckbalanceDto> payPayCheckbalanceDtoList = payPayCheckbalanceService.findStageList(year,month);
         return new AjaxMessage<>(ResultStatus.OK,payPayCheckbalanceDtoList);
     }
-
+/*
     @GetMapping("/findTradeDetail")
     @ApiOperation(value = "查询交易明细",notes = "查询交易明细")
     public AjaxMessage<Pagination<PayBaseAccountTransactionsDto>>findTradeDetail(
@@ -90,5 +90,5 @@ public class PayPayCheckbalanceController {
 
         return new AjaxMessage<>(ResultStatus.OK,payBaseAccountTransactionsDtoPagination);
     }
-
+*/
 }

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

@@ -28,10 +28,6 @@ public interface PayPayCheckbalanceMapper {
     //按帐期取交易总额
     List<PayPayCheckbalanceItemDto>findTradeMonthCycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 
-    //按月帐期取系统总额 按机构分类
-    PayPayCheckbalanceAgentDto findSysMonthCycle2(@Param("agentName") String agentName, @Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
-    PayPayCheckbalanceAgentDto findTradeMonthCycle2(@Param("machid") String machid, @Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
-
     //按帐期取每天系统总额
     List<PayPayCheckbalanceItemDto>findSysDay2Cycle(@Param("cycle") String cycle, @Param("stTime") LocalDateTime stTime, @Param("endTime") LocalDateTime endTime, @Param("siteId") BigInteger siteId, @Param("customerId") BigInteger customerId);
 

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

@@ -144,112 +144,6 @@ public class PayPayCheckbalanceServiceImpl implements PayPayCheckbalanceService
 
     }
 
-    public List<PayPayCheckbalanceListDto>findMonth2List(String year, String month)
-    {
-        LoginUser loginUser = UserUtil.getCurrentUser();
-        BigInteger siteId = new BigInteger(String.valueOf(loginUser.getSiteId()));
-        BigInteger customerId = new BigInteger(String.valueOf(loginUser.getCustomerId()));
-
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceListDtoList = new ArrayList<>();
-        //查询机构
-        List<PayPayAgentbranch> payPayAgentbranchList = payPayAgentbranchMapper.findList(siteId,customerId);
-        if(payPayAgentbranchList != null && payPayAgentbranchList.size() > 0)
-        {
-            Integer iYear=null;
-            Integer iMonth=null;
-            if(!StringUtils.isNullOrEmpty(year))
-                iYear = Integer.valueOf(year);
-            if(!StringUtils.isNullOrEmpty(month))
-                iMonth = Integer.valueOf(month);
-            //查询帐期
-            List<BaseClosingAccountInfoDto> baseClosingAccountInfoList = baseClosingAccountInfoMapper.getList(iYear,iMonth,siteId,customerId,Integer.valueOf("1"));
-
-            if(baseClosingAccountInfoList != null)
-            {
-                ZoneId zoneId = ZoneId.systemDefault();
-
-                for(int i=0;i<baseClosingAccountInfoList.size();i++)
-                {
-                    PayPayCheckbalanceListDto payPayCheckbalanceListDto = new PayPayCheckbalanceListDto();
-                    payPayCheckbalanceListDto.setYear(baseClosingAccountInfoList.get(i).getYear());
-                    payPayCheckbalanceListDto.setMonth(baseClosingAccountInfoList.get(i).getMonth());
-
-                    List<PayPayCheckbalanceAgentDto> payPayCheckbalanceAgentDtoList = new ArrayList<>();
-
-                    String cycle = baseClosingAccountInfoList.get(i).getName();
-                    LocalDateTime stTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getStartTime().toInstant(), zoneId);
-                    LocalDateTime endTime = LocalDateTime.ofInstant(baseClosingAccountInfoList.get(i).getEndTime().toInstant(), zoneId);
-                    //取每月系统总额 按机构
-                    for (int k=0;k<payPayAgentbranchList.size();k++)
-                    {
-                        PayPayCheckbalanceAgentDto payPayCheckbalanceAgentDto =
-                                payPayCheckbalanceMapper.findSysMonthCycle2(payPayAgentbranchList.get(k).getName(),cycle,stTime,endTime,siteId,customerId);
-
-                        PayPayCheckbalanceAgentDto payPayCheckbalanceAgentDto1 =
-                                payPayCheckbalanceMapper.findTradeMonthCycle2(payPayAgentbranchList.get(k).getMchid(),cycle,stTime,endTime,siteId,customerId);
-
-                        if(payPayCheckbalanceAgentDto == null && payPayCheckbalanceAgentDto1 == null)
-                            break;
-
-                        if(payPayCheckbalanceAgentDto == null)
-                        {
-                            payPayCheckbalanceAgentDto = new PayPayCheckbalanceAgentDto();
-                            payPayCheckbalanceAgentDto.setAgentName(payPayAgentbranchList.get(k).getName());
-                        }
-                        if(payPayCheckbalanceAgentDto1 != null)
-                            payPayCheckbalanceAgentDto.setTradeData(payPayCheckbalanceAgentDto1.getTradeData());
-
-                        //帐期各机构数据
-                        payPayCheckbalanceAgentDtoList.add(payPayCheckbalanceAgentDto);
-                    }
-                    payPayCheckbalanceListDto.setPayPayCheckbalanceAgentDtoList(payPayCheckbalanceAgentDtoList);
-
-                    payPayCheckbalanceListDtoList.add(payPayCheckbalanceListDto);
-
-                }
-
-
-            }
-
-
-        }
-
-
-        return payPayCheckbalanceListDtoList;
-    }
-
-    @Override
-    public Pagination<PayPayCheckbalanceListDto>findMonth2List(String year,String month,int pageNum, int pageSize)
-    {
-        Pagination<PayPayCheckbalanceListDto> pg = new Pagination<>();
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceListDtoList = findMonth2List(year,month);
-        pg.setTotal(payPayCheckbalanceListDtoList.size());
-        //获取分页部分
-        List<PayPayCheckbalanceListDto> payPayCheckbalanceDtoListPage = newArrayList();
-        int count = payPayCheckbalanceListDtoList.size();
-        int stIndex=0;
-        int endIndex=0;
-
-
-        if(count > 0 && pageNum >0 && pageSize >0)
-        {
-            stIndex = (pageNum-1) * pageSize;
-            endIndex = stIndex + pageSize -1;
-            if(count > stIndex )
-            {
-                for (int i=stIndex;i<=endIndex;i++)
-                {
-                    if(i >= count)
-                        break;
-                    payPayCheckbalanceDtoListPage.add(payPayCheckbalanceListDtoList.get(i));
-                }
-            }
-
-        }
-
-        pg.setList(payPayCheckbalanceDtoListPage);
-        return pg;
-    }
 
     /**
      * 查询指定年月下的每天数据

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

@@ -15,8 +15,6 @@ public interface PayPayCheckbalanceService {
 
     Pagination<PayPayCheckbalanceDto>findMonthList(String year,String month,int pageNum, int pageSize);
 
-    Pagination<PayPayCheckbalanceListDto>findMonth2List(String year, String month, int pageNum, int pageSize);
-
     //按自然月
     List<PayPayCheckbalanceDto> findDayList(String year,String month);
 

+ 24 - 24
smart-city-platform/src/main/resources/mapper/pay/PayPayAgentbranchMapper.xml

@@ -84,33 +84,33 @@
 
     <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayPayAgentbranchSelectDto">
         select
-            pa1.id,
-            pa1.type,
-            pa1.`code`,
-            pa1.name,
-            pa1.mchid,
-            pa1.paykey paykey,
-            pa1.appid,
-            scu.`name` as updateName,
-            pa1.update_date as updateDate,
-            psd.label as agentbranchType,
-            pa2.number as transactionsNumber,
-            IFNULL(pa2.sumAmount,0) as transactionsMoney
+        pa1.id,
+        pa1.type,
+        pa1.`code`,
+        pa1.name,
+        pa1.mchid,
+        pa1.paykey paykey,
+        pa1.appid,
+        scu.`name` as updateName,
+        pa1.update_date as updateDate,
+        psd.label as agentbranchType,
+        pa2.number as transactionsNumber,
+        IFNULL(pa2.sumAmount,0) as transactionsMoney
         from pay_pay_agentbranch pa1
         left join sc_user scu on pa1.update_by=scu.id
         left join pay_sys_dict psd on pa1.type = psd.value and psd.type='机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         left join (
-            select count(1) number,sum(amount) sumAmount,agent_code
-            from pay_pay_agenttransaction
-            <where>
-                state != 0 and state != 4
-                <if test="questParams != null"> and (agent_code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or agent_name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
-                <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
-                <if test="siteId != null"> and site_id=#{siteId}</if>
-                <if test="customerId != null"> and customer_id=#{customerId}</if>
-            </where>
-            group by agent_code) pa2
-        on pa1.code = pa2.agent_code
+        select count(1) number,sum(trans_fee) sumAmount,machid
+        from pay_pay_checkbalance
+        <where>
+            state != 0 and state != 4
+
+            <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
+            <if test="siteId != null"> and site_id=#{siteId}</if>
+            <if test="customerId != null"> and customer_id=#{customerId}</if>
+        </where>
+        group by machid) pa2
+        on pa1.mchid = pa2.machid
         <where>
             <if test="questParams != null"> (pa1.code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or pa1.name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
             <if test="siteId != null"> and pa1.site_id=#{siteId}</if>
@@ -122,7 +122,7 @@
     <select id="ExitsData" resultType="java.lang.Long">
         select id from pay_pay_agentbranch
         where site_id =#{siteId} and customer_id =#{customerId}
-          and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
+        and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
         <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
     </select>
 </mapper>

+ 33 - 49
smart-city-platform/src/main/resources/mapper/pay/PayPayCheckbalanceMapper.xml

@@ -4,35 +4,17 @@
     <select id="findSysMonthCycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
             #{cycle} cycle,
-            ppac.agent_name as typeName,
-            ppac.agent_code as typeCode,
+            psd.label as typeName,
+            psd.`value` as typeCode,
             SUM(ppac.amount) sumAmount
         from pay_pay_agenttransaction ppac
-        where ppac.transtime>= #{stTime} and ppac.transtime &lt;= #{endTime} and ppac.state not in(0,4)
+        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
+        where ppac.transtime>= #{stTime} and ppac.transtime <![CDATA[<=]]> #{endTime} and ppac.state not in(0,4)
         and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId}
-        group by ppac.agent_name,ppac.agent_code
+        group by psd.label,psd.`value`
     </select>
 
-    <select id="findSysMonthCycle2" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceAgentDto">
-        SELECT
-            ppab.name as agentName,
-            ppab.type agentTypeId,
-            SUM(ppac.amount) sysData,
-            #{cycle} cycle
-        from pay_pay_agenttransaction ppac
-        left JOIN pay_pay_agentbranch ppab on ppab.id = ppac.agentbranch_id
-        where ppac.transtime>= #{stTime} and ppac.transtime <![CDATA[<]]> #{endTime}
-            and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId} and ppab.name=#{agentName}
-        GROUP BY ppab.name,ppab.type
-    </select>
-
-    <select id="findTradeMonthCycle2" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceAgentDto">
-        select
-            IFNULL(sum(trans_fee),0) tradeData
-        from pay_pay_checkbalance
-        where transtime>=#{stTime} and transtime <![CDATA[<]]> #{endTime}
-            and site_id=#{siteId} and customer_id=#{customerId} and machid=#{machid}
-    </select>
 
     <select id="findTradeMonthCycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
@@ -55,31 +37,33 @@
 
     <select id="findClosingAccount" resultType="com.bz.smart_city.entity.pay.BaseClosingAccountInfo">
         select
-            pbc.`name`,
-            pbc.`year`,
-            pbc.`month`,
-            pbc.starttime as startTime,
-            pbc.endtime as endTime,
-            pbc.state
+        pbc.`name`,
+        pbc.`year`,
+        pbc.`month`,
+        pbc.starttime as startTime,
+        pbc.endtime as endTime,
+        pbc.state
         from pay_base_closingaccountinfo pbc
         where pbc.year=#{year,jdbcType=INTEGER} and pbc.site_id=#{siteId} and pbc.customer_id=#{customerId}
         and pbc.endtime is not null and pbc.starttime is not null
         <if test="month != null and month != '' "> and pbc.month=#{month}</if>
-         order by pbc.year,pbc.month desc
+        order by pbc.year,pbc.month desc
     </select>
 
 
 
     <select id="findSysDay2Cycle" resultType="com.bz.smart_city.dto.pay.PayPayCheckbalanceItemDto">
         select
-            ppac.agent_name as typeName,
-            ppac.agent_code as typeCode,
+            psd.label as typeName,
+            psd.`value` as typeCode,
             IFNULL(SUM(ppac.amount),0) sumAmount,
             date(ppac.transtime) as ymd
         from pay_pay_agenttransaction ppac
+        left join pay_pay_agentbranch ppa on ppac.agentbranch_id = ppa.id and ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
+        left join pay_sys_dict psd on ppa.type = psd.`value` and psd.type = '机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
         where ppac.state not in(0,4) and  ppac.transtime >= #{stTime} and ppac.transtime <![CDATA[<=]]> #{endTime}
         and ppac.site_id=#{siteId} and ppac.customer_id=#{customerId}
-        group by agent_name,agent_code,ymd ORDER BY ymd asc
+        group by psd.label,psd.`value`,ymd ORDER BY ymd asc
     </select>
 
 
@@ -106,25 +90,25 @@
 
     <select id="findTradeDetail" resultType="com.bz.smart_city.dto.pay.PayBaseAccountTransactionsDto">
         select
-            ptrans.id,
-            ptrans.`name` as transactionInfo,
-            ptrans.payseriesno,
-            ptrans.transamount,
-            ptrans.transtime,
-            ptrans.transtype,
-            ptrans.payway,
-            psd1.label as transtypeName,
-            psd2.label as paywayName,
-            pagent.order_no orderNo,
-            ptrans.canceltime,
-            ptrans.iscanceled,
-            ptrans.cancelperson,
-            scu.`name` as cancelpersonName
+        ptrans.id,
+        ptrans.`name` as transactionInfo,
+        ptrans.payseriesno,
+        ptrans.transamount,
+        ptrans.transtime,
+        ptrans.transtype,
+        ptrans.payway,
+        psd1.label as transtypeName,
+        psd2.label as paywayName,
+        pagent.order_no orderNo,
+        ptrans.canceltime,
+        ptrans.iscanceled,
+        ptrans.cancelperson,
+        scu.`name` as cancelpersonName
         from pay_pay_transactiondetails ptrans
         LEFT JOIN pay_sys_dict psd1 on psd1.`value` = ptrans.transtype and psd1.type='交易类型' and psd1.site_id=#{siteId} and psd1.customer_id=#{customerId}
         LEFT JOIN pay_sys_dict psd2 on psd2.`value` = ptrans.payway and psd2.type='支付方式' and psd2.site_id=#{siteId} and psd2.customer_id=#{customerId}
         left join pay_pay_agenttransaction pagent on pagent.payseriesno = ptrans.payseriesno and pagent.site_id=#{siteId} and pagent.customer_id=#{customerId}
-		left join sc_user scu on scu.id = ptrans.cancelperson
+        left join sc_user scu on scu.id = ptrans.cancelperson
         where ptrans.site_id=#{siteId} and ptrans.customer_id=#{customerId}
         and ptrans.create_date >= #{stTime} and ptrans.create_date <![CDATA[<]]> #{endTime}
         <if test="name != null and name != '' ">