From 56fcde8c93a1a10bc50fac775e370a2db57f520e Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 20 一月 2026 17:08:30 +0800
Subject: [PATCH] 小程序 接口开发
---
server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 256 insertions(+), 17 deletions(-)
diff --git a/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java b/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
index c0cceb2..b334fb7 100644
--- a/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1,14 +1,22 @@
package com.doumee.core.utils;
+import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
+import com.doumee.core.wx.WxMiniConfig;
import com.doumee.dao.business.model.Areas;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@Slf4j
public class Constants {
public static final String[] ALL_SPELL_LIST_FIRST = new String[]{"A", "B", "C", "D", "E", "F", "G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
@@ -30,8 +38,19 @@
public static final String ORDERSET_RETURN_SHOP_INTEGRAL_STATUS="ORDERSET_RETURN_SHOP_INTEGRAL_STATUS";
public static final String ORDERSET_RETURN_MEMBER_INTEGRAL="ORDERSET_RETURN_MEMBER_INTEGRAL";
public static final String ORDERSET_RETURN_SHOP_INTEGRAL="ORDERSET_RETURN_SHOP_INTEGRAL";
+
+ public static final String INTERALSET_DEDUCTINTEGRALLIMIT="INTERALSET_DEDUCTINTEGRALLIMIT";
+ public static final String INTERALSET_MININTEGRALPRICELIMIT="INTERALSET_MININTEGRALPRICELIMIT";
+ public static final String INTERALSET_INTEGRALINVALIDTYPE="INTERALSET_INTEGRALINVALIDTYPE";
+ public static final String INTERALSET_INTEGRALINVALIDCIRCLE="INTERALSET_INTEGRALINVALIDCIRCLE";
+ public static final String INTERALSET_INTEGRALRULEINFO="INTERALSET_INTEGRALRULEINFO";
+
public static final String ORDERSET_TOTAL_RATE="ORDERSET_TOTAL_RATE";
public static final String ORDER_SET ="ORDER_SET" ;
+ public static final String INTEGRAL_SET ="INTEGRAL_SET" ;
+
+ public static final String MEMBER_PREFIX = "member_";
+ public static final String SHOP_PREFIX = "shop_";
/**
* mq tag
@@ -56,6 +75,21 @@
public static final String RESOURCE_PATH = "RESOURCE_PATH";
public static final String INITIAL_PASSWORD = "INITIAL_PASSWORD";
public static final String ACCESS_TOKEN = "ACCESS_TOKEN";
+
+ public static final String MINIMUM_AVAILABLE_INTEGRAL = "MINIMUM_AVAILABLE_INTEGRAL";//鏈�浣庡彲鐢ㄧН鍒嗛厤缃�
+ public static final String SHOP_CONFIG = "SHOP_CONFIG";
+ public static final String INTEGRAL_EXCHANGE_CASH_RATA = "INTEGRAL_EXCHANGE_CASH_RATA"; //绉垎-鐜伴噾鍏戞崲姣斾緥锛圶XX绉垎鎶垫墸1鍏冿級
+
+
+ public static final String CASH_EXCHANGE_INTEGRAL_RATA = "CASH_EXCHANGE_INTEGRAL_RATA";//鐜伴噾-绉垎鍏戞崲姣斾緥锛�1鍏冨彲寰楀埌XXX绉垎锛�
+
+
+ public static final String MAIL_CONFIG = "MAIL_CONFIG";
+ public static final String FIRST_WEIGHT = "FIRST_WEIGHT";
+ public static final String CONTINUE_WEIGHT = "CONTINUE_WEIGHT";
+ public static final String FIRST_FEE = "FIRST_FEE";
+ public static final String CONTINUE_FEE = "CONTINUE_FEE";
+
public static final String INITIAL_ROLE = "INITIAL_ROLE";
@@ -109,11 +143,26 @@
public static final String COFFEE_ARTICLE_BACKGROUND = "COFFEE_ARTICLE_BACKGROUND";
+ public static final String TRANSFER_FILE = "TRANSFER_FILE";
+
+ public static final String INVITE_RULE = "INVITE_RULE";
+
+ public static final String INVITE_IMG = "INVITE_IMG";
+
+ public static final String SHARES_FILE = "SHARES_FILE";
+
+ public static final String INVITE_IMG_URL = "INVITE_IMG_URL";
+
+
+
+
+
public interface RedisKeys {
public static final String GOODSORDER_KEY = "ordercode_";
public static final String ACTIVITY_SIGN_KEY = "actcode_";
public static final String AFTERSALE_KEY = "salecode_";
+ public static final String WITHDRAW_KEY = "withdraw_";
}
/**
* 浼佷笟鏁版嵁鏉ユ簮 0骞冲彴娉ㄥ唽 1鍚庡彴瀵煎叆
@@ -307,6 +356,7 @@
SHOP_PICTURE(7, "鍟嗗鍥剧墖澶氬浘", "鍟嗗鍥剧墖澶氬浘"),
AFTERSALE_APPLY(8, "鐢宠鍞悗琛ュ厖璇存槑闄勪欢", "鐢宠鍞悗琛ュ厖璇存槑闄勪欢"),
AFTERSALE_KD(9, "鐢宠鍞悗閭瘎璇存槑闄勪欢", "鐢宠鍞悗閭瘎璇存槑闄勪欢"),
+ TRANSFER_FILE(10, "鎵撴鍑瘉", "鎵撴鍑瘉"),
;
// 鎴愬憳鍙橀噺
private String name;
@@ -568,7 +618,7 @@
*/
public enum OrderStatus{
WAIT_PAY(0, "寰呮敮浠�", "寰呮敮浠�"),
- PAY_DONE(1, "寰呭彂璐�", "宸叉敮浠樺緟鍙戣揣"),
+ PAY_DONE(1, "寰呭彂璐�/寰呰嚜鎻�", "宸叉敮浠樺緟鍙戣揣/寰呰嚜鎻�"),
WAIT_RECEIVE(2, "寰呮敹璐�", "宸插彂璐у緟鏀惰揣"),
DONE(3, "浜ゆ槗瀹屾垚", "浜ゆ槗瀹屾垚"),
CLOSE(4, "宸插叧闂�", "宸插叧闂�"),
@@ -830,34 +880,54 @@
* 绉垎绫诲瀷
*/
public enum IntegralObjType {
- REGISTER(0, "骞冲彴娉ㄥ唽", "骞冲彴娉ㄥ唽",0),
- SIGNIN(1, "绛惧埌", "绛惧埌",0),
- SHARE(2, "鍒嗕韩閭�璇�", "鍒嗕韩閭�璇�",0),
- INVITENEWUSER(3, "閭�璇锋柊鐢ㄦ埛", "閭�璇锋柊鐢ㄦ埛",0),
- EXCHANGEGOODS(4, "鍏戞崲鍟嗗搧", "鍏戞崲鍟嗗搧",1),
- EXCHANGECOUPON(5, "鍏戞崲浼樻儬鍒�", "鍏戞崲浼樻儬鍒�",1),
- SHARE_INFO(6,"鍒嗕韩璧勮","鍒嗕韩璧勮",0),
- POST_COMMENTS(7,"鍙戝竷璇勮","鍙戝竷璇勮",0),
- COFFEE_MAP_CONSUME(8,"鍜栧暋鍦板浘娑堣垂","鍜栧暋鍦板浘娑堣垂",0),
- SHOP_ORDER(9,"浣欓鎶垫墸鍟嗗搧","浣欓鎶垫墸鍟嗗搧",1),
- AFTERSALE_BACK(10,"鍞悗閫�娆�","鍞悗閫�娆�",1),
- EXCHANGE_CARD(11,"鍗″厖鍊�","鍗″厖鍊�",0),
- SYSTEM_RECHARGE(12,"骞冲彴鍏呭��","骞冲彴鍏呭��",0),
- SYSTEM_DEDUCT(13,"骞冲彴鎵f","骞冲彴鎵f",0),
- SHOP_ORDER_CANCEL(14,"浣欓鎶垫墸鍟嗗搧閫�杩�","浣欓鎶垫墸鍟嗗搧閫�杩�",0)
+ REGISTER(0, "娉ㄥ唽绉垎濂栧姳", "娉ㄥ唽鎴愬姛锛岃幏寰�${param}绉垎",0,0),
+ INVITENEWUSER(3, "閭�璇峰ソ鍙嬪緱绉垎", "鎺ㄨ崘濂藉弸${param}鎴愬姛锛岃幏寰�${param1}绉垎",0,0),
+ SYSTEM_RECHARGE(12,"绉垎鍙戞斁","骞冲彴濂栧姳锛岃幏寰�${param}绉垎",0,0),
+ SYSTEM_DEDUCT(13,"绉垎鎵i櫎","骞冲彴鎵e噺锛屾秷鑰�${param}绉垎",0,0),
+ MEMBER_ORDER_CANCEL(14,"鍙栨秷璁㈠崟閫�鍥�","浜ゆ槗閫�娆鹃��鍥烇紝鑾峰緱${param}绉垎",0,0),
+ MEMBER_ORDER(9,"涓嬪崟鎶垫墸","娑堣垂鎶垫墸锛屾秷鑰�${param}绉垎",1,0),
+ ORDER_DONATE(15,"娑堣垂杩旂Н鍒�","璐墿鎴愬姛锛岃幏寰�${param}绉垎",0,0),
+ SHOP_YEAR_SETTLEMENT(18,"绉垎杩囨湡","绉垎杩囨湡锛屾秷鑰�${param}绉垎",0,0),
+
+
+ ORDER_DONE_AMOUNT(16,"璁㈠崟缁撶畻","${param}璁㈠崟缁撶畻鎴愬姛锛岃幏寰楋骏${param1}鍏�",0,1),//${param}璁㈠崟缂栧彿锛�${param1}閲戦
+ WITHDRAW_APPLY(17,"浣欓鎻愮幇","浣欓鎻愮幇宸叉彁浜わ紝娑堣�楋骏${param}鍏�",0,1),
+ WITHDRAW_APPLY_BACK(19,"鎻愮幇閫�鍥�","浣欓鎻愮幇澶辫触锛岃幏寰楋骏${param}鍏�",0,1),
+ ORDER_DONE_AMOUNT_BACK(20,"璁㈠崟缁撶畻閫�鍥�","${param}璁㈠崟缁撶畻閫�鍥烇紝娑堣�楋骏${param1}鍏�",0,1),//${param}璁㈠崟缂栧彿锛�${param1}閲戦
+
+
+ SHOP_ORDER(21,"娑堣垂杩旂Н鍒�","浼氬憳${param}浜ゆ槗鎴愬姛锛岃幏寰�${param1}绉垎",0,0),//${param}鏄电О-鎵嬫満鍙�
+ SHOP_ORDER_CANCEL(22,"璁㈠崟鍙栨秷閫�鍥�","璁㈠崟鍙栨秷閫�鍥烇紝閫�鍥�${param}绉垎",0,0),
+ SHOP_SYSTEM_RECHARGE(23,"绉垎鍙戞斁","骞冲彴濂栧姳锛岃幏寰�${param}绉垎",0,0),
+ SHOP_SYSTEM_DEDUCT(24,"绉垎鎵i櫎","骞冲彴鎵e噺锛屾秷鑰�${param}绉垎",0,0),
+
+
+ //----------------搴熷純-------start---------
+ SIGNIN(1, "绛惧埌", "绛惧埌",0,0),
+ SHARE(2, "鍒嗕韩閭�璇�", "鍒嗕韩閭�璇�",0,0),
+ EXCHANGEGOODS(4, "鍏戞崲鍟嗗搧", "鍏戞崲鍟嗗搧",1,0),
+ EXCHANGECOUPON(5, "鍏戞崲浼樻儬鍒�", "鍏戞崲浼樻儬鍒�",1,0),
+ SHARE_INFO(6,"鍒嗕韩璧勮","鍒嗕韩璧勮",0,0),
+ POST_COMMENTS(7,"鍙戝竷璇勮","鍙戝竷璇勮",0,0),
+ COFFEE_MAP_CONSUME(8,"鍜栧暋鍦板浘娑堣垂","鍜栧暋鍦板浘娑堣垂",0,0),
+ AFTERSALE_BACK(10,"鍞悗閫�娆�","鍞悗閫�娆�",1,0),
+ EXCHANGE_CARD(11,"鍗″厖鍊�","鍗″厖鍊�",0,0),
+ //----------------搴熷純------end----------
;
// 鎴愬憳鍙橀噺
private String name;
private int key;
private String noteinfo;// 鎻忚堪
private Integer addTitle; // 0 = 鏂板锛�1 = 涓嶆柊澧�
+ private Integer type; // 0 = 绉垎锛�1=鐜伴噾
// 鏋勯�犳柟娉�
- IntegralObjType(int key, String name, String noteinfo ,Integer addTitle) {
+ IntegralObjType(int key, String name, String noteinfo ,Integer addTitle,Integer type) {
this.name = name;
this.key = key;
this.noteinfo = noteinfo;
this.addTitle = addTitle;
+ this.type = type;
}
// 鏅�氭柟娉�
@@ -878,6 +948,14 @@
}
}
return null;
+ }
+
+ public void setType(Integer type) {
+ this.type = type;
+ }
+
+ public Integer getType() {
+ return type;
}
// get set 鏂规硶
@@ -934,6 +1012,8 @@
BIG_AREA(13, "鍖哄煙鍒嗙被", "鍖哄煙鍒嗙被"),
APPLICABLE_BRAND(14, "閫傜敤鍝佺墝", "閫傜敤鍝佺墝"),
SERIES_BRAND(15, "鍝佺墝绯诲垪", "鍝佺墝绯诲垪"),
+ YUN_FEE(16, "杩愯垂閰嶇疆", "杩愯垂閰嶇疆"),
+ EXPRESS_DELIVERY(17, "蹇�掍俊鎭�", "蹇�掍俊鎭�"),
;
// 鎴愬憳鍙橀噺
private String name;
@@ -1056,4 +1136,163 @@
}
}
+
+
+ public static String getRandomNumber(){
+ Random random = new Random();
+ long randomNumber = (long)(random.nextDouble() * 90000000000L) + 100000000000L;
+ return randomNumber +"";
+ }
+
+
+ public enum INTEGRAL_TYPE{
+ ORDER_PAY(0, "璁㈠崟娑堣��", -1),
+ ORDER_CANCEL(1, "璁㈠崟鍙栨秷杩旇繕", 1),
+ ;
+ // 鎴愬憳鍙橀噺
+ private String name;
+ private int key;
+ private int type;// 鎻忚堪
+
+ // 鏋勯�犳柟娉�
+ INTEGRAL_TYPE(int key, String name, int type) {
+ this.name = name;
+ this.key = key;
+ this.type = type;
+ }
+
+ // 鏅�氭柟娉�
+ public static String getName(int index) {
+ for (INTEGRAL_TYPE c : INTEGRAL_TYPE.values()) {
+ if (c.getKey() == index) {
+ return c.name;
+ }
+ }
+ return null;
+ }
+
+
+ // get set 鏂规硶
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getKey() {
+ return key;
+ }
+
+ public void setKey(int key) {
+ this.key = key;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+ }
+
+ public enum UserActionType {
+ CHANGE_SHOP(0, "缁忛攢鍟嗘洿鎹�","鐢便��${param1}銆戜簬銆�${param2}銆戯紝杩涜銆愮粡閿�鍟嗘洿鎹€��" ),
+ CHANGE_SALETYPE(1, "缁忛攢鍟嗘洿鎹㈤攢鍞ā寮�","鐢便��${param1}銆戜簬銆�${param2}銆戯紝杩涜銆愰攢鍞ā寮忓彉鏇淬��" ),
+ ;
+
+ // 鎴愬憳鍙橀噺
+ private int key;
+ private String name;
+ private String info;
+
+ // 鏋勯�犳柟娉�
+ UserActionType(int key, String name,String info ) {
+ this.key = key;
+ this.info = info;
+ this.name = name;
+ }
+ public static String getName(int index) {
+ for (UserActionType c : UserActionType.values()) {
+ if (c.getKey() == index) {
+ return c.name;
+ }
+ }
+ return null;
+ }
+
+ public int getKey() {
+ return key;
+ }
+
+ public void setKey(int key) {
+ this.key = key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+ }
+
+
+ public static InputStream generateWxMiniImgStream(String scene, String page, boolean isUsePage) {
+ //鐢熸垚鍥剧墖涓婁紶OSS
+ Map<String,Object> body = new HashMap<>();
+ // 鍦烘櫙鐮侊紝涓庡墠绔害瀹氾紝鏈�缁堟槸闇�瑕佸墠绔В鏋�
+ body.put("scene", scene);
+ // 姝e紡鐗堜负 "release"锛屼綋楠岀増涓� "trial"锛屽紑鍙戠増涓� "develop"銆傞粯璁ゆ槸姝e紡鐗堛��
+ String env_version = "release";
+ body.put("env_version", env_version);
+ if(isUsePage){
+ body.put("page", page);
+ }
+ //body.put("page", "pages/index/index");
+ // 閫忔槑锛屾牴鎹綘鐨勫満鏅嚜琛岃缃産ody鍙傛暟
+ body.put("is_hyaline", true);
+ try {
+ WxMaCodeLineColor codeLineColor = new WxMaCodeLineColor("0","0","0");
+ byte[] bytes = WxMiniConfig.wxMaService.getQrcodeService().createWxaCodeUnlimitBytes
+ (scene,null,false,env_version,300,false,codeLineColor,false);
+ if (bytes !=null) {
+ InputStream inputStream = new ByteArrayInputStream(bytes);
+ /* ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = -1;
+ while ((len = inputStream.read(buffer)) != -1) {
+ baos.write(buffer, 0, len);
+ }
+ System.out.println("data:mediatype;base64," + Base64.getEncoder().encodeToString(baos.toByteArray()));*/
+ log.error("鐢熸垚灏忕▼搴忕爜鎴愬姛:============"+inputStream.available());
+ return inputStream;
+ }else{
+ log.error("鐢熸垚灏忕▼搴忕爜澶辫触:============");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("鐢熸垚灏忕▼搴忕爜澶辫触:============"+e.getMessage());
+ }
+ return null;
+ }
+
+
+ public static Integer getInviteCode(String inviteStr){
+ if(StringUtils.isNotBlank(inviteStr)&&inviteStr.startsWith("m_")){
+ return Integer.valueOf(inviteStr.replace("m_",""));
+ }
+ return null;
+ }
}
--
Gitblit v1.9.3