pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java
@@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.voSe.VoRecharge; import org.apache.ibatis.annotations.Mapper; import java.util.List; import java.util.Map; /** * @author ZhuBaoMin @@ -24,4 +28,18 @@ int updateByPrimaryKeySelective(SeCardOperate record); int updateByPrimaryKey(SeCardOperate record); /** * 根据指定条件获取充值记录数量 * @param params * @return */ Long getRecordCount(Map<?, ?> params); /** * 根据指定条件获取充值记录 * @param params * @return */ List<VoRecharge> getRecharges(Map<?, ?> params); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoRecharge.java
@@ -21,7 +21,7 @@ private static final long serialVersionUID = 1L; @Schema(title = "ID") private Long id; private String id; @Schema(title = "农户姓名") private String clientName; pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -218,4 +218,79 @@ operate_dt = #{operateDt,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} </update> <!--根据指定条件获取充值记录数量--> <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> select COUNT(*) AS recordCount FROM se_card_operate ope INNER JOIN se_client_card card ON ope.card_id = card.id INNER JOIN se_client cli ON ope.client_id = cli.id <where> AND ope.operate_type = 2 <if test = "clientName != null and clientName !=''"> AND cli.name like CONCAT('%',#{clientName},'%') </if> <if test = "clientNum != null and clientNum > 0"> AND cli.clientNum like CONCAT('%',#{clientNum},'%') </if> <if test = "cardNum != null and cardNum !=''"> AND card.cardNum like CONCAT('%',#{cardNum},'%') </if> <if test = "paymentId != null and paymentId > 0"> AND ope.payment_id = ${paymentId} </if> <if test = "rechargeTimeStart != null and rechargeTimeStop != null"> AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop} </if> </where> </select> <!--根据指定条件获取充值记录--> <select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge"> SELECT CAST(ope.id AS char) AS id , cli.name AS clientName, cli.clientNum, card.cardNum, ope.trade_amount AS amount, (ope.money + ope.trade_amount) AS afterRecharge, ope.payment_id, ope.price, (SELECT `name` FROM ba_user WHERE id = ope.operator) AS operator, ope.operate_dt FROM se_card_operate ope INNER JOIN se_client_card card ON ope.card_id = card.id INNER JOIN se_client cli ON ope.client_id = cli.id <where> AND ope.operate_type = 2 <if test = "clientName != null and clientName !=''"> AND cli.name like CONCAT('%',#{clientName},'%') </if> <if test = "clientNum != null and clientNum > 0"> AND cli.clientNum like CONCAT('%',#{clientNum},'%') </if> <if test = "cardNum != null and cardNum !=''"> AND card.cardNum like CONCAT('%',#{cardNum},'%') </if> <if test = "paymentId != null and paymentId > 0"> AND ope.payment_id = ${paymentId} </if> <if test = "rechargeTimeStart != null and rechargeTimeStop != null"> AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop} </if> </where> ORDER BY ope.operate_dt DESC <if test="pageCurr != null and pageSize != null"> LIMIT ${pageCurr}, ${pageSize} </if> </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -3,13 +3,16 @@ import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.util.Constant; import com.dy.pipIrrGlobal.voSe.VoRecharge; import com.dy.pipIrrSell.cardOperate.converter.RechargeDtoMapper; import com.dy.pipIrrSell.cardOperate.dto.*; import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; import com.dy.pipIrrSell.clientCard.CardStateENUM; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; @@ -26,10 +29,7 @@ import org.springframework.http.MediaType; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import java.time.format.DateTimeFormatter; import java.util.*; @@ -729,4 +729,25 @@ return BaseResponseUtils.buildSuccess(true) ; } @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 = VoRecharge.class))} ) }) @GetMapping(path = "/getRecharges") @SsoAop() public BaseResponse<QueryResultVo<List<VoRecharge>>> get(QoRecharge vo){ try { QueryResultVo<List<VoRecharge>> res = cardOperateSv.getRecharges(vo); return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取充值记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; } } } pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -2,24 +2,25 @@ import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.daoSe.SeClientMapper; import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voSe.VoRecharge; import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; import com.dy.pipIrrSell.result.SellResultCode; 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.Date; import java.util.HashMap; import java.util.Map; import java.util.Optional; import java.util.*; /** * @author ZhuBaoMin @@ -182,4 +183,41 @@ return BaseResponseUtils.buildSuccess(true) ; } public QueryResultVo<List<VoRecharge>> getRecharges(QoRecharge queryVo) { //完善查询充值记录的起止时间 String rechargeTimeStart = queryVo.rechargeTimeStart; String rechargeTimeStop = queryVo.rechargeTimeStop; if(rechargeTimeStart != null) { rechargeTimeStart = rechargeTimeStart + " 00:00:00"; queryVo.setRechargeTimeStart(rechargeTimeStart); } if(rechargeTimeStop != null) { rechargeTimeStop = rechargeTimeStop + " 23:59:59"; queryVo.setRechargeTimeStop(rechargeTimeStop); } Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); Long itemTotal = seCardOperateMapper.getRecordCount(params); QueryResultVo<List<VoRecharge>> 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 = seCardOperateMapper.getRecharges(params); return rsVo ; } } pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/qo/QoRecharge.java
New file @@ -0,0 +1,46 @@ package com.dy.pipIrrSell.cardOperate.qo; import com.dy.common.webUtil.QueryConditionVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; /** * @author ZhuBaoMin * @date 2024-01-20 11:35 * @LastEditTime 2024-01-20 11:35 * @Description */ @Data @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Builder @Schema(name = "IC卡充值记录查询条件") public class QoRecharge extends QueryConditionVo { @Schema(description = "农户姓名") public String clientName; @Schema(description = "农户编号") private Long clientId; @Schema(description = "IC卡号") public String cardAddr; @Schema(description = "付款方式") public Integer paymentId; //@Schema(description = "充值时间_开始") //public LocalDateTime rechargeTimeStart; // //@Schema(description = "充值时间_结束") //public LocalDateTime rechargeTimeStop; @Schema(description = "充值时间_开始") public String rechargeTimeStart; @Schema(description = "充值时间_结束") public String rechargeTimeStop; } pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoCtrl.java
@@ -7,7 +7,6 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoBa.BaUser; import com.dy.pipIrrGlobal.util.DistrictLevel; import com.dy.pipIrrGlobal.util.Org; import com.mysql.cj.util.StringUtils; import io.swagger.v3.oas.annotations.Hidden; @@ -22,15 +21,15 @@ import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.cache.CacheManager; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.UUID; //import org.springframework.cache.CacheManager; /** * 注解Tag 在API中显示: Tag 注解, 给整个接口起了个名字与描述" @@ -230,7 +229,7 @@ @GetMapping(path = "loginUserId") public Long loginUserId(String token){ BaUser userPo = this.sv.getByUuid(token) ; return userPo == null ? null : userPo.id ; return userPo == null ? null : userPo.userId ; } /** * 此方法供子模块系统调用,所以不公开在API接口中 @@ -307,8 +306,8 @@ BaUser userPo = this.sv.getByUuid(token) ; CurUserVo vo = new CurUserVo(); if(userPo != null){ vo.id = userPo.id ; vo.name = userPo.name ; vo.id = userPo.userId ; vo.name = userPo.userName; } return vo ; } pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/SsoSv.java
@@ -41,8 +41,8 @@ @Cacheable(cacheNames=CacheConstants.cacheNames, key="'" + CacheConstants.loginUserKeyPrefix + "' + #uuid", sync=true) public BaUser loginWithMapperXml(String uuid, String phone, String password){ BaUser baUser = this.baUserMapper.login(phone, password) ; if(baUser != null && baUser.id != null){ baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ; if(baUser != null && baUser.userId != null){ baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.userId) ; } return baUser; } @@ -66,8 +66,8 @@ .eq("phone", phone) .eq("password", password); BaUser baUser = this.baUserMapper.selectOne(qw) ; if(baUser != null && baUser.id != null){ baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.id) ; if(baUser != null && baUser.userId != null){ baUser.privileges = this.baPrivilegeMapper.selectPrivilegeByUserId(baUser.userId) ; } return baUser; } pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/busi/UserVoMapper.java
@@ -15,8 +15,8 @@ * @param po * @return */ @Mapping(target = "id", source = "id") @Mapping(target = "name", source = "name") @Mapping(target = "id", source = "userId") @Mapping(target = "name", source = "userName") @Mapping(target = "phone", source = "phone") @Mapping(target = "token", ignore=true) UserVo po2vo(BaUser po);