执法处罚统计、消息接口类

This commit is contained in:
huxin02 2025-03-14 18:06:51 +08:00
parent 7a7db49f36
commit f7bf2df07c
4 changed files with 168 additions and 0 deletions

View File

@ -0,0 +1,57 @@
package com.aisino.iles.lawenforcement.repository;
import com.aisino.iles.core.repository.BaseRepo;
import com.aisino.iles.lawenforcement.model.LawEnfPenaltyStat;
import com.aisino.iles.lawenforcement.model.dto.LawEnfPenaltyStatDto;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
/**
* 执法处罚统计仓库接口
*/
@Repository
public interface LawEnfPenaltyStatRepository extends BaseRepo<LawEnfPenaltyStat, String> {
/**
* 执法处罚统计市级
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 执法信息列表
*/
// @Query(name = "getLawEnfPenaltyStat", nativeQuery = true)
// @Query(value = " WITH d AS (SELECT * FROM zf_agency t where agency_level in(2,3)) "+
// " SELECT d.agency_code agencyCode,d.agency_name agencyName,d.agency_level agencyLevel, ifnull(q.xccs, 0) xccs,ifnull(q.fxwt,0) fxwts,ifnull(q.jjwt,0) jjwts,ifnull(q.las,0) las,ifnull(q.cfs,0) cfs " +
// " from d left join (select xccs.agencyCode agencyCode, xccs.xccs ,fxwt.fxwt,jjwt.jjwt, las.las,cfs.cfs " +
// " from ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) xccs from zf_online_patrol_info xc" +
// " left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime group by dw.agency_code ) xccs left join " +
// " ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) fxwt from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime and xc.approval_status='0' group by dw.agency_code ) fxwt on xccs.agencyCode = fxwt.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) jjwt from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime and xc.approval_status <> '0' group by dw.agency_code ) jjwt on fxwt.agencyCode = jjwt.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(la.case_id) las from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id " +
// " left join zf_enforcement_info zf on xc.enforcement_id = zf.enforcement_id left join zf_case_info la on zf.enforcement_id= la.enforcement_id where la.filling_date>= :startTime and la.filling_date<=:endTime group by dw.agency_code ) las on xccs.agencyCode=las.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(la.case_id) cfs from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id " +
// " left join zf_enforcement_info zf on xc.enforcement_id = zf.enforcement_id left join zf_case_info la on zf.enforcement_id= la.enforcement_id where la.filling_date>= :startTime and la.filling_date<=:endTime and zf.current_node_Code in('reviewing_done','brainstorm','closed','done') group by dw.agency_code ) cfs on cfs.agencyCode=las.agencyCode " +
// " ) q on d.agency_code = q. agencyCode " , nativeQuery = true)
@Query(name = "getOnlinePatrolStat")
List<Map<String, Object>> getLawEnfPenaltyStat(LocalDateTime startTime, LocalDateTime endTime);
// @Query(value = " WITH d AS (SELECT * FROM zf_agency t "+
// " SELECT d.agency_code agencyCode,d.agency_name agencyName,d.agency_level agencyLevel, ifnull(q.xccs, 0) xccs,ifnull(q.fxwt,0) fxwts,ifnull(q.jjwt,0) jjwts,ifnull(q.las,0) las,ifnull(q.cfs,0) cfs " +
// " from d left join (select xccs.agencyCode agencyCode, xccs.xccs ,fxwt.fxwt,jjwt.jjwt ,las.las,cfs.cfs " +
// " from ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) xccs from zf_online_patrol_info xc" +
// " left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime and dw.agency_id=:agencyCode group by dw.agency_code ) xccs left join " +
// " ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) fxwt from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime and xc.approval_status='0' and dw.agency_id=:agencyCode group by dw.agency_code ) fxwt on xccs.agencyCode = fxwt.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(xc.online_patrol_id) jjwt from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id where xc.create_time>= :startTime and xc.create_time<=:endTime and xc.approval_status <> '0' and dw.agency_id=:agencyCode group by dw.agency_code ) jjwt on fxwt.agencyCode = jjwt.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(la.case_id) las from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id " +
// " left join zf_enforcement_info zf on xc.enforcement_id = zf.enforcement_id left join zf_case_info la on zf.enforcement_id= la.enforcement_id where la.filling_date>= :startTime and la.filling_date<=:endTime and dw.agency_id=:agencyCode group by dw.agency_code ) las on xccs.agencyCode=las.agencyCode left join " +
// " ( select dw.agency_code agencyCode ,count(la.case_id) las from zf_online_patrol_info xc left join zf_agency dw on xc.agency_id = dw.agency_id " +
// " left join zf_enforcement_info zf on xc.enforcement_id = zf.enforcement_id left join zf_case_info la on zf.enforcement_id= la.enforcement_id where la.filling_date>= :startTime and la.filling_date<=:endTime and dw.agency_id=:agencyCode and zf.current_node_Code in('reviewing_done','brainstorm','closed','done') group by dw.agency_code ) cfs on cfs.agencyCode=las.agencyCode " +
// " ) q on d.agency_code = q. agencyCode " , nativeQuery = true)
@Query(name = "getOnlinePatrolStatByDistrict")
List<Map<String, Object>> getLawEnfPenaltyStatByDistrict( String agencyCode, LocalDateTime startTime, LocalDateTime endTime);
}

View File

@ -0,0 +1,13 @@
package com.aisino.iles.lawenforcement.repository;
import com.aisino.iles.core.repository.BaseRepo;
import com.aisino.iles.lawenforcement.model.Materials;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MaterialsRepository extends BaseRepo<Materials, String> {
List<Materials> findByLinkId(String linkId);
}

View File

@ -0,0 +1,66 @@
package com.aisino.iles.lawenforcement.repository;
import com.aisino.iles.lawenforcement.model.Message.MessageStatus;
import com.aisino.iles.lawenforcement.model.MessageReceiver;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
/**
* 消息接收者仓库接口
*/
@Repository
public interface MessageReceiverRepository extends JpaRepository<MessageReceiver, String> {
/**
* 根据接收者ID和消息ID查找消息接收记录
*
* @param receiverId 接收者ID
* @param messageId 消息ID
* @return 消息接收记录可选
*/
Optional<MessageReceiver> findByReceiverIdAndMessageId(String receiverId, String messageId);
/**
* 根据接收者ID查找所有消息接收记录并按创建时间降序排序
*
* @param receiverId 接收者ID
* @param statuses 消息状态列表可选
* @param pageable 分页参数
* @return 消息接收记录分页结果
*/
@Query("SELECT mr FROM MessageReceiver mr JOIN FETCH mr.message m WHERE mr.receiverId = :receiverId AND (mr.status IS NULL OR mr.status IN :statuses) ORDER BY m.createTime DESC")
Page<MessageReceiver> findByReceiverIdAndStatusIn(@Param("receiverId") String receiverId, @Param("statuses") Collection<MessageStatus> statuses, Pageable pageable);
/**
* 根据接收者ID和消息ID列表查找所有消息接收记录
*
* @param receiverId 接收者ID
* @param messageIds 消息ID列表
* @return 消息接收记录列表
*/
List<MessageReceiver> findByReceiverIdAndMessageIdIn(String receiverId, List<String> messageIds);
/**
* 统计接收者的未读消息数量
*
* @param receiverId 接收者ID
* @return 未读消息数量
*/
long countByReceiverIdAndStatus(String receiverId, MessageStatus status);
/**
* 根据消息ID查找所有接收者记录
*
* @param messageId 消息ID
* @return 消息接收记录列表
*/
List<MessageReceiver> findByMessageId(String messageId);
}

View File

@ -0,0 +1,32 @@
package com.aisino.iles.lawenforcement.repository;
import com.aisino.iles.lawenforcement.model.Message;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Optional;
/**
* 消息仓库接口
*/
@Repository
public interface MessageRepository extends JpaRepository<Message, String> {
/**
* 根据业务键查找消息
*
* @param businessKey 业务键
* @return 消息对象可选
*/
Optional<Message> findByBusinessKey(String businessKey);
/**
* 检查指定业务键的消息是否存在
*
* @param businessKey 业务键
* @return 是否存在
*/
boolean existsByBusinessKey(String businessKey);
}