From 70aeac289c132085e91d59dc82bc1facd41889fa Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 24 二月 2025 15:33:53 +0800
Subject: [PATCH] 有关表阀一体机(王江海制定)通信协议: 1、根据新版本协议,解析部分更新; 2、根据测试一体阀协议数据处理需求与逻辑,进行表阀一体机数据处理。
---
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 211 insertions(+), 5 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
index 10caf9c..0d259f0 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java
@@ -2,20 +2,30 @@
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
-import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper;
-import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.pipIrrGlobal.daoSe.*;
import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge;
+import com.dy.pipIrrGlobal.pojoSe.SeVcRefund;
+import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem;
import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard;
+import com.dy.pipIrrGlobal.voSe.VoOrders;
+import com.dy.pipIrrGlobal.voSe.VoVcRecharge;
+import com.dy.pipIrrGlobal.voSe.VoVirtualCard;
import com.dy.pipIrrSell.result.SellResultCode;
+import com.dy.pipIrrSell.virtualCard.dto.DtoVcRecharge;
import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard;
import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM;
import com.dy.pipIrrSell.virtualCard.enums.OrderStateENUM;
import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
+import java.util.List;
+import java.util.Map;
/**
* @author ZhuBaoMin
@@ -33,6 +43,44 @@
@Autowired
private SeVcRechargeMapper seVcRechargeMapper;
+ @Autowired
+ private SeVcRefundMapper seVcRefundMapper;
+
+ @Autowired
+ private SeVcRefundItemMapper seVcRefundItemMapper;
+
+ @Autowired
+ private SeClientMapper seClientMapper;
+
+ @Value("${vc.alarmValue}")
+ private Integer alarmValue;
+
+ /**
+ * 鏍规嵁鍐滄埛ID鑾峰彇5绾ц鏀垮尯鍒掍唬鐮侊紝娉ㄥ唽铏氭嫙鍗′娇鐢�
+ * @param clientId 鍐滄埛ID
+ * @return 5绾ц鏀垮尯鍒掍唬鐮�
+ */
+ public Long getAreaCodeById(Long clientId) {
+ return seClientMapper.getAreaCodeById(clientId);
+ }
+
+ /**
+ * 鑾峰彇鍐滄埛鍏ㄩ儴铏氭嫙鍗�
+ * @return
+ */
+ public List<VoVirtualCard> getVCs(Long clientId) {
+ return seVirtualCardMapper.getVCs(alarmValue, clientId);
+ }
+
+ /**
+ * 鏍规嵁铏氭嫙鍗D鑾峰彇铏氭嫙鍗″璞�
+ * @param vcId
+ * @return
+ */
+ public VoVirtualCard getVcById(Long vcId) {
+ return seVirtualCardMapper.getVcById(vcId);
+ }
+
/**
* 娉ㄥ唽铏氭嫙鍗�
* @param po
@@ -42,6 +90,24 @@
seVirtualCardMapper.insert(po);
return po.getId();
}
+
+ /**
+ * 鏍规嵁琛屾斂鍖哄垝涓叉ā绯婃煡璇㈣櫄鎷熷崱缂栧彿锛屾敞鍐岃櫄鎷熷崱浣跨敤
+ * @param areaCode
+ * @return
+ */
+ String getVcCardNumOfMax(String areaCode) {
+ return seVirtualCardMapper.getVcCardNumOfMax(areaCode);
+ }
+
+ /** 搴熷純
+ * 楠岃瘉鍐滄埛鏄惁鎷ユ湁鎸囧畾鍚嶇О鐨勮櫄鎷熷崱
+ * @param po
+ * @return
+ */
+ //public Integer getRecordCountByName(DtoRegist po) {
+ // return seVirtualCardMapper.getRecordCountByName(po.getClientId(), po.getVcName());
+ //}
/**
* 淇敼铏氭嫙鍗�
@@ -61,6 +127,7 @@
public SeVirtualCard selectVirtuCardById(Long virtualId) {
return seVirtualCardMapper.selectByPrimaryKey(virtualId);
}
+
/**
* 娣诲姞铏氭嫙鍗″厖鍊艰褰�
* JSAPI涓嬪崟鍚庣敓鎴愰儴鍒嗗厖鍊艰褰�
@@ -71,7 +138,7 @@
String orderNumber = po.getOrderNumber();
Long virtualId = po.getVirtualId();
Long clientId = po.getClientId();
- Integer rechargeAmount = po.getRechargeAmount();
+ Double rechargeAmount = po.getRechargeAmount();
// 楠岃瘉璇ヨ櫄鎷熷崱璐︽埛鏄惁瀛樺湪骞跺彇鍑哄綋鍓嶈处鎴蜂綑棰�
SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId);
@@ -97,6 +164,15 @@
}
/**
+ * 鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞�
+ * @param orderNumber
+ * @return
+ */
+ public SeVcRecharge getVCRechargeByorderNumber(String orderNumber) {
+ return seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber);
+ }
+
+ /**
* 淇敼铏氭嫙鍗″厖鍊艰褰�
* 寰俊鏀粯閫氱煡鍚庯細
* 1. 鏇存柊鍏呭�艰〃锛氬厖鍊煎悗浣欓銆佹敮浠樺畬鎴愭椂闂淬�佽鍗曠姸鎬�
@@ -113,7 +189,7 @@
Long virtualId = seVcRecharge.getVcId();
Double money = seVcRecharge.getMoney();
- Integer rechargeAmount = seVcRecharge.getRechargeAmount();
+ Double rechargeAmount = seVcRecharge.getRechargeAmount();
Double afterRrecharge = money + rechargeAmount;
seVcRecharge.setAfterRecharge(afterRrecharge);
@@ -139,7 +215,7 @@
}
/**
- * 淇敼铏氭嫙鍗″厖鍊艰褰�
+ * 淇敼铏氭嫙鍗″厖鍊艰褰曪紙搴熷純锛�
* 寰俊灏忕▼搴忔敮浠橀�氱煡鍚庝慨鏀癸細浣欓銆佸厖鍊煎悗浣欓銆佸厖鍊煎畬鎴愭椂闂�
* @param po
* @return
@@ -147,4 +223,134 @@
public Integer updateVCRecharge(SeVcRecharge po) {
return seVcRechargeMapper.updateByPrimaryKeySelective(po);
}
+
+ /**
+ * 鏍规嵁铏氭嫙鍗″彿鑾峰彇璁㈠崟鍒楄〃
+ * @param virtualId
+ * @return
+ */
+ public List<VoOrders> selectOrders(Long virtualId) {
+ List<VoOrders> rsVo = seVcRechargeMapper.getOrders(virtualId);
+ return rsVo ;
+ }
+
+ /**
+ * 鏍规嵁閫�娆綢D鑾峰彇閫�娆惧璞�
+ * @param refundId
+ * @return
+ */
+ public SeVcRefund selectRefundByRefundId(Long refundId) {
+ return seVcRefundMapper.selectByPrimaryKey(refundId);
+ }
+
+ /**
+ * 娣诲姞閫�娆剧敵璇�
+ * @param po
+ * @return
+ */
+ public Long addRefund(SeVcRefund po) {
+ seVcRefundMapper.insert(po);
+ return po.getId();
+ }
+
+ /**
+ * 淇敼閫�娆捐褰�
+ * @param po
+ * @return
+ */
+ public Integer updateRefund(SeVcRefund po) {
+ return seVcRefundMapper.updateByPrimaryKeySelective(po);
+ }
+
+ /**
+ * 鏍规嵁璁㈠崟鍙疯幏鍙栧叾鍚勭瑪閫�娆鹃噾棰�
+ * @param orderNumber
+ * @return
+ */
+ public List<Integer> selectRefundAmount(String orderNumber) {
+ List<Integer> rsVo = seVcRefundMapper.getRefundAmount(orderNumber);
+ return rsVo;
+ }
+
+ /**
+ * 娣诲姞閫�娆惧垎椤�
+ * @param po
+ * @return
+ */
+ public Long addRefundItem(SeVcRefundItem po) {
+ seVcRefundItemMapper.insert(po);
+ return po.getRefundId();
+ }
+
+ /**
+ * 缂栬緫閫�娆惧垎椤�
+ * @param po
+ * @return
+ */
+ public Integer updateRefundItem(SeVcRefundItem po) {
+ return seVcRefundItemMapper.updateByPrimaryKeySelective(po);
+ }
+
+ /**
+ * 鏍规嵁璁㈠崟鍙风敓鎴愰��娆惧崟鍙�
+ * @param orderNumber
+ * @return
+ */
+ public String generateRefundNumber(String orderNumber) {
+ String refundNumber = seVcRefundItemMapper.getLastRefundNumber(orderNumber);
+ if(refundNumber == null) {
+ refundNumber = orderNumber + "01";
+ return refundNumber;
+ }
+
+ String a = String.format("%02d", (Integer.parseInt(refundNumber.substring(29,30).trim()) + 1));
+ return a;
+ }
+
+ /**
+ * 鏍规嵁璁㈠崟鍙疯幏鍙栧厖鍊奸噾棰濓紝璋冪敤閫�娆剧敵璇锋帴鍙d娇鐢�
+ * @param orderNumber
+ * @return
+ */
+ public Double getRechargeAmountByOrderNumber(String orderNumber) {
+ return seVcRechargeMapper.getRechargeAmountByOrderNumber(orderNumber);
+
+ }
+
+ /**
+ * 鏍规嵁閫�娆鹃�氱煡鎺ュ彛杩斿洖鐨勯��娆惧崟鍙峰弽鏌ラ��娆綢D锛屾煡璇㈣閫�娆綢D涓嬫湭閫�娆捐褰曟暟閲�
+ * @param refundNumber
+ * @return
+ */
+ public Integer getNoRefundedCount(String refundNumber) {
+ return seVcRefundItemMapper.getNoRefundedCount(refundNumber);
+ }
+
+ /**
+ * 鏍规嵁閫�娆惧崟鍙疯幏鍙栭��娆綢D锛岄��娆鹃�氱煡鍚庢洿鏂伴��娆捐〃鎵�闇�
+ * @param refundNumber
+ * @return
+ */
+ public Long getRefundIdByRefundNumber(String refundNumber) {
+ return seVcRefundItemMapper.getRefundIdByRefundNumber(refundNumber);
+ }
+
+ /**
+ * 鑾峰彇铏氭嫙鍗″厖鍊艰褰�
+ * @param dtoVcRecharge
+ * @return
+ */
+ public QueryResultVo<List<VoVcRecharge>> getVcRechargeRecords(DtoVcRecharge dtoVcRecharge){
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(dtoVcRecharge);
+ Long itemTotal = seVirtualCardMapper.getRechargeRecordCount(params);
+
+ QueryResultVo<List<VoVcRecharge>> rsVo = new QueryResultVo<>();
+ rsVo.pageSize = dtoVcRecharge.pageSize;
+ rsVo.pageCurr = dtoVcRecharge.pageCurr;
+
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = seVirtualCardMapper.getVcRechargeRecords(params);
+
+ return rsVo;
+ }
}
--
Gitblit v1.8.0