2024-01-26 朱宝民 添加获取卡列表接口,应用程序使用
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | String getCardStateByCardNum(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据指定条件获取水卡列表记录数,应用程序使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getCardsCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据指定条件获取水卡列表,应用程序使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoCards> getCards(Map<?, ?> params); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import com.dy.common.po.BaseEntity; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-26 18:52 |
| | | * @LastEditTime 2024-01-26 18:52 |
| | | * @Description 应用程序中使用,查询条件为:农户编号、农户姓名、水卡编号 |
| | | */ |
| | | |
| | | @Data |
| | | @Schema(title = "农户卡视图对象") |
| | | public class VoCards implements BaseEntity { |
| | | private static final long serialVersionUID = 202401261853001L; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "电话号码") |
| | | private Float phone; |
| | | |
| | | @Schema(title = "身份证号码") |
| | | private Float idCard; |
| | | |
| | | @Schema(title = "水卡状态") |
| | | private Float cardState; |
| | | |
| | | @Schema(title = "水卡状态名称") |
| | | private String stateName; |
| | | |
| | | @Schema(title = "水卡类型") |
| | | private String cardType; |
| | | |
| | | @Schema(title = "余额") |
| | | private String money; |
| | | } |
| | |
| | | FROM se_client_card |
| | | WHERE cardNum = ${cardNum} |
| | | </select> |
| | | |
| | | <!--根据指定条件获取水卡列表记录数,应用程序使用--> |
| | | <select id="getCardsCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | <if test = "clientNum != null and clientNum !=''"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取水卡列表,应用程序使用--> |
| | | <select id="getCards" resultType="com.dy.pipIrrGlobal.voSe.VoCards"> |
| | | SELECT |
| | | cli.clientNum, |
| | | cli.name AS clientName, |
| | | card.cardNum, |
| | | cli.phone, |
| | | cli.idCard, |
| | | card.state AS cardState, |
| | | (CASE |
| | | WHEN card.state = 1 THEN '正常' |
| | | WHEN card.state = 2 THEN '已注销' |
| | | WHEN card.state = 3 THEN '已挂失' |
| | | End) AS stateName, |
| | | '农户卡' AS cardType, |
| | | card.money |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | <if test = "clientNum != null and clientNum !=''"> |
| | | AND cli.clientNum like CONCAT('%',#{clientNum},'%') |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY card.id |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取水卡列表,应用程序使用 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得一页水卡记录", description = "返回一页水卡数据") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "getcards") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCards>>> getcards(QoCards vo){ |
| | | try { |
| | | QueryResultVo<List<VoCards>> res = clientCardSv.getCards(vo); |
| | | if(res.itemTotal != null && res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(SellResultCode.THE_CARD_NOT_EXIST.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("查询农户异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.dy.pipIrrSell.clientCard; |
| | | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | String stateName = Optional.ofNullable(seClientCardMapper.getCardStateByCardNum(cardNum)).orElse(""); |
| | | return stateName; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件获取水卡列表,应用程序使用 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoCards>> getCards(QoCards queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | Long itemTotal = seClientCardMapper.getCardsCount(params); |
| | | |
| | | QueryResultVo<List<VoCards>> rsVo = new QueryResultVo<>() ; |
| | | Integer pageCurr = 0; |
| | | Integer pageSize = 10000; |
| | | rsVo.pageCurr = 1; |
| | | rsVo.pageSize = 10000; |
| | | if(queryVo.pageSize != null && queryVo.pageCurr != null) { |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr; |
| | | pageSize = queryVo.pageSize ; |
| | | pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString()); |
| | | } |
| | | params.put("pageCurr", pageCurr); |
| | | params.put("pageSize", pageSize); |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientCardMapper.getCards(params); |
| | | |
| | | return rsVo ; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrSell.clientCard.qo; |
| | | |
| | | import com.dy.common.webUtil.QueryConditionVo; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-01-26 19:11 |
| | | * @LastEditTime 2024-01-26 19:11 |
| | | * @Description |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "水卡记录查询条件") |
| | | public class QoCards extends QueryConditionVo { |
| | | |
| | | @Schema(description = "农户编号") |
| | | public Long clientNum; |
| | | |
| | | @Schema(description = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(description = "水卡编号") |
| | | public Long cardNum; |
| | | } |
| | |
| | | No_ActiveCards(10009, "没有符合条件的开卡数据"), |
| | | No_ReissueCards(10010, "没有符合条件的补卡数据"), |
| | | |
| | | THE_CARD_NOT_EXIST(10011, "没有符合条件的水卡"), |
| | | |
| | | /** |
| | | * 充值 |
| | | */ |