pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeCardOperateMapper.java
@@ -109,4 +109,19 @@ * @return */ List<VoActiveCardNew> getActiveCards(Map<?, ?> params); /** * 根据指定条件获取补卡记录数 * @param params * @return */ Long getReissueCardRecordCount(Map<?, ?> params); /** * 根据指定条件获取补卡记录 * @param params * @return */ List<VoReissueCard> getReissueCards(Map<?, ?> params); } pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoReissueCard.java
New file @@ -0,0 +1,47 @@ package com.dy.pipIrrGlobal.voSe; import com.dy.common.po.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * @author :WuZeYu * @Date :2024/1/26 9:31 * @LastEditTime :2024/1/26 9:31 * @Description */ @Data @Schema(title = "补卡记录视图对象") public class VoReissueCard implements BaseEntity { private static final long serialVersionUID = 2024012609330001L; @Schema(title = "ID") private Long id; @Schema(title = "农户姓名") private String clientName; @Schema(title = "农户编号") private String clientNum; @Schema(title = "水卡编号") private String cardNum; @Schema(title = "卡片费用") private Integer cardCost; @Schema(title = "补卡金额") private Double reissueAmount; @Schema(title = "操作人") private String operator; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(title = "操作时间") private Date operateDt; } pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeMapper.xml
@@ -234,12 +234,25 @@ <if test="blockName != null and blockName != ''"> AND blo.name = #{blockName} </if> <if test="isBinded == 0"> AND ge.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0) </if> <if test="isBinded == 1"> AND ge.id IN(SELECT intakeId FROM pr_controller where deleted = 0) </if> <if test="isBinded == null"> </if> <if test="address != null and address != ''"> AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%') </if> </where> </select> <!--根据指定条件获取取水口记录--> <select id="getIntakes" resultType="com.dy.pipIrrGlobal.voPr.VoIntake"> SELECT (@i:=@i+1) AS id, SELECT ge.id AS id, ge.`name` AS intakeName, divi.`name` AS divideName, blo.`name` AS blockName, @@ -255,7 +268,6 @@ INNER JOIN ba_district country ON ge.countyId = country.id INNER JOIN ba_district town ON ge.townId = town.id INNER JOIN ba_district village ON ge.villageId = village.id , (SELECT @i:=0) AS itable <where> ge.deleted = 0 AND divi.deleted = 0 @@ -263,6 +275,7 @@ <if test="intakeName != null and intakeName != ''"> AND ge.name LIKE CONCAT('%', #{intakeName}, '%') </if> <if test="divideName != null and divideName != ''"> AND divi.name LIKE CONCAT('%', #{divideName}, '%') </if> @@ -270,6 +283,19 @@ <if test="blockName != null and blockName != ''"> AND blo.name = #{blockName} </if> <if test="isBinded == 0"> AND ge.id NOT IN(SELECT intakeId FROM pr_controller where deleted = 0) </if> <if test="isBinded == 1"> AND ge.id IN(SELECT intakeId FROM pr_controller where deleted = 0) </if> <if test="isBinded == null"> </if> <if test="address != null and address != ''"> AND CONCAT(country.`name`, town.`name`, village.`name`) LIKE CONCAT('%', #{address}, '%') </if> </where> ORDER BY ge.operateDt DESC <if test="pageCurr != null and pageSize != null"> pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -526,4 +526,61 @@ LIMIT ${pageCurr}, ${pageSize} </if> </select> <!--根据指定条件获取补卡记录数量--> <select id="getReissueCardRecordCount" 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 = 4 <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> <if test = "activeTimeStart != null and activeTimeStop != null"> AND ope.operate_dt BETWEEN #{reissueCardTimeStart} AND #{reissueCardTimeStop} </if> </where> </select> <!--根据指定条件获取补卡记录--> <select id="getReissueCards" resultType="com.dy.pipIrrGlobal.voSe.VoReissueCard"> SELECT CAST(ope.id AS char) AS id , cli.name AS clientName, cli.clientNum AS clientNum, card.cardNum AS cardNum, ope.card_cost AS cardCost, IFNULL(ope.no_trade_amount,0) AS reissueAmount, (SELECT `name` FROM ba_user WHERE id = ope.operator) AS operator, ope.operate_dt AS operateDt 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 = 4 <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> <if test = "activeTimeStart != null and activeTimeStop != null"> AND ope.operate_dt BETWEEN #{reissueCardTimeStart} AND #{reissueCardTimeStop} </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-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
@@ -33,10 +33,7 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.*; /** * @author WuZeYu @@ -48,13 +45,14 @@ @Slf4j @Tag(name = "取水口管理", description = "取水口操作") @RestController @RequestMapping(path="intake") @RequestMapping(path = "intake") @RequiredArgsConstructor public class IntakeCtrl { private final IntakeSv intakeSv; /** * 客户端请求得到所有取水口名字 * * @return 所有取水口名字 */ @Operation(summary = "获得全部取水口", description = "返回全部取水口数据") @@ -68,22 +66,23 @@ }) @GetMapping(path = "all") @SsoAop() public BaseResponse<QueryResultVo<List<PrIntake>>> all(){ public BaseResponse<QueryResultVo<List<PrIntake>>> all() { try { QueryResultVo<List<PrIntake>> res = this.intakeSv.selectAll(); if(res == null) { if (res == null) { return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage()); }else { } else { return BaseResponseUtils.buildSuccess(res); } } catch (Exception e) { log.error("查询取水口异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; return BaseResponseUtils.buildException(e.getMessage()); } } /** * 得到一个取水口数据 * * @return 一个取水口数据 */ @Operation(summary = "一个取水口", description = "得到一个取水口数据") @@ -97,10 +96,10 @@ }) @GetMapping(path = "one/{id}") @SsoAop() public BaseResponse<PrIntake> one(@PathVariable("id") Long id){ if(this.intakeSv.selectById(id) == null) { public BaseResponse<PrIntake> one(@PathVariable("id") Long id) { if (this.intakeSv.selectById(id) == null) { return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage()); }else { } else { return BaseResponseUtils.buildSuccess(this.intakeSv.selectById(id)); } } @@ -116,16 +115,16 @@ }) @GetMapping(path = "getIntakes") @SsoAop() public BaseResponse<QueryResultVo<List<VoIntake>>> getIntakes(QueryVo vo){ public BaseResponse<QueryResultVo<List<VoIntake>>> getIntakes(QueryVo vo) { try { QueryResultVo<List<VoIntake>> res = intakeSv.getIntakes(vo); if(res == null) { if (res == null) { return BaseResponseUtils.buildFail(ProjectResultCode.NO_INTAKES.getMessage()); } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("获取取水口记录异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; return BaseResponseUtils.buildException(e.getMessage()); } } @@ -141,23 +140,24 @@ @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult){ public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); if(bindingResult != null && bindingResult.hasErrors()){ if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } Date operateTime = new Date(); po.setOperateDt(operateTime); Integer rec = Optional.ofNullable(intakeSv.addIntake(po)).orElse(0); if(rec == 0) { if (rec == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.ADD_INTAKE_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true) ; return BaseResponseUtils.buildSuccess(true); } /** * 编辑修改取水口 * * @param po 保存取水口form表单对象 * @return 是否成功 */ @@ -172,8 +172,8 @@ }) @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ public BaseResponse<Boolean> update(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } int count; @@ -183,18 +183,19 @@ count = this.intakeSv.update(po); } catch (Exception e) { log.error("保存分水口异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; return BaseResponseUtils.buildException(e.getMessage()); } if(count <= 0){ return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_INTAKE.getMessage()) ; }else{ return BaseResponseUtils.buildSuccess(true) ; if (count <= 0) { return BaseResponseUtils.buildFail(ProjectResultCode.UPDATE_INTAKE.getMessage()); } else { return BaseResponseUtils.buildSuccess(true); } } /** * 删除取水口 * @param id 取水口ID * * @param map 取水口ID * @return 是否成功 */ @Operation(summary = "删除分水口", description = "提交取水口ID,进行逻辑删除") @@ -206,28 +207,32 @@ schema = @Schema(implementation = Boolean.class))} ) }) @GetMapping(path = "delete/{id}") @PostMapping(path = "delete") @SsoAop() public BaseResponse<Boolean> delete(@PathVariable("id") Long id){ if(id == null ){ return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_INTAKE_ID.getMessage()) ; public BaseResponse<Boolean> delete(@RequestBody Map map) { if (map == null || map.size() <= 0) { return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_INTAKE_ID.getMessage()); } int count; Long id = Long.parseLong(map.get("id").toString()); try { count = this.intakeSv.delete(id); //取水口ID Integer recordCount = Optional.ofNullable(intakeSv.delete(id)).orElse(0); if (recordCount == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_INTAKE_FAIL.getMessage()); } else { return BaseResponseUtils.buildSuccess(true); } } catch (Exception e) { log.error("保存分水口异常", e); return BaseResponseUtils.buildException(e.getMessage()) ; return BaseResponseUtils.buildException(e.getMessage()); } if(count <= 0){ return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_INTAKE_FAIL.getMessage()) ; }else{ return BaseResponseUtils.buildSuccess(true) ; } } /** * 导出取水口列表 * * @param response * @param vo */ @@ -247,6 +252,7 @@ /** * 导入取水口列表 * * @param file */ @SneakyThrows @@ -257,7 +263,7 @@ .head(VoIntake.class) .sheet() .doReadSync(); return BaseResponseUtils.buildSuccess(memberList) ; return BaseResponseUtils.buildSuccess(memberList); } /** pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
@@ -79,6 +79,12 @@ * @return 取水口记录列表 */ public QueryResultVo<List<VoIntake>> getIntakes(QueryVo queryVo) { // String isBinded = queryVo.getIsBinded(); // // if(isBinded == null || isBinded.length() <= 0) { // // } Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); Long itemTotal = prIntakeMapper.getRecordCount(params); pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/QueryVo.java
@@ -29,7 +29,8 @@ public String blockName; @Schema(description = "是否绑定设备") public String isBind; //0未绑定 1已绑定 public Integer isBinded; @Schema(description = "地址") public String address; pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java
@@ -12,13 +12,11 @@ import com.dy.pipIrrGlobal.voSe.VoActiveCard; import com.dy.pipIrrGlobal.voSe.VoActiveCardNew; import com.dy.pipIrrGlobal.voSe.VoRecharge; import com.dy.pipIrrGlobal.voSe.VoReissueCard; 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.QoActiveCard; import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; import com.dy.pipIrrSell.cardOperate.qo.QoTransaction; import com.dy.pipIrrSell.cardOperate.qo.QoTransactionStatistics; import com.dy.pipIrrSell.cardOperate.qo.*; import com.dy.pipIrrSell.clientCard.CardStateENUM; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; @@ -835,7 +833,7 @@ }) @GetMapping(path = "/getActiveCards") @SsoAop() public BaseResponse<QueryResultVo<List<VoActiveCardNew>>> get(QoActiveCard vo){ public BaseResponse<QueryResultVo<List<VoActiveCardNew>>> getActiveCards(QoActiveCard vo){ try { QueryResultVo<List<VoActiveCardNew>> res = cardOperateSv.getActiveCards(vo); if(res.itemTotal == 0) { @@ -848,4 +846,35 @@ } } /** * 根据指定条件获取补卡记录 * @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 = VoActiveCard.class))} ) }) @GetMapping(path = "/getReissueCards") @SsoAop() public BaseResponse<QueryResultVo<List<VoReissueCard>>> getReissueCards(QoReissueCard vo){ try { QueryResultVo<List<VoReissueCard>> res = cardOperateSv.getReissueCards(vo); if(res.itemTotal == 0) { return BaseResponseUtils.buildFail(SellResultCode.No_ReissueCards.getMessage()); } 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
@@ -13,10 +13,7 @@ import com.dy.pipIrrGlobal.voSe.*; import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge; import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM; import com.dy.pipIrrSell.cardOperate.qo.QoActiveCard; import com.dy.pipIrrSell.cardOperate.qo.QoRecharge; import com.dy.pipIrrSell.cardOperate.qo.QoTransaction; import com.dy.pipIrrSell.cardOperate.qo.QoTransactionStatistics; import com.dy.pipIrrSell.cardOperate.qo.*; import com.dy.pipIrrSell.clientCard.ClientCardSv; import com.dy.pipIrrSell.clientCard.LastOperateENUM; import com.dy.pipIrrSell.result.SellResultCode; @@ -425,4 +422,45 @@ rsVo.obj = seCardOperateMapper.getActiveCards(params); return rsVo ; } /** * 根据指定条件获取补卡记录 * @param queryVo * @return */ public QueryResultVo<List<VoReissueCard>> getReissueCards(QoReissueCard queryVo) { //完善查询充值记录的起止时间 String reissueCardTimeStart = queryVo.reissueCardTimeStart; String reissueCardTimeStop = queryVo.reissueCardTimeStop; if(reissueCardTimeStart != null) { reissueCardTimeStart = reissueCardTimeStart + " 00:00:00"; queryVo.setReissueCardTimeStart(reissueCardTimeStart); } if(reissueCardTimeStop != null) { reissueCardTimeStop = reissueCardTimeStop + " 23:59:59"; queryVo.setReissueCardTimeStop(reissueCardTimeStop); } Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo); Long itemTotal = seCardOperateMapper.getReissueCardRecordCount(params); QueryResultVo<List<VoReissueCard>> 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.getReissueCards(params); return rsVo ; } } pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/qo/QoReissueCard.java
New file @@ -0,0 +1,35 @@ package com.dy.pipIrrSell.cardOperate.qo; import com.dy.common.webUtil.QueryConditionVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; /** * @author :WuZeYu * @Date :2024/1/26 9:17 * @LastEditTime :2024/1/26 9:17 * @Description */ @Data @EqualsAndHashCode(callSuper = false) @ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @Builder @Schema(name = "IC卡补卡记录查询条件") public class QoReissueCard extends QueryConditionVo { @Schema(description = "农户姓名") public String clientName; @Schema(description = "IC卡号") //public String cardAddr; public String cardNum; @Schema(description = "补卡时间_开始") public String reissueCardTimeStart; @Schema(description = "补卡时间_结束") public String reissueCardTimeStop; } pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java
@@ -25,6 +25,7 @@ REPLACE_FAIL_WRITE_CLIENT_CARD_ERROR(10007, "补卡失败-农户卡修改异常"), REPLACE_FAIL_WRITE_RECHARGE_ERROR(10008, "补卡失败-补卡记录写入异常"), No_ActiveCards(10009, "没有符合条件的开卡数据"), No_ReissueCards(10010, "没有符合条件的补卡数据"), /** * 充值