| package com.dy.pipIrrSell.activeCard; | 
|   | 
| import com.dy.common.webUtil.QueryResultVo; | 
| import com.dy.pipIrrGlobal.daoSe.SeActiveCardMapper; | 
| import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; | 
| import com.dy.pipIrrGlobal.daoSe.SeClientMapper; | 
| import com.dy.pipIrrGlobal.pojoSe.SeActiveCard; | 
| import com.dy.pipIrrGlobal.voSe.VoActiveCard; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.apache.dubbo.common.utils.PojoUtils; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.stereotype.Service; | 
|   | 
| import java.util.List; | 
| import java.util.Map; | 
|   | 
| /** | 
|  * @author ZhuBaoMin | 
|  * @date 2023/12/5 20:05 | 
|  * @LastEditTime 2023/12/5 20:05 | 
|  * @Description | 
|  */ | 
|   | 
| @Slf4j | 
| @Service | 
| public class ActiveCardSv { | 
|     @Autowired | 
|     private SeActiveCardMapper seActiveCardMapper; | 
|   | 
|     @Autowired | 
|     private SeClientCardMapper seClientCardMapper; | 
|   | 
|     //@Autowired | 
|     //private BaClientMapper baClientMapper; | 
|   | 
|     @Autowired | 
|     private SeClientMapper seClientMapper; | 
|   | 
|     public QueryResultVo<List<VoActiveCard>> getActiveCards(QueryVo queryVo) { | 
|         //完善查询开卡记录的起止时间 | 
|         String activeTimeStart = queryVo.activeTimeStart; | 
|         String activeTimeStop = queryVo.activeTimeStop; | 
|         if(activeTimeStart != null) { | 
|             activeTimeStart = activeTimeStart + " 00:00:00"; | 
|             queryVo.setActiveTimeStart(activeTimeStart); | 
|         } | 
|         if(activeTimeStop != null) { | 
|             activeTimeStop = activeTimeStop + " 23:59:59"; | 
|             queryVo.setActiveTimeStop(activeTimeStop); | 
|         } | 
|   | 
|         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); | 
|   | 
|         Long itemTotal = seActiveCardMapper.getRecordCount(params); | 
|   | 
|         QueryResultVo<List<VoActiveCard>> rsVo = new QueryResultVo<>() ; | 
|         rsVo.pageSize = queryVo.pageSize ; | 
|         rsVo.pageCurr = queryVo.pageCurr ; | 
|   | 
|         rsVo.calculateAndSet(itemTotal, params); | 
|         rsVo.obj = seActiveCardMapper.getActiveCards(params); | 
|         return rsVo ; | 
|     } | 
|   | 
|     public Long add(SeActiveCard po) { | 
|         seActiveCardMapper.insert(po); | 
|         return po.getId(); | 
|     } | 
|   | 
|     /** | 
|      * 根据农户编号获取5级行政区划代码 | 
|      * @param clientNum 农户编号 | 
|      * @return 5级行政区划代码 | 
|      */ | 
|     public Long getAreaCodeByNum(String clientNum) { | 
|         return seClientMapper.getAreaCodeByNum(clientNum); | 
|     } | 
|   | 
|     /** | 
|      * 根据农户编号获取农户ID | 
|      * @param clientNum | 
|      * @return | 
|      */ | 
|     public Long getClientIdByNum(String clientNum) { | 
|         return seClientMapper.getClientIdByNum(clientNum); | 
|     } | 
|   | 
|     /** | 
|      * 根据行政区划串模块查询水卡编号 | 
|      * @param areaCode | 
|      * @return | 
|      */ | 
|     String getCardNumOfMax(String areaCode) { | 
|         return seClientCardMapper.getCardNumOfMax(areaCode); | 
|     } | 
| } |