1. 营销模块下根据农户姓名、电话查询正常状态的水卡列表;
2. 小程序模块下根据农户ID获取正常状态的水卡列表
| | |
| | | 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 com.dy.pipIrrGlobal.voSe.VoCards2; |
| | | import com.dy.pipIrrGlobal.voWe.VoCards3; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | * @return 符合条件记录数,最多一条 |
| | | */ |
| | | Integer isLostAndUnreplaced(@Param("cardNum") Long cardNum); |
| | | |
| | | /** |
| | | * 根据农户姓名和手机号获取水卡列表记录数,应用程序使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | Long getCardsByClientNameAndPhoneCount(Map<?, ?> params); |
| | | |
| | | /** |
| | | * 根据农户姓名和手机号获取水卡列表,应用程序使用 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<VoCards2> getCardsByClientNameAndPhone(Map<?, ?> params); |
| | | |
| | | |
| | | /** |
| | | * 根据农户ID查询正常状态的水卡列表,小程序使用 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | List<VoCards3> getCardsByClientID(String clientId); |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voSe; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/6/26 17:14 |
| | | * @LastEditTime :2024/6/26 17:14 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(title = "农户卡视图对象") |
| | | public class VoCards2 { |
| | | private static final long serialVersionUID = 202406261715001L; |
| | | |
| | | @Schema(title = "水卡ID") |
| | | private String clientCardId; |
| | | |
| | | @Schema(title = "农户ID") |
| | | private String clientId; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "电话号码") |
| | | private String phone; |
| | | |
| | | @Schema(title = "身份证号码") |
| | | private String idCard; |
| | | |
| | | @Schema(title = "水卡状态") |
| | | private Integer cardState; |
| | | |
| | | @Schema(title = "水卡状态名称") |
| | | private String stateName; |
| | | |
| | | @Schema(title = "水卡类型") |
| | | private String cardType; |
| | | |
| | | @Schema(title = "余额") |
| | | private String money; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voWe; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/6/26 17:14 |
| | | * @LastEditTime :2024/6/26 17:14 |
| | | * @Description |
| | | */ |
| | | @Data |
| | | @Schema(title = "农户卡视图对象") |
| | | public class VoCards3 { |
| | | private static final long serialVersionUID = 202406261715001L; |
| | | |
| | | @Schema(title = "水卡ID") |
| | | private String clientCardId; |
| | | |
| | | @Schema(title = "农户ID") |
| | | private String clientId; |
| | | |
| | | @Schema(title = "农户编号") |
| | | private String clientNum; |
| | | |
| | | @Schema(title = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(title = "水卡编号") |
| | | private String cardNum; |
| | | |
| | | @Schema(title = "电话号码") |
| | | private String phone; |
| | | |
| | | @Schema(title = "身份证号码") |
| | | private String idCard; |
| | | |
| | | @Schema(title = "水卡状态") |
| | | private Integer cardState; |
| | | |
| | | @Schema(title = "水卡状态名称") |
| | | private String stateName; |
| | | |
| | | @Schema(title = "水卡类型") |
| | | private String cardType; |
| | | |
| | | @Schema(title = "余额") |
| | | private String money; |
| | | } |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据农户姓名和手机号获取水卡列表记录数,应用程序使用--> |
| | | <select id="getCardsByClientNameAndPhoneCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | card.state = 1 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <!--根据农户姓名和手机号获取水卡列表,应用程序使用--> |
| | | <select id="getCardsByClientNameAndPhone" resultType="com.dy.pipIrrGlobal.voSe.VoCards2"> |
| | | SELECT |
| | | card.id AS clientCardId, |
| | | cli.id AS clientId, |
| | | 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, |
| | | FORMAT(card.money, 2) AS money |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | <where> |
| | | card.state = 1 |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "phone != null and phone !=''"> |
| | | AND cli.phone like CONCAT('%',#{phone},'%') |
| | | </if> |
| | | </where> |
| | | ORDER BY card.id |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | <!--根据农户ID查询正常状态的水卡列表,小程序使用--> |
| | | <select id="getCardsByClientID" resultType="com.dy.pipIrrGlobal.voWe.VoCards3"> |
| | | SELECT |
| | | card.id AS clientCardId, |
| | | cli.id AS clientId, |
| | | 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, |
| | | FORMAT(card.money, 2) AS money |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON card.clientId = cli.id |
| | | where |
| | | card.state = 1 |
| | | AND cli.id like CONCAT('%',#{clientId},'%') |
| | | |
| | | |
| | | ORDER BY card.id |
| | | </select> |
| | | </mapper> |
| | |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards2; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards2; |
| | | import com.dy.pipIrrSell.result.SellResultCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据农户姓名、电话查询正常状态的水卡列表 |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "getCardsByClientNameAndPhone") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoCards2>>> getCardsByClientNameAndPhone(QoCards2 vo){ |
| | | try { |
| | | QueryResultVo<List<VoCards2>> res = clientCardSv.getCardsByClientNameAndPhone(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()) ; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrGlobal.pojoSe.SeClientCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoCardInfo; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards; |
| | | import com.dy.pipIrrGlobal.voSe.VoCards2; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards; |
| | | import com.dy.pipIrrSell.clientCard.qo.QoCards2; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 根据农户姓名、电话查询正常状态的水卡列表 |
| | | * @param queryVo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoCards2>> getCardsByClientNameAndPhone(QoCards2 queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | Long itemTotal = seClientCardMapper.getCardsByClientNameAndPhoneCount(params); |
| | | |
| | | QueryResultVo<List<VoCards2>> rsVo = new QueryResultVo<>() ; |
| | | rsVo.pageSize = queryVo.pageSize ; |
| | | rsVo.pageCurr = queryVo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = seClientCardMapper.getCardsByClientNameAndPhone(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 wuzeyu |
| | | */ |
| | | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @ToString(callSuper = true) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "水卡记录查询条件") |
| | | public class QoCards2 extends QueryConditionVo { |
| | | |
| | | @Schema(description = "农户姓名") |
| | | private String clientName; |
| | | |
| | | @Schema(description = "手机号") |
| | | private String phone; |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.client; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.voWe.VoCards3; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/6/26 15:58 |
| | | * @LastEditTime :2024/6/26 15:58 |
| | | * @Description |
| | | */ |
| | | |
| | | @Slf4j |
| | | @Tag(name = "农户水卡操作", description = "农户水卡操作") |
| | | @RestController |
| | | @RequestMapping(path="clientCard") |
| | | public class ClientCardCtrl { |
| | | @Autowired |
| | | private ClientCardSv clientCardSv; |
| | | |
| | | /** |
| | | * 根据农户ID查询正常状态的水卡列表 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "getCardsByClientID") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoCards3>> getCardsByClientID(String clientId){ |
| | | try { |
| | | List<VoCards3> res = clientCardSv.getCardsByClientID(clientId); |
| | | |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("查询水卡异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.dy.pipIrrWechat.client; |
| | | |
| | | import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; |
| | | import com.dy.pipIrrGlobal.voWe.VoCards3; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author :WuZeYu |
| | | * @Date :2024/6/26 16:05 |
| | | * @LastEditTime :2024/6/26 16:05 |
| | | * @Description |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ClientCardSv { |
| | | |
| | | @Autowired |
| | | private SeClientCardMapper seClientCardMapper; |
| | | /** |
| | | * 根据农户ID查询正常状态的水卡列表 |
| | | * @param clientId |
| | | * @return |
| | | */ |
| | | public List<VoCards3> getCardsByClientID(String clientId){ |
| | | |
| | | return seClientCardMapper.getCardsByClientID(clientId); |
| | | } |
| | | } |