|  |  | 
 |  |  |  | 
 |  |  | import com.dy.common.webUtil.QueryResultVo; | 
 |  |  | import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoSe.SeClientMapper; | 
 |  |  | import com.dy.pipIrrGlobal.daoSe.SeOpenIdMapper; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeClient; | 
 |  |  | import com.dy.pipIrrGlobal.pojoSe.SeOpenId; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoClient; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.dubbo.common.utils.PojoUtils; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BaDistrictMapper baDistrictMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private BaSettingsMapper baSettingsMapper; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SeOpenIdMapper seOpenIdMapper; | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据指定条件获取农户数据 | 
 |  |  |      * @param vo | 
 |  |  |      * @param queryVo | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public QueryResultVo<List<VoClient>> getClients(QueryVo vo){ | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ; | 
 |  |  |     public QueryResultVo<List<VoClient>> getClients(QueryVo queryVo){ | 
 |  |  |         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; | 
 |  |  |         Long itemTotal = seClientMapper.getRecordCount(params); | 
 |  |  |  | 
 |  |  |         QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; | 
 |  |  |         rsVo.pageSize = vo.pageSize ; | 
 |  |  |         rsVo.pageCurr = vo.pageCurr ; | 
 |  |  |         rsVo.pageSize = queryVo.pageSize ; | 
 |  |  |         rsVo.pageCurr = queryVo.pageCurr ; | 
 |  |  |  | 
 |  |  |         rsVo.calculateAndSet(itemTotal, params); | 
 |  |  |         rsVo.obj = seClientMapper.getClients(params); | 
 |  |  |  | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据主键获取农户对象 | 
 |  |  |      * @param id 农户主键 | 
 |  |  |      * @return 农户对象 | 
 |  |  |      */ | 
 |  |  |     public VoClient getOneClient(Long id) { | 
 |  |  |         SeClient seClient = seClientMapper.selectByPrimaryKey(id); | 
 |  |  |         VoClient voClient = SeClientToVoClient.INSTANCT.po2vo(seClient); | 
 |  |  |         return voClient; | 
 |  |  |     } | 
 |  |  |     /** | 
 |  |  |      * 增开农户 | 
 |  |  |      * @param po | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Integer addClient(SeClient po) { | 
 |  |  |         return seClientMapper.insert(po); | 
 |  |  |         return seClientMapper.insertSelective(po); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  | 
 |  |  |     public Map getDistrictsByVillageId(Long villageId) { | 
 |  |  |         return baDistrictMapper.getDistrictsByVillageId(villageId); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据农户ID逻辑删除农户 | 
 |  |  |      */ | 
 |  |  |     public Integer deleteClientById(Long id) { | 
 |  |  |         return seClientMapper.deleteClientById(id); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 修改农户对象 | 
 |  |  |      * @param po 农户对象 | 
 |  |  |      * @return 修改记录条数 | 
 |  |  |      */ | 
 |  |  |     public Integer updateByPrimaryKey(SeClient po) { | 
 |  |  |         return seClientMapper.updateByPrimaryKey(po); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据主键获取村ID | 
 |  |  |      * @param id | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Long getVillageIdById(Long id) { | 
 |  |  |         return seClientMapper.getVillageIdById(id); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取虚拟卡号最大值 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Long getMa1xVirtualId() { | 
 |  |  |         return seClientMapper.getMa1xVirtualId(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取用水方式列表 | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public List<Map<String, Object>> getWaterTypes() { | 
 |  |  |         return seClientMapper.getWaterTypes(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据配置项获取配置项值 | 
 |  |  |      * @param itemName | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public String getItemValue(String itemName) { | 
 |  |  |         return baSettingsMapper.getItemValue(itemName); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据电话号码获取农户ID | 
 |  |  |      * @param phoneNumber | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Long getClientIdByPhone(String phoneNumber) { | 
 |  |  |         return seClientMapper.getClientIdByPhone(phoneNumber); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 添加微信用户账户记录 | 
 |  |  |      * @param po | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |     public Long addOpenId(SeOpenId po) { | 
 |  |  |         seOpenIdMapper.insert(po); | 
 |  |  |         //return po.getClientId(); | 
 |  |  |         return po.getId(); | 
 |  |  |     } | 
 |  |  | } |