From a9417136ffaed5635199864a3719e77822903270 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 08 七月 2024 21:40:09 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java | 270 ++++++++++++++++++++++++++--------------------------- 1 files changed, 131 insertions(+), 139 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java index db6943f..c42f2a8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateCtrl.java @@ -1,5 +1,7 @@ package com.dy.pipIrrSell.cardOperate; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; @@ -9,8 +11,10 @@ import com.dy.pipIrrGlobal.pojoSe.SeCardOperate; import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.util.AmountToChinese; -import com.dy.pipIrrGlobal.util.Constant; -import com.dy.pipIrrGlobal.voSe.*; +import com.dy.pipIrrGlobal.voSe.VoActiveCard; +import com.dy.pipIrrGlobal.voSe.VoOperate; +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; @@ -34,7 +38,6 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; -import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -59,15 +62,6 @@ * @param bindingResult * @return 姘村崱缂栧彿 */ - @Operation(summary = "寮�鍗�", description = "鏂板紑鍐滄埛鍗�") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "active", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -77,24 +71,45 @@ } // 鑾峰彇5绾ц鏀垮尯鍒掍覆areaCode - String areaCode = String.valueOf(cardOperateSv.getAreaCodeByNum(po.getClientNum())); + String areaCode = cardOperateSv.getAreaCodeByNum(po.getClientNum()); + if(areaCode.trim().length() == 0) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.AREA_CODE_MISTAKE.getMessage()); + } + + // p206V1_0_1鍗忚锛屽彇琛屾斂鍖哄垝鐨勫悗6浣� + if(po.getProtocol() != null && po.getProtocol().trim().equals("p206V1_0_1")) { + areaCode = areaCode.substring(6); + } /** * 鏍规嵁琛屾斂鍖哄垝涓诧紙areaCode锛夊湪姘村崱琛ㄤ腑閽堝姘村崱缂栧彿锛坈ardNum锛夎繘琛屾ā绯婃煡璇� - * 濡傛灉4浣嶉『搴忓彿宸茬粡杈惧埌鏈�澶у�硷紝鎻愮ず鐢ㄦ埛鑱旂郴绯荤粺绠$悊鍛� - * 濡傛灉4浣嶉『搴忓彿鏈揪鍒版渶澶у�硷紝鍒欏姞1 + * 濡傛灉椤哄簭鍙峰凡缁忚揪鍒版渶澶у�硷紝鎻愮ず鐢ㄦ埛鑱旂郴绯荤粺绠$悊鍛� + * 濡傛灉椤哄簭鍙锋湭杈惧埌鏈�澶у�硷紝鍒欏姞1 * cardNum涓烘柊鐨勫崱鍙� */ String cardNum = Optional.ofNullable(cardOperateSv.getCardNumOfMax(areaCode)).orElse(""); - if(cardNum != null && cardNum.trim().length() > 0) { - Integer number = Integer.parseInt(cardNum.substring(12)); - number = number + 1; - if(number > 9999) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_OVERRUN.getMessage()); + if(po.getProtocol().trim().equals("p206V1_0_1")) { + if(cardNum != null && cardNum.trim().length() > 0) { + Integer number = Integer.parseInt(cardNum.substring(6)); + number = number + 1; + if(number > 9999) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_OVERRUN.getMessage()); + } + cardNum = cardNum.substring(0, 6) + String.format("%04d", number); + } else { + cardNum = areaCode + "0001"; } - cardNum = cardNum.substring(0, 12) + String.format("%04d", number); - } else { - cardNum = areaCode + "0001"; + }else { + if(cardNum != null && cardNum.trim().length() > 0) { + Integer number = Integer.parseInt(cardNum.substring(12)); + number = number + 1; + if(number > 65535) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_OVERRUN.getMessage()); + } + cardNum = cardNum.substring(0, 12) + String.format("%05d", number); + } else { + cardNum = areaCode + "00001"; + } } /** @@ -122,6 +137,9 @@ * 鏍规嵁鍐滄埛缂栧彿鑾峰彇鍐滄埛ID */ Long clientId = cardOperateSv.getClientIdByNum(clientNum); + if(clientId == null) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.CLIENT_NUM_ERROR.getMessage()); + } /** * 娣诲姞鍐滄埛鍗¤褰曪紝閫�杩橀噾棰濅綔涓哄綋鍓嶄綑棰� @@ -132,12 +150,14 @@ seClientCard.setClientid(clientId); seClientCard.setMoney(amount); seClientCard.setState(CardStateENUM.NORMAL.getCode()); - seClientCard.setOriginalCardId(originalCardId); + if(originalCardId != null) { + seClientCard.setOriginalCardId(originalCardId); + } seClientCard.setCreatedt(activeTime); seClientCard.setLastoper(LastOperateENUM.ACTIVE.getCode()); Long cardId = Optional.ofNullable(clientCardSv.add(seClientCard)).orElse(0L) ; if(cardId == 0) { - return BaseResponseUtils.buildFail(SellResultCode.ACTIVE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.ACTIVE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** @@ -155,7 +175,7 @@ seCardOperate.setOperateDt(activeTime); Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.ACTIVE_FAIL_WRITE_ACTIVE_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.ACTIVE_FAIL_WRITE_ACTIVE_CARD_ERROR.getMessage()); } /** @@ -171,12 +191,13 @@ dtoRecharge.setPrice(0f); BaseResponse<Boolean> job = cardOperateSv.addRecharge(dtoRecharge); if(!job.getCode().equals("0001")) { - return BaseResponseUtils.buildFail(SellResultCode.ACTIVE_FAIL_RECHARGE_EXCEPTION.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.ACTIVE_FAIL_RECHARGE_EXCEPTION.getMessage()); } } Map map = new HashMap(); - map.put("projectCode", Constant.projectCode_ym); + map.put("projectNo", String.format("%02x", Integer.parseInt(cardOperateSv.getProjectNo()))); + map.put("orderNumber", rec); map.put("cardNum", cardNum); return BaseResponseUtils.buildSuccess(map) ; } @@ -187,15 +208,6 @@ * @param bindingResult * @return */ - @Operation(summary = "琛ュ崱", description = "琛ュ崱") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "reissue", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -211,6 +223,7 @@ * cardId 鍘熸按鍗★紙鎸傚け姘村崱锛塈D锛岃浆绉讳綑棰濆悗闇�瑕佹洿鏂板崱浣欓涓�0 * moeny 浣欓锛屾寕澶辨椂浣跨敤 * cardCost 鍗$墖璐圭敤 + * reissueAmount 閫�杩橀噾棰� * paymentId 鏀粯鏂瑰紡缂栧彿 * remarks 澶囨敞 * operator 鎿嶄綔浜虹紪鍙� @@ -220,15 +233,24 @@ String clientNum = ""; Long cardNum = po.getCardNum(); Long cardId = 0L; - Integer cardCost = po.getCardCost(); + Integer cardCost = Optional.ofNullable(po.getCardCost()).orElse(0); Float reissueAmount = po.getReissueAmount(); Long paymentId = po.getPaymentId(); String remarks = po.getRemarks(); Long operator = po.getOperator(); + String protocol = null; - // 鍒ゆ柇褰撳墠姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏈ˉ鍗★紝浠呭凡缁忔寕澶卞叾鏈ˉ鍗$殑鍙互琛ュ崱 + // 鍒ゆ柇褰撳墠姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏈ˉ鍗★紝浠呭凡缁忔寕澶变笖鏈ˉ鍗$殑鍙互琛ュ崱 if(!cardOperateSv.isLostAndUnreplaced(cardNum)) { - return BaseResponseUtils.buildFail(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + } + + // 濡傛灉浼犲叆浜嗛��杩橀噾棰濓紝闇�瑕佸垽鏂�佸崱锛堣鎸傚け鐨勬按鍗★級鎸傚け鏃舵槸鍚﹀凡缁忛��娆撅紝鏃犺閫�娆惧灏戦兘鎻愮ず鐢ㄦ埛鎸傚け鏃跺凡閫�娆� + if(reissueAmount != null && reissueAmount > 0) { + Double tradeAmount = cardOperateSv.getTradeAmountByCardNo(cardNum); + if(tradeAmount != null) { + return BaseResponseUtils.buildErrorMsg(SellResultCode.THE_FEE_CANNOT_BE_REFUNDED.getMessage()); + } } /** @@ -236,7 +258,7 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } clientNum = map.get("clientNum").toString(); cardId = Long.parseLong(map.get("cardId").toString()); @@ -244,18 +266,24 @@ /** * 濡傛灉鏄ˉ鍗¤皟鐢ㄧ殑寮�鍗′笖杞Щ浜嗛��杩橀噾棰濓紝闇�淇敼鎸傚け鍗′綑棰濅负0 */ - SeClientCard seClientCard = new SeClientCard(); - seClientCard.setId(cardId); - seClientCard.setMoney(0f); - cardOperateSv.updateClientCard(seClientCard); + if(reissueAmount != null) { + SeClientCard seClientCard = new SeClientCard(); + seClientCard.setId(cardId); + seClientCard.setMoney(0f); + cardOperateSv.updateClientCard(seClientCard); + } /** * 娣诲姞寮�鍗¤褰曪紝閫�杩橀噾棰濆啿鍒版柊鍗′腑 */ + if(String.valueOf(cardNum).trim().length() == 10) { + protocol = "p206V1_0_1"; + } DtoActiveCard dtoActiveCard = new DtoActiveCard(); + dtoActiveCard.setProtocol(protocol); dtoActiveCard.setCardAddr(cardAddr); dtoActiveCard.setClientNum(clientNum); - dtoActiveCard.setOriginalCardId(cardNum); + dtoActiveCard.setOriginalCardId(cardId); dtoActiveCard.setCardCost(cardCost); dtoActiveCard.setAmount(reissueAmount); dtoActiveCard.setPaymentId(paymentId); @@ -264,14 +292,17 @@ BaseResponse<java.lang.Boolean> baseResponse_addActive = add_active(dtoActiveCard, null); if(!baseResponse_addActive.getCode().equals("0001")) { - return BaseResponseUtils.buildFail(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.REPLACE_FAIL_WRITE_RECHARGE_ERROR.getMessage()); } - String theContent = String.valueOf(baseResponse_addActive.getContent()); - cardNum = Long.parseLong(theContent.substring(theContent.indexOf("=") + 1, theContent.indexOf(","))); + JSONObject job_content = (JSONObject) JSON.toJSON( baseResponse_addActive.getContent()); + cardNum = job_content.getLong("cardNum"); + String orderNumber = job_content.getString("orderNumber"); + String projectNo = job_content.getString("projectNo"); Map map_response = new HashMap(); - map_response.put("projectCode", Constant.projectCode_ym); + map_response.put("projectNo", projectNo); + map_response.put("orderNumber", orderNumber); map_response.put("cardNum", cardNum); return BaseResponseUtils.buildSuccess(map_response) ; } @@ -282,15 +313,6 @@ * @param bindingResult * @return */ - @Operation(summary = "鍏呭��", description = "鍏呭��") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "recharge", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -307,20 +329,10 @@ * @param bindingResult * @return */ - @Operation(summary = "娣诲姞娉ㄩ攢璁板綍", description = "娣诲姞娉ㄩ攢璁板綍") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "cancel", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> add_cancel(@RequestBody @Valid DtoCancel po, 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()); } @@ -347,7 +359,7 @@ // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣� String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse(""); if(stateName.length() == 0 || !stateName.equals("姝e父")) { - return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); } /** @@ -355,7 +367,7 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } cardId = Long.parseLong(map.get("cardId").toString()); clientId = Long.parseLong(map.get("clientId").toString()); @@ -373,7 +385,7 @@ seClientCard.setLastoper(LastOperateENUM.CANCEL.getCode()); Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); if(rec_updateClientCard == 0) { - return BaseResponseUtils.buildFail(SellResultCode.CANCEL_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CANCEL_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** @@ -392,10 +404,14 @@ Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.CANCEL_FAIL_WRITE_CANCELL_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CANCEL_FAIL_WRITE_CANCELL_ERROR.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + Map map_response = new HashMap(); + map_response.put("projectNo", String.format("%02x", Integer.parseInt(cardOperateSv.getProjectNo()))); + map_response.put("orderNumber", rec); + map_response.put("cardNum", cardNum); + return BaseResponseUtils.buildSuccess(map_response) ; } /** @@ -404,15 +420,6 @@ * @param bindingResult * @return */ - @Operation(summary = "娣诲姞鎸傚け璁板綍", description = "娣诲姞鎸傚け璁板綍") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "loss", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -424,7 +431,7 @@ /** * cardId 姘村崱缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛� * clientId 鍐滄埛缂栧彿锛堥潪浼犲叆鍙傛暟锛岀敱cardNum鍙嶆煡锛� - * cardNum 姘村崱缂栧彿 + * cardNum 瑕佹寕澶辩殑姘村崱缂栧彿 * money 浣欓 * refund 閫�娆鹃噾棰� * remarks 澶囨敞 @@ -434,8 +441,8 @@ Long cardId = 0L; Long clientId = 0L; Long cardNum = po.getCardNum(); - Float money = po.getMoney(); - Float refund = po.getRefund(); + Float money = Optional.ofNullable(po.getMoney()).orElse(0f); + Float refund = Optional.ofNullable(po.getRefund()).orElse(0f); String remarks = po.getRemarks(); Long operator = po.getOperator(); Date lossTime = new Date(); @@ -443,7 +450,7 @@ // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣� String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse(""); if(stateName.length() == 0 || !stateName.equals("姝e父")) { - return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); } /** @@ -451,15 +458,17 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } cardId = Long.parseLong(map.get("cardId").toString()); clientId = Long.parseLong(map.get("clientId").toString()); /** * 淇敼鍐滄埛鍗′俊鎭細 - * 鎸傚け鏃堕棿 - * 鏈�鍚庢搷浣滅被鍨�-4 + * 浣欓 + * 鎸傚け鏃堕棿 + * 鐘舵�� + * 鏈�鍚庢搷浣滅被鍨�-6 */ SeClientCard seClientCard = new SeClientCard(); seClientCard.setId(cardId); @@ -469,11 +478,12 @@ seClientCard.setLastoper(LastOperateENUM.LOSS.getCode()); Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); if(rec_updateClientCard == 0) { - return BaseResponseUtils.buildFail(SellResultCode.LOSS_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.LOSS_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** * 娣诲姞鎸傚け璁板綍 + * 濡傛灉閫�娆鹃噾棰濅笉涓虹┖锛屽垯浼犲叆璐熷�� */ SeCardOperate seCardOperate = new SeCardOperate(); seCardOperate.setCardId(cardId); @@ -487,10 +497,14 @@ seCardOperate.setOperateDt(lossTime); Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.LOSS_FAIL_WRITE_LOSS_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.LOSS_FAIL_WRITE_LOSS_ERROR.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + Map map_response = new HashMap(); + map_response.put("projectNo", String.format("%02x", Integer.parseInt(cardOperateSv.getProjectNo()))); + map_response.put("orderNumber", rec); + map_response.put("cardNum", cardNum); + return BaseResponseUtils.buildSuccess(map_response) ; } /** @@ -499,15 +513,6 @@ * @param bindingResult * @return */ - @Operation(summary = "娣诲姞鍐叉璁板綍", description = "娣诲姞鍐叉璁板綍") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "reversal", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -538,7 +543,7 @@ // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣� String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse(""); if(stateName.length() == 0 || !stateName.equals("姝e父")) { - return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); } /** @@ -546,7 +551,7 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } cardId = Long.parseLong(map.get("cardId").toString()); clientId = Long.parseLong(map.get("clientId").toString()); @@ -563,7 +568,7 @@ seClientCard.setLastoper(LastOperateENUM.REVERSAL.getCode()); Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); if(rec_updateClientCard == 0) { - return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** @@ -580,10 +585,15 @@ seCardOperate.setOperateDt(reversalTime); Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.REVERSAL_FAIL_WRITE_REVERSAL_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.REVERSAL_FAIL_WRITE_REVERSAL_ERROR.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + Map map_response = new HashMap(); + map_response.put("projectNo", String.format("%02x", Integer.parseInt(cardOperateSv.getProjectNo()))); + map_response.put("orderNumber", rec); + map_response.put("cardNum", cardNum); + return BaseResponseUtils.buildSuccess(map_response) ; + } /** @@ -592,15 +602,6 @@ * @param bindingResult * @return */ - @Operation(summary = "琛ユ墸", description = "琛ユ墸") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "refund", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() @@ -631,7 +632,7 @@ // 楠岃瘉姘村崱鐘舵�佹槸鍚︽敮鎸佸綋鍓嶆搷浣� String stateName = Optional.ofNullable(clientCardSv.getCardStateByCardNum(cardNum)).orElse(""); if(stateName.length() == 0 || !stateName.equals("姝e父")) { - return BaseResponseUtils.buildFail(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(stateName + ", " + SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); } /** @@ -639,7 +640,7 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } cardId = Long.parseLong(map.get("cardId").toString()); clientId = Long.parseLong(map.get("clientId").toString()); @@ -656,7 +657,7 @@ seClientCard.setLastoper(LastOperateENUM.REFUND.getCode()); Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); if(rec_updateClientCard == 0) { - return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.RECHARGE_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** @@ -666,7 +667,6 @@ seCardOperate.setCardId(cardId); seCardOperate.setClientId(clientId); seCardOperate.setMoney(money); - //seCardOperate.setNoTradeAmount(refund); seCardOperate.setRefundAmount(refund); seCardOperate.setOperateType(OperateTypeENUM.REFUND.getCode()); seCardOperate.setRemarks(remarks); @@ -674,7 +674,7 @@ seCardOperate.setOperateDt(refundTime); Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.REFUND_FAIL_WRITE_REFUND_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.REFUND_FAIL_WRITE_REFUND_ERROR.getMessage()); } return BaseResponseUtils.buildSuccess(true) ; @@ -686,20 +686,10 @@ * @param bindingResult * @return */ - @Operation(summary = "娣诲姞瑙i攣璁板綍", description = "娣诲姞瑙i攣璁板綍") - @ApiResponses(value = { - @ApiResponse( - responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, - description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", - content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, - schema = @Schema(implementation = Boolean.class))} - ) - }) @PostMapping(path = "unlock", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> add_unlock(@RequestBody @Valid DtoUnlock po, 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()); } @@ -723,7 +713,7 @@ // 鍒ゆ柇褰撳墠姘村崱鏄惁涓烘寕澶辩姸鎬佷笖鏈ˉ鍗★紝浠呭凡缁忔寕澶卞叾鏈ˉ鍗$殑鍙互瑙i攣 if(!cardOperateSv.isLostAndUnreplaced(cardNum)) { - return BaseResponseUtils.buildFail(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.THE_CARD_NOT_SUPPORT_THIS_OPERATION.getMessage()); } /** @@ -731,7 +721,7 @@ */ Map map = Optional.ofNullable(clientCardSv.getCardIdAndClientNum(cardNum)).orElse(new HashMap()); if(map == null || map.size() <= 0) { - return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); } cardId = Long.parseLong(map.get("cardId").toString()); clientId = Long.parseLong(map.get("clientId").toString()); @@ -749,7 +739,7 @@ seClientCard.setLastoper(LastOperateENUM.UNLOCK.getCode()); Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); if(rec_updateClientCard == 0) { - return BaseResponseUtils.buildFail(SellResultCode.UNLOCK_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.UNLOCK_FAIL_WRITE_CLIENT_CARD_ERROR.getMessage()); } /** @@ -765,10 +755,15 @@ seCardOperate.setOperateDt(unlockTime); Long rec = Optional.ofNullable(cardOperateSv.add(seCardOperate)).orElse(0L); if(rec == 0) { - return BaseResponseUtils.buildFail(SellResultCode.UNLOCK_FAIL_WRITE_UNLOCK_ERROR.getMessage()); + return BaseResponseUtils.buildErrorMsg(SellResultCode.UNLOCK_FAIL_WRITE_UNLOCK_ERROR.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + Map map_response = new HashMap(); + map_response.put("projectNo", String.format("%02x", Integer.parseInt(cardOperateSv.getProjectNo()))); + map_response.put("orderNumber", rec); + map_response.put("cardNum", cardNum); + return BaseResponseUtils.buildSuccess(map_response) ; + } /** @@ -790,9 +785,6 @@ public BaseResponse<QueryResultVo<List<VoRecharge>>> get(QoRecharge vo){ try { QueryResultVo<List<VoRecharge>> res = cardOperateSv.getRecharges(vo); - if(res.itemTotal == 0) { - return BaseResponseUtils.buildFail(SellResultCode.No_RECHARGES.getMessage()); - } return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("鑾峰彇鍏呭�艰褰曞紓甯�", e); -- Gitblit v1.8.0