提交修改
This commit is contained in:
parent
b55a0b829c
commit
4e3eaafef7
@ -55,6 +55,14 @@ public class ApiConstants {
|
|||||||
public static String TOKEN = "token";
|
public static String TOKEN = "token";
|
||||||
|
|
||||||
|
|
||||||
|
public static String ACCESS_TOKEN_EQUALS= "access_token=";
|
||||||
|
|
||||||
|
|
||||||
|
public static String QUESTION_MARK= "?";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务调度参数key
|
* 任务调度参数key
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,9 +6,15 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class VVAdminDTO {
|
public class VVAdminDTO {
|
||||||
|
|
||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* token
|
||||||
|
*/
|
||||||
private String token;
|
private String token;
|
||||||
|
/***
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
private Long expireTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.heyu.api.aop;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.heyu.api.common.LogAspect;
|
import com.heyu.api.common.LogAspect;
|
||||||
|
import com.heyu.api.data.constants.ApiConstants;
|
||||||
import com.heyu.api.data.dto.BuyerDTO;
|
import com.heyu.api.data.dto.BuyerDTO;
|
||||||
import com.heyu.api.data.dto.VVRequestLogDTO;
|
import com.heyu.api.data.dto.VVRequestLogDTO;
|
||||||
import com.heyu.api.data.utils.*;
|
import com.heyu.api.data.utils.*;
|
||||||
@ -115,6 +116,7 @@ public class ZhenZhenLogAop {
|
|||||||
buyerId = buyerDTO.getBuyerId();
|
buyerId = buyerDTO.getBuyerId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Object argArr : argArrs) {
|
for (Object argArr : argArrs) {
|
||||||
argArr.getClass().getDeclaredMethods();
|
argArr.getClass().getDeclaredMethods();
|
||||||
|
|
||||||
@ -149,8 +151,6 @@ public class ZhenZhenLogAop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (uri.startsWith("/mm/")) {
|
} else if (uri.startsWith("/mm/")) {
|
||||||
// 登录不拦截
|
// 登录不拦截
|
||||||
if (!"/mm/admin/login".equals(uri)) {
|
if (!"/mm/admin/login".equals(uri)) {
|
||||||
@ -161,13 +161,11 @@ public class ZhenZhenLogAop {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = point.proceed();
|
result = point.proceed();
|
||||||
|
|
||||||
if (result instanceof R) {
|
if (result instanceof R) {
|
||||||
R r = (R) result;
|
R r = (R) result;
|
||||||
Object object = r.getData();
|
Object object = r.getData();
|
||||||
convertImage(object);
|
convertImage(object,token);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("LogAop set error " + sb.toString(), e);
|
log.error("LogAop set error " + sb.toString(), e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -179,25 +177,25 @@ public class ZhenZhenLogAop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void convertImage(Object object) {
|
public static void convertImage(Object object,String token) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (object instanceof List) {
|
if (object instanceof List) {
|
||||||
List list = (List) object;
|
List list = (List) object;
|
||||||
for (Object o : list) {
|
for (Object o : list) {
|
||||||
convertImage(o);
|
convertImage(o,token);
|
||||||
}
|
}
|
||||||
} else if (object instanceof Map) {
|
} else if (object instanceof Map) {
|
||||||
Map map = (Map) object;
|
Map map = (Map) object;
|
||||||
for (Object key : map.keySet()) {
|
for (Object key : map.keySet()) {
|
||||||
Object value = map.get(key);
|
Object value = map.get(key);
|
||||||
convertImage(value);
|
convertImage(value,token);
|
||||||
}
|
}
|
||||||
} else if (object.getClass().isArray()) {
|
} else if (object.getClass().isArray()) {
|
||||||
Object[] array = (Object[]) object;
|
Object[] array = (Object[]) object;
|
||||||
for (Object o : array) {
|
for (Object o : array) {
|
||||||
convertImage(o);
|
convertImage(o,token);
|
||||||
}
|
}
|
||||||
} else if (SanUtils.isBasicDataTypes(object.getClass())) {
|
} else if (SanUtils.isBasicDataTypes(object.getClass())) {
|
||||||
return;
|
return;
|
||||||
@ -219,15 +217,23 @@ public class ZhenZhenLogAop {
|
|||||||
if (method.getReturnType() == String.class) {
|
if (method.getReturnType() == String.class) {
|
||||||
String str = (String) image;
|
String str = (String) image;
|
||||||
if (str != null
|
if (str != null
|
||||||
&& str.startsWith("https://heyuimage.ihzhy.com")) {
|
&& str.startsWith("https://heyuimage.ihzhy.com")
|
||||||
String setMethodName = "set" + method.getName().substring(3);
|
) {
|
||||||
|
String newImage = str;
|
||||||
|
if (str.contains(ApiConstants.ACCESS_TOKEN_EQUALS)) {
|
||||||
|
String urlArray[] = str.split(ApiConstants.ACCESS_TOKEN_EQUALS);
|
||||||
|
newImage = urlArray[0] + ApiConstants.QUESTION_MARK + ApiConstants.ACCESS_TOKEN_EQUALS + token;
|
||||||
|
} else {
|
||||||
|
newImage = str + ApiConstants.QUESTION_MARK + ApiConstants.ACCESS_TOKEN_EQUALS + token;
|
||||||
|
}
|
||||||
|
String setMethodName = ApiConstants.set + method.getName().substring(3);
|
||||||
Method setMethod = methodMap.get(setMethodName);
|
Method setMethod = methodMap.get(setMethodName);
|
||||||
String newImage = image + "?key=xxxxxxx";
|
|
||||||
setMethod.invoke(object, new Object[]{newImage});
|
setMethod.invoke(object, new Object[]{newImage});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
convertImage(image);
|
convertImage(image,token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.heyu.api.data.dao.vv.VvLoginLogDao;
|
|||||||
import com.heyu.api.data.dto.vv.VVAdminDTO;
|
import com.heyu.api.data.dto.vv.VVAdminDTO;
|
||||||
import com.heyu.api.data.entity.vv.VvAdminEntity;
|
import com.heyu.api.data.entity.vv.VvAdminEntity;
|
||||||
import com.heyu.api.data.entity.vv.VvLoginLogEntity;
|
import com.heyu.api.data.entity.vv.VvLoginLogEntity;
|
||||||
|
import com.heyu.api.data.utils.DateUtils;
|
||||||
import com.heyu.api.data.utils.MD5Utils;
|
import com.heyu.api.data.utils.MD5Utils;
|
||||||
import com.heyu.api.data.utils.R;
|
import com.heyu.api.data.utils.R;
|
||||||
import com.heyu.api.data.utils.RedisUtils;
|
import com.heyu.api.data.utils.RedisUtils;
|
||||||
@ -17,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/mm/user/")
|
@RequestMapping("/mm/user/")
|
||||||
@ -25,21 +28,13 @@ public class AdminLoginController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VvAdminDao vvAdminDao;
|
private VvAdminDao vvAdminDao;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private VvLoginLogDao vvLoginLogDao;
|
private VvLoginLogDao vvLoginLogDao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtils redisUtils;
|
private RedisUtils redisUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* mmToken
|
* mmToken
|
||||||
*
|
*
|
||||||
* token
|
* token
|
||||||
@ -54,24 +49,23 @@ public class AdminLoginController {
|
|||||||
@RequestMapping("/login")
|
@RequestMapping("/login")
|
||||||
public R list(@RequestBody VVAdminRequest vvAdminRequest) {
|
public R list(@RequestBody VVAdminRequest vvAdminRequest) {
|
||||||
VVAdminDTO vvAdminDTO = new VVAdminDTO();
|
VVAdminDTO vvAdminDTO = new VVAdminDTO();
|
||||||
|
|
||||||
VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername());
|
VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername());
|
||||||
// admin123 != '1' or 1 = 1
|
// admin123 != '1' or 1 = 1
|
||||||
if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) {
|
if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) {
|
||||||
vvAdminDTO.setUsername(vvAdminRequest.getUsername());
|
String token = MD5Utils.getMD5(System.currentTimeMillis() + vvAdminRequest.getUsername());
|
||||||
String token = MD5Utils.getMD5(System.currentTimeMillis() + "admin");
|
|
||||||
vvAdminDTO.setToken(token);
|
vvAdminDTO.setToken(token);
|
||||||
|
vvAdminDTO.setUsername(vvAdminRequest.getUsername());
|
||||||
|
vvAdminDTO.setExpireTime(DateUtils.addDays(new Date(), 7).getTime());
|
||||||
|
|
||||||
VvLoginLogEntity vvLoginLogEntity = new VvLoginLogEntity();
|
VvLoginLogEntity vvLoginLogEntity = new VvLoginLogEntity();
|
||||||
|
|
||||||
vvLoginLogDao.deleteVvLoginLogRealByUserName(vvAdminRequest.getUsername());
|
vvLoginLogDao.deleteVvLoginLogRealByUserName(vvAdminRequest.getUsername());
|
||||||
|
|
||||||
vvLoginLogEntity.setUsername(vvAdminRequest.getUsername());
|
vvLoginLogEntity.setUsername(vvAdminRequest.getUsername());
|
||||||
|
redisUtils.set(token, vvAdminRequest.getUsername(), RedisConstans.SECOND_OF_ONE_7_DAY);
|
||||||
redisUtils.set(token,vvAdminRequest.getUsername(), RedisConstans.SECOND_OF_ONE_7_DAY);
|
|
||||||
|
|
||||||
vvLoginLogEntity.setToken(token);
|
vvLoginLogEntity.setToken(token);
|
||||||
vvLoginLogDao.insertOrUpdateVvLoginLog(vvLoginLogEntity);
|
vvLoginLogDao.insertOrUpdateVvLoginLog(vvLoginLogEntity);
|
||||||
|
|
||||||
return R.ok().setData(vvAdminDTO);
|
return R.ok().setData(vvAdminDTO);
|
||||||
}
|
}
|
||||||
return R.ok("密码错误");
|
return R.ok("密码错误");
|
||||||
|
|||||||
@ -166,6 +166,8 @@ public class AppOrderController {
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
* 订单添加
|
* 订单添加
|
||||||
|
*
|
||||||
|
* http://localhost:8888/app/order/add
|
||||||
*/
|
*/
|
||||||
@Describe("添加订单")
|
@Describe("添加订单")
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
@ -294,11 +296,6 @@ public class AppOrderController {
|
|||||||
vvProductDao.updateShowSaleCountAndSaleCount(map.getValue(), map.getValue(), map.getKey());
|
vvProductDao.updateShowSaleCountAndSaleCount(map.getValue(), map.getValue(), map.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(true){
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
DirectAPIv3JsapiPrepayResponse jsapiPrepayResponse = jsapiPrepay.prePay(vvTradeOrderEntity.getId(),
|
DirectAPIv3JsapiPrepayResponse jsapiPrepayResponse = jsapiPrepay.prePay(vvTradeOrderEntity.getId(),
|
||||||
BigDecimalUtil.multiply(vvTradeOrderEntity.getPayAmount(), new BigDecimal(100)).longValue(),
|
BigDecimalUtil.multiply(vvTradeOrderEntity.getPayAmount(), new BigDecimal(100)).longValue(),
|
||||||
vvBuyerEntity.getOpenid()
|
vvBuyerEntity.getOpenid()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user