| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoSe.*; |
| | | import com.dy.pipIrrSell.activeCardHistory.ActiveCardHistorySv; |
| | | import com.dy.pipIrrGlobal.voSe.VoActiveCard; |
| | | import com.dy.pipIrrSell.clientCard.CardStateENUM; |
| | | import com.dy.pipIrrSell.clientCard.ClientCardSv; |
| | | import com.dy.pipIrrSell.clientCard.LastOperateENUM; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | |
| | | public class ActiveCardCtrl { |
| | | private final ActiveCardSv activeCardSv; |
| | | private final ClientCardSv clientCardSv; |
| | | private final ActiveCardHistorySv activeCardHistorySv; |
| | | |
| | | @Operation(summary = "获得一页开卡记录", description = "返回一页开卡数据") |
| | | @ApiResponses(value = { |
| | |
| | | @PostMapping(path = "add_active", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PO_ActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_active(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | * cardCost 卡片费用 |
| | | * reissueAmount 补卡金额,补卡时使用 |
| | | * paymentId 支付方式编号 |
| | | * remarks 备注 |
| | | * operator 操作人编号 |
| | | * activeTime 开卡时间 |
| | | */ |
| | |
| | | Long clientId = po.getClientId(); |
| | | Integer cardCost = po.getCardCost(); |
| | | Long paymentId = po.getPaymentId(); |
| | | String remarks = po.getRemarks(); |
| | | Long operator = po.getOperator(); |
| | | Date activeTime = new Date(); |
| | | //LocalDateTime activeTime = LocalDateTime.parse(dtf.format(LocalDateTime.now()), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | |
| | | clientCard.setCardaddr(cardAddr); |
| | | clientCard.setClientid(clientId); |
| | | clientCard.setMoney(0.0); |
| | | clientCard.setState((byte) 1); |
| | | clientCard.setState(CardStateENUM.NORMAL.getCode()); |
| | | clientCard.setCreatedt(activeTime); |
| | | clientCard.setLastoper((byte) 1); |
| | | clientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); |
| | | |
| | | cardId = Optional.ofNullable(clientCardSv.add(clientCard)).orElse(0L) ; |
| | | if(cardId == 0) { |
| | |
| | | */ |
| | | SeActiveCard activeCard = new SeActiveCard(); |
| | | activeCard.setCardid(cardId); |
| | | activeCard.setClientid(clientId); |
| | | activeCard.setCardcost(cardCost); |
| | | activeCard.setPaymentid(paymentId); |
| | | activeCard.setOperatetype((byte)1); |
| | | activeCard.setOperatetype(OperateTypeENUM.ACTIVE.getCode()); |
| | | activeCard.setRemarks(remarks); |
| | | activeCard.setOperator(operator); |
| | | activeCard.setOperatedt(activeTime); |
| | | Long rec = Optional.ofNullable(activeCardSv.add(activeCard)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("开卡失败-开卡记录写入异常"); |
| | | } |
| | | |
| | | /** |
| | | * 添加开卡历史记录 |
| | | */ |
| | | SeActiveCardHistory activeCardHistory = new SeActiveCardHistory(); |
| | | activeCardHistory.setCardid(cardId); |
| | | activeCardHistory.setCardcost(cardCost); |
| | | activeCardHistory.setPaymentid(paymentId); |
| | | activeCardHistory.setOperatetype((byte)1); |
| | | activeCardHistory.setOperator(operator); |
| | | activeCardHistory.setOperatedt(activeTime); |
| | | Long rec_history = Optional.ofNullable(activeCardHistorySv.add(activeCardHistory)).orElse(0L); |
| | | if(rec_history == 0) { |
| | | return BaseResponseUtils.buildFail("开卡失败-开卡历史记录写入异常"); |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | |
| | | @PostMapping(path = "add_reissue", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop("-1")//@SsoAop(power = "-1") |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PO_ActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> add_reissue(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoActiveCard po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | |
| | | /** |
| | | * cardId 水卡编号(非传入参数,由cardAddr反查) |
| | | * cardAddr 水卡地址 |
| | | * clientId 农户编号 |
| | | * cardCost 卡片费用 |
| | | * reissueAmount 补卡金额,补卡时使用 |
| | | * paymentId 支付方式编号 |
| | | * remarks 备注 |
| | | * operator 操作人编号 |
| | | * activeTime 补卡时间 |
| | | */ |
| | | Long cardId = 0L; |
| | | String cardAddr = po.getCardAddr(); |
| | | Long clientId = po.getClientId(); |
| | | Integer cardCost = po.getCardCost(); |
| | | Double reissueAmount = po.getReissueAmount(); |
| | | Long paymentId = po.getPaymentId(); |
| | | String remarks = po.getRemarks(); |
| | | Long operator = po.getOperator(); |
| | | Date activeTime = new Date(); |
| | | |
| | |
| | | SeClientCard seClientCard = new SeClientCard(); |
| | | seClientCard.setId(cardId); |
| | | seClientCard.setReplacedt(activeTime); |
| | | seClientCard.setLastoper((byte)2); |
| | | seClientCard.setLastoper(LastOperateENUM.REPLACE.getCode()); |
| | | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); |
| | | if(rec_updateClientCard == 0) { |
| | | return BaseResponseUtils.buildFail("补卡失败-农户卡修改异常"); |
| | | } |
| | | |
| | | /** |
| | | * 删除开卡/补卡表该卡的补卡记录 |
| | | */ |
| | | Integer rec_deleteActiveCard = Optional.ofNullable(activeCardSv.deleteByIdAndOperateType(cardId, (byte)2)).orElse(0); |
| | | /** |
| | | * 添加补卡记录 |
| | | */ |
| | | SeActiveCard activeCard = new SeActiveCard(); |
| | | activeCard.setCardid(cardId); |
| | | activeCard.setClientid(clientId); |
| | | activeCard.setCardcost(cardCost); |
| | | activeCard.setPaymentid(paymentId); |
| | | activeCard.setReissueamount(reissueAmount); |
| | | activeCard.setOperatetype((byte)2); |
| | | activeCard.setOperatetype(OperateTypeENUM.REPLACE.getCode()); |
| | | activeCard.setRemarks(remarks); |
| | | activeCard.setOperator(operator); |
| | | activeCard.setOperatedt(activeTime); |
| | | Long rec = Optional.ofNullable(activeCardSv.add(activeCard)).orElse(0L); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("补卡失败-补卡记录写入异常"); |
| | | } |
| | | |
| | | /** |
| | | * 添加补卡历史记录 |
| | | */ |
| | | SeActiveCardHistory activeCardHistory = new SeActiveCardHistory(); |
| | | activeCardHistory.setCardid(cardId); |
| | | activeCardHistory.setCardcost(cardCost); |
| | | activeCardHistory.setPaymentid(paymentId); |
| | | activeCard.setReissueamount(reissueAmount); |
| | | activeCardHistory.setOperatetype((byte)2); |
| | | activeCardHistory.setOperator(operator); |
| | | activeCardHistory.setOperatedt(activeTime); |
| | | Long rec_history = Optional.ofNullable(activeCardHistorySv.add(activeCardHistory)).orElse(0L); |
| | | if(rec_history == 0) { |
| | | return BaseResponseUtils.buildFail("补卡失败-补卡历史记录写入异常"); |
| | | } |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |