提交修改
This commit is contained in:
parent
44da3917c6
commit
807a88f645
@ -70,4 +70,7 @@ public interface VvBuyerDao extends BaseMapper<VvBuyerEntity> {
|
||||
|
||||
int updateVvBuyerDrawFailedById(@Plus BigDecimal promoterDrawCashFailedCount,
|
||||
@Sub BigDecimal promoterApplyDrawCashAmount, Long id);
|
||||
|
||||
@LIMIT
|
||||
VvBuyerEntity selectVvBuyerOpenId(String openid);
|
||||
}
|
||||
@ -76,6 +76,8 @@ public interface VvProductDao extends BaseMapper<VvProductEntity> {
|
||||
@IF Integer appCategoryId2,
|
||||
@IF Integer appCategoryId3,
|
||||
@IF Integer isTest,
|
||||
@IF Integer isNew,
|
||||
@IF Integer isFlash,
|
||||
@IF @OrderBy(VvProductEntity.show_sale_price) String salePriceSort,
|
||||
@IF @OrderBy(VvProductEntity.show_sale_count) String saleCountSort,
|
||||
@IF @OrderBy(VvProductEntity.create_timestamp) String createTimestampSort
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 配置表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-11-04
|
||||
*/
|
||||
import com.heyu.api.data.entity.vv.VvScrollConfigEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvScrollConfigDao extends BaseMapper<VvScrollConfigEntity> {
|
||||
|
||||
|
||||
VvScrollConfigEntity selectVvScrollConfigById(@Param("id")Long id);
|
||||
|
||||
|
||||
Long insertVvScrollConfig(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
Long insertOrUpdateVvScrollConfig(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int updateVvScrollConfigById(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int updateCoverVvScrollConfigById(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int deleteVvScrollConfigById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<VvScrollConfigEntity> selectVvScrollConfigAll();
|
||||
}
|
||||
@ -27,4 +27,12 @@ public class BuyerDTO {
|
||||
*/
|
||||
private String token ;
|
||||
|
||||
|
||||
/***
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.heyu.api.data.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class WeiChatLoginDTO {
|
||||
|
||||
|
||||
@JsonProperty("session_key")
|
||||
private String sessionKey;
|
||||
@JsonProperty("openid")
|
||||
private String openid;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*买家信息
|
||||
* @author quyixiao
|
||||
* @since 2025-10-25
|
||||
* @since 2025-11-03
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -46,6 +46,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String promoter_draw_cash_failed_amount = CLASS_NAME + "promoter_draw_cash_failed_amount"; // 提现失败金额
|
||||
public final static String promoter_apply_draw_cash_amount = CLASS_NAME + "promoter_apply_draw_cash_amount"; // 申请提现金额
|
||||
public final static String avatar_ = CLASS_NAME + "avatar"; // 微信头像
|
||||
public final static String session_key = CLASS_NAME + "session_key"; // 微信session_key
|
||||
public final static String openid_ = CLASS_NAME + "openid"; // 微信open_id
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -97,6 +99,10 @@ private static final long serialVersionUID = 1L;
|
||||
private String promoterApplyDrawCashAmount;
|
||||
//微信头像
|
||||
private String avatar;
|
||||
//微信session_key
|
||||
private String sessionKey;
|
||||
//微信open_id
|
||||
private String openid;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -472,6 +478,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信session_key
|
||||
* @return
|
||||
*/
|
||||
public String getSessionKey() {
|
||||
return sessionKey;
|
||||
}
|
||||
/**
|
||||
* 微信session_key
|
||||
* @param sessionKey
|
||||
*/
|
||||
public void setSessionKey(String sessionKey) {
|
||||
this.sessionKey = sessionKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信open_id
|
||||
* @return
|
||||
*/
|
||||
public String getOpenid() {
|
||||
return openid;
|
||||
}
|
||||
/**
|
||||
* 微信open_id
|
||||
* @param openid
|
||||
*/
|
||||
public void setOpenid(String openid) {
|
||||
this.openid = openid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvBuyerEntity{" +
|
||||
@ -500,6 +536,8 @@ private static final long serialVersionUID = 1L;
|
||||
",promoterDrawCashFailedAmount=" + promoterDrawCashFailedAmount +
|
||||
",promoterApplyDrawCashAmount=" + promoterApplyDrawCashAmount +
|
||||
",avatar=" + avatar +
|
||||
",sessionKey=" + sessionKey +
|
||||
",openid=" + openid +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*商品表
|
||||
* @author quyixiao
|
||||
* @since 2025-10-25
|
||||
* @since 2025-11-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -55,6 +55,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String feature1_ = CLASS_NAME + "feature1"; // 特色1
|
||||
public final static String feature2_ = CLASS_NAME + "feature2"; // 特色2
|
||||
public final static String app_name = CLASS_NAME + "app_name"; // 应用名称:goudezhao
|
||||
public final static String is_new = CLASS_NAME + "is_new"; // 是否是新品
|
||||
public final static String is_flash = CLASS_NAME + "is_flash"; // 限时秒杀
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -124,6 +126,10 @@ private static final long serialVersionUID = 1L;
|
||||
private String feature2;
|
||||
//应用名称:goudezhao
|
||||
private String appName;
|
||||
//是否是新品
|
||||
private Integer isNew;
|
||||
//限时秒杀
|
||||
private Integer isFlash;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -634,6 +640,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.appName = appName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是新品
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsNew() {
|
||||
return isNew;
|
||||
}
|
||||
/**
|
||||
* 是否是新品
|
||||
* @param isNew
|
||||
*/
|
||||
public void setIsNew(Integer isNew) {
|
||||
this.isNew = isNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* 限时秒杀
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsFlash() {
|
||||
return isFlash;
|
||||
}
|
||||
/**
|
||||
* 限时秒杀
|
||||
* @param isFlash
|
||||
*/
|
||||
public void setIsFlash(Integer isFlash) {
|
||||
this.isFlash = isFlash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvProductEntity{" +
|
||||
@ -671,6 +707,8 @@ private static final long serialVersionUID = 1L;
|
||||
",feature1=" + feature1 +
|
||||
",feature2=" + feature2 +
|
||||
",appName=" + appName +
|
||||
",isNew=" + isNew +
|
||||
",isFlash=" + isFlash +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*配置表
|
||||
* @author quyixiao
|
||||
* @since 2025-11-04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("vv_scroll_config")
|
||||
public class VvScrollConfigEntity implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvScrollConfigEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 买家创建时间
|
||||
public final static String type_ = CLASS_NAME + "type"; // header 头部,input , 输入框,post 公告
|
||||
public final static String content_ = CLASS_NAME + "content"; // 内容
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//是否删除:0 否 1 删除
|
||||
private Integer isDelete;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//修改时间
|
||||
private Date modifyTime;
|
||||
//买家创建时间
|
||||
private Long createTimestamp;
|
||||
//header 头部,input , 输入框,post 公告
|
||||
private String type;
|
||||
//内容
|
||||
private String content;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTime
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* @return
|
||||
*/
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
/**
|
||||
* 修改时间
|
||||
* @param modifyTime
|
||||
*/
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 买家创建时间
|
||||
* @return
|
||||
*/
|
||||
public Long getCreateTimestamp() {
|
||||
return createTimestamp;
|
||||
}
|
||||
/**
|
||||
* 买家创建时间
|
||||
* @param createTimestamp
|
||||
*/
|
||||
public void setCreateTimestamp(Long createTimestamp) {
|
||||
this.createTimestamp = createTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* header 头部,input , 输入框,post 公告
|
||||
* @return
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* header 头部,input , 输入框,post 公告
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 内容
|
||||
* @return
|
||||
*/
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
/**
|
||||
* 内容
|
||||
* @param content
|
||||
*/
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvScrollConfigEntity{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",createTime=" + createTime +
|
||||
",modifyTime=" + modifyTime +
|
||||
",createTimestamp=" + createTimestamp +
|
||||
",type=" + type +
|
||||
",content=" + content +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.data.service.impl.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 配置表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-11-04
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.heyu.api.data.dao.vv.VvScrollConfigDao;
|
||||
import com.heyu.api.data.entity.vv.VvScrollConfigEntity;
|
||||
import com.heyu.api.data.service.vv.VvScrollConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class VvScrollConfigServiceImpl extends ServiceImpl<VvScrollConfigDao, VvScrollConfigEntity> implements VvScrollConfigService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvScrollConfigDao vvScrollConfigDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VvScrollConfigEntity selectVvScrollConfigById(Long id){
|
||||
return vvScrollConfigDao.selectVvScrollConfigById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertVvScrollConfig(VvScrollConfigEntity vvScrollConfig){
|
||||
return vvScrollConfigDao.insertVvScrollConfig(vvScrollConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertOrUpdateVvScrollConfig(VvScrollConfigEntity vvScrollConfig){
|
||||
return vvScrollConfigDao.insertOrUpdateVvScrollConfig(vvScrollConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateVvScrollConfigById(VvScrollConfigEntity vvScrollConfig){
|
||||
return vvScrollConfigDao.updateVvScrollConfigById(vvScrollConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverVvScrollConfigById(VvScrollConfigEntity vvScrollConfig){
|
||||
return vvScrollConfigDao.updateCoverVvScrollConfigById(vvScrollConfig);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteVvScrollConfigById(Long id){
|
||||
return vvScrollConfigDao.deleteVvScrollConfigById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.data.service.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 配置表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-11-04
|
||||
*/
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.heyu.api.data.entity.vv.VvScrollConfigEntity;
|
||||
public interface VvScrollConfigService extends IService<VvScrollConfigEntity> {
|
||||
|
||||
|
||||
|
||||
VvScrollConfigEntity selectVvScrollConfigById(Long id);
|
||||
|
||||
|
||||
Long insertVvScrollConfig(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
Long insertOrUpdateVvScrollConfig(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int updateVvScrollConfigById(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int updateCoverVvScrollConfigById(VvScrollConfigEntity vvScrollConfig);
|
||||
|
||||
|
||||
int deleteVvScrollConfigById(Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -1,27 +1,32 @@
|
||||
package com.heyu.api.utils;
|
||||
package com.heyu.api.data.utils;
|
||||
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.scheme.Scheme;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@ -30,7 +35,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class HttpUtils {
|
||||
|
||||
static final int TIMEOUT_MSEC = 5 * 1000;
|
||||
|
||||
/**
|
||||
* get
|
||||
@ -56,6 +64,161 @@ public class HttpUtils {
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
// 创建参数列表
|
||||
if (paramMap != null) {
|
||||
List<NameValuePair> paramList = new ArrayList();
|
||||
for (Map.Entry<String, String> param : paramMap.entrySet()) {
|
||||
paramList.add(new BasicNameValuePair(param.getKey(), param.getValue()));
|
||||
}
|
||||
// 模拟表单
|
||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
|
||||
httpPost.setConfig(builderRequestConfig());
|
||||
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost4Json(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
if (paramMap != null) {
|
||||
// 构造json格式数据
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, String> param : paramMap.entrySet()) {
|
||||
jsonObject.put(param.getKey(), param.getValue());
|
||||
}
|
||||
StringEntity entity = new StringEntity(jsonObject.toString(), "utf-8");
|
||||
// 设置请求编码
|
||||
entity.setContentEncoding("utf-8");
|
||||
// 设置数据类型
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
|
||||
httpPost.setConfig(builderRequestConfig());
|
||||
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
private static RequestConfig builderRequestConfig() {
|
||||
return RequestConfig.custom().setConnectTimeout(TIMEOUT_MSEC).setConnectionRequestTimeout(TIMEOUT_MSEC)
|
||||
.setSocketTimeout(TIMEOUT_MSEC).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送GET方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String doGet(String url, Map<String, String> paramMap) {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
||||
String result = "";
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
try {
|
||||
URIBuilder builder = new URIBuilder(url);
|
||||
if (paramMap != null) {
|
||||
for (String key : paramMap.keySet()) {
|
||||
builder.addParameter(key, paramMap.get(key));
|
||||
}
|
||||
}
|
||||
URI uri = builder.build();
|
||||
|
||||
// 创建GET请求
|
||||
HttpGet httpGet = new HttpGet(uri);
|
||||
|
||||
// 发送请求
|
||||
response = httpClient.execute(httpGet);
|
||||
log.info("response:{}", response);
|
||||
|
||||
// 判断响应状态
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
result = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* post form
|
||||
@ -0,0 +1,56 @@
|
||||
package com.heyu.api.data.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.data.dto.WeiChatLoginDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Slf4j
|
||||
public class WechatUtils {
|
||||
|
||||
/**
|
||||
* 微信 auth.code2Session 接口
|
||||
*/
|
||||
public final static String WECHAT_LOGIN_URL = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
public final static String WECHAT_APPID = "wx75fa59c097bd3dfd";
|
||||
public final static String WECHAT_SECRET = "1837c382de696013a2dfc64591e6b854";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 获取 openid
|
||||
WeiChatLoginDTO weiChatLoginDTO = getOpenId("0b1tMGll2jJdBg4sfwml2pnGk32tMGlg");
|
||||
System.out.println(weiChatLoginDTO.getOpenid());
|
||||
System.out.println("o6t1512tT-JuBeT6rIu6RhFGf3BQ".length());
|
||||
System.out.println("FMOMCp63WoRFUJtL4tvjcQ==".length());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过微信登录code获取openId
|
||||
*
|
||||
* @param code 微信登录code
|
||||
* @return openId
|
||||
*/
|
||||
// ============json============{"session_key":"FMOMCp63WoRFUJtL4tvjcQ==","openid":"o6t1512tT-JuBeT6rIu6RhFGf3BQ"}
|
||||
public static WeiChatLoginDTO getOpenId(String code) {
|
||||
try {
|
||||
// 添加参数
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("appid", WECHAT_APPID);
|
||||
map.put("secret", WECHAT_SECRET);
|
||||
map.put("js_code", code);
|
||||
map.put("grant_type", "authorization_code");
|
||||
// 使用封装好的HttpClientUtil工具类发送请求
|
||||
String json = HttpUtils.doGet(WECHAT_LOGIN_URL, map);
|
||||
System.out.println("============json============" + json);
|
||||
// 将JSON字符串转换为JSONObject对象
|
||||
WeiChatLoginDTO weiChatLoginDTO = JSON.parseObject(json, WeiChatLoginDTO.class);
|
||||
// 从JSONObject中获取openid并返回
|
||||
return weiChatLoginDTO;
|
||||
} catch (Exception e) {
|
||||
log.error("getOpenId error", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
<?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.heyu.api.data.dao.vv.VvScrollConfigDao">
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -94,7 +94,7 @@ public class MysqlMain_insert {
|
||||
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("vv_package"));
|
||||
list.add(new TablesBean("vv_scroll_config"));
|
||||
|
||||
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public class MysqlMain_update {
|
||||
}
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("vv_promoter_award_line"));
|
||||
list.add(new TablesBean("vv_product"));
|
||||
|
||||
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
|
||||
@ -11,7 +11,7 @@ import com.heyu.api.data.entity.api.ApiBankCardEntity;
|
||||
import com.heyu.api.data.service.api.ApiRechargeMoneyService;
|
||||
import com.heyu.api.data.utils.BankCardUtils;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
@ -11,7 +11,7 @@ import com.heyu.api.data.entity.api.ApiBankCardEntity;
|
||||
import com.heyu.api.data.service.api.ApiRechargeMoneyService;
|
||||
import com.heyu.api.data.utils.BankCardUtils;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
@ -11,7 +11,7 @@ import com.heyu.api.data.entity.api.ApiBankCardEntity;
|
||||
import com.heyu.api.data.service.api.ApiRechargeMoneyService;
|
||||
import com.heyu.api.data.utils.BankCardUtils;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
@ -44,4 +44,9 @@ public class AppIndexPageRequest extends AppBaseRequest {
|
||||
*/
|
||||
private String status ;
|
||||
|
||||
//是否是新品
|
||||
private Integer isNew;
|
||||
//限时秒杀
|
||||
private Integer isFlash;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.alibaba.request.vv;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppUserLoginRequest {
|
||||
|
||||
/***
|
||||
* 微信code
|
||||
*/
|
||||
private String code;
|
||||
}
|
||||
@ -9,7 +9,7 @@ import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.TencentBaseHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ -9,7 +9,7 @@ import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.tencent.TencentBaseHandle;
|
||||
import com.heyu.api.tencent.request.TMobile3MetaVerificationRequest;
|
||||
import com.heyu.api.tencent.resp.TMobile3MetaVerificationResp;
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.heyu.api.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import com.heyu.api.tencent.resp.ThirdIdCardResp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
|
||||
@ -58,8 +58,6 @@ public class AppIndexPageController {
|
||||
@Autowired
|
||||
private VvBuyerDao vvBuyerDao ;
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 列表 /app/index/page/list
|
||||
*/
|
||||
@ -76,7 +74,6 @@ public class AppIndexPageController {
|
||||
return R.error("非内部用户");
|
||||
}
|
||||
}
|
||||
|
||||
PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize())
|
||||
.doSelect(new ISelect() {
|
||||
@Override
|
||||
@ -89,6 +86,8 @@ public class AppIndexPageController {
|
||||
vvProductRequest.getCategoryId2(),
|
||||
vvProductRequest.getCategoryId3(),
|
||||
vvProductRequest.getIsTest(),
|
||||
vvProductRequest.getIsNew(),
|
||||
vvProductRequest.getIsFlash(),
|
||||
vvProductRequest.getSalePriceSort(),
|
||||
vvProductRequest.getSaleCountSort(),
|
||||
vvProductRequest.getCreateTimestampSort()
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.heyu.api.alibaba.request.vv.AppBaseRequest;
|
||||
import com.heyu.api.common.annotation.Describe;
|
||||
import com.heyu.api.data.dao.vv.VvScrollConfigDao;
|
||||
import com.heyu.api.data.entity.vv.VvScrollConfigEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.SanUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/app/scroll")
|
||||
public class AppScrollController {
|
||||
|
||||
@Autowired
|
||||
private VvScrollConfigDao vvScrollConfigDao;
|
||||
|
||||
// http://localhost:8888/app/scroll/list
|
||||
@Describe("查询滚动")
|
||||
@RequestMapping("/list")
|
||||
public R query(@RequestBody AppBaseRequest request) {
|
||||
List<VvScrollConfigEntity> vvScrollConfigEntityList = vvScrollConfigDao.selectVvScrollConfigAll();
|
||||
Map<String, List<VvScrollConfigEntity>> configMap = SanUtils.list2GroupBy(vvScrollConfigEntityList, VvScrollConfigEntity::getType);
|
||||
return R.ok().setData(configMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -3,13 +3,16 @@ package com.heyu.api.controller.vv;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.mm.VvAppLoginRequest;
|
||||
import com.heyu.api.alibaba.request.vv.AppUserLoginRequest;
|
||||
import com.heyu.api.common.annotation.Describe;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||
import com.heyu.api.data.dto.BuyerDTO;
|
||||
import com.heyu.api.data.dto.WeiChatLoginDTO;
|
||||
import com.heyu.api.data.entity.vv.VvBuyerEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.RedisUtils;
|
||||
import com.heyu.api.data.utils.TokenUtils;
|
||||
import com.heyu.api.data.utils.WechatUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -18,8 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/app/target")
|
||||
public class AppLoginController {
|
||||
@RequestMapping("/app/user")
|
||||
public class AppUserLoginController {
|
||||
|
||||
@Autowired
|
||||
private VvBuyerDao vvBuyerDao;
|
||||
@ -27,10 +30,40 @@ public class AppLoginController {
|
||||
@Autowired
|
||||
private RedisUtils redisUtils;
|
||||
|
||||
// http://localhost:8888/app/target/login
|
||||
|
||||
// http://localhost:8888/app/user/login
|
||||
@RequestMapping("/login")
|
||||
@Describe("目标用户登录")
|
||||
public R login(@RequestBody VvAppLoginRequest request) {
|
||||
public R login(@RequestBody AppUserLoginRequest request) {
|
||||
WeiChatLoginDTO weiChatLoginDTO = WechatUtils.getOpenId(request.getCode());
|
||||
if (weiChatLoginDTO == null) {
|
||||
return R.error("code 失效");
|
||||
}
|
||||
VvBuyerEntity target = vvBuyerDao.selectVvBuyerOpenId(weiChatLoginDTO.getOpenid());
|
||||
if (target == null) {
|
||||
target = new VvBuyerEntity();
|
||||
target.setOpenid(weiChatLoginDTO.getOpenid());
|
||||
target.setIsTest(0);
|
||||
target.setCreateTimestamp(System.currentTimeMillis());
|
||||
}
|
||||
target.setSessionKey(weiChatLoginDTO.getSessionKey());
|
||||
vvBuyerDao.insertOrUpdateVvBuyer(target);
|
||||
BuyerDTO buyerDTO = new BuyerDTO();
|
||||
buyerDTO.setBuyerId(target.getId());
|
||||
buyerDTO.setBuyerName(target.getBuyerName());
|
||||
buyerDTO.setFlag(target.getIsTest());
|
||||
String token = TokenUtils.generateToken(target.getId());
|
||||
buyerDTO.setToken(token);
|
||||
// 默认24 小时
|
||||
redisUtils.set(token, JSON.toJSON(buyerDTO), RedisUtils.DEFAULT_EXPIRE);
|
||||
return R.ok().put("buyer", buyerDTO);
|
||||
}
|
||||
|
||||
|
||||
// http://localhost:8888/app/user/target/login
|
||||
@RequestMapping("/target/login")
|
||||
@Describe("目标用户登录")
|
||||
public R targetLogin(@RequestBody VvAppLoginRequest request) {
|
||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerIsTestById(request.getBuyerId(), 1);
|
||||
if (vvBuyerEntity == null) {
|
||||
return R.error("你不是内部用户");
|
||||
@ -50,5 +83,4 @@ public class AppLoginController {
|
||||
return R.ok().put("buyer", buyerDTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.api.test;
|
||||
|
||||
import com.heyu.api.utils.HttpUtils;
|
||||
import com.heyu.api.data.utils.HttpUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user