zouhantao pirms 1 mēnesi
vecāks
revīzija
31c70ea050

+ 21
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/basic/QtkBlackCardHisRepo.java Parādīt failu

@@ -2,7 +2,28 @@ package cn.com.taiji.core.repo.jpa.basic;

import cn.com.taiji.common.repo.jpa.AbstractJpaRepo;
import cn.com.taiji.core.entity.basic.QtkBlackCardHis;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface QtkBlackCardHisRepo extends AbstractJpaRepo<QtkBlackCardHis, String>{

@Query(nativeQuery = true, value = "SELECT c.agency_id AS agencyId, " +
"count(*) AS count, " +
"d.PRODUCT_ID AS productId, " +
"d.PRODUCT_NAME AS productName, " +
"d.VEHICLE_CLASS AS vehicleClass, " +
"d.CHANNEL_ID AS channelId, " +
"CASE WHEN c.DEBIT_TYPE = 1 THEN 3 ELSE CASE WHEN substr(c.CARD_ID, 9, 2) = '23' THEN 2 ELSE 1 END END AS cardtype " +
"FROM QTK_BLACK_CARD_HIS b, qtk_cardinfo c,ISSUE_ORDERINFO d " +
"WHERE b.card_id = c.card_id " +
"AND b.CARD_ID = d.CARD_ID " +
"AND substr(RELEASE_TIME, 0, 10) = ?1 " +
"GROUP BY c.agency_id ," +
"CASE WHEN c.DEBIT_TYPE = 1 THEN 3 ELSE CASE WHEN substr(c.CARD_ID, 9, 2) = '23' THEN 2 ELSE 1 END END, " +
"d.PRODUCT_ID, d.PRODUCT_NAME, d.VEHICLE_CLASS, d.CHANNEL_ID ")
public List<Map<String, Object>> countByReleaseTimeGroupByAgencyIdAndType(String createTime);


}

+ 4
- 1
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/basic/QtkBlackCardRepo.java Parādīt failu

@@ -6,14 +6,17 @@ import cn.com.taiji.core.entity.dict.basic.CardBlackType;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface QtkBlackCardRepo extends AbstractJpaRepo<QtkBlackCard, String> {


@Query("from QtkBlackCard where cardId=?1 and status=?2")
public List<QtkBlackCard> listCardBlackByStatus(String cardId, int status);

@Query("from QtkBlackCard where cardId=?1 and type = ?2 order by creationTime desc")
List<QtkBlackCard> queryByCardIdAndType(String cardId, CardBlackType type);

@Query(nativeQuery = true,
value = "select c.agency_id as agencyId,count(*) as count,d.PRODUCT_ID as productId,d.PRODUCT_NAME as productName,d.VEHICLE_CLASS as vehicleClass,d.CHANNEL_ID as channelId,case when c.DEBIT_TYPE = 1 then 3 else case when substr(c.CARD_ID,9,2) = '23' then 2 else 1 end end As cardtype from QTK_BLACK_CARD b, qtk_cardinfo c ,ISSUE_ORDERINFO d where b.card_id = c.card_id and b.CARD_ID=d.CARD_ID and substr(CREATION_TIME,0,10) = ?1 group by c.agency_id ,case when c.DEBIT_TYPE = 1 then 3 else case when substr(c.CARD_ID,9,2) = '23' then 2 else 1 end end,d.PRODUCT_ID,d.PRODUCT_NAME,d.VEHICLE_CLASS,d.CHANNEL_ID ")
List<Map<String, Object>> countByCreateTimeGroupByAgencyIdAndType(String createTime);
}

+ 61
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/basic/QtkCardInfoRepo.java Parādīt failu

@@ -3,9 +3,11 @@ package cn.com.taiji.core.repo.jpa.basic;
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo;
import cn.com.taiji.core.entity.basic.QtkCardInfo;
import cn.com.taiji.core.entity.dict.basic.CardStatus;
import feign.Param;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

public interface QtkCardInfoRepo extends AbstractJpaRepo<QtkCardInfo, String>{

@@ -28,4 +30,63 @@ public interface QtkCardInfoRepo extends AbstractJpaRepo<QtkCardInfo, String>{
@Query("select cardId from QtkCardInfo where vehicleId = ?1")
List<String> queryByVehicleId(String vehicleId);

/**统计从在某时间节点之前,各省累计用户的数量*/
@Query(nativeQuery = true, value = "select v.province as province,count(*) as countNum from qtk_cardinfo c,qtk_vehicleinfo v where c.vehicle_id = v.vehicle_id and c.VEHICLE_ID = v.VEHICLE_ID" +
" and c.card_status in (1,6,11)" +
" and c.insert_time < to_date(:endDateTime , 'yyyy-mm-dd hh24:mi:ss')" +
" group by v.province")
List<Map<String, String>> countByEndDateTime(@Param("endDateTime") String endDateTime);

/**统计从[开始时间,结束时间),各省累计用户的数量*/
@Query(nativeQuery = true, value = "select v.province as province,count(*) as countNum from qtk_cardinfo c,qtk_vehicleinfo v where c.vehicle_id = v.vehicle_id and c.VEHICLE_ID = v.VEHICLE_ID" +
" and c.card_status in (1,6,11)" +
" and c.insert_time >= to_date(:startDateTime , 'yyyy-mm-dd hh24:mi:ss')" +
" and c.insert_time < to_date(:endDateTime , 'yyyy-mm-dd hh24:mi:ss')" +
" group by v.province")
List<Map<String, String>> countByStartDateTimeAndEndDateTime(@Param("startDateTime") String startDateTime, @Param("endDateTime") String endDateTime);

@Query(nativeQuery = true, value="select c.agency_id as agencyId,floor(v.type/10) as vehicleType, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END AS cardType, " +
"o.product_id as productId,o.product_name as productName, null as orderType, " +
"count(*) as count " +
"from qtk_cardinfo c, qtk_vehicleinfo v,issue_orderinfo o where substr(card_enabletime, 0, 10) = ?1 " +
"and c.vehicle_id = v.vehicle_id and c.card_id = o.card_id " +
"group by c.agency_id, floor(v.type/10), " +
"o.product_id ,o.product_name, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END ")
public List<Map<String, Object>> countDayByEnableTimeGroupByAgencyIdAndVehicleTypeAndCardType(String accountDate);

@Query(nativeQuery = true, value="select c.agency_id as agencyId,floor(v.type/10) as vehicleType, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END AS cardType, " +
"o.product_id as productId,o.product_name as productName, null as orderType, " +
"count(*) as count " +
"from qtk_cardinfo c, qtk_vehicleinfo v,issue_orderinfo o where substr(card_enabletime, 0, 7) = ?1 " +
"and c.vehicle_id = v.vehicle_id and c.card_id = o.card_id " +
"group by c.agency_id, floor(v.type/10), " +
"o.product_id ,o.product_name, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END ")
public List<Map<String, Object>> countMonthByEnableTimeGroupByAgencyIdAndVehicleTypeAndCardType(String accountDate);

@Query(nativeQuery = true, value="select c.agency_id as agencyId,floor(v.type/10) as vehicleType, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END AS cardType, " +
"o.product_id as productId,o.product_name as productName, null as orderType, " +
"count(*) as count " +
"from qtk_cardinfo c, qtk_vehicleinfo v,issue_orderinfo o where substr(card_enabletime, 0, 4) = ?1 " +
"and c.vehicle_id = v.vehicle_id and c.card_id = o.card_id " +
"group by c.agency_id, floor(v.type/10), " +
"o.product_id ,o.product_name, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END ")
public List<Map<String, Object>> countYearByEnableTimeGroupByAgencyIdAndVehicleTypeAndCardType(String accountDate);

@Query(nativeQuery = true, value="select c.agency_id as agencyId,floor(v.type/10) as vehicleType, " +
"CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END AS cardType, " +
"o.product_id as productId,o.product_name as productName, null as orderType, " +
"count(*) as count " +
"from qtk_cardinfo c, qtk_vehicleinfo v,issue_orderinfo o where substr(card_enabletime, 0, 10) <= ?1 " +
"and c.vehicle_id = v.vehicle_id and c.card_id = o.card_id " +
"group by c.agency_id, floor(v.type/10), " +
"o.product_id ,o.product_name, " +
" CASE\tWHEN c.DEBIT_TYPE = 0 THEN ( CASE WHEN substr( c.card_id, 9, 2 ) = '23' THEN 2 ELSE 1 END ) ELSE 3 END ")
List<Map<String, Object>> countByEnableTimeGroupByAgencyIdAndVehicleTypeAndCardType(String accountDate);

}

+ 16
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/comm/OcrResultRepo.java Parādīt failu

@@ -10,4 +10,20 @@ public interface OcrResultRepo extends AbstractJpaRepo<OcrResult, String>{
@Query(" from OcrResult where url = ?1 and ocrType = ?2 and code='0000'")
OcrResult findByUrlAndType(String url, OcrType ocrType);

@Query(nativeQuery=true,
value="select count(*) FROM OcrResult")
int statisticAll();

@Query(nativeQuery=true,
value="select count(*) FROM OcrResult WHERE CODE = 200 or CODE = 0000")
int statistic();

@Query(nativeQuery=true,
value="select count(*) FROM (select OCR_TYPE FROM OcrResult WHERE CODE = 200 or CODE= 0000) WHERE OCR_TYPE = ?1")
int statisticByType(OcrType type);

@Query(nativeQuery=true,
value="select count(*) FROM OcrResult WHERE OCR_TYPE = ?1")
int statisticAllByType(OcrType type);

}

+ 31
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/issue/IssueOrderinfoRepo.java Parādīt failu

@@ -4,6 +4,9 @@ import cn.com.taiji.common.repo.jpa.AbstractJpaRepo;
import cn.com.taiji.core.entity.issue.IssueOrderinfo;
import org.springframework.data.jpa.repository.Query;

import java.time.LocalDateTime;
import java.util.List;

public interface IssueOrderinfoRepo extends AbstractJpaRepo<IssueOrderinfo, String>{

@Query("from IssueOrderinfo where vehicleId = ?1 and orderStatus = 'NORMAL'")
@@ -13,4 +16,32 @@ public interface IssueOrderinfoRepo extends AbstractJpaRepo<IssueOrderinfo, Stri

IssueOrderinfo findByQdOrderNo(String qdOrderNo);

/**
* 根据渠道统计条件查询订单明细
*/
@Query(nativeQuery = true, value = "SELECT a.* FROM ISSUE_ORDERINFO a ,QTK_CARDINFO b where a.CARD_ID = b.CARD_ID " +
" and a.ORDER_STATUS IN ('ACTIVE','SEAL') and b.DEBIT_TYPE=0 and substr(a.CARD_ID,9,2) != '23' " +
" and a.AGENCY_ID=?1 and a.INSERT_TIME>=?2 and a.INSERT_TIME<=?3 and a.PRODUCT_NAME=?4 and a.VEHICLE_CLASS=?6 and a.CHANNEL_ID=?5 ")
List<IssueOrderinfo> findByAgencyAllThree(String agencyId, LocalDateTime startTime, LocalDateTime endTime,
String productName, String dotName, Integer vehicleType);

/**
* 根据渠道统计条件查询订单明细
*/
@Query(nativeQuery = true, value = "SELECT a.* FROM ISSUE_ORDERINFO a ,QTK_CARDINFO b" +
" where a.CARD_ID = b.CARD_ID and a.ORDER_STATUS IN ('ACTIVE','SEAL')" +
" and b.DEBIT_TYPE=0 and substr(a.CARD_ID,9,2) = '23' and a.AGENCY_ID=?1 and a.INSERT_TIME>=?2" +
" and a.INSERT_TIME<=?3 and a.PRODUCT_NAME=?4 and a.VEHICLE_CLASS=?6 and a.CHANNEL_ID=?5 ")
List<IssueOrderinfo> findByAgencyAllTwo(String agencyId, LocalDateTime startTime, LocalDateTime endTime,
String productName, String dotName, Integer vehicleType);

/**
* 根据渠道统计条件查询订单明细
*/
@Query(nativeQuery = true, value = "SELECT a.* FROM ISSUE_ORDERINFO a ,QTK_CARDINFO b" +
" where a.CARD_ID = b.CARD_ID and a.ORDER_STATUS IN ('ACTIVE','SEAL')" +
" and b.DEBIT_TYPE=1 and a.AGENCY_ID=?1 and a.INSERT_TIME>=?2 and a.INSERT_TIME<=?3" +
" and a.PRODUCT_NAME=?4 and a.VEHICLE_CLASS=?6 and a.CHANNEL_ID=?5 ")
List<IssueOrderinfo> findByAgencyAll(String agencyId, LocalDateTime startTime, LocalDateTime endTime,
String productName, String dotName, Integer vehicleType);
}

Notiek ielāde…
Atcelt
Saglabāt