| | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.business.vo.UnitCodeVo; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | | import okhttp3.Response; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.utils.URIBuilder; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.net.URI; |
| | | import java.net.URLDecoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | public static final String HK_ROOTORG_CODE ="HK_ROOTORG_CODE" ; |
| | | public static final String HK_ROOTORG_NAME ="HK_ROOTORG_NAME" ; |
| | | public static final String REDIS_TOKEN_KEY = "token_"; |
| | | public static final String CUSTOMER = "CUSTOMER"; |
| | | public static final String CUSTOMER = "CUSTOMER"; |
| | | public static final String BUSINESS = "BUSINESS"; |
| | | |
| | | |
| | |
| | | public static final String ZBOM = "ZBOM" ; |
| | | public static final String ZBOM_IAM_APPKEY = "ZBOM_IAM_APPKEY"; |
| | | public static final String ZBOM_IAM_APPID = "ZBOM_IAM_APPID"; |
| | | public static final String USER_CARD_HEADER_IMG ="USER_CARD_HEADER_IMG" ; |
| | | public static final String USER_CARD_PHONE_IMG ="USER_CARD_PHONE_IMG" ; |
| | | public static final String USER_CARD_ADDR_IMG ="USER_CARD_ADDR_IMG" ; |
| | | public static final String USER_CARD_SHOP_IMG ="USER_CARD_SHOP_IMG" ; |
| | | public static final String USER_CARD_LOGO_IMG ="USER_CARD_LOGO_IMG" ; |
| | | |
| | | public static Integer parseIntByStr(String idtOrgStatus) { |
| | | try { |
| | |
| | | public static final String ACCESS_ID="ACCESS_ID"; |
| | | public static final String BUCKETNAME = "BUCKETNAME"; |
| | | public static final String OBJCET_STORAGE = "OBJCET_STORAGE"; |
| | | public static final String ZBOM_CUSTOMIZED = "ZBOM_CUSTOMIZED"; |
| | | |
| | | |
| | | public static final String ACCESS_KEY = "ACCESS_KEY"; |
| | | public static final String ENDPOINT = "ENDPOINT"; |
| | | public static final String RESOURCE_PATH = "RESOURCE_PATH"; |
| | | public static final String WEIXIN_DEFAULT_IMGS = "WEIXIN_DEFAULT_IMGS"; |
| | | public static final String USER_CARD_DEFAULT_IMG = "USER_CARD_DEFAULT_IMG"; |
| | | public static final String USERS_FILE = "USERS_FILE"; |
| | | public static final String SHARES_FILE = "SHARES_FILE"; |
| | | public static final String NEWS_FILE = "NEWS_FILE"; |
| | | public static final String USER_LABEL = "USER_LABEL"; |
| | | //发送会议开始 定时提前多少分钟发送 |
| | | |
| | | public static final String SYSTEM ="SYSTEM"; |
| | |
| | | |
| | | |
| | | public static final String WX_MINI_CONFIG = "WX_MINI_CONFIG"; |
| | | public static final String SHARE_HAIBAO_HEADER_TITLE = "SHARE_HAIBAO_HEADER_TITLE"; |
| | | public static final String WX_APPID_CUSTOMER = "WX_APPID_CUSTOMER"; |
| | | public static final String WX_SECRET_CUSTOMER = "WX_SECRET_CUSTOMER"; |
| | | public static final String WX_APPID_PERSONNEL = "WX_APPID_PERSONNEL"; |
| | | public static final String WX_SECRET_PERSONNEL = "WX_SECRET_PERSONNEL"; |
| | | public static final String WX_TOKEN_CUSTOMER = "WX_TOKEN_CUSTOMER"; |
| | | public static final String WX_TOKEN_PERSONNEL = "WX_TOKEN_PERSONNEL"; |
| | | |
| | | |
| | | public interface RedisKeys { |
| | |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | |
| | | public static InputStream generateWxMiniImgStream(String accessToken,String scene,String page) { |
| | | //生成图片上传OSS |
| | | Map<String,Object> body = new HashMap<>(); |
| | | // 场景码,与前端约定,最终是需要前端解析 |
| | | body.put("scene", scene); |
| | | // 正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。 |
| | | body.put("env_version", "develop"); |
| | | body.put("page", page); |
| | | // 透明,根据你的场景自行设置body参数 |
| | | body.put("is_hyaline", true); |
| | | OkHttpClient client = new OkHttpClient().newBuilder().build(); |
| | | okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json"); |
| | | okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(mediaType, JSONObject.toJSONString(body)); |
| | | Request request = new Request.Builder().url("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+accessToken) |
| | | .method("POST", requestBody).build(); |
| | | try { |
| | | Response response = client.newCall(request).execute(); |
| | | if (response.isSuccessful()) { |
| | | InputStream inputStream = new ByteArrayInputStream(response.body().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()));*/ |
| | | return inputStream; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"生成图片失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |