From 7914cc9dc7a5223b1804daa36a0614d00c92937f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期三, 27 三月 2024 14:54:25 +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/virtualCard/VirtualCardCtrl.java | 228 +++ pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml | 3 pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml | 9 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundStateENUM.java | 22 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundMapper.java | 37 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRefund.java | 34 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml | 199 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/QueryVo.java | 3 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java | 114 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java | 25 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardCtrl.java | 30 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java | 40 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml | 7 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java | 55 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java | 51 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java | 9 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java | 274 ++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java | 36 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java | 39 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java | 12 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java | 28 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java | 506 +++++++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java | 22 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java | 51 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java | 102 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java | 514 +++++++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundItemMapper.java | 49 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 4 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java | 8 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java | 45 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundItemMapper.xml | 168 ++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/ToRefund.java | 35 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java | 70 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java | 52 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java | 76 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoOrders.java | 44 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java | 21 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java | 16 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefundItem.java | 88 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml | 38 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundItemStateENUM.java | 21 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoAudit.java | 40 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Orders.java | 44 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardSv.java | 19 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java | 47 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefund.java | 116 + pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java | 43 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundMapper.xml | 211 +++ pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java | 21 pipIrr-platform/pipIrr-web/pom.xml | 1 pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml | 10 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml | 116 + /dev/null | 13 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java | 81 + pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java | 6 60 files changed, 3,885 insertions(+), 82 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java index b329fa7..b75f7ce 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeClientCardMapper.java @@ -107,4 +107,16 @@ * @return */ List<VoCards> getCards(Map<?, ?> params); + + /** + * 鑾峰彇宸叉寕澶憋紝鏈ˉ鍗$殑璁板綍鏁伴噺锛屽簲鐢ㄧ▼搴忎娇鐢� + * @return + */ + Long getUnreplacedRecordCount(); + + /** + * 鑾峰彇宸叉寕澶憋紝鏈ˉ鍗$殑璁板綍锛屽簲鐢ㄧ▼搴忎娇鐢� + * @return + */ + List<VoCards> getUnreplaced(Map<?, ?> params); } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java new file mode 100644 index 0000000..4c96274 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRechargeMapper.java @@ -0,0 +1,52 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge; +import com.dy.pipIrrGlobal.voSe.VoOrders; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-03-05 20:21 + * @LastEditTime 2024-03-05 20:21 + * @Description + */ + +@Mapper +public interface SeVcRechargeMapper extends BaseMapper<SeVcRecharge> { + int deleteByPrimaryKey(Long id); + + int insert(SeVcRecharge record); + + int insertSelective(SeVcRecharge record); + + SeVcRecharge selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeVcRecharge record); + + int updateByPrimaryKey(SeVcRecharge record); + + /** + * 鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞� + * @param orderNumber + * @return + */ + SeVcRecharge getVCRechargeByorderNumber(String orderNumber); + + /** + * 鏍规嵁铏氭嫙鍗″彿鑾峰彇璁㈠崟鍒楄〃 + * @param virtualId + * @return + */ + List<VoOrders> getOrders(@Param("virtualId") Long virtualId); + + /** + * 鏍规嵁璁㈠崟鍙疯幏鍙栧厖鍊奸噾棰� + * @param orderNumber + * @return + */ + Integer getRechargeAmountByOrderNumber(@Param("orderNumber") String orderNumber); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundItemMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundItemMapper.java new file mode 100644 index 0000000..d86ef0d --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundItemMapper.java @@ -0,0 +1,49 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @author ZhuBaoMin + * @date 2024-03-10 21:05 + * @LastEditTime 2024-03-10 21:05 + * @Description + */ + +@Mapper +public interface SeVcRefundItemMapper extends BaseMapper<SeVcRefundItem> { + int deleteByPrimaryKey(Long id); + + int insert(SeVcRefundItem record); + + int insertSelective(SeVcRefundItem record); + + SeVcRefundItem selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeVcRefundItem record); + + int updateByPrimaryKey(SeVcRefundItem record); + + /** + * 鏍规嵁璁㈠崟鍙疯幏鍙栨渶鍚庝竴涓��鍗曞彿 + * @param orderNumber + * @return + */ + String getLastRefundNumber(@Param("orderNumber") String orderNumber); + + /** + * 鏍规嵁閫�娆鹃�氱煡鎺ュ彛杩斿洖鐨勯��娆惧崟鍙峰弽鏌ラ��娆綢D锛屾煡璇㈣閫�娆綢D涓嬫湭閫�娆捐褰曟暟閲� + * @param refundNumber + * @return + */ + Integer getNoRefundedCount(String refundNumber); + + /** + * 鏍规嵁閫�娆惧崟鍙疯幏鍙栭��娆綢D锛岄��娆鹃�氱煡鍚庢洿鏂伴��娆捐〃鎵�闇� + * @param refundNumber + * @return + */ + Long getRefundIdByRefundNumber(String refundNumber); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundMapper.java new file mode 100644 index 0000000..7e632ad --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVcRefundMapper.java @@ -0,0 +1,37 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefund; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 11:06 + * @LastEditTime 2024-03-08 11:06 + * @Description + */ + +@Mapper +public interface SeVcRefundMapper extends BaseMapper<SeVcRefund> { + int deleteByPrimaryKey(Long id); + + int insert(SeVcRefund record); + + int insertSelective(SeVcRefund record); + + SeVcRefund selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeVcRefund record); + + int updateByPrimaryKey(SeVcRefund record); + + /** + * 鏍规嵁璁㈠崟鍙疯幏鍙栧叾鍚勭瑪閫�娆鹃噾棰� + * @param orderNumber + * @return + */ + List<Integer> getRefundAmount(@Param("orderNumber") String orderNumber); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java new file mode 100644 index 0000000..8bac3d7 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoSe/SeVirtualCardMapper.java @@ -0,0 +1,28 @@ +package com.dy.pipIrrGlobal.daoSe; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author ZhuBaoMin + * @date 2024-03-05 20:45 + * @LastEditTime 2024-03-05 20:45 + * @Description + */ + +@Mapper +public interface SeVirtualCardMapper extends BaseMapper<SeVirtualCard> { + int deleteByPrimaryKey(Long id); + + int insert(SeVirtualCard record); + + int insertSelective(SeVirtualCard record); + + SeVirtualCard selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SeVirtualCard record); + + int updateByPrimaryKey(SeVirtualCard record); + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java new file mode 100644 index 0000000..933faa1 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRecharge.java @@ -0,0 +1,102 @@ +package com.dy.pipIrrGlobal.pojoSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.*; +import org.hibernate.validator.constraints.Length; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-05 20:21 + * @LastEditTime 2024-03-05 20:21 + * @Description + */ + +@TableName(value="se_vc_recharge", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "铏氭嫙鍗″厖鍊煎疄浣�") +public class SeVcRecharge implements BaseEntity { + public static final long serialVersionUID = 202403052025001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long id; + + /** + * 铏氭嫙鍗D + */ + @Schema(description = "铏氭嫙鍗D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖") + private Long vcId; + + /** + * 鍐滄埛ID + */ + @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖") + private Long clientId; + + /** + * 閽卞寘浣欓 + */ + @Schema(description = "閽卞寘浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閽卞寘浣欓涓嶈兘涓虹┖") + private Double money; + + /** + * 鍏呭�煎悗浣欓 + */ + @Schema(description = "鍏呭�煎悗浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�煎悗浣欓涓嶈兘涓虹┖") + private Double afterRecharge; + + /** + * 璁㈠崟鍙� + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�") + private Integer rechargeAmount; + + /** + * 涓嬪崟鏃堕棿 + */ + @Schema(description = "涓嬪崟鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date orderTime; + + /** + * 鍏呭�煎畬鎴愭椂闂� + */ + @Schema(description = "鍏呭�煎畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date rechargeTime; + + /** + * 璁㈠崟鐘舵��;1-鏈敮浠橈紝2-宸叉敮浠� + */ + @Schema(description = "璁㈠崟鐘舵��", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Length(message = "璁㈠崟鐘舵�佷笉澶т簬{max}锛屼笉灏忎簬{min}", min = 1, max = 2) + private Byte orderState; +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefund.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefund.java new file mode 100644 index 0000000..2c15c12 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefund.java @@ -0,0 +1,116 @@ +package com.dy.pipIrrGlobal.pojoSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 11:06 + * @LastEditTime 2024-03-08 11:06 + * @Description + */ + +@TableName(value="se_vc_refund", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "铏氭嫙鍗¢��娆惧疄浣�") +public class SeVcRefund implements BaseEntity { + public static final long serialVersionUID = 202403081109001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long id; + + /** + * 铏氭嫙鍗D + */ + @Schema(description = "铏氭嫙鍗D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖") + private Long vcId; + + /** + * 鍐滄埛ID + */ + @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖") + private Long clientId; + + /** + * 铏氭嫙鍗′綑棰濓紝閫�娆鹃�氱煡鍚庢洿鏂颁綑棰� + */ + @Schema(description = "铏氭嫙鍗′綑棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Double money; + + /** + * 閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + private Integer refundAmount; + + /** + * 閫�娆惧悗浣欓 + */ + @Schema(description = "閫�娆惧悗浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Double afterRefund; + + /** + * 鐢宠鏃堕棿 + */ + @Schema(description = "鐢宠鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鐢宠鏃堕棿涓嶈兘涓虹┖") + private Date applicationTime; + + /** + * 瀹℃牳浜� + */ + @Schema(description = "瀹℃牳浜�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long auditor; + + /** + * 瀹℃牳鏃堕棿 + */ + @Schema(description = "瀹℃牳鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date auditTime; + + /** + * 瀹℃牳澶囨敞 + */ + @Schema(description = "瀹℃牳澶囨敞", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private String remarks; + + /** + * 閫�娆惧崟鍙�;12浣嶅啘鎴峰彿+17浣嶆椂闂存埑+2浣嶆暟閲� + */ + @Schema(description = "閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private String refundNumber; + + /** + * 閫�娆惧畬鎴愭椂闂� + */ + @Schema(description = "閫�娆惧畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date refundTime; + + /** + * 閫�娆剧姸鎬�;1-寰呭鏍革紝2-寰呴��娆撅紝3-宸查��娆� + */ + @Schema(description = "閫�娆剧姸鎬�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Byte refundStatus; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefundItem.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefundItem.java new file mode 100644 index 0000000..ee8ba08 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVcRefundItem.java @@ -0,0 +1,88 @@ +package com.dy.pipIrrGlobal.pojoSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-10 21:05 + * @LastEditTime 2024-03-10 21:05 + * @Description + */ + +@TableName(value="se_vc_refund_item", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "铏氭嫙鍗¢��娆惧垎椤瑰疄浣�") +public class SeVcRefundItem implements BaseEntity { + public static final long serialVersionUID = 202403102108001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long id; + + /** + * 閫�娆綢D + */ + @Schema(description = "閫�娆綢D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆綢D涓嶈兘涓虹┖") + private Long refundId; + + /** + * 璁㈠崟鍙�;12浣嶅啘鎴峰ソ+17浣嶆椂闂存埑 + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 閫�娆惧崟鍙�;12浣嶅啘鎴峰彿+17浣嶆椂闂存埑+2浣嶆暟閲� + */ + @Schema(description = "閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "閫�娆惧崟鍙蜂笉鑳戒负绌�") + private String refundNumber; + + /** + * 閫�娆鹃噾棰�;涓庤鍗曞搴旂殑閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + private Integer refundAmount; + + /** + * 閫�娆惧崟鍒涘缓鏃堕棿 + */ + @Schema(description = "閫�娆惧崟鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆惧崟鍒涘缓鏃堕棿涓嶈兘涓虹┖") + private Date createTime; + + /** + * 閫�娆惧畬鎴愭椂闂� + */ + @Schema(description = "閫�娆惧畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date refundTime; + + /** + * 閫�娆剧姸鎬�;1-鏈��娆撅紝2-宸查��娆� + */ + @Schema(description = "閫�娆剧姸鎬�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Byte refundStatus; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java new file mode 100644 index 0000000..23484e2 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoSe/SeVirtualCard.java @@ -0,0 +1,76 @@ +package com.dy.pipIrrGlobal.pojoSe; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-05 20:45 + * @LastEditTime 2024-03-05 20:45 + * @Description + */ + +@TableName(value="se_virtual_card", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "铏氭嫙鍗″疄浣�") +public class SeVirtualCard implements BaseEntity { + public static final long serialVersionUID = 202403052048001L; + + /** + * 涓婚敭 + */ + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + @Schema(description = "瀹炰綋id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Long id; + + /** + * 鍐滄埛ID + */ + @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖") + private Long clientId; + + /** + * 閽卞寘浣欓 + */ + @Schema(description = "閽卞寘浣欓", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Min(value = 0, message = "閽卞寘浣欓涓嶈兘灏忎簬0") + private Double money; + + /** + * 鏈�鍚庢搷浣�;1-寮�鎴凤紝2-鍏呭�硷紝3-娑堣垂锛�4-鐢宠閫�娆撅紝5-閫�娆惧鏍� + */ + @Schema(description = "鎿嶄綔绫诲瀷", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Min(value = 1, message = "鏈�鍚庢搷浣滀笉鑳藉皬浜�1") + @Max(value = 5, message = "鏈�鍚庢搷浣滀笉鑳藉ぇ浜�5") + private Byte lastOperate; + + /** + * 鏈�鍚庢搷浣滄椂闂� + */ + @Schema(description = "鏈�鍚庢搷浣滄椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date lastOperateTime; + + /** + * 鍒涘缓鏃堕棿 + */ + @Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Date createTime; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java index f24306a..3b870e8 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoController.java @@ -5,6 +5,8 @@ import com.dy.common.po.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -25,7 +27,7 @@ @Schema(title = "ID") @ExcelProperty("ID") @ColumnWidth(10) - private Long id; + private String id; @Schema(title = "鎺у埗鍣ㄥ湴鍧�") @ExcelProperty("鎺у埗鍣ㄥ湴鍧�") @@ -48,4 +50,9 @@ @ExcelProperty("鍙戠幇鏃ユ湡鏃堕棿") @ColumnWidth(30) private Date findDt; + + @Schema(title = "鍦ㄧ嚎鐘舵��") + @ExcelProperty("鍦ㄧ嚎鐘舵��") + @ColumnWidth(6) + private String onlineState; } diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java index 02a7fd4..7973e6f 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voPr/VoFlowMonitoring.java @@ -21,7 +21,7 @@ @Schema(title = "ID") @ExcelProperty("ID") @ColumnWidth(10) - private Long id; + private String id; @Schema(title = "绠$綉娴侀噺鐩戞祴绔欏悕绉�") @ExcelProperty("绠$綉娴侀噺鐩戞祴绔欏悕绉�") diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java index 2ec42d9..95da821 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoCards.java @@ -26,13 +26,13 @@ private String cardNum; @Schema(title = "鐢佃瘽鍙风爜") - private Float phone; + private String phone; @Schema(title = "韬唤璇佸彿鐮�") - private Float idCard; + private String idCard; @Schema(title = "姘村崱鐘舵��") - private Float cardState; + private Integer cardState; @Schema(title = "姘村崱鐘舵�佸悕绉�") private String stateName; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoOrders.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoOrders.java new file mode 100644 index 0000000..9a3ea4e --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voSe/VoOrders.java @@ -0,0 +1,44 @@ +package com.dy.pipIrrGlobal.voSe; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 9:36 + * @LastEditTime 2024-03-08 9:36 + * @Description + */ + +@Data +@Schema(title = "璁㈠崟瑙嗗浘瀵硅薄") +public class VoOrders { + public static final long serialVersionUID = 202403072157001L; + + /** + * 璁㈠崟鍙� + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�") + @Positive(message = "鍏呭�奸噾棰濆繀椤讳负澶т簬0鐨勬暣鏁�") + private Integer rechargeAmount; + + /** + * 鍏呭�煎畬鎴愭椂闂� + */ + @Schema(description = "鍏呭�煎畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�煎畬鎴愭椂闂翠笉鑳戒负绌�") + private Date rechargeTime; +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index ffa34fd..28bf7d0 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -112,10 +112,6 @@ webPort: 8085 actutorPort: 9085 idSuffix: 7 - webchat: - webPort: 8086 - actutorPort: 9086 - idSuffix: 8 #椤圭洰缂栧彿 #projectCode: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml index f139fd2..d9edbe5 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrControllerMapper.xml @@ -30,7 +30,7 @@ </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> - select + select <include refid="Base_Column_List" /> from pr_controller where id = #{id,jdbcType=BIGINT} @@ -172,7 +172,7 @@ INNER JOIN pr_intake inta ON con.intakeId = inta.id <where> AND ic.operateType = 1 - AND deleted = 0 + AND con.deleted = 0 <if test = "id != null and id > 0"> AND con.id = ${id} @@ -191,16 +191,18 @@ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鎺у埗鍣ㄨ褰�--> <select id="getControllers" resultType="com.dy.pipIrrGlobal.voPr.VoController"> SELECT + CAST(con.id AS char) AS id, con.rtuAddr AS rtuAddr, inta.name AS intakeName, + "鍦ㄧ嚎" AS onlineState, (SELECT COUNT(*) FROM pr_intake_controller WHERE controllerId = con.id AND intakeId = inta.id AND operateType = 1) AS bindNumber, - con.findDt + con.findDt AS findDt FROM pr_controller con INNER JOIN pr_intake_controller ic ON ic.controllerId = con.id INNER JOIN pr_intake inta ON con.intakeId = inta.id <where> AND ic.operateType = 1 - AND deleted = 0 + AND con.deleted = 0 <if test = "id != null and id > 0"> AND con.id = ${id} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml index c0d4f0e..65ce426 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrFlowMonitoringMapper.xml @@ -214,7 +214,7 @@ INNER JOIN ba_district country ON pfm.countyId = country.id INNER JOIN ba_district town ON pfm.townId = town.id INNER JOIN ba_district village ON pfm.villageId = village.id - INNER JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id + LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id <where> pfm.deleted = 0 <if test = "name != null and name !=''"> @@ -228,7 +228,7 @@ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇娴侀噺鐩戞祴绔欏疄浣撹褰�--> <select id="getPrFlowMonitoring" parameterType="map" resultType="com.dy.pipIrrGlobal.voPr.VoFlowMonitoring"> - select (@i:=@i+1) AS id, + select CAST(pfm.id AS char) AS id, CONCAT(country.`name`, town.`name`, village.`name`) AS address, pfm.`name` AS `name`, pmofl.operateType AS bindState @@ -236,8 +236,7 @@ INNER JOIN ba_district country ON pfm.countyId = country.id INNER JOIN ba_district town ON pfm.townId = town.id INNER JOIN ba_district village ON pfm.villageId = village.id - INNER JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id, - (SELECT @i:=0) AS itable + LEFT JOIN pr_monitoring_flowmeter pmofl ON pmofl.monitoringId = pfm.id <where> pfm.deleted = 0 <if test = "name != null and name !=''"> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml index df62638..9e87a44 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrIntakeControllerMapper.xml @@ -150,7 +150,8 @@ <select id="getBindsByIntakeId" resultType="java.util.Map"> SELECT user.name AS userName, - con.code AS controllerCode, + <!--con.code AS controllerCode,--> + con.rtuAddr, (CASE WHEN ic.operateType = 1 THEN "缁戝畾" WHEN ic.operateType = 2 THEN "瑙g粦" diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml index fbd6120..f2d8c83 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeClientCardMapper.xml @@ -364,7 +364,7 @@ WHEN card.state = 3 THEN '宸叉寕澶�' End) AS stateName, '鍐滄埛鍗�' AS cardType, - card.money + FORMAT(card.money, 2) AS money FROM se_client_card card INNER JOIN se_client cli ON card.clientId = cli.id <where> @@ -387,4 +387,40 @@ </if> </trim> </select> + + <!--鑾峰彇宸叉寕澶辨湭琛ュ崱鐨勮褰曟暟閲�--> + <select id="getUnreplacedRecordCount" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM se_client_card card + INNER JOIN se_client cli ON card.clientId = cli.id + WHERE card.state = 3 AND NOT EXISTS (SELECT * FROM se_client_card card2 WHERE card.clientId = card2.clientId AND card2.state = 1) + </select> + + <!--鑾峰彇宸叉寕澶辨湭琛ュ崱鐨勮褰�--> + <select id="getUnreplaced" resultType="com.dy.pipIrrGlobal.voSe.VoCards"> + SELECT + cli.clientNum, + cli.name AS clientName, + card.cardNum, + cli.phone, + cli.idCard, + card.state AS cardState, + (CASE + WHEN card.state = 1 THEN '姝e父' + WHEN card.state = 2 THEN '宸叉敞閿�' + WHEN card.state = 3 THEN '宸叉寕澶�' + End) AS stateName, + '鍐滄埛鍗�' AS cardType, + FORMAT(card.money,2) AS money + FROM se_client_card card + INNER JOIN se_client cli ON card.clientId = cli.id + WHERE card.state = 3 AND NOT EXISTS (SELECT * FROM se_client_card card2 WHERE card.clientId = card2.clientId AND card2.state = 1) + ORDER BY card.id + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> </mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml new file mode 100644 index 0000000..de16e7a --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRechargeMapper.xml @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge"> + <!--@mbg.generated--> + <!--@Table se_vc_recharge--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="vc_id" jdbcType="BIGINT" property="vcId" /> + <result column="client_id" jdbcType="BIGINT" property="clientId" /> + <result column="money" jdbcType="FLOAT" property="money" /> + <result column="after_recharge" jdbcType="FLOAT" property="afterRecharge" /> + <result column="order_number" jdbcType="VARCHAR" property="orderNumber" /> + <result column="recharge_amount" jdbcType="INTEGER" property="rechargeAmount" /> + <result column="order_time" jdbcType="TIMESTAMP" property="orderTime" /> + <result column="recharge_time" jdbcType="TIMESTAMP" property="rechargeTime" /> + <result column="order_state" jdbcType="TINYINT" property="orderState" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, vc_id, client_id, money, after_recharge, order_number, recharge_amount, order_time, + recharge_time, order_state + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_vc_recharge + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_vc_recharge + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge"> + <!--@mbg.generated--> + insert into se_vc_recharge (id, vc_id, client_id, + money, after_recharge, order_number, + recharge_amount, order_time, recharge_time, + order_state) + values (#{id,jdbcType=BIGINT}, #{vcId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, + #{money,jdbcType=FLOAT}, #{afterRecharge,jdbcType=FLOAT}, #{orderNumber,jdbcType=VARCHAR}, + #{rechargeAmount,jdbcType=INTEGER}, #{orderTime,jdbcType=TIMESTAMP}, #{rechargeTime,jdbcType=TIMESTAMP}, + #{orderState,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge"> + <!--@mbg.generated--> + insert into se_vc_recharge + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="vcId != null"> + vc_id, + </if> + <if test="clientId != null"> + client_id, + </if> + <if test="money != null"> + money, + </if> + <if test="afterRecharge != null"> + after_recharge, + </if> + <if test="orderNumber != null"> + order_number, + </if> + <if test="rechargeAmount != null"> + recharge_amount, + </if> + <if test="orderTime != null"> + order_time, + </if> + <if test="rechargeTime != null"> + recharge_time, + </if> + <if test="orderState != null"> + order_state, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="vcId != null"> + #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + #{money,jdbcType=FLOAT}, + </if> + <if test="afterRecharge != null"> + #{afterRecharge,jdbcType=FLOAT}, + </if> + <if test="orderNumber != null"> + #{orderNumber,jdbcType=VARCHAR}, + </if> + <if test="rechargeAmount != null"> + #{rechargeAmount,jdbcType=INTEGER}, + </if> + <if test="orderTime != null"> + #{orderTime,jdbcType=TIMESTAMP}, + </if> + <if test="rechargeTime != null"> + #{rechargeTime,jdbcType=TIMESTAMP}, + </if> + <if test="orderState != null"> + #{orderState,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge"> + <!--@mbg.generated--> + update se_vc_recharge + <set> + <if test="vcId != null"> + vc_id = #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + client_id = #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + money = #{money,jdbcType=FLOAT}, + </if> + <if test="afterRecharge != null"> + after_recharge = #{afterRecharge,jdbcType=FLOAT}, + </if> + <if test="orderNumber != null"> + order_number = #{orderNumber,jdbcType=VARCHAR}, + </if> + <if test="rechargeAmount != null"> + recharge_amount = #{rechargeAmount,jdbcType=INTEGER}, + </if> + <if test="orderTime != null"> + order_time = #{orderTime,jdbcType=TIMESTAMP}, + </if> + <if test="rechargeTime != null"> + recharge_time = #{rechargeTime,jdbcType=TIMESTAMP}, + </if> + <if test="orderState != null"> + order_state = #{orderState,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRecharge"> + <!--@mbg.generated--> + update se_vc_recharge + set vc_id = #{vcId,jdbcType=BIGINT}, + client_id = #{clientId,jdbcType=BIGINT}, + money = #{money,jdbcType=FLOAT}, + after_recharge = #{afterRecharge,jdbcType=FLOAT}, + order_number = #{orderNumber,jdbcType=VARCHAR}, + recharge_amount = #{rechargeAmount,jdbcType=INTEGER}, + order_time = #{orderTime,jdbcType=TIMESTAMP}, + recharge_time = #{rechargeTime,jdbcType=TIMESTAMP}, + order_state = #{orderState,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁璁㈠崟鍙疯幏鍙栬櫄鎷熷崱鍏呭�煎璞�--> + <select id="getVCRechargeByorderNumber" resultMap="BaseResultMap"> + SELECT + <include refid="Base_Column_List" /> + FROM se_vc_recharge + WHERE order_number = #{orderNumber} + LIMIT 0,1 + </select> + + <!--鏍规嵁铏氭嫙鍗″彿鑾峰彇璁㈠崟鍒楄〃--> + <select id="getOrders" resultType="com.dy.pipIrrGlobal.voSe.VoOrders"> + SELECT + order_number AS orderNumber, + recharge_amount AS rechargeAmount, + recharge_time AS rechargeTime + FROM se_vc_recharge + <where> + AND order_state = 2 + <if test = "virtualId != null and virtualId > 0"> + AND vc_id = ${virtualId} + </if> + </where> + ORDER BY order_number + </select> + +<!--鏍规嵁璁㈠崟鍙疯幏鍙栧厖鍊奸噾棰�--> + <select id="getRechargeAmountByOrderNumber" resultType="java.lang.Integer"> + SELECT + recharge_amount AS rechargeAmount + FROM se_vc_recharge + <where> + <if test = "orderNumber != null and orderNumber !=''"> + AND order_number = #{orderNumber} + </if> + </where> + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundItemMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundItemMapper.xml new file mode 100644 index 0000000..f381ebe --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundItemMapper.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> + <!--@mbg.generated--> + <!--@Table se_vc_refund_item--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="refund_id" jdbcType="BIGINT" property="refundId" /> + <result column="order_number" jdbcType="VARCHAR" property="orderNumber" /> + <result column="refund_number" jdbcType="VARCHAR" property="refundNumber" /> + <result column="refund_amount" jdbcType="INTEGER" property="refundAmount" /> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> + <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" /> + <result column="refund_status" jdbcType="TINYINT" property="refundStatus" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, refund_id, order_number, refund_number, refund_amount, create_time, refund_time, + refund_status + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_vc_refund_item + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_vc_refund_item + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> + <!--@mbg.generated--> + insert into se_vc_refund_item (id, refund_id, order_number, + refund_number, refund_amount, create_time, + refund_time, refund_status) + values (#{id,jdbcType=BIGINT}, #{refundId,jdbcType=BIGINT}, #{orderNumber,jdbcType=VARCHAR}, + #{refundNumber,jdbcType=VARCHAR}, #{refundAmount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, + #{refundTime,jdbcType=TIMESTAMP}, #{refundStatus,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> + <!--@mbg.generated--> + insert into se_vc_refund_item + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="refundId != null"> + refund_id, + </if> + <if test="orderNumber != null"> + order_number, + </if> + <if test="refundNumber != null"> + refund_number, + </if> + <if test="refundAmount != null"> + refund_amount, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="refundTime != null"> + refund_time, + </if> + <if test="refundStatus != null"> + refund_status, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="refundId != null"> + #{refundId,jdbcType=BIGINT}, + </if> + <if test="orderNumber != null"> + #{orderNumber,jdbcType=VARCHAR}, + </if> + <if test="refundNumber != null"> + #{refundNumber,jdbcType=VARCHAR}, + </if> + <if test="refundAmount != null"> + #{refundAmount,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundTime != null"> + #{refundTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundStatus != null"> + #{refundStatus,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> + <!--@mbg.generated--> + update se_vc_refund_item + <set> + <if test="refundId != null"> + refund_id = #{refundId,jdbcType=BIGINT}, + </if> + <if test="orderNumber != null"> + order_number = #{orderNumber,jdbcType=VARCHAR}, + </if> + <if test="refundNumber != null"> + refund_number = #{refundNumber,jdbcType=VARCHAR}, + </if> + <if test="refundAmount != null"> + refund_amount = #{refundAmount,jdbcType=INTEGER}, + </if> + <if test="createTime != null"> + create_time = #{createTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundTime != null"> + refund_time = #{refundTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundStatus != null"> + refund_status = #{refundStatus,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem"> + <!--@mbg.generated--> + update se_vc_refund_item + set refund_id = #{refundId,jdbcType=BIGINT}, + order_number = #{orderNumber,jdbcType=VARCHAR}, + refund_number = #{refundNumber,jdbcType=VARCHAR}, + refund_amount = #{refundAmount,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + refund_time = #{refundTime,jdbcType=TIMESTAMP}, + refund_status = #{refundStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁璁㈠崟鍙疯幏鍙栨渶鍚庝竴涓��鍗曞彿--> + <select id="getLastRefundNumber" resultType="java.lang.String"> + SELECT + refund_number AS refundNumber + FROM se_vc_refund_item + <where> + <if test = "orderNumber != null"> + AND order_number = #{orderNumber} + </if> + </where> + ORDER BY refund_number DESC + LIMIT 0,1 + </select> + + <!--鏍规嵁閫�娆鹃�氱煡鎺ュ彛杩斿洖鐨勯��娆惧崟鍙峰弽鏌ラ��娆綢D锛屾煡璇㈣閫�娆綢D涓嬫湭閫�娆捐褰曟暟閲�--> + <select id="getNoRefundedCount" resultType="java.lang.Integer"> + SELECT + COUNT(*) AS recordCount + FROM se_vc_refund_item + WHERE refund_id = (SELECT refund_id FROM se_vc_refund_item WHERE refund_number = #{refundNumber}) AND refund_status = 1 + </select> + + <!--鏍规嵁閫�娆惧崟鍙疯幏鍙栭��娆綢D锛岄��娆鹃�氱煡鍚庢洿鏂伴��娆捐〃鎵�闇�--> + <select id="getRefundIdByRefundNumber" resultType="java.lang.Long"> + SELECT + refund_id AS refundId + FROM se_vc_refund_item + WHERE refund_number = #{refundNumber} + </select> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundMapper.xml new file mode 100644 index 0000000..011458f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcRefundMapper.xml @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeVcRefundMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVcRefund"> + <!--@mbg.generated--> + <!--@Table se_vc_refund--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="vc_id" jdbcType="BIGINT" property="vcId" /> + <result column="client_id" jdbcType="BIGINT" property="clientId" /> + <result column="money" jdbcType="FLOAT" property="money" /> + <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" /> + <result column="after_refund" jdbcType="FLOAT" property="afterRefund" /> + <result column="application_time" jdbcType="TIMESTAMP" property="applicationTime" /> + <result column="auditor" jdbcType="BIGINT" property="auditor" /> + <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" /> + <result column="remarks" jdbcType="VARCHAR" property="remarks" /> + <result column="refund_number" jdbcType="VARCHAR" property="refundNumber" /> + <result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" /> + <result column="refund_status" jdbcType="TINYINT" property="refundStatus" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, vc_id, client_id, money, refund_amount, after_refund, application_time, auditor, + audit_time, remarks, refund_number, refund_time, refund_status + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_vc_refund + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_vc_refund + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefund"> + <!--@mbg.generated--> + insert into se_vc_refund (id, vc_id, client_id, + money, refund_amount, after_refund, + application_time, auditor, audit_time, + remarks, refund_number, refund_time, + refund_status) + values (#{id,jdbcType=BIGINT}, #{vcId,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, + #{money,jdbcType=FLOAT}, #{refundAmount,jdbcType=FLOAT}, #{afterRefund,jdbcType=FLOAT}, + #{applicationTime,jdbcType=TIMESTAMP}, #{auditor,jdbcType=BIGINT}, #{auditTime,jdbcType=TIMESTAMP}, + #{remarks,jdbcType=VARCHAR}, #{refundNumber,jdbcType=VARCHAR}, #{refundTime,jdbcType=TIMESTAMP}, + #{refundStatus,jdbcType=TINYINT}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefund"> + <!--@mbg.generated--> + insert into se_vc_refund + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="vcId != null"> + vc_id, + </if> + <if test="clientId != null"> + client_id, + </if> + <if test="money != null"> + money, + </if> + <if test="refundAmount != null"> + refund_amount, + </if> + <if test="afterRefund != null"> + after_refund, + </if> + <if test="applicationTime != null"> + application_time, + </if> + <if test="auditor != null"> + auditor, + </if> + <if test="auditTime != null"> + audit_time, + </if> + <if test="remarks != null"> + remarks, + </if> + <if test="refundNumber != null"> + refund_number, + </if> + <if test="refundTime != null"> + refund_time, + </if> + <if test="refundStatus != null"> + refund_status, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="vcId != null"> + #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + #{money,jdbcType=FLOAT}, + </if> + <if test="refundAmount != null"> + #{refundAmount,jdbcType=FLOAT}, + </if> + <if test="afterRefund != null"> + #{afterRefund,jdbcType=FLOAT}, + </if> + <if test="applicationTime != null"> + #{applicationTime,jdbcType=TIMESTAMP}, + </if> + <if test="auditor != null"> + #{auditor,jdbcType=BIGINT}, + </if> + <if test="auditTime != null"> + #{auditTime,jdbcType=TIMESTAMP}, + </if> + <if test="remarks != null"> + #{remarks,jdbcType=VARCHAR}, + </if> + <if test="refundNumber != null"> + #{refundNumber,jdbcType=VARCHAR}, + </if> + <if test="refundTime != null"> + #{refundTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundStatus != null"> + #{refundStatus,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefund"> + <!--@mbg.generated--> + update se_vc_refund + <set> + <if test="vcId != null"> + vc_id = #{vcId,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + client_id = #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + money = #{money,jdbcType=FLOAT}, + </if> + <if test="refundAmount != null"> + refund_amount = #{refundAmount,jdbcType=FLOAT}, + </if> + <if test="afterRefund != null"> + after_refund = #{afterRefund,jdbcType=FLOAT}, + </if> + <if test="applicationTime != null"> + application_time = #{applicationTime,jdbcType=TIMESTAMP}, + </if> + <if test="auditor != null"> + auditor = #{auditor,jdbcType=BIGINT}, + </if> + <if test="auditTime != null"> + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + </if> + <if test="remarks != null"> + remarks = #{remarks,jdbcType=VARCHAR}, + </if> + <if test="refundNumber != null"> + refund_number = #{refundNumber,jdbcType=VARCHAR}, + </if> + <if test="refundTime != null"> + refund_time = #{refundTime,jdbcType=TIMESTAMP}, + </if> + <if test="refundStatus != null"> + refund_status = #{refundStatus,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVcRefund"> + <!--@mbg.generated--> + update se_vc_refund + set vc_id = #{vcId,jdbcType=BIGINT}, + client_id = #{clientId,jdbcType=BIGINT}, + money = #{money,jdbcType=FLOAT}, + refund_amount = #{refundAmount,jdbcType=FLOAT}, + after_refund = #{afterRefund,jdbcType=FLOAT}, + application_time = #{applicationTime,jdbcType=TIMESTAMP}, + auditor = #{auditor,jdbcType=BIGINT}, + audit_time = #{auditTime,jdbcType=TIMESTAMP}, + remarks = #{remarks,jdbcType=VARCHAR}, + refund_number = #{refundNumber,jdbcType=VARCHAR}, + refund_time = #{refundTime,jdbcType=TIMESTAMP}, + refund_status = #{refundStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> + + <!--鏍规嵁璁㈠崟鍙疯幏鍙栧叾鍚勭瑪閫�娆鹃噾棰�--> + <select id="getRefundAmount" resultType="java.lang.Integer"> + SELECT + refund_amount AS refundAmount + FROM se_vc_refund + <where> + AND refund_status = 3 + <if test = "orderNumber != null"> + AND refund_amount LIKE CONCAT(#{orderNumber},'%') + </if> + </where> + </select> + +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml new file mode 100644 index 0000000..15614b3 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVirtualCardMapper.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> + <!--@mbg.generated--> + <!--@Table se_virtual_card--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="client_id" jdbcType="BIGINT" property="clientId" /> + <result column="money" jdbcType="FLOAT" property="money" /> + <result column="last_operate" jdbcType="TINYINT" property="lastOperate" /> + <result column="last_operate_time" jdbcType="TIMESTAMP" property="lastOperateTime" /> + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, client_id, money, last_operate, last_operate_time, create_time + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from se_virtual_card + where id = #{id,jdbcType=BIGINT} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from se_virtual_card + where id = #{id,jdbcType=BIGINT} + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> + <!--@mbg.generated--> + insert into se_virtual_card (id, client_id, money, + last_operate, last_operate_time, create_time + ) + values (#{id,jdbcType=BIGINT}, #{clientId,jdbcType=BIGINT}, #{money,jdbcType=FLOAT}, + #{lastOperate,jdbcType=TINYINT}, #{lastOperateTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> + <!--@mbg.generated--> + insert into se_virtual_card + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="clientId != null"> + client_id, + </if> + <if test="money != null"> + money, + </if> + <if test="lastOperate != null"> + last_operate, + </if> + <if test="lastOperateTime != null"> + last_operate_time, + </if> + <if test="createTime != null"> + create_time, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="clientId != null"> + #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + #{money,jdbcType=FLOAT}, + </if> + <if test="lastOperate != null"> + #{lastOperate,jdbcType=TINYINT}, + </if> + <if test="lastOperateTime != null"> + #{lastOperateTime,jdbcType=TIMESTAMP}, + </if> + <if test="createTime != null"> + #{createTime,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> + <!--@mbg.generated--> + update se_virtual_card + <set> + <if test="clientId != null"> + client_id = #{clientId,jdbcType=BIGINT}, + </if> + <if test="money != null"> + money = #{money,jdbcType=FLOAT}, + </if> + <if test="lastOperate != null"> + last_operate = #{lastOperate,jdbcType=TINYINT}, + </if> + <if test="lastOperateTime != null"> + last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP}, + </if> + <if test="createTime != null"> + create_time = #{createTime,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeVirtualCard"> + <!--@mbg.generated--> + update se_virtual_card + set client_id = #{clientId,jdbcType=BIGINT}, + money = #{money,jdbcType=FLOAT}, + last_operate = #{lastOperate,jdbcType=TINYINT}, + last_operate_time = #{lastOperateTime,jdbcType=TIMESTAMP}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> + +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java index 30a1954..c4bd05d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerCtrl.java @@ -44,13 +44,14 @@ @Slf4j @Tag(name = "鎺у埗鍣ㄧ鐞�", description = "鎺у埗鍣ㄦ搷浣�") @RestController -@RequestMapping(path="controller") +@RequestMapping(path = "controller") @RequiredArgsConstructor public class ControllerCtrl { private final ControllerSv controllerSv; /** * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鎺у埗鍣ㄥ垪琛� + * * @param vo 鏌ヨ鏉′欢 * @return 绗﹀悎鏉′欢鐨勬帶鍒跺櫒鍒楄〃 */ @@ -65,23 +66,24 @@ }) @GetMapping(path = "/getControllers") @SsoAop() - public BaseResponse<QueryResultVo<List<VoController>>> getControllers(QueryVo vo){ + public BaseResponse<QueryResultVo<List<VoController>>> getControllers(QueryVo vo) { try { QueryResultVo<List<VoController>> res = controllerSv.getControllers(vo); - if(res.itemTotal != null && res.itemTotal > 0) { + if (res.itemTotal != null && res.itemTotal > 0) { return BaseResponseUtils.buildSuccess(res); - }else { + } else { return BaseResponseUtils.buildFail(ProjectResultCode.NO_RECORDS.getMessage()); } //return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } } /** * 鏍规嵁鎺у埗鍣ㄧ紪鍙疯幏鍙栨帶鍒跺櫒鍒楄〃 + * * @param rtuAddr 鎺у埗鍣ㄥ湴鍧� * @return 绗﹀悎鏉′欢鐨勬帶鍒跺櫒鍒楄〃 */ @@ -96,22 +98,23 @@ }) @GetMapping(path = "controller_list") @SsoAop() - public BaseResponse<List<Map<String, Object>>> getControllersByCode(String rtuAddr){ + public BaseResponse<List<Map<String, Object>>> getControllersByCode(String rtuAddr) { try { List<Map<String, Object>> list = Optional.ofNullable(controllerSv.getControllersByAddr(rtuAddr)).orElse(new ArrayList<>()); - if(list.size() <= 0) { + if (list.size() <= 0) { return BaseResponseUtils.buildFail(ProjectResultCode.NO_RECORDS.getMessage()); } return BaseResponseUtils.buildSuccess(list); } catch (Exception e) { log.error("鏌ヨ鎺у埗鍣ㄥ紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } } /** * 娣诲姞鎺у埗鍣� - * @param po 鎺у埗鍣ㄥ疄浣撳璞� + * + * @param po 鎺у埗鍣ㄥ疄浣撳璞� * @param bindingResult * @return 娣诲姞鏄惁鎴愬姛 */ @@ -128,8 +131,8 @@ @Transactional(rollbackFor = Exception.class) @SsoAop() //public BaseResponse<Boolean> add(@RequestBody @Valid DtoController po, BindingResult bindingResult){ - public BaseResponse<Boolean> add(@RequestBody @Valid PrController po, BindingResult bindingResult){ - if(bindingResult != null && bindingResult.hasErrors()){ + public BaseResponse<Boolean> add(@RequestBody @Valid PrController po, BindingResult bindingResult) { + if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -141,17 +144,21 @@ Date operateTime = new Date(); po.setOperateDt(operateTime); - po.setDeleted((byte)0); + po.setDeleted((byte) 0); po.setFindDt(operateTime); + if (po.getAddWays() == null) { + po.setAddWays((byte) 1); + } Integer rec = Optional.ofNullable(controllerSv.addController(po)).orElse(0); - if(rec == 0) { + if (rec == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.CONTROLLER_FAIL.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + return BaseResponseUtils.buildSuccess(true); } /** * 鏍规嵁鎺у埗鍣ㄧ紪鍙峰垹闄ゆ帶鍒跺櫒 + * * @param map * @return */ @@ -166,21 +173,22 @@ }) @PostMapping(path = "delete") @SsoAop() - public BaseResponse<Boolean> delete(@RequestBody Map map){ - if(map == null || map.size() <=0) { + public BaseResponse<Boolean> delete(@RequestBody Map map) { + if (map == null || map.size() <= 0) { return BaseResponseUtils.buildFail(ProjectResultCode.PLEASE_INPUT_CONTROLLER_ID.getMessage()); } Long controllerId = Long.parseLong(map.get("controllerId").toString()); Integer recordCount = Optional.ofNullable(controllerSv.deleteControllerById(controllerId)).orElse(0); - if(recordCount == 0) { + if (recordCount == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_CONTROLLER_FAIL.getMessage()); } - return BaseResponseUtils.buildSuccess(true) ; + return BaseResponseUtils.buildSuccess(true); } /** * 鑾峰彇鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙e垪琛� + * * @return */ @Operation(summary = "鑾峰緱鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙h褰�", description = "杩斿洖鏈粦鎺у埗鍣ㄧ殑鍙栨按鍙f暟鎹�") @@ -194,21 +202,22 @@ }) @GetMapping(path = "nobinding_intakes") @SsoAop() - public BaseResponse<JSONArray> getNoBindingIntakes(){ + public BaseResponse<JSONArray> getNoBindingIntakes() { try { JSONArray array = controllerSv.getNoBindingIntakes(); - if(array.size() <= 0) { + if (array.size() <= 0) { return BaseResponseUtils.buildFail(ProjectResultCode.NO_BINDING_INTAKE.getMessage()); } return BaseResponseUtils.buildSuccess(array); } catch (Exception e) { log.error("鏌ヨ鎺у埗鍣ㄥ紓甯�", e); - return BaseResponseUtils.buildException(e.getMessage()) ; + return BaseResponseUtils.buildException(e.getMessage()); } } /** * 瀵煎嚭鎺у埗鍣ㄥ垪琛� + * * @param response * @param vo */ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java index 9fb3d15..70235e1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/ControllerSv.java @@ -4,8 +4,10 @@ import com.alibaba.fastjson2.JSONArray; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrControllerMapper; +import com.dy.pipIrrGlobal.daoPr.PrIntakeControllerMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; import com.dy.pipIrrGlobal.pojoPr.PrController; +import com.dy.pipIrrGlobal.pojoPr.PrIntakeController; import com.dy.pipIrrGlobal.voPr.VoController; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; @@ -33,6 +35,9 @@ @Autowired private PrIntakeMapper prIntakeMapper; + @Autowired + private PrIntakeControllerMapper prIntakeControllerMapper; + /** * 鏍规嵁鎸囧畾鑾峰彇鎺у埗鍣ㄨ褰� * @param queryVo @@ -58,7 +63,16 @@ * @return */ public Integer addController(PrController po) { - return prControllerMapper.insert(po); + prControllerMapper.insert(po); + PrIntakeController addPrIntakeController = new PrIntakeController(); + addPrIntakeController.setIntakeid(po.getIntakeId()); + addPrIntakeController.setControllerid(po.getId()); + addPrIntakeController.setOperatetype((byte) 1); + addPrIntakeController.setOperator(po.getOperator()); + addPrIntakeController.setOperatedt(po.getOperateDt()); + addPrIntakeController.setRemarks("缁戝畾"); + prIntakeControllerMapper.insert(addPrIntakeController); + return 1; } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/QueryVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/QueryVo.java index da037f3..10edbd8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/QueryVo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/controller/QueryVo.java @@ -26,6 +26,9 @@ @Schema(description = "鎺у埗鍣ㄧ紪鍙�") private String controllerCode; + @Schema(description = "鎺у埗鍣ㄥ湴鍧�") + private String rtuAddr; + @Schema(description = "鍦ㄧ嚎鐘舵��") public Integer onlineState; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml index 841fc87..8511298 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/pom.xml @@ -15,6 +15,15 @@ <name>pipIrr-web-sell</name> <description>web钀ラ攢淇℃伅绯荤粺</description> + <dependencies> + <!--OkHttp--> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + <version>4.9.2</version> + </dependency> + </dependencies> + <build> <plugins> <!-- 鐢熸垚涓嶅寘鍚緷璧杍ar鐨勫彲鎵цjar鍖� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java index 29de085..0aed5d4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/client/ClientCtrl.java @@ -110,7 +110,7 @@ @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() - public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult){ + public BaseResponse<Boolean> add(@RequestBody @Valid DtoClient po, BindingResult bindingResult) { if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardCtrl.java index 01b56eb..93901fd 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardCtrl.java @@ -146,4 +146,34 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } } + + /** + * 鑾峰緱涓�椤靛凡鎸傚け锛屾湭琛ュ崱鐨勬按鍗¤褰� + * @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 = BaClient.class))} + ) + }) + @GetMapping(path = "getUnreplaced") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoCards>>> getUnreplaced(QoCards vo){ + try { + QueryResultVo<List<VoCards>> res = clientCardSv.getUnreplaced(vo); + if(res.itemTotal != null && res.itemTotal > 0) { + return BaseResponseUtils.buildSuccess(res); + }else { + return BaseResponseUtils.buildFail(SellResultCode.THE_CARD_NOT_EXIST.getMessage()); + } + } catch (Exception e) { + log.error("鏌ヨ鍐滄埛寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardSv.java index d195dc2..6f7e24c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/clientCard/ClientCardSv.java @@ -130,4 +130,23 @@ return rsVo ; } + + /** + * 鑾峰彇宸叉寕澶憋紝鏈ˉ鍗$殑璁板綍锛屽簲鐢ㄧ▼搴忎娇鐢� + * @param queryVo + * @return + */ + public QueryResultVo<List<VoCards>> getUnreplaced(QoCards queryVo){ + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; + Long itemTotal = seClientCardMapper.getUnreplacedRecordCount(); + + QueryResultVo<List<VoCards>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = queryVo.pageSize ; + rsVo.pageCurr = queryVo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seClientCardMapper.getUnreplaced(params); + + return rsVo ; + } } diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java new file mode 100644 index 0000000..cb8956b --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateConfig.java @@ -0,0 +1,45 @@ +package com.dy.pipIrrSell.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.web.client.RestTemplate; + +import java.nio.charset.StandardCharsets; +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 11:43 + * @LastEditTime 2024-03-06 11:43 + * @Description + */ + +@Configuration +public class RestTemplateConfig { + @Autowired + private RestTemplateWechatCertConfig restTemplateWechatCertConfig; + + @Bean() + public RestTemplate restTemplate() throws Exception { + RestTemplate restTemplate = new RestTemplate(restTemplateWechatCertConfig.wechatHttpRequestFactory()); + // 娣诲姞鎷︽埅鍣� + //List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(); + //RestTemplateWechatCertConfig.MyRequestInterceptor myRequestInterceptor = new RestTemplateWechatCertConfig.MyRequestInterceptor(); + //interceptors.add(myRequestInterceptor); + //restTemplate.setInterceptors(interceptors); + + // 涓枃涔辩爜锛屼富瑕佹槸 StringHttpMessageConverter鐨勯粯璁ょ紪鐮佷负ISO瀵艰嚧鐨� + List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters(); + for (HttpMessageConverter converter : list) { + if (converter instanceof StringHttpMessageConverter) { + ((StringHttpMessageConverter) converter).setDefaultCharset(StandardCharsets.UTF_8); + break; + } + } + + return restTemplate; + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java similarity index 93% rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java index f566a74..5a3c7d4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateWechatCertConfig.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/config/RestTemplateWechatCertConfig.java @@ -1,6 +1,6 @@ -package com.dy.pipirrWebChat.config; +package com.dy.pipIrrSell.config; -import com.dy.pipirrWebChat.payment.PayInfo; +import com.dy.pipIrrSell.wechatpay.PayInfo; import okhttp3.OkHttpClient; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -18,8 +18,8 @@ /** * @author ZhuBaoMin - * @date 2024-02-23 19:18 - * @LastEditTime 2024-02-23 19:18 + * @date 2024-03-06 11:44 + * @LastEditTime 2024-03-06 11:44 * @Description */ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java index a0b2d7c..6209612 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/result/SellResultCode.java @@ -79,18 +79,32 @@ AUDITS_ADD_FAIL(80001, "鎬昏处瀹℃牳璁板綍娣诲姞澶辫触"), /** - * 鐢靛瓙閽卞寘 + * 铏氭嫙鍗� */ + + VERIFY_FAIL(10001, "楠岀澶辫触"), + + TOTAL_REFUND_EXCEED_TRADE(10001, "閫�娆炬�婚瓒呰繃璁㈠崟閲戦"), + ACCEPTED(10001, "閫�娆剧敵璇峰凡鍙楃悊"), + PROCESSING(10001, "閫�娆惧鐞嗕腑"), + ABNORMAL(10001, "閫�娆惧紓甯�"), + RECHARGE_ADD_FAIL(10001, "鍏呭�艰褰曟坊鍔犲け璐�"), + CLIENT_ID_CANNOT_BE_NULL(90001, "鍐滄埛缂栧彿涓嶈兘涓虹┖"), - WALLET_OPEN_ACCOUNT_FAIL(90002, "鐢靛瓙閽卞寘璐︽埛娉ㄥ唽澶辫触"), - WALLET_ACCOUNT_EXIST(90003, "璇ュ啘鎴峰凡娉ㄥ唽鐢靛瓙閽卞寘"), - NO_ACCOUNT(90004, "鎮ㄥ皻鏈敞鍐岀數瀛愰挶鍖呰处鎴�"), + WALLET_OPEN_ACCOUNT_FAIL(90002, "铏氭嫙鍗¤处鎴锋敞鍐屽け璐�"), + //WALLET_ACCOUNT_EXIST(90003, "璇ュ啘鎴峰凡娉ㄥ唽鐢靛瓙閽卞寘"), + NO_ACCOUNT(90004, "鎮ㄦ寚瀹氱殑铏氭嫙鍗℃湭娉ㄥ唽"), + UPDATE_ACCOUNT_FAIL(90005, "鍏呭�煎け璐ワ紝鐢靛瓙閽卞寘璐︽埛鏇存柊澶辫触"), RECHARGE_FAIL(90006, "鍏呭�煎け璐�"), + RECHARGE_NOT_EXIST(90006, "鍏呭�艰褰曚笉瀛樺湪"), + VIRTUAL_CARD_NOT_EXIST(90006, "铏氭嫙鍗¤处鎴蜂笉瀛樺湪"), + BALANCE_IS_INSUFFICIENT(90007, "娑堣垂澶辫触锛屼綑棰濅笉瓒�"), CONSUME_FAIL(90008, "娑堣垂澶辫触"), REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY(90009, "鐢宠閫�娆惧け璐ワ紝閫�娆鹃噾棰濅笉鑳藉ぇ浜庝綑棰�"), APPLICATION_REFUND_FAIL(900010, "鐢宠閫�娆惧け璐�"), + NOT_SUFFICIENT_FUNDS(900010, "閫�娆惧け璐ワ紝浣欓涓嶈冻"), NO_TO_AUDIT_REFUND(900011, "璇ョ數瀛愰挶鍖呮病鏈夊緟瀹℃牳鐨勯��娆剧敵璇�"), AUDIT_REFUND_FAIL(900012, "瀹℃牳閫�娆剧敵璇峰け璐�"), No_WALLER_RECHARGES(900013, "娌℃湁绗﹀悎鏉′欢鐨勫厖鍊兼暟鎹�"), diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java new file mode 100644 index 0000000..0d70bd5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/AesUtil.java @@ -0,0 +1,51 @@ +package com.dy.pipIrrSell.util; + +import javax.crypto.Cipher; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.GCMParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 11:46 + * @LastEditTime 2024-03-06 11:46 + * @Description + */ + +public class AesUtil { + static final int KEY_LENGTH_BYTE = 32; + static final int TAG_LENGTH_BIT = 128; + + /** + * 瑙e瘑 + * @param apiV3Key apiV3瀵嗛挜 + * @param associatedData 闄勫姞鏁版嵁 + * @param nonce 闅忔満涓� + * @param ciphertext 鏁版嵁瀵嗘枃 + * @return 瑙e瘑鍚庡瓧绗︿覆 + * @throws GeneralSecurityException + * @throws IOException + */ + public static String decryptToString(byte[] apiV3Key, byte[] associatedData, byte[] nonce, String ciphertext) throws GeneralSecurityException, IOException { + try { + Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); + SecretKeySpec key = new SecretKeySpec(apiV3Key, "AES"); + GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce); + + cipher.init(Cipher.DECRYPT_MODE, key, spec); + cipher.updateAAD(associatedData); + + return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), "utf-8"); + } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { + throw new IllegalStateException(e); + } catch (InvalidKeyException | InvalidAlgorithmParameterException e) { + throw new IllegalArgumentException(e); + } + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java new file mode 100644 index 0000000..176dd63 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/HmacSha256.java @@ -0,0 +1,43 @@ +package com.dy.pipIrrSell.util; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 11:47 + * @LastEditTime 2024-03-06 11:47 + * @Description + */ +public class HmacSha256 { + public static String getSignature(String secretKey, String data) throws NoSuchAlgorithmException, InvalidKeyException { + // 鍒涘缓瀵嗛挜瀵硅薄 + byte[] keyBytes = secretKey.getBytes(StandardCharsets.UTF_8); + SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "HmacSHA256"); + + // 鍒涘缓Mac瀵硅薄骞跺垵濮嬪寲 + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(secretKeySpec); + + // 灏嗗緟鍔犲瘑鐨勬暟鎹浆鎹负瀛楄妭鏁扮粍 + byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8); + + // 浣跨敤瀵嗛挜瀵规暟鎹繘琛屽姞瀵� + byte[] encryptedBytes = mac.doFinal(dataBytes); + + // 灏嗗姞瀵嗗悗鐨勭粨鏋滆浆鎹负鍗佸叚杩涘埗瀛楃涓� + StringBuilder hexString = new StringBuilder(); + for (byte b : encryptedBytes) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + String hmacSha256 = hexString.toString(); + return hmacSha256; + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java new file mode 100644 index 0000000..e90474a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/PayHelper.java @@ -0,0 +1,506 @@ +package com.dy.pipIrrSell.util; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; +import com.dy.pipIrrGlobal.voSe.VoOrders; +import com.dy.pipIrrSell.result.SellResultCode; +import com.dy.pipIrrSell.virtualCard.VirtualCardSv; +import com.dy.pipIrrSell.wechatpay.PayInfo; +import com.dy.pipIrrSell.wechatpay.dto.Refund; +import com.dy.pipIrrSell.wechatpay.dto.RefundRequest; +import com.dy.pipIrrSell.wechatpay.dto.RefundResponse; +import com.dy.pipIrrSell.wechatpay.dto.ToRefund; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import javax.crypto.NoSuchPaddingException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.*; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.*; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 11:47 + * @LastEditTime 2024-03-06 11:47 + * @Description + */ +@Component +@RequiredArgsConstructor +public class PayHelper { + private final VirtualCardSv virtualCardSv; + private final RestTemplateUtil restTemplateUtil; + + private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + + private String checkSessionUrl = PayInfo.checkSessionUrl; + private String tokenUrl = PayInfo.tokenUrl; + private String resetUserSessionKeyUrl = PayInfo.resetUserSessionKeyUrl; + private String notifyUrl = PayInfo.notifyUrl; + private String schema = PayInfo.schema; + private String privateCertFileName = PayInfo.privateCertFileName; + private String refundUrl = PayInfo.refundUrl; + + // 骞冲彴璇佷功鍏挜 + public Map<String, Certificate> CERTIFICATE_MAP = new HashMap(); + + /** + * 鑾峰彇32浣嶉殢鏈哄瓧绗︿覆 + * @return 闅忔満涓� + */ + public String generateRandomString() { + Random random = new Random(); + StringBuilder sb = new StringBuilder(32); + for (int i = 0; i < 32; i++) { + int index = random.nextInt(CHARACTERS.length()); + sb.append(CHARACTERS.charAt(index)); + } + return sb.toString(); + } + + /** + * 鑾峰彇鍟嗘埛璇佷功绉侀挜瀵硅薄 + * @param filename 绉侀挜鏂囦欢璺緞 + * @return 绉侀挜瀵硅薄 + * @throws IOException + */ + public PrivateKey getPrivateKey(String filename) throws IOException { + String content = new String(Files.readAllBytes(Paths.get(filename)), "utf-8"); + try { + String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "") + .replace("-----END PRIVATE KEY-----", "") + .replaceAll("\\s+", ""); + KeyFactory kf = KeyFactory.getInstance("RSA"); + return kf.generatePrivate(new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey))); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("褰撳墠Java鐜涓嶆敮鎸丷SA", e); + } catch (InvalidKeySpecException e) { + throw new RuntimeException("鏃犳晥鐨勫瘑閽ユ牸寮�"); + } + } + + /** + * 妫�楠岀櫥褰曟�� + * @param appid 灏忕▼搴� appId + * @param secret 灏忕▼搴� appSecret + * @param openid 鐢ㄦ埛鍞竴鏍囪瘑绗� + * @param sessionKey 浼氳瘽瀵嗛挜 + * @return + * @throws IOException + */ + public JSONObject checkSessionKey(String appid, String secret, String openid, String sessionKey) throws IOException, NoSuchAlgorithmException, InvalidKeyException { + String accessToken = ""; + Integer expiresIn = 0; + String signature = HmacSha256.getSignature(sessionKey, ""); + String sigMethod = "hmac_sha256"; + + JSONObject job_token = getAccessToken(appid, secret); + if(job_token != null) { + accessToken = job_token.getString("access_token"); + expiresIn = job_token.getInteger("expires_in"); + } + + Map<String, Object> queryParams = new HashMap<>(); + queryParams.put("access_token", accessToken); + queryParams.put("openid", openid); + queryParams.put("signature", signature); + queryParams.put("sig_method", sigMethod); + Map<String, String> headerParams = new HashMap<>(); + JSONObject result = restTemplateUtil.get(checkSessionUrl, queryParams, headerParams); + return result; + } + + /** + * 閲嶇疆鐧诲綍鎬� + * @param appid 灏忕▼搴� appId + * @param secret 灏忕▼搴� appSecret + * @param openid 鐢ㄦ埛鍞竴鏍囪瘑绗� + * @param sessionKey 浼氳瘽瀵嗛挜 + * @return + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + * @throws IOException + */ + public JSONObject resetUserSessionKey(String appid, String secret, String openid, String sessionKey) throws NoSuchAlgorithmException, InvalidKeyException, IOException { + String accessToken = ""; + Integer expiresIn = 0; + String signature = HmacSha256.getSignature(sessionKey, ""); + String sigMethod = "hmac_sha256"; + + JSONObject job_token = getAccessToken(appid, secret); + if(job_token != null) { + accessToken = job_token.getString("access_token"); + expiresIn = job_token.getInteger("expires_in"); + } + + Map<String, Object> queryParams = new HashMap<>(); + queryParams.put("access_token", accessToken); + queryParams.put("openid", openid); + queryParams.put("signature", signature); + queryParams.put("sig_method", sigMethod); + Map<String, String> headerParams = new HashMap<>(); + JSONObject result = restTemplateUtil.get(resetUserSessionKeyUrl, queryParams, headerParams); + return result; + } + + /** + * 鑾峰彇鎺ュ彛璋冪敤鍑嵁 + * @param appid 灏忕▼搴� appId + * @param secret 灏忕▼搴� appSecret + * @return 鍑嵁鍙婂嚟鎹湁鏁堟椂闂� + * @throws IOException + */ + public JSONObject getAccessToken(String appid, String secret) throws IOException { + Map<String, Object> queryParams = new HashMap<>(); + queryParams.put("grant_type", "client_credential"); + queryParams.put("appid", appid); + queryParams.put("secret", secret); + Map<String, String> headerParams = new HashMap<>(); + JSONObject job_result = restTemplateUtil.get(tokenUrl, queryParams, headerParams); + return job_result; + } + + /** + * 鏋勯�犵鍚嶄覆_涓嬪崟 + * @param method HTTP璇锋眰鏂规硶 + * @param url URL + * @param timestamp 鏃堕棿鎴� + * @param nonceStr 闅忔満涓� + * @param body 鎶ユ枃涓婚 + * @return 绛惧悕涓� + */ + public String buildMessage_order(String method, String url, long timestamp, String nonceStr, String body) { + return method + "\n" + + url + "\n" + + timestamp + "\n" + + nonceStr + "\n" + + body + "\n"; + } + + /** + * 鏋勯�犵鍚嶄覆_鍐嶆涓嬪崟 + * @param appid 灏忕▼搴忓敮涓�鏍囪瘑 + * @param timestamp 鏃堕棿鎴� + * @param nonceStr 闅忔満涓� + * @param pkg package + * @return 绛惧悕涓� + */ + public String buildMessage_signAgain(String appid, String timestamp, String nonceStr, String pkg) { + return appid + "\n" + + timestamp + "\n" + + nonceStr + "\n" + + pkg + "\n"; + } + + /** + * 绛惧悕 + * @param message 琚鍚嶄俊鎭� + * @param certFileName 绉侀挜璇佷功鏂囦欢璺緞 + * @return signature绛惧悕鍊硷紝绛惧悕淇℃伅涓殑涓�椤癸紝鍙備笌鐢熸垚绛惧悕淇℃伅 + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + * @throws SignatureException + * @throws IOException + */ + public String sign(byte[] message, String certFileName) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException { + Signature sign = Signature.getInstance("SHA256withRSA"); + sign.initSign(getPrivateKey(certFileName)); + sign.update(message); + return Base64.getEncoder().encodeToString(sign.sign()); + } + + /** + * 鑾峰彇绛惧悕淇℃伅 + * @param method + * @param url + * @param body + * @return 绛惧悕淇℃伅锛孒TTP澶翠腑鐨勭鍚嶄俊鎭� + * HTTP澶达細Authorization: 璁よ瘉绫诲瀷 绛惧悕淇℃伅 + * 璁よ瘉绫诲瀷锛學ECHATPAY2-SHA256-RSA2048 + */ + public String getToken(String method, String url, String body, String nonceStr, Long timestamp, String certFileName) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException, NoSuchPaddingException { + String message = buildMessage_order(method, url, timestamp, nonceStr, body); + String signature = sign(message.getBytes("utf-8"), certFileName); + + return "mchid=\"" + PayInfo.mchid + "\"," + + "nonce_str=\"" + nonceStr + "\"," + + "timestamp=\"" + timestamp + "\"," + + "serial_no=\"" + PayInfo.serial_no + "\"," + + "signature=\"" + signature + "\""; + } + + /** + * 鏋勯�犻獙閫犵鍚嶄覆 + * @param wechatpayTimestamp 璇锋眰澶翠腑杩斿洖鐨勬椂闂存埑 + * @param wechatpayNonce 璇锋眰澶翠腑杩斿洖鐨勯殢鏈轰覆 + * @param boey 璇锋眰杩斿洖鐨刡ody + * @return signatureStr鏋勯�犵殑楠岀鍚嶄覆 + */ + public String responseSign(String wechatpayTimestamp, String wechatpayNonce, String boey) { + String signatureStr = wechatpayTimestamp + "\n" + + wechatpayNonce + "\n" + + boey + "\n"; + return signatureStr; + } + + /** + * 閲嶆柊涓嬭浇璇佷功 + */ + public void refreshCertificate() throws GeneralSecurityException, IOException { + String method = "GET"; + String httpUrl = "/v3/certificates"; + String nonceStr = generateRandomString(); + Long timestamp = System.currentTimeMillis() / 1000; + + String header = PayInfo.schema + " " + getToken(method, httpUrl, "", nonceStr, timestamp, PayInfo.privateCertFileName); + + Map<String, String> headers = new HashMap<>(); + headers.put("Authorization", header); + headers.put("Accept", "application/json"); + + JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers); + JSONObject job_headers = job_result.getJSONObject("headers"); + + String wechatpayNonce = job_headers.getJSONArray("Wechatpay-Nonce").getString(0); + String wechatpaySerial = job_headers.getJSONArray("Wechatpay-Serial").getString(0); + String signature_h = job_headers.getJSONArray("Wechatpay-Signature").getString(0); + String signatureType_h = job_headers.getJSONArray("Wechatpay-Signature-Type").getString(0); + String wechatpayTimestamp = job_headers.getJSONArray("Wechatpay-Timestamp").getString(0); + + JSONObject job_body = job_result.getJSONObject("body"); + if(job_body != null) { + JSONArray array = job_body.getJSONArray("data"); + if(array != null && array.size() > 0) { + for(int i = 0; i < array.size(); i++) { + JSONObject job_data = array.getJSONObject(i); + String certificateSerial = job_data.getString("serial_no"); + String effective_time = job_data.getString("effective_time"); + String expire_time = job_data.getString("expire_time"); + JSONObject job_certificate = job_data.getJSONObject("encrypt_certificate"); + String algorithm = job_certificate.getString("algorithm"); + String nonce = job_certificate.getString("nonce"); + String associated_data = job_certificate.getString("associated_data"); + String ciphertext = job_certificate.getString("ciphertext"); + + //瀵硅瘉涔﹀瘑鏂囪繘琛岃В瀵嗗緱鍒板钩鍙拌瘉涔﹀叕閽� + String publicKey = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associated_data.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext); + + // 灏嗗钩鍙板叕閽ュ瓧绗︿覆杞垚Certificate瀵硅薄 + final CertificateFactory cf = CertificateFactory.getInstance("X509"); + ByteArrayInputStream inputStream = new ByteArrayInputStream(publicKey.getBytes(StandardCharsets.UTF_8)); + Certificate certificate = null; + try { + certificate = cf.generateCertificate(inputStream); + } catch (CertificateException e) { + e.printStackTrace(); + } + + // 鍝嶅簲澶磋瘉涔﹀簭鍙蜂笌鍝嶅簲浣撹瘉涔﹀簭鍒楀彿涓�鑷达紝涓旀椂闂村樊灏忎簬5鍒嗛挓鏃舵墠灏嗚瘉涔﹀瓨鍌╩ap + Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60; + if(wechatpaySerial.equals(certificateSerial) && timeDiff <= 5) { + // 璇佷功鏀惧叆MAP + CERTIFICATE_MAP.put(certificateSerial, certificate); + } + } + } + } + } + + /** + * 浣跨敤寰俊骞冲彴璇佷功杩涜鍝嶅簲楠岀 + * @param wechatpaySerial 鏉ヨ嚜鍝嶅簲澶寸殑寰俊骞冲彴璇佷功搴忓垪鍙� + * @param signatureStr 鏋勯�犵殑楠岀鍚嶄覆 + * @param wechatpaySignature 鏉ヨ嚜鍝嶅簲澶寸殑寰俊骞冲彴绛惧悕 + * @return + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + * @throws SignatureException + */ + public Boolean responseSignVerify(String wechatpaySerial, String signatureStr, String wechatpaySignature) throws GeneralSecurityException, IOException { + if(CERTIFICATE_MAP.isEmpty() || !CERTIFICATE_MAP.containsKey(wechatpaySerial)) { + CERTIFICATE_MAP.clear(); + refreshCertificate(); + } + Certificate certificate = (Certificate)CERTIFICATE_MAP.get(wechatpaySerial); + if(certificate == null) { + return false; + } + + // 鑾峰彇鍏挜 + PublicKey publicKey = certificate.getPublicKey(); + + // 鍒濆鍖朣HA256withRSA鍓嶉潰鍣� + Signature signature = Signature.getInstance("SHA256withRSA"); + // 鐢ㄥ井淇″钩鍙板叕閽ュ鍓嶉潰鍣ㄨ繘琛屽垵濮嬪寲 + signature.initVerify(certificate); + + // 灏嗘瀯閫犵殑楠岀鍚嶄覆鏇存柊鍒扮鍚嶅櫒涓� + signature.update(signatureStr.getBytes(StandardCharsets.UTF_8)); + + // 璇锋眰澶翠腑寰俊鏈嶅姟鍣ㄨ繑鍥炵殑绛惧悕鐢˙ase64瑙g爜锛屼娇鐢ㄧ鍚嶅櫒杩涜楠岃瘉 + boolean valid = signature.verify(Base64.getDecoder().decode(wechatpaySignature)); + return valid; + } + + + /** + * 鑾峰彇寰呴��娆惧璞″垪琛� + * 寰呴��娆惧璞″寘鍚鍗曞彿鍜屽彲閫�娆鹃噾棰� + * 璁㈠崟瀵硅薄鍖呭惈璁㈠崟鍙枫�佸厖鍊奸噾棰濄�佸厖鍊煎畬鎴愭椂闂� + * 1. 鏍规嵁铏氭嫙鍗″彿鍒拌櫄鎷熷崱琛ㄤ腑鍙栧嚭璇ュ崱浣欓 + * 2. 鏍规嵁铏氭嫙鍗″彿鍒板厖鍊艰〃鍙栧嚭璁㈠崟瀵硅薄鍒楄〃 + * @param virtualId + * @param refundAmount + * @return + */ + public List<ToRefund> getToRefunds(Long virtualId, Integer refundAmount) { + ToRefund toRefund = new ToRefund(); + List<ToRefund> list = new ArrayList<>(); + Double money = 0d; + + // 鏍规嵁铏氭嫙鍗″彿鑾峰彇褰撳墠铏氭嫙鍗′綑棰� + SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId); + if(seVirtualCard != null) { + money = seVirtualCard.getMoney(); + } + + // 瑕侀��閲戦澶т簬璇ュ崱浣欓锛岃繑鍥炵┖鍒楄〃 + if(refundAmount > money) { + return list; + } + + // 鏍规嵁铏氭嫙鍗″彿鑾峰彇璁㈠崟鍒楄〃锛堜粎闄愬厖鍊兼垚鍔熺殑锛� + List<VoOrders> list_Orders = virtualCardSv.selectOrders(virtualId); + // 閬嶅巻璁㈠崟鍒楄〃锛岃幏鍙� + if(list_Orders != null && list_Orders.size() > 0) { + JSONArray array_Orders = (JSONArray) JSON.toJSON(list_Orders); + for(int i = 0; i < array_Orders.size(); i++) { + JSONObject job_order = array_Orders.getJSONObject(i); + String orderNumber = job_order.getString("orderNumber"); + Integer rechargeAmount = job_order.getInteger("rechargeAmount"); + Date rechargeTime = job_order.getDate("rechargeTime"); + + // 璁$畻鍏呭�艰嚦浠婃椂闂村樊锛堝垎閽燂級 + Long timestamp_Recharge = rechargeTime.getTime() / 1000; + Long timestamp_Current = System.currentTimeMillis() / 1000; + Long timeDiff_Minute = (timestamp_Current - timestamp_Recharge)/60; + + // 鑾峰彇璇ヨ鍗曞凡閫�娆剧瑪鏁� + Integer refundCount = 0; + List<Integer> list_RefundAmount = virtualCardSv.selectRefundAmount(orderNumber); + if(list_RefundAmount != null && list_RefundAmount.size() > 0) { + refundCount = list_RefundAmount.size(); + } + + // 鍏呭�艰嚦浠婃湭瓒呰繃涓�骞翠笖璇ヨ鍗曢��娆炬�绘鏁版湭瓒呰繃50娆� + if(timeDiff_Minute/(365*24*60) >= 1 && (refundCount + 1) > 50) + return list; + + /** + * 1. 濡傛灉瑕侀��閲戦灏忎簬褰撳墠璁㈠崟鐨勫厖鍊奸噾棰濓紝瑕侀��閲戦鍗充负搴旈��閲戦骞惰繑鍥� + * 2. 濡傛灉瑕佹帹閲戦澶т簬褰撳墠璁㈠崟鍏呭�奸噾棰濓紝褰撳墠璁㈠崟鍏呭�奸噾棰濆嵆涓哄簲閫�閲戦 + * a. 鐢熸垚搴旈��娆惧璞� + * b. 璁$畻鏂扮殑浣欓 + * c. 閲戣挏鏂扮殑瑕侀��娆鹃噾棰� + * d. 濡傛灉瑕侀��閲戦澶т簬0锛岄亶鍘嗕笅涓�涓鍗� + */ + if(refundAmount <= rechargeAmount) { + toRefund = new ToRefund(); + toRefund.setOrderNumber(orderNumber); + toRefund.setRefundAmount(refundAmount); + list.add(toRefund); + // 璁$畻鏂扮殑浣欓鍜屾柊鐨勮閫�閲戦 + money = money - refundAmount; + refundAmount = refundAmount - refundAmount; + return list; + }else { + toRefund = new ToRefund(); + toRefund.setOrderNumber(orderNumber); + toRefund.setRefundAmount(rechargeAmount); + list.add(toRefund); + // 璁$畻鏂扮殑浣欓鍜屾柊鐨勮閫�閲戦 + money = money - rechargeAmount; + refundAmount = refundAmount - rechargeAmount; + if(refundAmount > 0) { + continue; + }else { + return list; + } + } + } + } + return list; + } + + /** + * 閫�娆剧敵璇凤紝璋冪敤寰俊鏀粯閫�娆剧敵璇锋帴鍙� + * @param po 閫�娆捐姹傚璞★紝鍖呭惈璁㈠崟鍙枫�侀��娆惧崟鍙枫�侀��娆鹃噾棰� + * @return + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws InvalidKeySpecException + * @throws IOException + * @throws SignatureException + * @throws InvalidKeyException + */ + public BaseResponse<Boolean> refunds(Refund po) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException { + String tradeNo = po.getTradeNo(); + String refundNo = po.getRefundNo(); + Integer refund = po.getRefund(); + + // 鐢熸垚body + Integer total = virtualCardSv.getRechargeAmountByOrderNumber(tradeNo); + RefundRequest.Amount amount = new RefundRequest.Amount(); + amount.setRefund(refund); + amount.setTotal(total); + amount.setCurrency("CNY"); + + RefundRequest refundRequest = new RefundRequest(); + refundRequest.setOut_trade_no(tradeNo); + refundRequest.setOut_refund_no(refundNo); + refundRequest.setNotify_url(notifyUrl); + refundRequest.setAmount(amount); + + // 鐢熸垚header + String nonceStr = generateRandomString(); + Long timestamp = System.currentTimeMillis() / 1000; + + String method = "POST"; + String httpUrl = "/v3/refund/domestic/refunds"; + + String body = JSONObject.toJSONString(refundRequest); + String header = schema + " " + getToken(method, httpUrl, body, nonceStr, timestamp, privateCertFileName); + + Map<String, String> headers = new HashMap<>(); + headers.put("Authorization", header); + headers.put("Accept", "application/json"); + headers.put("Content-Type", "application/json"); + + JSONObject job_refundResponse = restTemplateUtil.post(PayInfo.refundUrl, body, headers); + RefundResponse refundResponse = JSON.parseObject(job_refundResponse.toJSONString(), RefundResponse.class); + + String status = refundResponse.getStatus(); + if(status != null && status.equals("SUCCESS")) { + // 閫�娆剧敵璇峰凡鍙楃悊 + return BaseResponseUtils.buildSuccess(true) ; + } else if(status != null && status.equals("PROCESSING")) { + // 閫�娆惧鐞嗕腑 + return BaseResponseUtils.buildFail(SellResultCode.PROCESSING.getMessage()); + } else { + // 閫�娆惧紓甯� + return BaseResponseUtils.buildError(SellResultCode.ABNORMAL.getMessage()); + } + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java similarity index 82% rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java index 980a121..7b89aea 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/RestTemplateUtil.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/util/RestTemplateUtil.java @@ -1,4 +1,4 @@ -package com.dy.pipirrWebChat.util; +package com.dy.pipIrrSell.util; import com.alibaba.fastjson2.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -13,8 +13,8 @@ /** * @author ZhuBaoMin - * @date 2024-02-23 15:42 - * @LastEditTime 2024-02-23 15:42 + * @date 2024-03-06 13:47 + * @LastEditTime 2024-03-06 13:47 * @Description */ @@ -39,6 +39,19 @@ HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers); ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class); return JSONObject.parseObject(response.getBody()); + } + + public JSONObject getHeaders(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException { + String tempUrl = setParamsByAppendUrl(queryParams, url); + HttpHeaders headers = new HttpHeaders(); + headerParams.forEach(headers::add); + HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(null, headers); + ResponseEntity<String> response = restTemplate.exchange(tempUrl, HttpMethod.GET, httpEntity, String.class); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("headers", response.getHeaders()); + jsonObject.put("body", response.getBody()); + return jsonObject; } public JSONObject get2(String url, Map<String, Object> queryParams, Map<String, String> headerParams) throws IOException { @@ -99,4 +112,4 @@ return url + sb; } -} +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java new file mode 100644 index 0000000..5a30b15 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardCtrl.java @@ -0,0 +1,228 @@ +package com.dy.pipIrrSell.virtualCard; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefund; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem; +import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; +import com.dy.pipIrrSell.result.SellResultCode; +import com.dy.pipIrrSell.util.PayHelper; +import com.dy.pipIrrSell.virtualCard.dto.DtoAudit; +import com.dy.pipIrrSell.virtualCard.dto.DtoRefund; +import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; +import com.dy.pipIrrSell.virtualCard.enums.RefundItemStateENUM; +import com.dy.pipIrrSell.virtualCard.enums.RefundStateENUM; +import com.dy.pipIrrSell.wechatpay.dto.Refund; +import com.dy.pipIrrSell.wechatpay.dto.ToRefund; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.crypto.NoSuchPaddingException; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SignatureException; +import java.security.spec.InvalidKeySpecException; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 8:40 + * @LastEditTime 2024-03-06 8:40 + * @Description + */ + +@Slf4j +@Tag(name = "铏氭嫙鍗$鐞�", description = "铏氭嫙鍗$鐞�") +@RestController +@RequestMapping(path="virtual_card") +@RequiredArgsConstructor +@Validated +public class VirtualCardCtrl { + private final VirtualCardSv virtualCardSv; + private final PayHelper payHelper; + + /** + * 铏氭嫙鍗¤处鍙锋敞鍐� + * @param clientId + * @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 = "add_vc") + @SsoAop() + public BaseResponse<Boolean> addWallet(@RequestParam("clientId") @NotNull(message = "鍐滄埛缂栧彿涓嶈兘涓虹┖") Long clientId){ + if(clientId == null || clientId < 0) { + return BaseResponseUtils.buildFail(SellResultCode.CLIENT_ID_CANNOT_BE_NULL.getMessage()); + } + + SeVirtualCard seVirtualCard = new SeVirtualCard(); + seVirtualCard.setClientId(clientId); + seVirtualCard.setMoney(0d); + seVirtualCard.setLastOperate(LastOperateENUM.OPEN_ACCOUNT.getCode()); + seVirtualCard.setLastOperateTime(new Date()); + seVirtualCard.setCreateTime(new Date()); + Long rec = virtualCardSv.insertVirtualCard(seVirtualCard); + if(rec == null) { + return BaseResponseUtils.buildFail(SellResultCode.WALLET_OPEN_ACCOUNT_FAIL.getMessage()); + } + return BaseResponseUtils.buildSuccess(true) ; + } + + + /** + * 鐢ㄦ埛鐢宠閫�娆� + * @param po + * @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 = "add_refund", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> addRefund(@RequestBody @Valid DtoRefund po, BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + Long virtualId = po.getVirtualId(); + Integer refundAmount = po.getRefundAmount(); + + // 鏍规嵁铏氭嫙鍗D鑾峰彇铏氭嫙鍗″璞� + SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId); + if(seVirtualCard == null) { + return BaseResponseUtils.buildFail(SellResultCode.VIRTUAL_CARD_NOT_EXIST.getMessage()); + } + Long clientId = seVirtualCard.getClientId(); + Double money = seVirtualCard.getMoney(); + + // 楠岃瘉閫�娆鹃噾棰濇槸鍚﹀ぇ浜庝綑棰� + if(refundAmount > money) { + return BaseResponseUtils.buildFail(SellResultCode.REFUND_AMOUNT_CANNOT_GREATER_THAN_MONEY.getMessage()); + } + + // 璁$畻娑堣垂鍚庝綑棰� + Double afterRefund = money - refundAmount; + + SeVcRefund seVcRefund = new SeVcRefund(); + seVcRefund.setVcId(virtualId); + seVcRefund.setClientId(clientId); + seVcRefund.setMoney(money); + seVcRefund.setRefundAmount(refundAmount); + seVcRefund.setAfterRefund(afterRefund); + seVcRefund.setApplicationTime(new Date()); + seVcRefund.setRefundStatus(RefundStateENUM.TO_AUDIT.getCode()); + + Long rec = virtualCardSv.addRefund(seVcRefund); + if(rec == 0) { + return BaseResponseUtils.buildFail(SellResultCode.APPLICATION_REFUND_FAIL.getMessage()); + } + return BaseResponseUtils.buildSuccess(true) ; + } + + /** + * 瀹℃牳閫�娆剧敵璇� + * @param po + * @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 = "audit_refund", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> auditRefund(@RequestBody @Valid DtoAudit po, BindingResult bindingResult) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + // 鏍规嵁閫�娆綢D鑾峰彇閫�娆惧璞★紝骞舵洿鏂板鏍镐汉銆佸鏍告椂闂淬�佸鏍稿娉ㄣ�侀��娆剧姸鎬佸瓧娈� + SeVcRefund seVcRefund = virtualCardSv.selectRefundByRefundId(po.getRefundId()); + Long virtualId = seVcRefund.getVcId(); + Integer refundAmount = seVcRefund.getRefundAmount(); + seVcRefund.setAuditor(po.getAuditor()); + seVcRefund.setAuditTime(new Date()); + seVcRefund.setRemarks(po.getRemarks()); + seVcRefund.setRefundStatus(RefundStateENUM.TO_REFUND.getCode()); + Integer rec = virtualCardSv.updateRefund(seVcRefund); + if(rec == 0) { + return BaseResponseUtils.buildFail(SellResultCode.AUDIT_REFUND_FAIL.getMessage()); + } + + // 瀹屾垚瀹℃牳鍚庤幏鍙栧緟閫�娆捐鍗曞垪琛� + List<ToRefund> list_ToRefund = payHelper.getToRefunds(virtualId, refundAmount); + if(list_ToRefund == null || list_ToRefund.size() <=0) + return BaseResponseUtils.buildFail(SellResultCode.NOT_SUFFICIENT_FUNDS.getMessage()); + + //閬嶅巻寰呴��娆惧垪琛� + JSONArray array_ToRefund = (JSONArray) JSON.toJSON(list_ToRefund); + for(int i = 0; i < array_ToRefund.size(); i++) { + JSONObject job_ToRefund = array_ToRefund.getJSONObject(i); + String orderNumber_ToRefund = job_ToRefund.getString("orderNumber"); + Integer refundAmount_ToRefund = job_ToRefund.getInteger("refundAmount"); + + // 鐢熸垚閫�娆惧垎椤硅褰� + SeVcRefundItem seVcRefundItem = new SeVcRefundItem(); + seVcRefundItem.setRefundId(po.getRefundId()); + seVcRefundItem.setOrderNumber(orderNumber_ToRefund); + String refundNumber = virtualCardSv.generateRefundNumber(orderNumber_ToRefund); + seVcRefundItem.setRefundNumber(refundNumber); + seVcRefundItem.setRefundAmount(refundAmount_ToRefund); + seVcRefundItem.setCreateTime(new Date()); + seVcRefundItem.setRefundStatus(RefundItemStateENUM.NO_REFUND.getCode()); + Long refundItemId = virtualCardSv.addRefundItem(seVcRefundItem); + + // 璋冪敤寰俊閫�娆剧敵璇锋帴鍙� + Refund refund = new Refund(); + refund.setTradeNo(orderNumber_ToRefund); + refund.setRefundNo(refundNumber); + refund.setRefund(refundAmount_ToRefund); + BaseResponse rep = payHelper.refunds(refund); + } + + return BaseResponseUtils.buildSuccess(true) ; + } + +} 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 new file mode 100644 index 0000000..1765f7b --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/VirtualCardSv.java @@ -0,0 +1,274 @@ +package com.dy.pipIrrSell.virtualCard; + +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper; +import com.dy.pipIrrGlobal.daoSe.SeVcRefundItemMapper; +import com.dy.pipIrrGlobal.daoSe.SeVcRefundMapper; +import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; +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.pipIrrSell.result.SellResultCode; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 8:41 + * @LastEditTime 2024-03-06 8:41 + * @Description + */ + +@Slf4j +@Service +public class VirtualCardSv { + @Autowired + private SeVirtualCardMapper seVirtualCardMapper; + + @Autowired + private SeVcRechargeMapper seVcRechargeMapper; + + @Autowired + private SeVcRefundMapper seVcRefundMapper; + + @Autowired + private SeVcRefundItemMapper seVcRefundItemMapper; + + /** + * 娉ㄥ唽铏氭嫙鍗� + * @param po + * @return + */ + public Long insertVirtualCard(SeVirtualCard po) { + seVirtualCardMapper.insert(po); + return po.getId(); + } + + /** + * 淇敼铏氭嫙鍗� + * 鍏呭�笺�佹秷璐广�佺敵璇烽��娆俱�佸鏍搁��娆炬椂闇�瑕佷慨鏀硅櫄鎷熷崱鐨勶細浣欓銆佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� + * @param po + * @return + */ + public Integer updateVirtualCard(SeVirtualCard po) { + return seVirtualCardMapper.updateByPrimaryKeySelective(po); + } + + /** + * 鏍规嵁铏氭嫙鍗$紪鍙疯幏鍙栬櫄鎷熷崱瀵硅薄 + * @param virtualId + * @return + */ + public SeVirtualCard selectVirtuCardById(Long virtualId) { + return seVirtualCardMapper.selectByPrimaryKey(virtualId); + } + + /** + * 娣诲姞铏氭嫙鍗″厖鍊艰褰� + * JSAPI涓嬪崟鍚庣敓鎴愰儴鍒嗗厖鍊艰褰� + * @param po + * @return + */ + public BaseResponse<Boolean> insertVCRecharge(DtoVirtualCard po) { + String orderNumber = po.getOrderNumber(); + Long virtualId = po.getVirtualId(); + Long clientId = po.getClientId(); + Integer rechargeAmount = po.getRechargeAmount(); + + // 楠岃瘉璇ヨ櫄鎷熷崱璐︽埛鏄惁瀛樺湪骞跺彇鍑哄綋鍓嶈处鎴蜂綑棰� + SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId); + if(seVirtualCard == null) { + return BaseResponseUtils.buildFail(SellResultCode.NO_ACCOUNT.getMessage()); + } + Double money = seVirtualCard.getMoney(); + + // 娣诲姞鍏呭�艰褰� + SeVcRecharge seVcRecharge = new SeVcRecharge(); + seVcRecharge.setVcId(virtualId); + seVcRecharge.setClientId(clientId); + seVcRecharge.setMoney(money); + seVcRecharge.setOrderNumber(orderNumber); + seVcRecharge.setRechargeAmount(rechargeAmount); + seVcRecharge.setOrderTime(new Date()); + seVcRecharge.setOrderState(OrderStateENUM.NON_PAYMENT.getCode()); + Integer rec = seVcRechargeMapper.insert(seVcRecharge); + if(rec == null) { + return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); + } + return BaseResponseUtils.buildSuccess(true) ; + } + + /** + * 淇敼铏氭嫙鍗″厖鍊艰褰� + * 寰俊鏀粯閫氱煡鍚庯細 + * 1. 鏇存柊鍏呭�艰〃锛氬厖鍊煎悗浣欓銆佹敮浠樺畬鎴愭椂闂淬�佽鍗曠姸鎬� + * 2. 鏇存柊铏氭嫙鍗¤〃锛氳处鎴蜂綑棰濄�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� + * @param orderNumber 璁㈠崟缂栧彿 + * @return + */ + @Transactional(rollbackFor = Exception.class) + public BaseResponse<Boolean> updateVCRecharge(String orderNumber, Date rechargeTime) { + SeVcRecharge seVcRecharge = seVcRechargeMapper.getVCRechargeByorderNumber(orderNumber); + if(seVcRecharge == null) { + return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_NOT_EXIST.getMessage()); + } + + Long virtualId = seVcRecharge.getVcId(); + Double money = seVcRecharge.getMoney(); + Integer rechargeAmount = seVcRecharge.getRechargeAmount(); + Double afterRrecharge = money + rechargeAmount; + + seVcRecharge.setAfterRecharge(afterRrecharge); + seVcRecharge.setRechargeTime(rechargeTime); + seVcRecharge.setOrderState(OrderStateENUM.PAID.getCode()); + Integer rec = seVcRechargeMapper.updateByPrimaryKeySelective(seVcRecharge); + if(rec == null) { + return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); + } + + SeVirtualCard seVirtualCard = seVirtualCardMapper.selectByPrimaryKey(virtualId); + if(seVirtualCard == null) { + return BaseResponseUtils.buildFail(SellResultCode.VIRTUAL_CARD_NOT_EXIST.getMessage()); + } + seVirtualCard.setMoney(afterRrecharge); + seVirtualCard.setLastOperate(LastOperateENUM.RECHARGE.getCode()); + seVirtualCard.setLastOperateTime(new Date()); + Integer rec2 = seVirtualCardMapper.updateByPrimaryKeySelective(seVirtualCard); + if(rec2 == null) { + return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL.getMessage()); + } + return BaseResponseUtils.buildSuccess(true) ; + } + + /** + * 淇敼铏氭嫙鍗″厖鍊艰褰曪紙搴熷純锛� + * 寰俊灏忕▼搴忔敮浠橀�氱煡鍚庝慨鏀癸細浣欓銆佸厖鍊煎悗浣欓銆佸厖鍊煎畬鎴愭椂闂� + * @param po + * @return + */ + 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 Integer 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); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoAudit.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoAudit.java new file mode 100644 index 0000000..4ac150c --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoAudit.java @@ -0,0 +1,40 @@ +package com.dy.pipIrrSell.virtualCard.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 21:09 + * @LastEditTime 2024-03-08 21:09 + * @Description + */ + +@Data +@Schema(name = "閫�娆惧鏍镐紶鍏ュ璞�") +public class DtoAudit { + public static final long serialVersionUID = 202403082109001L; + + /** + * 铏氭嫙鍗¢��娆綢D + */ + @Schema(description = "铏氭嫙鍗¢��娆綢D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗¢��娆綢D涓嶈兘涓虹┖") + private Long refundId; + + /** + * 瀹℃牳浜篒D + */ + @Schema(description = "瀹℃牳浜篒D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "瀹℃牳ID涓嶈兘涓虹┖") + private Long auditor; + + /** + * 瀹℃牳澶囨敞 + */ + @Schema(description = "瀹℃牳澶囨敞", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @Length(max = 200) + private String remarks; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRefund.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRefund.java new file mode 100644 index 0000000..1bff55b --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoRefund.java @@ -0,0 +1,34 @@ +package com.dy.pipIrrSell.virtualCard.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 20:17 + * @LastEditTime 2024-03-08 20:17 + * @Description + */ + +@Data +@Schema(name = "鐢ㄦ埛閫�娆句紶鍏ュ璞�") +public class DtoRefund { + public static final long serialVersionUID = 202403080858001L; + + /** + * 铏氭嫙鍗$紪鍙� + */ + @Schema(description = "铏氭嫙鍗$紪鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗$紪鍙蜂笉鑳戒负绌�") + private Long virtualId; + + /** + * 閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + @Positive(message = "鍏呭�奸噾棰濆繀椤讳负澶т簬0鐨勬暣鏁�") + private Integer refundAmount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java new file mode 100644 index 0000000..381dd41 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/dto/DtoVirtualCard.java @@ -0,0 +1,47 @@ +package com.dy.pipIrrSell.virtualCard.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 9:40 + * @LastEditTime 2024-03-06 9:40 + * @Description + */ + +@Data +@Schema(name = "铏氭嫙鍗″厖鍊间紶鍏ュ璞�") +public class DtoVirtualCard { + public static final long serialVersionUID = 202403060943001L; + + /** + * 璁㈠崟鍙� + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 鍐滄埛ID + */ + @Schema(description = "鍐滄埛ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍐滄埛ID涓嶈兘涓虹┖") + private Long clientId; + + /** + * 铏氭嫙鍗D + */ + @Schema(description = "铏氭嫙鍗D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗D涓嶈兘涓虹┖") + private Long virtualId; + + /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�") + private Integer rechargeAmount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java new file mode 100644 index 0000000..b29688d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/LastOperateENUM.java @@ -0,0 +1,25 @@ +package com.dy.pipIrrSell.virtualCard.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 9:21 + * @LastEditTime 2024-03-06 9:21 + * @Description + */ + +@Getter +@AllArgsConstructor +public enum LastOperateENUM { + OPEN_ACCOUNT((byte)1, "寮�鎴�"), + RECHARGE((byte)2, "鍏呭��"), + CONSUME((byte)3, "娑堣垂"), + APPLY_REFUND((byte)4, "鐢宠閫�娆�"), + AUDIT_REFUND((byte)5, "閫�娆惧鏍�"), + REFUND((byte)6, "閫�娆�"); + + private final Byte code; + private final String message; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java new file mode 100644 index 0000000..4af1b90 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/OrderStateENUM.java @@ -0,0 +1,21 @@ +package com.dy.pipIrrSell.virtualCard.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 10:00 + * @LastEditTime 2024-03-06 10:00 + * @Description + */ + +@Getter +@AllArgsConstructor +public enum OrderStateENUM { + NON_PAYMENT((byte)1, "鏈敮浠�"), + PAID((byte)2, "宸叉敮浠�"); + + private final Byte code; + private final String message; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundItemStateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundItemStateENUM.java new file mode 100644 index 0000000..6eca897 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundItemStateENUM.java @@ -0,0 +1,21 @@ +package com.dy.pipIrrSell.virtualCard.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ZhuBaoMin + * @date 2024-03-11 8:49 + * @LastEditTime 2024-03-11 8:49 + * @Description 閫�娆惧垎椤圭殑閫�娆剧姸鎬侊紝鍗冲井淇¢��娆剧姸鎬� + */ + +@Getter +@AllArgsConstructor +public enum RefundItemStateENUM { + NO_REFUND((byte)1, "鏈��娆�"), + REFUNDED((byte)2, "宸查��娆�"); + + private final Byte code; + private final String message; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundStateENUM.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundStateENUM.java new file mode 100644 index 0000000..0a5c69a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/virtualCard/enums/RefundStateENUM.java @@ -0,0 +1,22 @@ +package com.dy.pipIrrSell.virtualCard.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author ZhuBaoMin + * @date 2024-03-08 20:45 + * @LastEditTime 2024-03-08 20:45 + * @Description + */ + +@Getter +@AllArgsConstructor +public enum RefundStateENUM { + TO_AUDIT((byte)1, "寰呭鏍�"), + TO_REFUND((byte)2, "寰呴��娆�"), + REFUNDED((byte)3, "宸查��娆�"); + + private final Byte code; + private final String message; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java index 500dd92..6250be5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletCtrl.java @@ -76,7 +76,7 @@ } if(walletSv.getWalletByClientId(clientId) != null) { - return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage()); + //return BaseResponseUtils.buildFail(SellResultCode.WALLET_ACCOUNT_EXIST.getMessage()); } SeWallet seWallet = new SeWallet(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java index 3fafbb3..c253f27 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java @@ -13,8 +13,8 @@ import com.dy.pipIrrGlobal.voSe.VoWalletConsume; import com.dy.pipIrrGlobal.voSe.VoWalletRecharge; import com.dy.pipIrrGlobal.voSe.VoWalletRefund; -import com.dy.pipIrrSell.wallet.qo.QueryVo; import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge; +import com.dy.pipIrrSell.wallet.qo.QueryVo; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java similarity index 79% rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java index ef11dac..eb0827c 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayInfo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PayInfo.java @@ -1,18 +1,33 @@ -package com.dy.pipirrWebChat.payment; +package com.dy.pipIrrSell.wechatpay; /** * @author ZhuBaoMin - * @date 2024-02-22 20:20 - * @LastEditTime 2024-02-22 20:20 + * @date 2024-03-06 13:49 + * @LastEditTime 2024-03-06 13:49 * @Description */ public class PayInfo { - /* + /** * 灏忕▼搴忕櫥褰旳PI */ public static String loginUrl = "https://api.weixin.qq.com/sns/jscode2session"; - /* + /** + * 妫�楠岀櫥褰曟�� + */ + public static String checkSessionUrl = "https://api.weixin.qq.com/wxa/checksession"; + + /** + * 閲嶇疆鐧诲綍鎬� + */ + public static String resetUserSessionKeyUrl = "https://api.weixin.qq.com/wxa/resetusersessionkey"; + + /** + * 鑾峰彇鎺ュ彛璋冪敤鍑嵁 + */ + public static String tokenUrl = "https://api.weixin.qq.com/cgi-bin/token"; + + /** * 缁熶竴涓嬪崟API */ //public static String orderUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder"; @@ -26,17 +41,18 @@ /* * 鏀粯缁撴灉閫氱煡API */ - public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify"; + //public static String notifyUrl = "https://www.muxiaobao.com/api/Payment/OrderNotify"; + public static String notifyUrl = "https://44978f7456.imdo.co/webchat/payment/orderNotify"; /* * 鏌ヨ璁㈠崟API */ public static String queryUrl = "https://api.mch.weixin.qq.com/pay/orderquery"; - /* + /** * 鐢宠閫�娆続PI */ - public static String refundUrl = "https://api.mch.weixin.qq.com/secapi/pay/refund"; + public static String refundUrl = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds"; /* * 閫�娆鹃�氱煡API @@ -128,7 +144,9 @@ /** * 绉侀挜鏂囦欢璺緞 */ - public static String certFileName = "C:\\webchat\\apiclient_key.pem"; + public static String privateCertFileName = "C:\\webchat\\apiclient_key.pem"; + + public static String publicCertFileName = "C:\\webchat\\wxp_cert.pem"; /* * 寰俊璁㈠崟鍙凤紝浼樺厛浣跨敤 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java new file mode 100644 index 0000000..4aad549 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentCtrl.java @@ -0,0 +1,514 @@ +package com.dy.pipIrrSell.wechatpay; + +import com.alibaba.fastjson2.JSONObject; +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefund; +import com.dy.pipIrrGlobal.pojoSe.SeVcRefundItem; +import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; +import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; +import com.dy.pipIrrGlobal.voSe.VoClient; +import com.dy.pipIrrSell.client.ClientSv; +import com.dy.pipIrrSell.result.SellResultCode; +import com.dy.pipIrrSell.util.AesUtil; +import com.dy.pipIrrSell.util.PayHelper; +import com.dy.pipIrrSell.util.RestTemplateUtil; +import com.dy.pipIrrSell.virtualCard.VirtualCardSv; +import com.dy.pipIrrSell.virtualCard.dto.DtoVirtualCard; +import com.dy.pipIrrSell.virtualCard.enums.LastOperateENUM; +import com.dy.pipIrrSell.virtualCard.enums.RefundItemStateENUM; +import com.dy.pipIrrSell.wallet.enums.RefundStatusENUM; +import com.dy.pipIrrSell.wechatpay.dto.Code2Session; +import com.dy.pipIrrSell.wechatpay.dto.DtoOrder; +import com.dy.pipIrrSell.wechatpay.dto.OrderNotify; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import javax.crypto.NoSuchPaddingException; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.SignatureException; +import java.security.spec.InvalidKeySpecException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:49 + * @LastEditTime 2024-03-06 13:49 + * @Description + */ + +@Slf4j +@Tag(name = "寰俊鏀粯绠$悊", description = "寰俊鏀粯鍚勭鎿嶄綔") +@RestController +@RequestMapping(path="payment") +@RequiredArgsConstructor +public class PaymentCtrl { + private final PaymentSv paymentSv; + private final RestTemplateUtil restTemplateUtil; + private final PayHelper payHelper; + private final VirtualCardSv virtualCardSv; + private final ClientSv clientSv; + + private final String privateCertFileName = PayInfo.privateCertFileName; + private final String appid = PayInfo.appid; + private final String mchid = PayInfo.mchid; + private final String schema = PayInfo.schema; + private final String signType = PayInfo.signType; + private final String description = PayInfo.description; + private final String loginUrl = PayInfo.loginUrl; + private final String notifyUrl = PayInfo.notifyUrl; + private final String grantType = PayInfo.grantType; + + // 骞冲彴璇佷功鍏挜 + private final Map CERTIFICATE_MAP = new HashMap(); + + /** + * 鐧诲綍鍑瘉鏍¢獙 + * @param code2Session 鐧诲綍鍑瘉鏍¢獙浼犲叆瀵硅薄 + * @param bindingResult + * @return + * @throws Exception + */ + @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 = "getSessionId") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> getSessionId(@RequestBody @Valid Code2Session code2Session, BindingResult bindingResult) throws Exception { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + Map<String, Object> queryParams = new HashMap<>(); + queryParams.put("appid", appid); + queryParams.put("secret", code2Session.getSecret()); + queryParams.put("js_code", code2Session.getJs_code()); + queryParams.put("grant_type", grantType); + Map<String, String> headerParams = new HashMap<>(); + JSONObject job = restTemplateUtil.get(loginUrl, queryParams, headerParams); + + if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) { + return BaseResponseUtils.buildFail("鐧诲綍鍑瘉鏍¢獙澶辫触"); + } + + String openid = job.getString("openid"); + String sessionKey = job.getString("session_key"); + + // 妫�楠岀櫥褰曟�� + //JSONObject checkSessionKey = payHelper.checkSessionKey(appid, secret, openid, sessionKey); + //if(checkSessionKey != null) { + // Integer errcode = checkSessionKey.getInteger("errcode"); + // String errmsg = checkSessionKey.getString("errmsg"); + //} + + // 閲嶇疆鐧诲綍鎬� + //JSONObject resetUserSessionKey = payHelper.resetUserSessionKey(appid, secret, openid, sessionKey); + //if(resetUserSessionKey != null) { + // Integer errcode = checkSessionKey.getInteger("errcode"); + // String errmsg = checkSessionKey.getString("errmsg"); + // String openid_New = checkSessionKey.getString("openid"); + // String sessionKey_New = checkSessionKey.getString("session_key"); + //} + + // 娣诲姞鐧诲綍鎬佽褰� + SeWebchatLogonState po = new SeWebchatLogonState(); + po.setOpenId(openid); + po.setSessionKey(sessionKey); + Date createTime = new Date(); + po.setCreateTime(createTime); + Long id = paymentSv.insert(po); + if(id == null || id <= 0) { + return BaseResponseUtils.buildFail("鐧诲綍鎬佽褰曟坊鍔犲け璐�"); + } + String SessionId = String.valueOf(id); + + return BaseResponseUtils.buildSuccess(SessionId) ; + } + + /** + * 涓嬭浇寰俊鏀粯骞冲彴璇佷功 娴嬭瘯瀹屽簾闄� + * @return + * @throws Exception + */ + @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))} + ) + }) + @GetMapping(path = "certificates") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> certificates() throws Exception { + String method = "GET"; + String httpUrl = "/v3/certificates"; + String nonceStr = payHelper.generateRandomString(); + Long timestamp = System.currentTimeMillis() / 1000; + + String header = schema + " " + payHelper.getToken(method, httpUrl, "", nonceStr, timestamp, privateCertFileName); + + Map<String, String> headers = new HashMap<>(); + headers.put("Authorization", header); + headers.put("Accept", "application/json"); + JSONObject job_result = restTemplateUtil.getHeaders(PayInfo.certificates,null, headers); + JSONObject job_headers = job_result.getJSONObject("headers"); + String wechatpayNonce = job_headers.getJSONArray("Wechatpay-Nonce").getString(0); + String wechatpaySerial = job_headers.getJSONArray("Wechatpay-Serial").getString(0); + String wechatpaySignature = job_headers.getJSONArray("Wechatpay-Signature").getString(0); + String wechatpaySignatureType = job_headers.getJSONArray("Wechatpay-Signature-Type").getString(0); + String wechatpayTimestamp = job_headers.getJSONArray("Wechatpay-Timestamp").getString(0); + + JSONObject job_body = job_result.getJSONObject("body"); + + // 鏋勯�犻獙绛惧悕涓� + String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, job_body.toJSONString()); + // 楠岃瘉绛惧悕 + Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature); + + return BaseResponseUtils.buildSuccess(); + } + + /** + * JSAPI涓嬪崟 + * @param order 涓嬪崟璇锋眰瀵硅薄锛屽寘鍚渶瑕佷紶鍏ョ殑鍙傛暟 + * @param bindingResult + * @return + */ + @Operation(summary = "JSAPI涓嬪崟", description = "JSAPI涓嬪崟") + @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 = "placeOrder") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> placeOrder(@RequestBody @Valid DtoOrder order, BindingResult bindingResult) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + // 鎺ユ敹鍙傛暟锛氱櫥褰曟�両D銆佸啘鎴稩D銆佽櫄鎷熷崱ID銆佸厖鍊奸噾棰� + String sessionId = order.getSessionId(); + Long virtualId = order.getVirtualId(); + Integer rechargeAmount = order.getRechargeAmount(); + + String prepayId = ""; + SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); + String openid = po.getOpenId(); + + SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(virtualId); + Long clientId = seVirtualCard.getClientId(); + + VoClient voClient = clientSv.getOneClient(clientId); + String clientNum = voClient.getClientNum(); + + // 鐢熸垚璁㈠崟鍙峰苟娣诲姞鍏呭�艰褰� + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String orderNumber = clientNum + dateFormat.format(new Date()); + + // 鐢熸垚铏氭嫙鍗″厖鍊艰褰曪紙閮ㄥ垎瀛楁锛� + DtoVirtualCard virtualCard = new DtoVirtualCard(); + virtualCard.setOrderNumber(orderNumber); + virtualCard.setClientId(clientId); + virtualCard.setVirtualId(virtualId); + virtualCard.setRechargeAmount(rechargeAmount); + BaseResponse result = virtualCardSv.insertVCRecharge(virtualCard); + if(!result.getCode().equals("0001")) { + return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_ADD_FAIL.getMessage()); + } + + JSONObject job_body = new JSONObject(); + job_body.put("appid", appid); + job_body.put("mchid", mchid); + job_body.put("description", description); + job_body.put("out_trade_no", orderNumber); + job_body.put("notify_url", notifyUrl); + + //璁㈠崟閲戦 + JSONObject job_amount = new JSONObject(); + job_amount.put("total", 1); + job_amount.put("currency", "CNY"); + job_body.put("amount", job_amount); + + //鏀粯鑰� + JSONObject job_payer = new JSONObject(); + job_payer.put("openid", openid); + job_body.put("payer", job_payer); + + // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� + String nonceStr = payHelper.generateRandomString(); + Long timestamp = System.currentTimeMillis() / 1000; + + String method = "POST"; + String httpUrl = "/v3/pay/transactions/jsapi"; + + String body = job_body.toJSONString(); + String header = schema + " " + payHelper.getToken(method, httpUrl, body, nonceStr, timestamp, privateCertFileName); + + Map<String, String> headers = new HashMap<>(); + headers.put("Authorization", header); + headers.put("Accept", "application/json"); + headers.put("Content-Type", "application/json"); + + // 鏆傛椂娉ㄩ噴鎺夛紝璁よ瘉閫氳繃鍚庡啀鏀惧紑 + //JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers); + //if(job_result != null) { + // System.out.println(job_result.toString()); + // prepayId = job_result.getString("prepay_id"); + //} + + return BaseResponseUtils.buildSuccess(prepayId) ; + } + + /** + * 鏀粯閫氱煡/閫�娆剧粨鏋滈�氱煡 + * @param headers + * @param orderNotify + * @param response + * @return + * @throws IOException + * @throws GeneralSecurityException + */ + @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 = "orderNotify", consumes = MediaType.APPLICATION_JSON_VALUE) + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public JSONObject orderNotify(@RequestHeader HttpHeaders headers, @RequestBody OrderNotify orderNotify, HttpServletResponse response) throws IOException, GeneralSecurityException { + JSONObject result = new JSONObject(); + + /** + * 1.楠岀澶勭悊 + * 浠巋eader涓彇鍑�4涓瓙鍙傛暟锛屽悓鏃跺彇鍑篵ody + * 楠屾椂闂村樊锛岃秴杩�5鍒嗛挓鐨勪笉澶勭悊 + * 楠岃瘉绛惧悕 + * 楠岃瘉涔﹀簭鍒楀彿锛屽繀椤讳笌鏌愪竴涓瘉涔︾殑搴忓垪鍙蜂竴鑷� + */ + String wechatpayNonce = String.valueOf(headers.get("Wechatpay-Nonce").get(0)); + String wechatpaySerial = String.valueOf(headers.get("Wechatpay-Serial").get(0)); + String wechatpaySignature = String.valueOf(headers.get("Wechatpay-Signature").get(0)); + String wechatpayTimestamp = String.valueOf(headers.get("Wechatpay-Timestamp").get(0)); + String bodyStr = JSONObject.toJSONString(orderNotify); + + // 楠屾椂闂存埑锛屾椂闂村樊澶т簬5鍒嗛挓鐨勬嫆缁� + Long timeDiff = (System.currentTimeMillis() / 1000 - Long.parseLong(wechatpayTimestamp))/60; + if(timeDiff > 5) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + + // 鏋勯�犻獙绛惧悕涓� + String signatureStr = payHelper.responseSign(wechatpayTimestamp, wechatpayNonce, bodyStr); + // 楠岃瘉绛惧悕 + Boolean valid = payHelper.responseSignVerify(wechatpaySerial, signatureStr, wechatpaySignature); + if(!valid) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + + // 搴忓垪鍙烽獙璇佽鏀惧湪楠岀鍚庯紝鍥犱负楠岀鏃跺彲鑳戒細涓嬭浇鏂扮殑璇佷功 + boolean SerialIsValid = false; + for (String key : payHelper.CERTIFICATE_MAP.keySet()) { + if(key.equals(wechatpaySerial)) { + SerialIsValid = true; + } + } + if(!SerialIsValid) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + + /** + * 瑙e瘑澶勭悊 + * 1 + */ + String eventType = orderNotify.getEvent_type(); + + if(eventType != null && eventType.equals("TRANSACTION.SUCCESS")) { + // 鏀粯鎴愬姛鍥炶皟 + /** + * 鏀粯鎴愬姛鐨勫洖璋� + * 鍙栧嚭閫氱煡鏁版嵁瀵硅薄锛岀户鑰屽彇鍑鸿В瀵嗘墍闇�鐨刟ssociatedData鍜宯once锛屼互鍙婂瘑鏂嘽iphertext + * 瑙e瘑ciphertext寰楀埌 + */ + OrderNotify.NotifyResource notifyResource = orderNotify.getResource(); + String associatedData = notifyResource.getAssociated_data(); + String nonce = notifyResource.getNonce(); + String ciphertext = notifyResource.getCiphertext(); + + String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext); + JSONObject job_resource = JSONObject.parseObject(resource); + + // 瑙e瘑鍚庡彇鍑猴細鍟嗘埛璁㈠崟鍛樸�佸井淇℃敮浠樿鍗曞彿銆佷氦鏄撶姸鎬併�佹敮浠樺畬鎴愭椂闂� + String out_trade_no = job_resource.getString("out_trade_no"); + String transaction_id = job_resource.getString("transaction_id"); + String trade_state = job_resource.getString("trade_state"); + Date success_time = job_resource.getDate("success_time"); + + // 鏇存柊铏氭嫙鍗¤〃鍙婂厖鍊艰〃鍝嶅簲瀛楁 + BaseResponse result_ = virtualCardSv.updateVCRecharge(out_trade_no, success_time); + if(!result_.getCode().equals("0001")) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + } else if(eventType != null && eventType.equals("REFUND.SUCCESS")) { + // 閫�娆炬垚鍔熷悗鍥炶皟 + /** + * 閫�娆炬垚鍔熺殑鍥炶皟 + * 鍙栧嚭閫氱煡鏁版嵁瀵硅薄锛岀户鑰屽彇鍑鸿В瀵嗘墍闇�鐨刟ssociatedData鍜宯once锛屼互鍙婂瘑鏂嘽iphertext + * 瑙e瘑ciphertext寰楀埌 + */ + OrderNotify.NotifyResource notifyResource = orderNotify.getResource(); + String associatedData = notifyResource.getAssociated_data(); + String nonce = notifyResource.getNonce(); + String ciphertext = notifyResource.getCiphertext(); + + String resource = AesUtil.decryptToString(PayInfo.key.getBytes("utf-8"), associatedData.getBytes("utf-8"), nonce.getBytes("utf-8"), ciphertext); + JSONObject job_resource = JSONObject.parseObject(resource); + + // 瑙e瘑鍚庡彇鍑猴細鍟嗘埛璁㈠崟鍛樸�佸井淇℃敮浠樿鍗曞彿銆佷氦鏄撶姸鎬併�佹敮浠樺畬鎴愭椂闂� + String out_trade_no = job_resource.getString("out_trade_no"); + String transaction_id = job_resource.getString("transaction_id"); + String out_refund_no = job_resource.getString("out_refund_no"); + String refund_status = job_resource.getString("refund_status"); + Date success_time = job_resource.getDate("success_time"); + if(!refund_status.equals("SUCCESS")) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + + // 鏇存柊铏氭嫙鍗¤〃鍙婂厖鍊艰〃鍝嶅簲瀛楁 + SeVcRefundItem seVcRefundItem = new SeVcRefundItem(); + seVcRefundItem.setRefundTime(success_time); + seVcRefundItem.setRefundStatus(RefundItemStateENUM.REFUNDED.getCode()); + Integer rec = virtualCardSv.updateRefundItem(seVcRefundItem); + if(rec == null && rec <= 0) { + response.setStatus(500); + result.put("code", "FAIL"); + result.put("message", "澶辫触"); + return result; + } + + // 鏍规嵁閫�娆惧崟鍙峰弽鏌ラ��娆綢D锛屾牴鎹��娆綢D鑾峰彇閫�娆剧姸鎬佹槸鏈��娆剧殑璁板綍鏁伴噺锛屽鏋滄槸0鍒欒鏄庡叏閮ㄩ��娆惧畬鎴愶紝鏇存柊閫�娆捐〃鐘舵�佷负宸查��娆撅紝灏嗛��娆惧悗閲戦鏇存柊鍒拌櫄鎷熷崱琛� + /** + * 鏍规嵁閫�娆鹃�氱煡鎺ュ彛杩斿洖鐨勯��娆惧崟鍙峰弽鏌ラ��娆綢D锛屾煡璇㈣閫�娆綢D涓嬫湭閫�娆捐褰曟暟閲� + * 濡傛灉缁撴灉涓�0锛屽垯璇ラ��娆惧凡缁忓畬鎴� + * 1. 鏇存柊閫�娆捐〃鐘舵�佷负宸查��娆� + * 2. 灏嗛��娆惧悗浣欓鏇存柊鍒拌櫄鎷熷崱琛ㄤ腑 + */ + Integer noRefundedCount = virtualCardSv.getNoRefundedCount(out_refund_no); + if(noRefundedCount != null && noRefundedCount == 0) { + // 鑾峰彇閫�娆惧璞″苟淇敼閫�娆剧姸鎬� + Long refundId = virtualCardSv.getRefundIdByRefundNumber(out_refund_no); + SeVcRefund seVcRefund = virtualCardSv.selectRefundByRefundId(refundId); + seVcRefund.setRefundStatus(RefundStatusENUM.REFUNDED.getCode()); + virtualCardSv.updateRefund(seVcRefund); + + // 鑾峰彇铏氭嫙鍗″璞″苟淇敼浣欓銆佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� + Long vcId = seVcRefund.getVcId(); + Double afterRefund = seVcRefund.getAfterRefund(); + SeVirtualCard seVirtualCard = virtualCardSv.selectVirtuCardById(vcId); + seVirtualCard.setMoney(afterRefund); + seVirtualCard.setLastOperate(LastOperateENUM.REFUND.getCode()); + seVirtualCard.setLastOperateTime(new Date()); + virtualCardSv.updateVirtualCard(seVirtualCard); + } + } + + // 閫氱煡搴旂瓟 + response.setStatus(200); + result.put("code", "SUCCESS"); + result.put("message", "鎴愬姛"); + return result; + } + + /** + * 鍐嶆绛惧悕 + * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇� + * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁� + * @throws Exception + */ + @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))} + ) + }) + @GetMapping(path = "/signAgain") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception { + + // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� + String appid = PayInfo.appid; + String timestamp = String.valueOf(System.currentTimeMillis() / 1000); + String nonceStr = payHelper.generateRandomString(); + String pkg = "prepay_id=" + prepayId; + String message = payHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg); + String paySign = payHelper.sign(message.getBytes("utf-8"), privateCertFileName); + + JSONObject job_result = new JSONObject(); + job_result.put("timestamp", timestamp); + job_result.put("nonceStr", nonceStr); + job_result.put("package", pkg); + job_result.put("signType", signType); + job_result.put("paySign", paySign); + + return BaseResponseUtils.buildSuccess(job_result) ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java new file mode 100644 index 0000000..de4d16d --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/PaymentSv.java @@ -0,0 +1,55 @@ +package com.dy.pipIrrSell.wechatpay; + +import com.dy.pipIrrGlobal.daoSe.SeVcRechargeMapper; +import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper; +import com.dy.pipIrrGlobal.pojoSe.SeVcRecharge; +import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:51 + * @LastEditTime 2024-03-06 13:51 + * @Description + */ + +@Slf4j +@Service +public class PaymentSv { + @Autowired + private SeWebchatLogonStateMapper seWebchatLogonStateMapper; + + @Autowired + private SeVcRechargeMapper seVcRechargeMapper; + + /** + * 娣诲姞鐧诲綍鎬佺姸鎬佽褰� + * @param po + * @return + */ + Long insert(SeWebchatLogonState po) { + seWebchatLogonStateMapper.insert(po); + return po.getId(); + } + + /** + * 鏍规嵁鐧诲綍鎬両D鑾峰彇鐧诲綍鎬佸璞� + * @param id + * @return + */ + SeWebchatLogonState selectOne(Long id) { + return seWebchatLogonStateMapper.selectByPrimaryKey(id); + } + + /** + * 娣诲姞铏氭嫙鍗″厖鍊艰褰� + * @param po + * @return + */ + Long insertVCRecharge(SeVcRecharge po) { + seVcRechargeMapper.insert(po); + return po.getId(); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java similarity index 90% rename from pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java rename to pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java index 21cc420..ad86942 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/dto/Code2Session.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Code2Session.java @@ -1,4 +1,4 @@ -package com.dy.pipirrWebChat.payment.dto; +package com.dy.pipIrrSell.wechatpay.dto; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; @@ -6,8 +6,8 @@ /** * @author ZhuBaoMin - * @date 2024-02-22 15:34 - * @LastEditTime 2024-02-22 15:34 + * @date 2024-03-06 13:53 + * @LastEditTime 2024-03-06 13:53 * @Description */ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java new file mode 100644 index 0000000..407f244 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/DtoOrder.java @@ -0,0 +1,40 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:54 + * @LastEditTime 2024-03-06 13:54 + * @Description 涓嬪崟璇锋眰瀵硅薄锛屼笅鍗曟椂浼犵粰JSAPI涓嬪崟鎺ュ彛 + */ + +@Data +@Schema(name = "涓嬪崟璇锋眰瀵硅薄") +public class DtoOrder { + public static final long serialVersionUID = 202403012108001L; + + /** + * 鐧诲綍鎬両D锛岀敤鏉ヨ幏鍙杘penID + */ + @Schema(description = "鐧诲綍鎬両D", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "鐧诲綍鎬両D涓嶈兘涓虹┖") + private String sessionId; + + /** + * 铏氭嫙鍗$紪鍙凤紝澶栭敭锛岀敤鏉ヨ幏鍙栬櫄鎷熷崱浣欓 + */ + @Schema(description = "铏氭嫙鍗$紪鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭嫙鍗$紪鍙蜂笉鑳戒负绌�") + private Long virtualId; + + /** + * 鍏呭�奸噾棰濋噾棰� + */ + @Schema(description = "鏀粯閲戦", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "铏氭敮浠橀噾棰濅笉鑳戒负绌�") + private Integer rechargeAmount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java new file mode 100644 index 0000000..dff01c7 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/OrderNotify.java @@ -0,0 +1,81 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:54 + * @LastEditTime 2024-03-06 13:54 + * @Description 鏀粯鍜岄��娆鹃�氱煡鎺ユ敹瀵硅薄 + */ + +@Data +@Schema(name = "鏀粯鍜岄��娆惧洖璋冨璞�") +public class OrderNotify { + public static final long serialVersionUID = 202402291431001L; + + /** + * 閫氱煡ID + */ + private String id; + + /** + * 閫氱煡鍒涘缓鏃堕棿 + */ + private String create_time; + + /** + * 閫氱煡绫诲瀷 + * 鏀粯鎴愬姛閫氱煡鐨勭被鍨嬩负锛歍RANSACTION.SUCCESS + */ + private String event_type; + + /** + * 閫氱煡鏁版嵁绫诲瀷 + * 鏀粯鎴愬姛閫氱煡涓猴細encrypt-resource + */ + private String resource_type; + + /** + * 閫氱煡鏁版嵁 + */ + private NotifyResource resource; + + /** + * 鍥炶皟鎽樿锛岄��娆鹃�氱煡鏃犳灞炴�� + */ + private String summary; + + + @Data + public class NotifyResource { + + /** + * 鍔犲瘑绠楁硶绫诲瀷 + * 浠呮敮鎸丄EAD_AES_256_GCM + */ + private String algorithm; + + /** + * 鏁版嵁瀵嗘枃 + */ + private String ciphertext; + + /** + * 闄勫姞鏁版嵁 + */ + public String associated_data; + + /** + * 鍘熷绫诲瀷 + * 鍘熷鍥炶皟绫诲瀷涓猴細transaction + */ + private String original_type; + + /** + * 闅忔満涓� + */ + private String nonce; + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Orders.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Orders.java new file mode 100644 index 0000000..4c8e63e --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Orders.java @@ -0,0 +1,44 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +import java.util.Date; + +/** + * @author ZhuBaoMin + * @date 2024-03-07 21:56 + * @LastEditTime 2024-03-07 21:56 + * @Description 璁㈠崟瀵硅薄锛屼粠鍏呭�艰〃涓彇鍑虹殑璁㈠崟淇℃伅 + */ + +@Data +@Schema(name = "璁㈠崟瀵硅薄") +public class Orders { + public static final long serialVersionUID = 202403072157001L; + + /** + * 璁㈠崟鍙� + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 鍏呭�奸噾棰� + */ + @Schema(description = "鍏呭�奸噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�奸噾棰濅笉鑳戒负绌�") + @Positive(message = "鍏呭�奸噾棰濆繀椤讳负澶т簬0鐨勬暣鏁�") + private Integer rechargeAmount; + + /** + * 鍏呭�煎畬鎴愭椂闂� + */ + @Schema(description = "鍏呭�煎畬鎴愭椂闂�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍏呭�煎畬鎴愭椂闂翠笉鑳戒负绌�") + private Date rechargeTime; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java new file mode 100644 index 0000000..57be610 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/Refund.java @@ -0,0 +1,39 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:55 + * @LastEditTime 2024-03-06 13:55 + * @Description 閫�娆捐姹傚璞★紝灏忕▼搴忚皟鐢ㄦ帴鍙f椂浼犲弬鎵�鐢ㄥ璞� + */ + +@Data +@Schema(name = "閫�娆捐姹傚璞�") +public class Refund { + public static final long serialVersionUID = 202403011607001L; + + /** + * 鍟嗘埛璁㈠崟鍙� + */ + @Schema(description = "鍟嗘埛璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "鍟嗘埛璁㈠崟鍙蜂笉鑳戒负绌�") + private String tradeNo; + + /** + * 閫�娆惧崟鍙� + */ + @Schema(description = "閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private String refundNo; + + /** + * 閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + private Integer refund; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java new file mode 100644 index 0000000..ad42f4b --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundRequest.java @@ -0,0 +1,70 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:55 + * @LastEditTime 2024-03-06 13:55 + * @Description 閫�娆捐姹傚璞★紝瀵硅薄璧嬪�煎畬鏁村悗鍚戝井淇¤姹傞��娆� + */ + +@Data +@Schema(name = "閫�娆捐姹傚璞�") +public class RefundRequest { + public static final long serialVersionUID = 202403011540001L; + + /** + * 鍟嗘埛璁㈠崟鍙凤紝涓嬪崟鏃剁殑璁㈠崟鍙� + */ + @Schema(description = "鍟嗘埛璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "鍟嗘埛璁㈠崟鍙蜂笉鑳戒负绌�") + private String out_trade_no; + + /** + * 鍟嗘埛閫�娆惧崟鍙凤紝璁㈠崟鍙峰墠鍔犲墠缂�鈥淩鈥� + */ + @Schema(description = "鍟嗘埛閫�娆惧崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "鍟嗘埛閫�娆惧崟鍙蜂笉鑳戒负绌�") + private String out_refund_no; + + /** + * 閫�娆剧粨鏋滃洖璋僽rl锛宺efundUrl + */ + @Schema(description = "閫�娆剧粨鏋滃洖璋僽rl", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "閫�娆剧粨鏋滃洖璋僽rl涓嶈兘涓虹┖") + private String notify_url; + + /** + * 閲戦淇℃伅 + */ + @Schema(description = "閲戦淇℃伅", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + private Amount amount; + + @Data + public static class Amount { + /** + * 閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + private Integer refund; + + /** + * 鍘熻鍗曢噾棰濓紝鏍规嵁璁㈠崟鍙锋煡璇� + */ + @Schema(description = "鍘熻鍗曢噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "鍘熻鍗曢噾棰濅笉鑳戒负绌�") + private Integer total; + + /** + * 閫�娆惧竵绉嶏紝鍥哄畾涓衡�淐NY鈥� + */ + @Schema(description = "閫�娆惧竵绉�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "閫�娆惧竵绉嶄笉鑳戒负绌�") + private String currency; + } +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java new file mode 100644 index 0000000..63c143a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/RefundResponse.java @@ -0,0 +1,114 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-06 13:56 + * @LastEditTime 2024-03-06 13:56 + * @Description 閫�娆剧敵璇疯繑鍥炵殑瀵硅薄 + */ + +@Data +@Schema(name = "閫�娆剧敵璇疯繑鍥炲璞�") +public class RefundResponse { + public static final long serialVersionUID = 202403011431001L; + + /** + * 寰俊鏀粯閫�娆惧彿 + */ + private String refund_id; + + /** + * 鍟嗘埛閫�娆惧崟鍙� + */ + private String out_refund_no; + + /** + * 寰俊鏀粯璁㈠崟鍙� + */ + private String transaction_id; + + /** + * 鍟嗘埛璁㈠崟鍙� + */ + private String out_trade_no; + + /** + * 閫�娆炬笭閬� + */ + private String channel; + + /** + * 閫�娆惧叆璐﹁处鎴� + */ + private String user_received_account; + + /** + * 閫�娆炬垚鍔熸椂闂� + */ + private String success_time; + + /** + * 閫�娆惧垱寤烘椂闂� + */ + private String create_time; + + /** + * 閫�娆剧姸鎬� + */ + private String status; + + /** + * 閲戦淇℃伅 + */ + private Amount amount; + + + @Data + private static class Amount { + + /** + * 璁㈠崟鎬婚噾棰� + */ + private Integer total; + + /** + * 閫�娆鹃噾棰� + */ + private Integer refund; + + /** + * 鐢ㄦ埛鏀粯閲戦 + */ + private Integer payer_total; + + /** + * 鐢ㄦ埛閫�娆鹃噾棰� + */ + private Integer payer_refund; + + /** + * 搴旂粨閫�娆鹃噾棰� + */ + private Integer settlement_refund; + + /** + * 搴旂粨璁㈠崟閲戦 + */ + private Integer settlement_total; + + /** + * 浼樻儬閫�娆鹃噾棰� + */ + private Integer discount_refund; + + /** + * 閫�娆惧竵绉� + */ + private String currency; + + } + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/ToRefund.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/ToRefund.java new file mode 100644 index 0000000..24eb95f --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wechatpay/dto/ToRefund.java @@ -0,0 +1,35 @@ +package com.dy.pipIrrSell.wechatpay.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; +import lombok.Data; + +/** + * @author ZhuBaoMin + * @date 2024-03-07 21:43 + * @LastEditTime 2024-03-07 21:43 + * @Description 寰呴��娆惧璞★紝鐢ㄦ埛閫夋嫨涓�涓櫄鎷熷崱閫�娆炬椂锛岀郴缁熼亶鍘嗗嚭涓�涓��娆惧璞″垪琛紝鐢卞涓鍗曞叡鍚屽畬鎴愰��娆� + */ + +@Data +@Schema(name = "寰呴��娆惧璞�") +public class ToRefund { + public static final long serialVersionUID = 202403072144001L; + + /** + * 璁㈠崟鍙� + */ + @Schema(description = "璁㈠崟鍙�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotBlank(message = "璁㈠崟鍙蜂笉鑳戒负绌�") + private String orderNumber; + + /** + * 閫�娆鹃噾棰� + */ + @Schema(description = "閫�娆鹃噾棰�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @NotNull(message = "閫�娆鹃噾棰濅笉鑳戒负绌�") + @Positive(message = "閫�娆鹃噾棰濆繀椤讳负澶т簬0鐨勬暣鏁�") + private Integer refundAmount; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore deleted file mode 100644 index 549e00a..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index cb28b0e..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.jar +++ /dev/null Binary files differ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 5f0536e..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw deleted file mode 100644 index 66df285..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw +++ /dev/null @@ -1,308 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Apache Maven Wrapper startup batch script, version 3.2.0 -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /usr/local/etc/mavenrc ] ; then - . /usr/local/etc/mavenrc - fi - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "$(uname)" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME - else - JAVA_HOME="/Library/Java/Home"; export JAVA_HOME - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=$(java-config --jre-home) - fi -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME=$(cygpath --unix "$JAVA_HOME") - [ -n "$CLASSPATH" ] && - CLASSPATH=$(cygpath --path --unix "$CLASSPATH") -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && - JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="$(which javac)" - if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=$(which readlink) - if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then - if $darwin ; then - javaHome="$(dirname "\"$javaExecutable\"")" - javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" - else - javaExecutable="$(readlink -f "\"$javaExecutable\"")" - fi - javaHome="$(dirname "\"$javaExecutable\"")" - javaHome=$(expr "$javaHome" : '\(.*\)/bin') - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=$(cd "$wdir/.." || exit 1; pwd) - fi - # end of workaround - done - printf '%s' "$(cd "$basedir" || exit 1; pwd)" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - # Remove \r in case we run on Windows within Git Bash - # and check out the repository with auto CRLF management - # enabled. Otherwise, we may read lines that are delimited with - # \r\n and produce $'-Xarg\r' rather than -Xarg due to word - # splitting rules. - tr -s '\r\n' ' ' < "$1" - fi -} - -log() { - if [ "$MVNW_VERBOSE" = true ]; then - printf '%s\n' "$1" - fi -} - -BASE_DIR=$(find_maven_basedir "$(dirname "$0")") -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR -log "$MAVEN_PROJECTBASEDIR" - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" -if [ -r "$wrapperJarPath" ]; then - log "Found $wrapperJarPath" -else - log "Couldn't find $wrapperJarPath, downloading it ..." - - if [ -n "$MVNW_REPOURL" ]; then - wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - else - wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - fi - while IFS="=" read -r key value; do - # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) - safeValue=$(echo "$value" | tr -d '\r') - case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; - esac - done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" - log "Downloading from: $wrapperUrl" - - if $cygwin; then - wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") - fi - - if command -v wget > /dev/null; then - log "Found wget ... using wget" - [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - else - wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - log "Found curl ... using curl" - [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" - else - curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" - fi - else - log "Falling back to using Java to download" - javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" - javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaSource=$(cygpath --path --windows "$javaSource") - javaClass=$(cygpath --path --windows "$javaClass") - fi - if [ -e "$javaSource" ]; then - if [ ! -e "$javaClass" ]; then - log " - Compiling MavenWrapperDownloader.java ..." - ("$JAVA_HOME/bin/javac" "$javaSource") - fi - if [ -e "$javaClass" ]; then - log " - Running MavenWrapperDownloader.java ..." - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -# If specified, validate the SHA-256 sum of the Maven wrapper jar file -wrapperSha256Sum="" -while IFS="=" read -r key value; do - case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; - esac -done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" -if [ -n "$wrapperSha256Sum" ]; then - wrapperSha256Result=false - if command -v sha256sum > /dev/null; then - if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then - wrapperSha256Result=true - fi - elif command -v shasum > /dev/null; then - if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then - wrapperSha256Result=true - fi - else - echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." - echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." - exit 1 - fi - if [ $wrapperSha256Result = false ]; then - echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 - echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 - echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 - exit 1 - fi -fi - -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$JAVA_HOME" ] && - JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") - [ -n "$CLASSPATH" ] && - CLASSPATH=$(cygpath --path --windows "$CLASSPATH") - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -# shellcheck disable=SC2086 # safe args -exec "$JAVACMD" \ - $MAVEN_OPTS \ - $MAVEN_DEBUG_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd deleted file mode 100644 index 95ba6f5..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/mvnw.cmd +++ /dev/null @@ -1,205 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.2.0 -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* -if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %WRAPPER_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file -SET WRAPPER_SHA_256_SUM="" -FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B -) -IF NOT %WRAPPER_SHA_256_SUM%=="" ( - powershell -Command "&{"^ - "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ - "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ - " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ - " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ - " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ - " exit 1;"^ - "}"^ - "}" - if ERRORLEVEL 1 goto error -) - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% ^ - %JVM_CONFIG_MAVEN_PROPS% ^ - %MAVEN_OPTS% ^ - %MAVEN_DEBUG_OPTS% ^ - -classpath %WRAPPER_JAR% ^ - "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ - %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" -if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%"=="on" pause - -if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% - -cmd /C exit /B %ERROR_CODE% diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml deleted file mode 100644 index 5cb8ab3..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/pom.xml +++ /dev/null @@ -1,172 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>com.dy</groupId> - <artifactId>pipIrr-web</artifactId> - <version>1.0.0</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <packaging>jar</packaging> - - <artifactId>pipIrr-web-webchat</artifactId> - <name>pipIrr-web-webchat</name> - <description>web寰俊鏀粯妯″潡</description> - - <dependencies> - <!--寰俊鏀粯--> - <dependency> - <groupId>com.github.wechatpay-apiv3</groupId> - <artifactId>wechatpay-java</artifactId> - <version>0.2.12</version> - </dependency> - - <!--OkHttp--> - <dependency> - <groupId>com.squareup.okhttp3</groupId> - <artifactId>okhttp</artifactId> - <version>4.9.2</version> - </dependency> - - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.5.3</version> - </dependency> - - <dependency> - <groupId>org.apache.httpcomponents.client5</groupId> - <artifactId>httpclient5</artifactId> - <version>5.1.3</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents.client5</groupId> - <artifactId>httpclient5-fluent</artifactId> - <version>5.1.3</version> - </dependency> - - </dependencies> - <build> - <plugins> - <!-- 鐢熸垚涓嶅寘鍚緷璧杍ar鐨勫彲鎵цjar鍖� - <plugin> - !- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 - - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - !- - <goals> - <goal>repackage</goal> - </goals> - - - <configuration> - !- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar - - <classifier>execute</classifier> - !- 涓嶆寚瀹氱敓鎴愯矾寰勭殑璇�, 榛樿淇濆瓨鍦� ${build.directory} 涓� - - <outputDirectory>${project.build.directory}/execute</outputDirectory> - <finalName>${artifactId}-${version}</finalName> - <layout>ZIP</layout> - <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> - <includes> - <include> - <groupId>com.dy</groupId> - <artifactId>pipIrr-common</artifactId> - </include> - <include> - <groupId>com.dy</groupId> - <artifactId>pipIrr-global</artifactId> - </include> - </includes> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </execution> - </executions> - - </plugin> - --> - <!-- 鎷疯礉渚濊禆鐨刯ar鍖呭埌lib鐩綍--> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <configuration> - <!-- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar - <classifier>execute</classifier> - --> - <!-- ${project.build.directory}鏄痬aven鍙橀噺锛屽唴缃殑锛岃〃绀簍arget鐩綍,濡傛灉涓嶅啓锛屽皢鍦ㄦ牴鐩綍涓嬪垱寤�/lib --> - <outputDirectory>${project.build.directory}/lib</outputDirectory> - <!-- excludeTransitive:鏄惁涓嶅寘鍚棿鎺ヤ緷璧栧寘锛屾瘮濡傛垜浠緷璧朅锛屼絾鏄疉鍙堜緷璧栦簡B锛屾垜浠槸鍚︿篃瑕佹妸B鎵撹繘鍘� 榛樿涓嶆墦--> - <excludeTransitive>false</excludeTransitive> - <!-- 澶嶅埗鐨刯ar鏂囦欢鍘绘帀鐗堟湰淇℃伅 --> - <stripVersion>false</stripVersion> - <finalName>${project.artifactId}-${project.version}</finalName> - <layout>ZIP</layout> - <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> - <includes> - <include> - <groupId>com.dy</groupId> - <artifactId>pipIrr-common</artifactId> - </include> - <include> - <groupId>com.dy</groupId> - <artifactId>pipIrr-global</artifactId> - </include> - </includes> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <!-- 璁剧疆java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <!-- source锛� 婧愪唬鐮佺紪璇戠増鏈紱target锛� 鐩爣骞冲彴缂栬瘧鐗堟湰锛沞ncoding锛� 瀛楃闆嗙紪鐮併�� --> - <configuration> - <source>${java.version}</source> - <target>${java.version}</target> - <encoding>${encoding}</encoding> - </configuration> - </plugin> - <plugin> - <!-- 瑙e喅璧勬簮鏂囦欢鐨勭紪鐮侀棶棰� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <configuration> - <encoding>${encoding}</encoding> - </configuration> - </plugin> - <plugin> - <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skipTests>true</skipTests> - </configuration> - </plugin> - <plugin> - <!-- 涓嬮潰瑙e喅锛氬綋杩涜Maven Lifecycle package鏃舵姤閿欙細Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - </plugin> - </plugins> - </build> - -</project> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java deleted file mode 100644 index 2517c4a..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/PipIrrWebChatApplication.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.dy.pipirrWebChat; - -import com.dy.common.multiDataSource.EnableMultiDataSource; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.EnableAspectJAutoProxy; - -/** - * @author ZhuBaoMin - * @date 2024/02/21 16:07 - * @LastEditTime 2024/02/21 16:07 - * @Description - */ - -@SpringBootApplication -@EnableAspectJAutoProxy -@EnableMultiDataSource -@ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.pipirrWebChat"}) -@MapperScan({"com.dy.pipIrrGlobal.daoSe", "com.dy.pipIrrGlobal.daoBa"}) -public class PipIrrWebChatApplication { - - public static void main(String[] args) { - SpringApplication.run(PipIrrWebChatApplication.class, args); - } - -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java deleted file mode 100644 index 0cbc9c1..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/RestTemplateConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.dy.pipirrWebChat.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.StringHttpMessageConverter; -import org.springframework.web.client.RestTemplate; - -import java.nio.charset.StandardCharsets; -import java.util.List; -//import org.apache.http.client.HttpClient; - -/** - * @author ZhuBaoMin - * @date 2024-02-23 15:42 - * @LastEditTime 2024-02-23 15:42 - * @Description - */ - -@Configuration -public class RestTemplateConfig { - @Autowired - private RestTemplateWechatCertConfig restTemplateWechatCertConfig; - - //@Bean - //public RestTemplate restTemplate() { - // return new RestTemplate(); - //} - - //@Bean - //public RestTemplate restTemplate() { - // String mchid = PayInfo.mchid; - // RestTemplate restTemplate = null; - // try { - // KeyStore keyStore = KeyStore.getInstance("PKCS12"); - // //InputStream cp = this.getClass().getResourceAsStream("apiclient_cert.p12"); - // FileInputStream instream = new FileInputStream(new File("C:\\webchat\\apiclient_cert.p12")); - // keyStore.load(instream, mchid.toCharArray()); - // // Trust own CA and all self-signed certs - // SSLContext sslcontext = SSLContextBuilder.create() - // .loadKeyMaterial(keyStore, mchid.toCharArray()) - // .build(); - // //Allow TLSv1 protocol only - // SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[]{"TLSv1"}, null, NoopHostnameVerifier.INSTANCE); - // CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build(); - // HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(httpClient); - // - // restTemplate = new RestTemplate(factory); - // //灏嗚浆鎹㈠櫒鐨勭紪鐮佹崲鎴恥tf-8 - // restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(Charset.forName("utf-8"))); - // //System.out.println("restTemplate.hashCode():" + restTemplate.hashCode()); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // return restTemplate; - //} - - //@Bean(name = "wechatRestTemplate") - @Bean() - public RestTemplate restTemplate() throws Exception { - RestTemplate restTemplate = new RestTemplate(restTemplateWechatCertConfig.wechatHttpRequestFactory()); - // 娣诲姞鎷︽埅鍣� - //List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(); - //RestTemplateWechatCertConfig.MyRequestInterceptor myRequestInterceptor = new RestTemplateWechatCertConfig.MyRequestInterceptor(); - //interceptors.add(myRequestInterceptor); - //restTemplate.setInterceptors(interceptors); - - // 涓枃涔辩爜锛屼富瑕佹槸 StringHttpMessageConverter鐨勯粯璁ょ紪鐮佷负ISO瀵艰嚧鐨� - List<HttpMessageConverter<?>> list = restTemplate.getMessageConverters(); - for (HttpMessageConverter converter : list) { - if (converter instanceof StringHttpMessageConverter) { - ((StringHttpMessageConverter) converter).setDefaultCharset(StandardCharsets.UTF_8); - break; - } - } - - return restTemplate; - } -} - diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java deleted file mode 100644 index fd118ff..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebFilterConfiguration.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.dy.pipirrWebChat.config; - -import com.dy.common.webFilter.DevOfDataSourceNameSetFilter; -import com.dy.common.webFilter.UserTokenFilter; -import jakarta.servlet.Filter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author ZhuBaoMin - * @date 2024-02-21 16:10 - * @LastEditTime 2024-02-21 16:10 - * @Description - */ - -@Configuration -public class WebFilterConfiguration { - - @Value("${pipIrr.global.dev}") - public String isDevStage ;//鏄惁涓哄紑鍙戦樁娈� - @Value("${pipIrr.global.dsName}") - public String dsName ;//寮�鍙戦樁娈电殑鏁版嵁婧愬悕绉� - - /** - * DevOfDataSourceNameSetFilter涓嶶serTokenFilter鍙兘涓�涓閰嶇疆涓婏紝 - * 鎵�浠ヤ粬浠殑order閮芥槸1 - */ - private static final int order_UserTokenFilter = 1 ;//涓庝笅闈� - private static final int order_DevOfDataSourceNameSetFilter = 1 ; - - - @Bean - public FilterRegistrationBean<? extends Filter> RegFilter() { - FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>(); - if(this.isDevStage != null && !this.isDevStage.trim().equals("") && this.isDevStage.trim().equalsIgnoreCase("true")){ - filterRegistrationBean.setFilter(new DevOfDataSourceNameSetFilter()); - filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯 - filterRegistrationBean.addInitParameter("dataSourceName",dsName);//璁剧疆init鍙傛暟 - filterRegistrationBean.setName("DevOfDataSourceNameSetFilter");//璁剧疆杩囨护鍣ㄥ悕绉� - filterRegistrationBean.setOrder(order_DevOfDataSourceNameSetFilter);//鎵ц娆″簭 - }else{ - filterRegistrationBean.setFilter(new UserTokenFilter()); - filterRegistrationBean.addUrlPatterns("/*");//閰嶇疆杩囨护瑙勫垯 - filterRegistrationBean.setName("UserTokenFilter");//璁剧疆杩囨护鍣ㄥ悕绉� - filterRegistrationBean.setOrder(order_UserTokenFilter);//鎵ц娆″簭 - } - return filterRegistrationBean; - } - -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java deleted file mode 100644 index 7cd9d6e..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/config/WebListenerConfiguration.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.dy.pipirrWebChat.config; - -import com.dy.common.webListener.GenerateIdSetSuffixListener; -import jakarta.servlet.ServletContextListener; -import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author ZhuBaoMin - * @date 2024-02-21 16:11 - * @LastEditTime 2024-02-21 16:11 - * @Description - */ - -@Configuration -public class WebListenerConfiguration { - - /** - * 鍚姩椤哄簭 - */ - //private static final int order_config = 0 ; - private static final int order_idSetSuffix = 1 ; - //private static final int order_init = 2 ; - - /* - * 瑙f瀽鍚勭***.config閰嶇疆鐨凜onfigListener锛屾殏鏃朵笉閲囩敤姝ょ閰嶇疆鏂瑰紡 - * - @Bean - public ConfigListener getGlConfigListener(){ - return new ConfigListener() ; - } - /** - * 澶栭儴鎻愪緵Listener - * @param listener 澶栭儴鎻愪緵Listener - * @return 娉ㄥ唽Bean - @Bean - public ServletListenerRegistrationBean<? extends ServletContextListener> regConfigListener(ConfigListener listener) { - ServletListenerRegistrationBean<ConfigListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); - listenerRegistrationBean.setListener(listener); - listenerRegistrationBean.setOrder(order_config); - return listenerRegistrationBean; - } - */ - - /** - * 鍐呴儴鎻愪緵listener锛岃listener鍦ㄧ郴缁熷惎鍔ㄦ椂锛屾牴鎹厤缃� 璁剧疆ID浜х敓鍣ㄧ殑鍚庣紑 - * @return 娉ㄥ唽Bean - */ - @Bean - public ServletListenerRegistrationBean<? extends ServletContextListener> regSsoListener() { - ServletListenerRegistrationBean<GenerateIdSetSuffixListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); - listenerRegistrationBean.setListener(new GenerateIdSetSuffixListener()); - listenerRegistrationBean.setOrder(order_idSetSuffix); - return listenerRegistrationBean; - } - -// /** -// * 鍐呴儴鎻愪緵listener锛岃listener鍦ㄧ郴缁熷惎鍔ㄦ椂锛屽垵濮嬪寲鏁版嵁搴撴暟鎹� -// * @return 娉ㄥ唽Bean -// */ -// @Bean -// public ServletListenerRegistrationBean<? extends ServletContextListener> regInitListener() { -// ServletListenerRegistrationBean<InitListener> listenerRegistrationBean = new ServletListenerRegistrationBean<>(); -// listenerRegistrationBean.setListener(new InitListener()); -// listenerRegistrationBean.setOrder(order_init); -// return listenerRegistrationBean; -// } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java deleted file mode 100644 index 9412ba3..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PayHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.dy.pipirrWebChat.payment; - -import javax.crypto.NoSuchPaddingException; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.*; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.util.Base64; -import java.util.Random; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 20:31 - * @LastEditTime 2024-02-22 20:31 - * @Description - */ -public class PayHelper { - private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - - /** - * 鑾峰彇32浣嶉殢鏈哄瓧绗︿覆 - * @return 闅忔満涓� - */ - public static String generateRandomString() { - Random random = new Random(); - StringBuilder sb = new StringBuilder(32); - for (int i = 0; i < 32; i++) { - int index = random.nextInt(CHARACTERS.length()); - sb.append(CHARACTERS.charAt(index)); - } - return sb.toString(); - } - - /** - * 鑾峰彇绉侀挜瀵硅薄 - * @param filename 绉侀挜鏂囦欢璺緞 - * @return 绉侀挜瀵硅薄 - * @throws IOException - */ - public static PrivateKey getPrivateKey(String filename) throws IOException { - //String filename = "C:\\webchat\\apiclient_key.pem"; - String content = new String(Files.readAllBytes(Paths.get(filename)), "utf-8"); - try { - String privateKey = content.replace("-----BEGIN PRIVATE KEY-----", "") - .replace("-----END PRIVATE KEY-----", "") - .replaceAll("\\s+", ""); - KeyFactory kf = KeyFactory.getInstance("RSA"); - return kf.generatePrivate( - new PKCS8EncodedKeySpec(Base64.getDecoder().decode(privateKey))); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException("褰撳墠Java鐜涓嶆敮鎸丷SA", e); - } catch (InvalidKeySpecException e) { - throw new RuntimeException("鏃犳晥鐨勫瘑閽ユ牸寮�"); - } - } - - /** - * 鏋勯�犵鍚嶄覆_涓嬪崟 - * @param method HTTP璇锋眰鏂规硶 - * @param url URL - * @param timestamp 鏃堕棿鎴� - * @param nonceStr 闅忔満涓� - * @param body 鎶ユ枃涓婚 - * @return 绛惧悕涓� - */ - public static String buildMessage_order(String method, String url, long timestamp, String nonceStr, String body) { - return method + "\n" - + url + "\n" - + timestamp + "\n" - + nonceStr + "\n" - + body + "\n"; - } - - public static String buildMessage_signAgain(String appid, String timestamp, String nonceStr, String pkg) { - return appid + "\n" - + timestamp + "\n" - + nonceStr + "\n" - + pkg + "\n"; - } - - /** - * 绛惧悕 - * @param message 琚鍚嶄俊鎭� - * @param certFileName 绉侀挜璇佷功鏂囦欢璺緞 - * @return signature绛惧悕鍊硷紝绛惧悕淇℃伅涓殑涓�椤癸紝鍙備笌鐢熸垚绛惧悕淇℃伅 - * @throws NoSuchAlgorithmException - * @throws InvalidKeyException - * @throws SignatureException - * @throws IOException - */ - public static String sign(byte[] message, String certFileName) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException, IOException { - Signature sign = Signature.getInstance("SHA256withRSA"); - sign.initSign(getPrivateKey(certFileName)); - sign.update(message); - return Base64.getEncoder().encodeToString(sign.sign()); - } - - /** - * 鑾峰彇绛惧悕淇℃伅 - * @param method - * @param url - * @param body - * @return 绛惧悕淇℃伅锛孒TTP澶翠腑鐨勭鍚嶄俊鎭� - * HTTP澶达細Authorization: 璁よ瘉绫诲瀷 绛惧悕淇℃伅 - * 璁よ瘉绫诲瀷锛學ECHATPAY2-SHA256-RSA2048 - */ - public static String getToken(String method, String url, String body, String nonceStr, Long timestamp, String certFileName) throws NoSuchAlgorithmException, InvalidKeySpecException, IOException, SignatureException, InvalidKeyException, NoSuchPaddingException { - String message = buildMessage_order(method, url, timestamp, nonceStr, body); - String signature = sign(message.getBytes("utf-8"), certFileName); - - return "mchid=\"" + PayInfo.mchid + "\"," - + "nonce_str=\"" + nonceStr + "\"," - + "timestamp=\"" + timestamp + "\"," - + "serial_no=\"" + PayInfo.serial_no + "\"," - + "signature=\"" + signature + "\""; - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java deleted file mode 100644 index 4b4b246..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentCtrl.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.dy.pipirrWebChat.payment; - -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.dy.common.aop.SsoAop; -import com.dy.common.webUtil.BaseResponse; -import com.dy.common.webUtil.BaseResponseUtils; -import com.dy.common.webUtil.ResultCodeMsg; -import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; -import com.dy.pipirrWebChat.util.OkHttpUtil; -import com.dy.pipirrWebChat.util.RestTemplateUtil; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.MediaType; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 15:24 - * @LastEditTime 2024-02-22 15:24 - * @Description - */ - -@Slf4j -@Tag(name = "寰俊鏀粯绠$悊", description = "寰俊鏀粯鍚勭鎿嶄綔") -@RestController -@RequestMapping(path="payment") -@RequiredArgsConstructor -public class PaymentCtrl { - private final PaymentSv paymentSv; - private final RestTemplateUtil restTemplateUtil; - private String certFileName = PayInfo.certFileName; - - /** - * 鐧诲綍鍑瘉鏍¢獙 - * @param appid 灏忕▼搴� appId - * @param secret 灏忕▼搴� appSecret - * @param js_code 涓存椂鐧诲綍鍑瘉code - * @return - * @throws Exception - */ - @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 = "getSessionId") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<Boolean> getSessionId(@RequestParam("appid") String appid, @RequestParam("secret") String secret, @RequestParam("js_code") String js_code) throws Exception { - String result = OkHttpUtil.builder().url("https://api.weixin.qq.com/sns/jscode2session") - .addParam("appid", appid) - .addParam("secret", secret) - .addParam("js_code", js_code) - .initGet() - .sync(); - JSONObject job = JSONObject.parseObject(result); - System.out.println(job.getString("session_key")); - - if(job.getLong("errcode") != null && job.getLong("errcode") >= -1) { - return BaseResponseUtils.buildFail("鐧诲綍鍑瘉鏍¢獙澶辫触"); - } - - // 娣诲姞鐧诲綍鎬佽褰� - SeWebchatLogonState po = new SeWebchatLogonState(); - po.setOpenId(job.getString("openid")); - po.setSessionKey(job.getString("session_key")); - Date createTime = new Date(); - po.setCreateTime(createTime); - Long id = paymentSv.insert(po); - if(id == null || id <= 0) { - return BaseResponseUtils.buildFail("鐧诲綍鎬佽褰曟坊鍔犲け璐�"); - } - - String SessionId = String.valueOf(id); - return BaseResponseUtils.buildSuccess(SessionId) ; - } - - @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))} - ) - }) - @GetMapping(path = "certificates") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<JSONObject> certificates() throws Exception { - //String prepayId = ""; - //SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); - //String openid = po.getOpenId(); - - String method = "GET"; - String httpUrl = "/v3/certificates"; - String nonceStr = PayHelper.generateRandomString(); - Long timestamp = System.currentTimeMillis() / 1000; - - String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, "", nonceStr, timestamp, certFileName); - - Map<String, String> headers = new HashMap<>(); - headers.put("Authorization", header); - headers.put("Accept", "application/json"); - JSONObject job_result = restTemplateUtil.get(PayInfo.certificates,null, headers); - if(job_result != null) { - JSONArray array = job_result.getJSONArray("data"); - if(array != null && array.size() > 0) { - for(int i = 0; i < array.size(); i++) { - JSONObject job_data = array.getJSONObject(i); - String serial_no = job_data.getString("serial_no"); - String effective_time = job_data.getString("effective_time"); - String expire_time = job_data.getString("expire_time"); - JSONObject job_certificate = job_data.getJSONObject("encrypt_certificate"); - String algorithm = job_certificate.getString("algorithm"); - String nonce = job_certificate.getString("nonce"); - String associated_data = job_certificate.getString("associated_data"); - String ciphertext = job_certificate.getString("ciphertext"); - } - } - } - System.out.println(job_result.toJSONString()); - return BaseResponseUtils.buildSuccess(job_result.toJSONString()) ; - } - - /** - * JSAPI涓嬪崟 - * @param sessionId - * @param orderNumber - * @param payAmount - * @return - * @throws Exception - */ - @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 = "unifiedOrder") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<Boolean> unifiedOrder(@RequestParam("sessionId") String sessionId, @RequestParam("orderNumber") String orderNumber, @RequestParam("payAmount") String payAmount) throws Exception { - String prepayId = ""; - SeWebchatLogonState po = paymentSv.selectOne(Long.parseLong(sessionId)); - String openid = po.getOpenId(); - - JSONObject job_body = new JSONObject(); - job_body.put("appid", PayInfo.appid); - job_body.put("mchid", PayInfo.mchid); - job_body.put("description", PayInfo.description); - job_body.put("out_trade_no", orderNumber); - job_body.put("notify_url", PayInfo.notifyUrl); - - //璁㈠崟閲戦 - JSONObject job_amount = new JSONObject(); - job_amount.put("total", 1); - job_amount.put("currency", "CNY"); - job_body.put("amount", job_amount); - - //鏀粯鑰� - JSONObject job_payer = new JSONObject(); - job_payer.put("openid", openid); - job_body.put("payer", job_payer); - - // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� - String nonceStr = PayHelper.generateRandomString(); - Long timestamp = System.currentTimeMillis() / 1000; - - String method = "POST"; - String httpUrl = "/v3/pay/transactions/jsapi"; - - String body = job_body.toJSONString(); - String header = PayInfo.schema + " " + PayHelper.getToken(method, httpUrl, body, nonceStr, timestamp, certFileName); - - Map<String, String> headers = new HashMap<>(); - headers.put("Authorization", header); - headers.put("Accept", "application/json"); - headers.put("Content-Type", "application/json"); - - JSONObject job_result = restTemplateUtil.post(PayInfo.orderUrl, body, headers); - if(job_result != null) { - System.out.println(job_result.toString()); - prepayId = job_result.getString("prepay_id"); - } - - - - //String result = OkHttpUtil.builder().url(PayInfo.orderUrl) - // .addBody(body) - // .addHeader("Authorization", header) - // .addHeader("Accept", "application/json") - // .addHeader("Content-Type", "application/json") - // .initPost(true) - // .sync(); - //System.out.println(result); - - return BaseResponseUtils.buildSuccess(prepayId) ; - } - - /** - * 鍐嶆绛惧悕 - * @param prepayId 棰勬敮浠樹氦鏄撲細璇濇爣璇� - * @return 灏忕▼搴忚皟璧锋敮浠樺弬鏁� - * @throws Exception - */ - @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))} - ) - }) - @GetMapping(path = "/signAgain") - @Transactional(rollbackFor = Exception.class) - @SsoAop() - public BaseResponse<JSONObject> signAgain(@RequestParam("prepayId") String prepayId) throws Exception { - - // 鑾峰彇闅忔満涓插拰鏃堕棿鎴筹紝鏀惧湪姝ゅ浠ヤ繚璇� - String appid = PayInfo.appid; - String timestamp = String.valueOf(System.currentTimeMillis() / 1000); - String nonceStr = PayHelper.generateRandomString(); - String pkg = "prepay_id=" + prepayId; - String signType = PayInfo.signType; - String message = PayHelper.buildMessage_signAgain(appid, timestamp, nonceStr, pkg); - String paySign = PayHelper.sign(message.getBytes("utf-8"), certFileName); - - JSONObject job_result = new JSONObject(); - job_result.put("timestamp", timestamp); - job_result.put("nonceStr", nonceStr); - job_result.put("package", pkg); - job_result.put("signType", signType); - job_result.put("paySign", paySign); - - return BaseResponseUtils.buildSuccess(job_result) ; - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java deleted file mode 100644 index 11e8d4e..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/payment/PaymentSv.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.dy.pipirrWebChat.payment; - -import com.dy.pipIrrGlobal.daoSe.SeWebchatLogonStateMapper; -import com.dy.pipIrrGlobal.pojoSe.SeWebchatLogonState; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 17:39 - * @LastEditTime 2024-02-22 17:39 - * @Description - */ - -@Slf4j -@Service -public class PaymentSv { - @Autowired - private SeWebchatLogonStateMapper seWebchatLogonStateMapper; - - /** - * 娣诲姞鐧诲綍鎬佺姸鎬佽褰� - * @param po - * @return - */ - Long insert(SeWebchatLogonState po) { - seWebchatLogonStateMapper.insert(po); - return po.getId(); - } - - SeWebchatLogonState selectOne(Long id) { - return seWebchatLogonStateMapper.selectByPrimaryKey(id); - } -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java deleted file mode 100644 index 2eb1327..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/result/WebChatResultCode.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.dy.pipirrWebChat.result; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * @author ZhuBaoMin - * @date 2024-02-21 16:13 - * @LastEditTime 2024-02-21 16:13 - * @Description - */ - -@Getter -@AllArgsConstructor -public enum WebChatResultCode { - /** - * 寰俊鏀粯 - */ - DIVIDE_FAIL(10001, "鍒嗘按鎴挎坊鍔犲け璐�"); - - private final Integer code; - private final String message; -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java deleted file mode 100644 index a40aa1d..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/ICallback.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.dy.pipirrWebChat.util; - -import okhttp3.Call; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 15:22 - * @LastEditTime 2024-02-22 15:22 - * @Description - */ - -public interface ICallback { - void onSuccess(Call call, String data); - void onFail(Call call, String errorMsg); -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java deleted file mode 100644 index 67c6ae0..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/java/com/dy/pipirrWebChat/util/OkHttpUtil.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.dy.pipirrWebChat.util; - -import okhttp3.*; -import org.jetbrains.annotations.NotNull; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; - -/** - * @author ZhuBaoMin - * @date 2024-02-22 13:39 - * @LastEditTime 2024-02-22 13:39 - * @Description - */ - -public class OkHttpUtil { - - private static volatile OkHttpClient okHttpClient = null; - private static volatile Semaphore semaphore = null; - private Map<String, String> headerMap; - private Map<String, Object> paramMap; - private String url; - private Request.Builder request; - private String body; - - private OkHttpUtil() { - if (Objects.isNull(okHttpClient)) { - synchronized (OkHttpUtil.class) { - if (Objects.isNull(okHttpClient)) { - TrustManager[] trustManagers = buildTrustManager(); - okHttpClient = new OkHttpClient.Builder() - .connectTimeout(15, TimeUnit.SECONDS) - .writeTimeout(20, TimeUnit.SECONDS) - .readTimeout(20, TimeUnit.SECONDS) - .sslSocketFactory(createSSLSocketFactory(trustManagers), (X509TrustManager)trustManagers[0]) - .hostnameVerifier((hostname, session) -> true) - .retryOnConnectionFailure(true) - .build(); - addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"); - } - } - } - } - - public OkHttpUtil initGet() { - request = new Request.Builder().get(); - StringBuilder builder = new StringBuilder(url); - if (Objects.nonNull(paramMap)) { - builder.append("?"); - paramMap.forEach((key, value) -> { - try { - builder.append(URLEncoder.encode(key, "utf-8")) - .append("=") - .append(URLEncoder.encode((String)value, "utf-8")) - .append("&"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - }); - builder.deleteCharAt(builder.length() - 1); - } - request.url(builder.toString()); - return this; - } - - public OkHttpUtil initPost(boolean isJson) { - RequestBody requestBody = null; - if (isJson) { - requestBody = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), body); - } else { - FormBody.Builder formBody = new FormBody.Builder(); - if (Objects.nonNull(paramMap)) { - paramMap.forEach((x, y) -> formBody.add(x, (String) y)); - } - requestBody = formBody.build(); - } - request = new Request.Builder().post(requestBody).url(url); - return this; - } - - /** - * @Description:鍚屾璇锋眰 - * @Author: zzc - * @Date: 2022-12-04 18:06 - * @return: java.lang.String - **/ - public String sync() throws Exception { - setHeader(request); - try { - Response result = okHttpClient.newCall(request.build()).execute(); - if (result.isSuccessful()) { - return result.body().string(); - } - throw new Exception(result.body().string()); - } catch (IOException e) { - throw new Exception(e.getMessage()); - } - } - - /** - * @Description:寮傛璇锋眰锛屾湁杩斿洖鍊� - * @Author: zzc - * @Date: 2022-12-04 18:05 - * @return: java.lang.String - **/ - public String async() { - StringBuffer buffer = new StringBuffer(); - setHeader(request); - okHttpClient.newCall(request.build()).enqueue(new Callback() { - @Override - public void onResponse(@NotNull okhttp3.Call call, @NotNull Response response) throws IOException { - if (Objects.nonNull(response.body())) { - buffer.append(response.body().string()); - getSemaphore().release(); - } - } - @Override - public void onFailure(@NotNull okhttp3.Call call, @NotNull IOException e) { - buffer.append("璇锋眰鍑洪敊").append(e.getMessage()); - } - }); - try { - getSemaphore().acquire(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return buffer.toString(); - } - - private static Semaphore getSemaphore() { - synchronized (OkHttpUtil.class) { - if (Objects.isNull(semaphore)) { - semaphore = new Semaphore(0); - } - } - return semaphore; - } - - public static OkHttpUtil builder() { - return new OkHttpUtil(); - } - - public OkHttpUtil url(String url) { - this.url = url; - return this; - } - - public OkHttpUtil addParam(String key, String value) { - if (Objects.isNull(paramMap)) { - paramMap = new LinkedHashMap<>(16); - } - paramMap.put(key, value); - return this; - } - - public OkHttpUtil addBody(String body) { - this.body = body; - return this; - } - - public void setHeader(Request.Builder request) { - if (Objects.nonNull(headerMap)) { - headerMap.forEach(request::addHeader); - } - } - - public OkHttpUtil addHeader(String key, String value) { - if (Objects.isNull(headerMap)) { - headerMap = new LinkedHashMap<>(16); - } - headerMap.put(key, value); - return this; - } - - /** - * @Description:鐢熸垚瀹夊叏濂楁帴瀛楀伐鍘傦紝鐢ㄤ簬Https璇锋眰鐨勮瘉涔﹁烦杩� - * @Author: zzc - * @Date: 2022-11-30 16:03 - * @param trustManagers: - * @return: javax.net.ssl.SSLSocketFactory - **/ - //private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) { - // SSLSocketFactory sslSocketFactory = null; - // try { - // SSLContext ssl = SSLContext.getInstance("SSL"); - // ssl.init(null, trustManagers, new SecureRandom()); - // sslSocketFactory = ssl.getSocketFactory(); - // } catch (Exception e) { - // e.printStackTrace(); - // } - // return sslSocketFactory; - //} - - private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustManagers) { - SSLSocketFactory sslSocketFactory = null; - try { - SSLContext ssl = SSLContext.getInstance("SSL"); - ssl.init(null, trustManagers, new SecureRandom()); - sslSocketFactory = ssl.getSocketFactory(); - - } catch (Exception e) { - e.printStackTrace(); - } - return sslSocketFactory; - } - - private static TrustManager[] buildTrustManager() { - return new TrustManager[] { - new X509TrustManager() { - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - } - - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[]{}; - } - } - }; - } - -} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml deleted file mode 100644 index 3702633..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/application.yml +++ /dev/null @@ -1,18 +0,0 @@ -spring: - profiles: - include: global, database, database-ym, database-pj - -#actutor鐨剋eb绔彛 -management: - server: - port: ${pipIrr.webchat.actutorPort} -#web鏈嶅姟绔彛锛�8086 -server: - port: ${pipIrr.webchat.webPort} - servlet: - context-path: /webchat #webchat璁块棶涓婁笅鏂囪矾寰� - context-parameters: - #GenerateIdSetSuffixListener涓簲鐢紝鍙栧�艰寖鍥存槸0-99 - idSuffix: ${pipIrr.webchat.idSuffix} - #ConfigListener涓簲鐢� - #configFileNames: config-global.xml,config-demo.xml diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml deleted file mode 100644 index 924901d..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/main/resources/log4j2.yml +++ /dev/null @@ -1,73 +0,0 @@ -Configuration: - #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�) - status: Error - - Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺 - Property: - #鏃ュ織鏂囦欢瀛樺偍鐨勭洰褰� - - name: log.path - value: ./logs - #鏃ュ織鏂囦欢瀛樺偍鍚嶇О - - name: project.name - value: pipIrrBase - - #瀹氫箟杈撳嚭鍣紝鍙互杈撳嚭鍒版帶鍒跺彴鍜屾枃浠�. - Appenders: - #杈撳嚭鍒版帶鍒跺彴 - Console: - #Appender鍛藉悕 - name: CONSOLE - target: SYSTEM_OUT - ThresholdFilter: - level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - #%n-鎹㈣ - #%m-鏃ュ織鍐呭锛岃緭鍑轰唬鐮佷腑鎸囧畾鐨勬棩蹇椾俊鎭� - #%p-杈撳嚭浼樺厛绾э紝鍗矰EBUG,INFO,WARN,ERROR,FATAL - #%r-绋嬪簭鍚姩鍒扮幇鍦ㄧ殑姣鏁� - #%%- 杈撳嚭涓�涓�"%" 瀛楃 - #%t-褰撳墠绾跨▼鍚� - #%d-鏃ユ湡鍜屾椂闂�, 甯哥敤鐨勬牸寮忔湁%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} - #%l-鍚�%F%L%C%M - #%F-java婧愭枃浠跺悕 - #%L-java婧愮爜琛屾暟 - #%C-java绫诲悕,%C{1}杈撳嚭鏈�鍚庝竴涓厓绱� - #%M-java鏂规硶鍚� - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - # 杈撳嚭鍒版枃浠讹紝瓒呰繃10MB褰掓。 - RollingFile: - - name: ROLLING_FILE - ignoreExceptions: false - fileName: ${log.path}/${project.name}.log - filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" - ThresholdFilter: - level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - Policies: - SizeBasedTriggeringPolicy: - size: "10 MB" - DefaultRolloverStrategy: - max: 1000 - - Loggers: - Root: - level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off - AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender. - - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - # 涓哄寘閰嶇疆鐗规畩鐨凩og绾у埆锛屾柟渚胯皟璇曪紝 - # 涓嶅彈Loggers.Root.level闄愬埗 - Logger: - - name: com.dy.pipIrrGlobal.daoSe - additivity: false #鍘婚櫎閲嶅鐨刲og - level: debug #杈撳嚭鏃ュ織绾у埆 - AppenderRef: - - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java b/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java deleted file mode 100644 index e9dfe9d..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-webchat/src/test/java/com/dy/pipirrWebChat/PipIrrWebWebchatApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.dy.pipirrWebChat; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class PipIrrWebWebchatApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/pipIrr-platform/pipIrr-web/pom.xml b/pipIrr-platform/pipIrr-web/pom.xml index 2562ee2..06ace49 100644 --- a/pipIrr-platform/pipIrr-web/pom.xml +++ b/pipIrr-platform/pipIrr-web/pom.xml @@ -26,7 +26,6 @@ <module>pipIrr-web-gis</module> <module>pipIrr-web-sell</module> <module>pipIrr-web-project</module> - <module>pipIrr-web-webchat</module> </modules> <dependencies> -- Gitblit v1.8.0