| | |
| | | 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"}; |
| | |
| | | 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 enum WxNotice { |
| | | |
| | | GOODSORDER_SEND(0,"您购买的商品【{param}】已发货","/","02BlSaqsSje7IjsWy0K7HdH7ArpOsEHD14OQU2Mk2Cs"), |
| | | GOODSORDER_WRITEOFF(1,"您购买的商品【{param}】已核销","/","A_-0NgHwX5a6Dlst64rqcDtcz_fGILwl3HTpN1rf7GE"), |
| | | GOODSORDER_REFUND(2,"您购买的商品【{param}】已退款,退款金额【¥{param2}】","/","yGwMHrXM3Qd55hdSeaKY9dLb-kfgE2Vs-8iK9kQaveI"); |
| | | |
| | | WxNotice(int i, String s, String s1,String s2) { |
| | | this.type = i; |
| | | this.noticeInfo = s; |
| | | this.jumpUrl = s1; |
| | | this.tempId = s2; |
| | | } |
| | | |
| | | |
| | | private int type; |
| | | private String noticeInfo; //通知信息 |
| | | private String jumpUrl;//跳转路径 |
| | | private String tempId;//跳转路径 |
| | | |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getNoticeInfo() { |
| | | return noticeInfo; |
| | | } |
| | | |
| | | public void setNoticeInfo(String noticeInfo) { |
| | | this.noticeInfo = noticeInfo; |
| | | } |
| | | |
| | | public String getJumpUrl() { |
| | | return jumpUrl; |
| | | } |
| | | |
| | | public void setJumpUrl(String jumpUrl) { |
| | | this.jumpUrl = jumpUrl; |
| | | } |
| | | public String getTempId() { |
| | | return tempId; |
| | | } |
| | | public void setTempId(String tempId) { |
| | | this.tempId = tempId; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 标签类型 |
| | |
| | | public enum UserActionType { |
| | | CHANGE_SHOP(0, "经销商更换","由【${param1}】于【${param2}】,进行【经销商更换】" ), |
| | | CHANGE_SALETYPE(1, "经销商更换销售模式","由【${param1}】于【${param2}】,进行【销售模式变更】" ), |
| | | CHANGE_ORDER_KD(2, "订单快递更换","${param1}" ), |
| | | ; |
| | | |
| | | // 成员变量 |
| | |
| | | this.info = info; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static InputStream generateWxMiniImgStream(String scene, String page, boolean isUsePage) { |
| | | //生成图片上传OSS |
| | | Map<String,Object> body = new HashMap<>(); |
| | | // 场景码,与前端约定,最终是需要前端解析 |
| | | body.put("scene", scene); |
| | | // 正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。 |
| | | String env_version = "release"; |
| | | body.put("env_version", env_version); |
| | | if(isUsePage){ |
| | | body.put("page", page); |
| | | } |
| | | //body.put("page", "pages/index/index"); |
| | | // 透明,根据你的场景自行设置body参数 |
| | | 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; |
| | | } |
| | | } |