去除e.printStackTrace();使用slf4j实现
This commit is contained in:
commit
a51e86fd98
@ -17,6 +17,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -29,6 +30,7 @@ import java.io.IOException;
|
||||
* @author Chopper
|
||||
* @date 2020-11-25 19:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "买家端,web联合登录")
|
||||
@RequestMapping("/buyer/connect")
|
||||
@ -92,7 +94,7 @@ public class ConnectBuyerWebController {
|
||||
try {
|
||||
return ResultUtil.data(connectService.appLoginCallback(authUser, uuid));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("unionID登录错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -26,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @author Chopper
|
||||
* @date 2020-12-18 16:59
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "买家端,收银台接口")
|
||||
@RequestMapping("/buyer/cashier")
|
||||
@ -66,7 +68,7 @@ public class CashierController {
|
||||
try {
|
||||
return cashierSupport.payment(paymentMethodEnum, paymentClientEnum, request, response, payParam);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("收银台支付错误",e);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
@ -5,6 +5,7 @@ import cn.lili.modules.file.plugin.FileManagerPlugin;
|
||||
import cn.lili.modules.goods.entity.dos.Brand;
|
||||
import cn.lili.modules.goods.service.BrandService;
|
||||
import com.xkcoding.http.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -19,6 +20,7 @@ import java.util.List;
|
||||
* @author paulG
|
||||
* @since 2020/11/14
|
||||
**/
|
||||
@Slf4j
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
class FileTest {
|
||||
@ -43,7 +45,7 @@ class FileTest {
|
||||
// 上传至第三方云服务或服务器
|
||||
brand.setLogo(fileManagerPlugin.inputStreamUpload(inputStream, brand.getId() + ".png"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("上传你文件出错",e);
|
||||
}
|
||||
}
|
||||
brandService.updateBatchById(categoryList);
|
||||
|
@ -8,6 +8,7 @@ import cn.lili.common.verification.service.VerificationService;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -17,8 +18,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @author Chopper
|
||||
* @date 2020/11/26 15:41
|
||||
*/
|
||||
@RequestMapping("/common/slider")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/common/slider")
|
||||
@Api(tags = "滑块验证码接口")
|
||||
public class SliderImageController {
|
||||
|
||||
@ -35,7 +37,7 @@ public class SliderImageController {
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取校验接口错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class BillExecute implements EveryDayExecute {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
//获取当前时间的前一天
|
||||
//获取当前天数
|
||||
int day = DateUtil.date().dayOfMonth();
|
||||
|
||||
//获取待结算商家列表
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.common.cache.impl;
|
||||
|
||||
import cn.lili.common.cache.Cache;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.core.*;
|
||||
@ -18,6 +19,7 @@ import java.util.function.Consumer;
|
||||
*
|
||||
* @author Chopepr
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RedisCache implements Cache {
|
||||
|
||||
@ -158,7 +160,7 @@ public class RedisCache implements Cache {
|
||||
return null;
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("scan错误",e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
@ -74,7 +74,7 @@ public abstract class AbstractDelayQueueMachineFactory {
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
log.error("延时队列机器开始运作错误",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public abstract class BaseElasticsearchService {
|
||||
log.info(" Indicates whether the requisite number of shard copies were started for each shard in the index before timing out :{}", createIndexResponse.isShardsAcknowledged());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("创建索引错误",e);
|
||||
throw new ElasticsearchException("创建索引 {" + index + "} 失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ public abstract class BaseElasticsearchService {
|
||||
try {
|
||||
searchResponse = client.search(searchRequest, COMMON_OPTIONS);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("es 搜索错误",e);
|
||||
}
|
||||
return searchResponse;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
try {
|
||||
SendSmsResponse response = client.sendSms(sendSmsRequest);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("发送短信错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
try {
|
||||
client.sendBatchSms(sendBatchSmsRequest);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("批量发送短信错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
config.endpoint = "dysmsapi.aliyuncs.com";
|
||||
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("短信初始化错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Base64;
|
||||
@ -12,6 +13,7 @@ import java.io.*;
|
||||
*
|
||||
* @author Chopper
|
||||
*/
|
||||
@Slf4j
|
||||
public class Base64DecodeMultipartFile implements MultipartFile {
|
||||
|
||||
private final byte[] imgContent;
|
||||
@ -64,7 +66,7 @@ public class Base64DecodeMultipartFile implements MultipartFile {
|
||||
stream = new FileOutputStream(dest);
|
||||
stream.write(imgContent);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("transferTo错误",e);
|
||||
}finally {
|
||||
stream.close();
|
||||
}
|
||||
@ -92,7 +94,7 @@ public class Base64DecodeMultipartFile implements MultipartFile {
|
||||
byte[] bytes = Base64.getDecoder().decode(base64);
|
||||
stream = new ByteArrayInputStream(bytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("base64ToInputStream错误",e);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
@ -109,13 +111,13 @@ public class Base64DecodeMultipartFile implements MultipartFile {
|
||||
}
|
||||
data = swapStream.toByteArray();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("转码错误",e);
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("inputStreamToStream错误",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -11,24 +13,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
* @version v1.0
|
||||
* 2020-12-14 09:32
|
||||
*/
|
||||
@Slf4j
|
||||
public class CookieUtil {
|
||||
|
||||
/**
|
||||
* 新增cookie
|
||||
*
|
||||
* @param key key值
|
||||
* @param value 对应值
|
||||
* @param response 响应
|
||||
*/
|
||||
public static void addCookie(String key, String value, HttpServletResponse response) {
|
||||
try {
|
||||
Cookie c = new Cookie(key, value);
|
||||
c.setPath("/");
|
||||
response.addCookie(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增cookie
|
||||
@ -45,7 +32,7 @@ public class CookieUtil {
|
||||
c.setPath("/");
|
||||
response.addCookie(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("新增cookie错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +48,7 @@ public class CookieUtil {
|
||||
c.setMaxAge(0);
|
||||
response.addCookie(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("删除cookie错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +70,7 @@ public class CookieUtil {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取cookie错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import org.apache.http.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpEntityEnclosingRequest;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.NoHttpResponseException;
|
||||
import org.apache.http.client.HttpRequestRetryHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
@ -21,7 +24,6 @@ import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
@ -30,10 +32,9 @@ import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class HttpClientUtils {
|
||||
|
||||
// org.apache.http.impl.client.CloseableHttpClient
|
||||
@ -146,11 +147,9 @@ public class HttpClientUtils {
|
||||
// 判断返回状态是否为200
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} else {
|
||||
System.out.println(response.getStatusLine().getStatusCode());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("get请求错误",e);
|
||||
} finally {
|
||||
try {
|
||||
if (response != null) {
|
||||
@ -158,71 +157,9 @@ public class HttpClientUtils {
|
||||
}
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("Get错误",e);
|
||||
}
|
||||
}
|
||||
return resultString;
|
||||
}
|
||||
|
||||
public static String doPost(String url, Map<String, String> param) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = getHttpClient();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
// 创建参数列表
|
||||
if (param != null) {
|
||||
List<NameValuePair> paramList = new ArrayList<>();
|
||||
for (String key : param.keySet()) {
|
||||
paramList.add(new BasicNameValuePair(key, param.get(key)));
|
||||
}
|
||||
// 模拟表单
|
||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList, "utf-8");
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
|
||||
public static String doPostJson(String url, String json) {
|
||||
// 创建HttpClient对象
|
||||
CloseableHttpClient httpClient = getHttpClient();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
// 创建请求内容
|
||||
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
|
||||
httpPost.setEntity(entity);
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package cn.lili.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.DefaultTypedTuple;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -17,6 +16,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* @author paulG
|
||||
* @since 2020/11/7
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RedisUtil {
|
||||
@Autowired
|
||||
@ -38,51 +38,11 @@ public class RedisUtil {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("指定缓存失效时间错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key 获取过期时间
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @return 时间(秒) 返回0代表为永久有效
|
||||
*/
|
||||
public long getExpire(String key) {
|
||||
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断key是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hasKey(String key) {
|
||||
try {
|
||||
return redisTemplate.hasKey(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
*
|
||||
* @param key 可以传一个值 或多个
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void del(String... key) {
|
||||
if (key != null && key.length > 0) {
|
||||
if (key.length == 1) {
|
||||
redisTemplate.delete(key[0]);
|
||||
} else {
|
||||
redisTemplate.delete(CollectionUtils.arrayToList(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================String=============================
|
||||
|
||||
@ -120,7 +80,7 @@ public class RedisUtil {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("缓存放入错误",e);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -143,215 +103,13 @@ public class RedisUtil {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("普通缓存放入并设置时间错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递增
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long incr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递增因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递减
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long decr(String key, long delta) {
|
||||
if (delta < 0) {
|
||||
throw new RuntimeException("递减因子必须大于0");
|
||||
}
|
||||
return redisTemplate.opsForValue().increment(key, -delta);
|
||||
}
|
||||
|
||||
//================================Map=================================
|
||||
|
||||
/**
|
||||
* HashGet
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return 值
|
||||
*/
|
||||
public Object hget(String key, String item) {
|
||||
return redisTemplate.opsForHash().get(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取hashKey对应的所有键值
|
||||
*
|
||||
* @param key 键
|
||||
* @return 对应的多个键值
|
||||
*/
|
||||
public Map<Object, Object> hmget(String key) {
|
||||
return redisTemplate.opsForHash().entries(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @return true 成功 false 失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HashSet 并设置时间
|
||||
*
|
||||
* @param key 键
|
||||
* @param map 对应多个键值
|
||||
* @param time 时间(秒)
|
||||
* @return true成功 false失败
|
||||
*/
|
||||
public boolean hmset(String key, Map<String, Object> map, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(key, map);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向一张hash表中放入数据,如果不存在将创建
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param value 值
|
||||
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
|
||||
* @return true 成功 false失败
|
||||
*/
|
||||
public boolean hset(String key, String item, Object value, long time) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(key, item, value);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除hash表中的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 可以使多个 不能为null
|
||||
*/
|
||||
public void hdel(String key, Object... item) {
|
||||
redisTemplate.opsForHash().delete(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断hash表中是否有该项的值
|
||||
*
|
||||
* @param key 键 不能为null
|
||||
* @param item 项 不能为null
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean hHasKey(String key, String item) {
|
||||
return redisTemplate.opsForHash().hasKey(key, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要增加几(大于0)
|
||||
* @return
|
||||
*/
|
||||
public double hincr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, by);
|
||||
}
|
||||
|
||||
/**
|
||||
* hash递减
|
||||
*
|
||||
* @param key 键
|
||||
* @param item 项
|
||||
* @param by 要减少记(小于0)
|
||||
* @return
|
||||
*/
|
||||
public double hdecr(String key, String item, double by) {
|
||||
return redisTemplate.opsForHash().increment(key, item, -by);
|
||||
}
|
||||
|
||||
//============================set=============================
|
||||
|
||||
/**
|
||||
* 根据key获取Set中的所有值
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public Set<Object> sGet(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value从一个set中查询,是否存在
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return true 存在 false不存在
|
||||
*/
|
||||
public boolean sHasKey(String key, Object value) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().isMember(key, value);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据放入set缓存
|
||||
@ -364,112 +122,11 @@ public class RedisUtil {
|
||||
try {
|
||||
return redisTemplate.opsForSet().add(key, values);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将数据放入set缓存错误",e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将set数据放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param time 时间(秒)
|
||||
* @param values 值 可以是多个
|
||||
* @return 成功个数
|
||||
*/
|
||||
public long sSetAndTime(String key, long time, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().add(key, values);
|
||||
if (time > 0) {
|
||||
expire(key, time);
|
||||
}
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取set缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long sGetSetSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForSet().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除值为value的
|
||||
*
|
||||
* @param key 键
|
||||
* @param values 值 可以是多个
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long setRemove(String key, Object... values) {
|
||||
try {
|
||||
Long count = redisTemplate.opsForSet().remove(key, values);
|
||||
return count;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//===============================listByParentId=================================
|
||||
|
||||
/**
|
||||
* 获取list缓存的内容
|
||||
*
|
||||
* @param key 键
|
||||
* @param start 开始
|
||||
* @param end 结束 0 到 -1代表所有值
|
||||
* @return
|
||||
*/
|
||||
public List<Object> lGet(String key, long start, long end) {
|
||||
try {
|
||||
return redisTemplate.opsForList().range(key, start, end);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取list缓存的长度
|
||||
*
|
||||
* @param key 键
|
||||
* @return
|
||||
*/
|
||||
public long lGetListSize(String key) {
|
||||
try {
|
||||
return redisTemplate.opsForList().size(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过索引 获取list中的值
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
|
||||
* @return
|
||||
*/
|
||||
public Object lGetIndex(String key, long index) {
|
||||
try {
|
||||
return redisTemplate.opsForList().index(key, index);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
@ -483,7 +140,7 @@ public class RedisUtil {
|
||||
redisTemplate.opsForList().rightPush(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将list放入缓存错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -504,7 +161,7 @@ public class RedisUtil {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将list放入缓存错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -521,27 +178,11 @@ public class RedisUtil {
|
||||
redisTemplate.opsForList().rightPushAll(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将list放入缓存错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public <T> boolean lPush(String key, List<T> value) {
|
||||
try {
|
||||
redisTemplate.opsForList().leftPushAll(key, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将list放入缓存
|
||||
@ -559,46 +200,12 @@ public class RedisUtil {
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将list放入缓存错误",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据索引修改list中的某条数据
|
||||
*
|
||||
* @param key 键
|
||||
* @param index 索引
|
||||
* @param value 值
|
||||
* @return
|
||||
*/
|
||||
public boolean lUpdateIndex(String key, long index, Object value) {
|
||||
try {
|
||||
redisTemplate.opsForList().set(key, index, value);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除N个值为value
|
||||
*
|
||||
* @param key 键
|
||||
* @param count 移除多少个
|
||||
* @param value 值
|
||||
* @return 移除的个数
|
||||
*/
|
||||
public long lRemove(String key, long count, Object value) {
|
||||
try {
|
||||
Long remove = redisTemplate.opsForList().remove(key, count, value);
|
||||
return remove;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//===============================ZSet=================================
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ public class VerificationServiceImpl implements VerificationService {
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("创建校验错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.config.elasticsearch;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
@ -27,6 +28,7 @@ import java.util.List;
|
||||
* @author paulG
|
||||
* @since 2020/10/13
|
||||
**/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
||||
@ -96,7 +98,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
|
||||
try {
|
||||
this.client.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("es clientClose错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package cn.lili.modules.base.serviceimpl;
|
||||
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.utils.HttpClientUtils;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.modules.base.mapper.RegionMapper;
|
||||
import cn.lili.modules.base.service.RegionService;
|
||||
import cn.lili.modules.system.entity.dos.Region;
|
||||
@ -13,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -33,6 +35,8 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
*/
|
||||
private String syncUrl = "https://restapi.amap.com/v3/config/district?subdistrict=4&key=e456d77800e2084a326f7b777278f89d";
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@Override
|
||||
public void synchronizationData(String url) {
|
||||
try {
|
||||
@ -51,8 +55,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
|
||||
int endPoint = Math.min((100 + (i * 100)), regions.size());
|
||||
this.saveBatch(regions.subList(i * 100, endPoint));
|
||||
}
|
||||
//删除缓存
|
||||
cache.vagueDel("{regions}");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("同步行政数据错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
@ -95,10 +94,8 @@ public class WechatMediaUtil {
|
||||
reader.close();
|
||||
resultIn.close();
|
||||
urlConn.disconnect();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
log.error("微信媒体上传失败",e);
|
||||
}
|
||||
JSONObject jsonObject=new JSONObject(resultStr.toString());
|
||||
return jsonObject.get("media_id").toString();
|
||||
|
@ -339,7 +339,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
|
||||
return JSONUtil.parseObj(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("解密,获取微信信息错误",e);
|
||||
}
|
||||
throw new ServiceException(ResultCode.USER_CONNECT_ERROR);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import cn.lili.modules.system.entity.dto.connect.dto.QQConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.dto.connect.dto.WechatConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -41,6 +42,7 @@ import java.io.IOException;
|
||||
* @version v1.0
|
||||
* 2020-11-25 21:16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ConnectUtil {
|
||||
|
||||
@ -98,7 +100,7 @@ public class ConnectUtil {
|
||||
try {
|
||||
httpServletResponse.sendRedirect(url);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("登录回调错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package cn.lili.modules.connect.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
@ -11,6 +13,7 @@ import java.net.UnknownHostException;
|
||||
* @version v1.0
|
||||
* 2020-12-08 15:32
|
||||
*/
|
||||
@Slf4j
|
||||
public class IpUtils {
|
||||
|
||||
/**
|
||||
@ -22,7 +25,7 @@ public class IpUtils {
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取本机IP错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import cn.lili.modules.member.entity.dos.Member;
|
||||
import cn.lili.modules.member.entity.dos.MemberPointsHistory;
|
||||
import cn.lili.modules.member.service.MemberPointsHistoryService;
|
||||
import cn.lili.modules.member.service.MemberService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 7:22 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class PointLogInterceptor {
|
||||
@ -62,7 +64,7 @@ public class PointLogInterceptor {
|
||||
memberPointsHistoryService.save(memberPointsHistory);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("积分操作错误",e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
|
||||
memberService.updateMemberPoint(point, true, memberId, content);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("会员签到错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -25,6 +26,7 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
* @date 2021/1/30 4:27 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> implements SmsSignService {
|
||||
@ -42,7 +44,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
|
||||
smsSign.setSignStatus(0);
|
||||
this.save(smsSign);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("添加短信签名错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +57,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
|
||||
this.removeById(id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("删除短信签名错误",e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -74,7 +76,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
|
||||
this.updateById(smsSign);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("查询短信签名错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +86,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
|
||||
aliSmsUtil.modifySmsSign(smsSign);
|
||||
this.updateById(smsSign);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("更新短信签名错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -23,6 +24,7 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
* @date 2021/1/30 4:27 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTemplate> implements SmsTemplateService {
|
||||
@ -38,7 +40,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
|
||||
smsTemplate.setTemplateType(1);
|
||||
this.save(smsTemplate);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("添加短信模板错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +53,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
|
||||
}
|
||||
this.removeById(id);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("删除短信模板错误",e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -71,7 +73,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
|
||||
this.updateById(smsTemplate);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("查询短信模板错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,7 +84,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
|
||||
smsTemplate.setTemplateStatus(0);
|
||||
this.updateById(smsTemplate);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("重新提交短信模板错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class WechatMessageUtil {
|
||||
try {
|
||||
content = HttpUtil.post(url, JSONUtil.toJsonStr(map));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("微信消息发送错误",e);
|
||||
}
|
||||
JSONObject json = new JSONObject(content);
|
||||
log.info("微信消息发送结果:" + content);
|
||||
|
@ -5,9 +5,8 @@ import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.utils.SpelUtil;
|
||||
import cn.lili.common.utils.ThreadPoolUtil;
|
||||
import cn.lili.modules.order.trade.entity.dos.AfterSaleLog;
|
||||
import cn.lili.modules.order.order.service.AfterSaleLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import cn.lili.modules.order.trade.entity.dos.AfterSaleLog;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
@ -51,7 +50,7 @@ public class AfterSaleOperationLogAspect {
|
||||
//调用线程保存
|
||||
ThreadPoolUtil.getPool().execute(new SaveAfterSaleLogThread(afterSaleLog, afterSaleLogService));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("售后日志错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import cn.lili.common.utils.SpelUtil;
|
||||
import cn.lili.common.utils.ThreadPoolUtil;
|
||||
import cn.lili.modules.order.trade.entity.dos.OrderLog;
|
||||
import cn.lili.modules.order.trade.service.OrderLogService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
@ -23,6 +23,7 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
* @date: 2020/11/17 7:22 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@Component
|
||||
public class OrderOperationLogAspect {
|
||||
@ -48,7 +49,7 @@ public class OrderOperationLogAspect {
|
||||
//调用线程保存
|
||||
ThreadPoolUtil.getPool().execute(new SaveOrderLogThread(orderLog, orderLogService));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单日志错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
out = response.getOutputStream();
|
||||
writer.flush(out, true);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取待发货订单编号列表错误",e);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.modules.payment.kit.core.kit;
|
||||
|
||||
import cn.lili.modules.payment.kit.core.http.AbstractHttpDelegate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
@ -13,6 +14,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpKit {
|
||||
|
||||
private static AbstractHttpDelegate delegate = new DefaultHttpKit();
|
||||
@ -44,7 +46,7 @@ public class HttpKit {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("readData错误",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.lili.modules.payment.kit.core.XmlHelper;
|
||||
import cn.lili.modules.payment.kit.core.enums.RequestMethodEnums;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
@ -33,6 +34,7 @@ import java.util.*;
|
||||
* @Description:
|
||||
* @since 2020/12/18 15:24
|
||||
*/
|
||||
@Slf4j
|
||||
public class PayKit {
|
||||
|
||||
/**
|
||||
@ -173,7 +175,7 @@ public class PayKit {
|
||||
try {
|
||||
return URLEncoder.encode(src, CharsetUtil.UTF_8).replace("+", "%20");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
log.error("URL 编码错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,11 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
@ -22,6 +21,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
@Slf4j
|
||||
public class QrCodeKit {
|
||||
/**
|
||||
* 图形码生成工具
|
||||
@ -50,40 +50,11 @@ public class QrCodeKit {
|
||||
bufImg = MatrixToImageWriter.toBufferedImage(bitMatrix, config);
|
||||
bool = writeToFile(bufImg, format, saveImgFilePath);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("图形码生成工具生成错误",e);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param outputStream 可以来自response,也可以来自文件
|
||||
* @param contents 内容
|
||||
* @param barcodeFormat BarcodeFormat对象
|
||||
* @param margin 图片格式,可选[png,jpg,bmp]
|
||||
* @param errorLevel 纠错级别 一般为:ErrorCorrectionLevel.H
|
||||
* @param format 图片格式,可选[png,jpg,bmp]
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
*/
|
||||
public static void encodeOutPutSteam(OutputStream outputStream, String contents, BarcodeFormat barcodeFormat, Integer margin, ErrorCorrectionLevel errorLevel, String format, int width, int height) throws IOException {
|
||||
Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>(3);
|
||||
hints.put(EncodeHintType.ERROR_CORRECTION, errorLevel);
|
||||
hints.put(EncodeHintType.MARGIN, margin);
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
|
||||
|
||||
try {
|
||||
BitMatrix bitMatrix = (new MultiFormatWriter()).encode(contents, barcodeFormat, width, height, hints);
|
||||
MatrixToImageWriter.writeToStream(bitMatrix, format, outputStream);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param srcImgFilePath 要解码的图片地址
|
||||
* @return {Result}
|
||||
@ -105,7 +76,7 @@ public class QrCodeKit {
|
||||
throw new IllegalArgumentException("Could not decode image.");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("图片解码错误",e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -123,7 +94,7 @@ public class QrCodeKit {
|
||||
try {
|
||||
bool = ImageIO.write(bufImg, format, new File(saveImgFilePath));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("将BufferedImage对象写入文件错误",e);
|
||||
}
|
||||
return bool;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.modules.payment.kit.core.kit;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -19,6 +20,7 @@ import java.util.Map;
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
@Slf4j
|
||||
public class RsaKit {
|
||||
|
||||
/**
|
||||
@ -77,29 +79,7 @@ public class RsaKit {
|
||||
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
|
||||
return (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用模和指数生成RSA私钥
|
||||
* 注意:【此代码用了默认补位方式,为RSA/None/PKCS1Padding,不同JDK默认的补位方式可能不同,如Android默认是RSA
|
||||
* /None/NoPadding】
|
||||
*
|
||||
* @param modulus 模
|
||||
* @param exponent 指数
|
||||
* @return {@link RSAPrivateKey}
|
||||
*/
|
||||
public static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
|
||||
try {
|
||||
BigInteger b1 = new BigInteger(modulus);
|
||||
BigInteger b2 = new BigInteger(exponent);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
|
||||
RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
|
||||
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("使用模和指数生成RSA公钥错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class BankTransferPlugin implements Payment {
|
||||
refundLog.setIsRefund(true);
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("线下收款错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class WalletPlugin implements Payment {
|
||||
refundLog.setIsRefund(true);
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单取消错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class WalletPlugin implements Payment {
|
||||
refundLog.setIsRefund(true);
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("退款失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class WechatPlugin implements Payment {
|
||||
|
||||
return ResultUtil.data(JSONUtil.toJsonStr(response.getBody()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("微信H5支付错误",e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
@ -558,7 +558,7 @@ public class WechatPlugin implements Payment {
|
||||
refundLogService.save(refundLog);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("微信退款失败",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ public class WechatPlugin implements Payment {
|
||||
WechatPaymentSetting wechatPaymentSetting = JSONUtil.toBean(systemSetting.getSettingValue(), WechatPaymentSetting.class);
|
||||
return wechatPaymentSetting;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("微信支付暂不支持",e);
|
||||
throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
|
||||
}
|
||||
}
|
||||
@ -624,7 +624,7 @@ public class WechatPlugin implements Payment {
|
||||
}
|
||||
return PayKit.getCertificate(publicCert);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("证书获取失败",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -38,6 +39,7 @@ import java.util.stream.Collectors;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:46 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService {
|
||||
@ -114,7 +116,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
|
||||
try {
|
||||
return managerTokenGenerate.createToken(username, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("管理员登录错误",e);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
@ -11,7 +11,7 @@ import cn.lili.modules.permission.service.DepartmentRoleService;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -25,6 +25,7 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:47 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
|
||||
@ -65,7 +66,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
||||
|
||||
return tree;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("部门业务错误",e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import cn.lili.modules.permission.service.MenuService;
|
||||
import cn.lili.modules.permission.service.RoleMenuService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -30,6 +31,7 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 3:49 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {
|
||||
@ -96,7 +98,7 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements Me
|
||||
List<Menu> menus = this.list();
|
||||
return tree(menus);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("菜单树错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -7,10 +7,11 @@ import cn.lili.modules.permission.mapper.RoleMenuMapper;
|
||||
import cn.lili.modules.permission.service.RoleMenuService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import groovy.util.logging.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -19,12 +20,13 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
* @date 2020/11/22 11:43
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
|
||||
|
||||
//菜单
|
||||
@Autowired
|
||||
@Resource
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@Override
|
||||
@ -48,7 +50,7 @@ public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> i
|
||||
//重新保存角色菜单关系
|
||||
this.saveBatch(roleMenus);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("修改用户权限错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CustomWordsServiceImpl extends ServiceImpl<CustomWordsMapper, Custo
|
||||
response.setHeader("Last-Modified", customWords.getCreateTime().toString());
|
||||
response.setHeader("ETag", customWords.getUpdateTime().toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("自定义分词错误",e);
|
||||
}
|
||||
builder.append(customWords.getName());
|
||||
flag = false;
|
||||
|
@ -9,7 +9,6 @@ import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
|
||||
import cn.lili.modules.statistics.aop.PageViewPoint;
|
||||
import cn.lili.modules.statistics.aop.enums.PageViewEnum;
|
||||
import cn.lili.modules.statistics.util.StatisticsSuffix;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
@ -85,7 +84,7 @@ public class PageViewInterceptor {
|
||||
//店铺UV 统计,则需要对id去重复,所以如下处理
|
||||
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("页面出错",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -50,6 +51,12 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
|
||||
//商家流水
|
||||
@Autowired
|
||||
private StoreFlowService storeFlowService;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
//结算单
|
||||
@Resource
|
||||
private BillMapper billMapper;
|
||||
>>>>>>> master
|
||||
|
||||
@Override
|
||||
public void createBill(String storeId, Date startTime, DateTime endTime) {
|
||||
@ -79,7 +86,10 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
|
||||
.eq("store_id",storeId)
|
||||
.eq("flow_type",FlowTypeEnum.PAY.name())
|
||||
.between("create_time",startTime,endTime));
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> master
|
||||
Double orderPrice = 0D;
|
||||
if (orderBill != null) {
|
||||
bill.setOrderPrice(orderBill.getOrderPrice());
|
||||
|
@ -20,8 +20,7 @@ import cn.lili.modules.system.entity.vo.InstantDeliveryResultVO;
|
||||
import cn.lili.modules.system.service.InstantDeliveryLogService;
|
||||
import cn.lili.modules.system.utils.HttpUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -38,11 +37,10 @@ import java.util.Map;
|
||||
* @Description:
|
||||
* @since 2020/12/01 15:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("ddPlugin")
|
||||
public class DadaPlugin implements InstantDeliveryPlugin {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
private StoreDetailService storeDetailService;
|
||||
@Autowired
|
||||
@ -186,7 +184,7 @@ public class DadaPlugin implements InstantDeliveryPlugin {
|
||||
//组织返回参数
|
||||
InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
|
||||
if (instantDeliveryResultVO.getStatus().equals("fail")) {
|
||||
logger.error("达达店铺信息修改失败," + instantDeliveryResultVO.getMsg());
|
||||
log.error("达达店铺信息修改失败",instantDeliveryResultVO.getMsg());
|
||||
}
|
||||
return instantDeliveryResultVO;
|
||||
}
|
||||
@ -273,17 +271,17 @@ public class DadaPlugin implements InstantDeliveryPlugin {
|
||||
}
|
||||
InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
|
||||
if (instantDeliveryResultVO.getStatus().equals("fail")) {
|
||||
logger.error("达达订单发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg());
|
||||
log.error("达达订单发送失败,订单号为",order.getSn() + "," + instantDeliveryResultVO.getMsg());
|
||||
//如果发送失败择等待一秒重新发送,如果失败择记录日志
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("达达订单发布失败",e);
|
||||
}
|
||||
result = HttpUtils.doPostWithJson(url + InstantDeliveryUrl.DD_RE_ADD_ORDER.getUrl(), requstJson);
|
||||
InstantDeliveryResultVO instantDeliveryResResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
|
||||
if (instantDeliveryResResultVO.getStatus().equals("fail")) {
|
||||
logger.error("达达订单重试发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg());
|
||||
log.error("达达订单重试发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg());
|
||||
}
|
||||
}
|
||||
return instantDeliveryResultVO;
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.lili.modules.system.serviceimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.system.entity.dos.Logistics;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.entity.vo.Traces;
|
||||
import cn.lili.modules.system.entity.dto.KuaidiSetting;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.entity.vo.Traces;
|
||||
import cn.lili.modules.system.mapper.LogisticsMapper;
|
||||
import cn.lili.modules.system.service.LogisticsService;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
@ -15,7 +15,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.gson.Gson;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import groovy.util.logging.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -36,6 +36,7 @@ import java.util.Map;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 8:02 下午
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional
|
||||
public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics> implements LogisticsService {
|
||||
@ -47,7 +48,8 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
||||
try {
|
||||
return getOrderTracesByJson(logisticsId, logisticsNo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取物流公司错误",e);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -214,7 +216,7 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
||||
result.append(line);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("向指定 URL 发送POST方法的请求错误",e);
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.modules.system.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -16,6 +17,7 @@ import java.util.Map;
|
||||
* @author pikachu
|
||||
* @date 2018/3/13
|
||||
*/
|
||||
@Slf4j
|
||||
public final class HttpUtils {
|
||||
|
||||
public static final int HTTP_CONN_TIMEOUT = 100000;
|
||||
@ -73,7 +75,7 @@ public final class HttpUtils {
|
||||
|
||||
return res;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("post请求错误",e);
|
||||
}
|
||||
return "error"; // 自定义错误信息
|
||||
|
||||
@ -116,7 +118,7 @@ public final class HttpUtils {
|
||||
|
||||
return res;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("post错误",e);
|
||||
}
|
||||
return "error"; // 自定义错误信息
|
||||
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.modules.system.utils;
|
||||
|
||||
import cn.lili.modules.system.entity.dos.SensitiveWords;
|
||||
import cn.lili.modules.system.service.SensitiveWordsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
@ -20,6 +21,7 @@ import java.util.NavigableSet;
|
||||
* @since v1.0
|
||||
* 2020-02-25 14:10:16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SensitiveWordsFilter implements Serializable, ApplicationRunner {
|
||||
|
||||
@ -240,7 +242,7 @@ public class SensitiveWordsFilter implements Serializable, ApplicationRunner {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("初始化敏感词错误",e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,7 @@ import cn.lili.modules.page.service.ArticleCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -20,6 +21,7 @@ import java.util.List;
|
||||
* @author pikachu
|
||||
* @date 2020-05-5 15:10:16
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,文章分类管理接口")
|
||||
@RequestMapping("/manager/article-category")
|
||||
@ -37,7 +39,7 @@ public class ArticleCategoryManagerController {
|
||||
try {
|
||||
return ResultUtil.data(this.articleCategoryService.allChildren());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("查询分类列表错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.lili.modules.search.service.CustomWordsService;
|
||||
import cn.lili.modules.system.entity.dos.Setting;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -20,6 +21,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* @author paulG
|
||||
* @since 2020/10/16
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,自定义分词接口")
|
||||
@RequestMapping("/manager/custom-words")
|
||||
@ -54,7 +56,7 @@ public class CustomWordsController {
|
||||
try {
|
||||
return new String(res.getBytes(), StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取分词错误",e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class AdminUserManagerController {
|
||||
}
|
||||
adminUserService.saveAdminUser(adminUser, roles);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("添加用户错误",e);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.permission.entity.dos.Menu;
|
||||
@ -10,6 +9,7 @@ import cn.lili.modules.permission.service.MenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
* @date 2020/11/20 12:07
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "管理端,菜单管理接口")
|
||||
@RequestMapping("/manager/menu")
|
||||
@ -41,7 +42,7 @@ public class MenuManagerController {
|
||||
try {
|
||||
menuService.save(menu);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("添加菜单错误",e);
|
||||
}
|
||||
return ResultUtil.data(menu);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -41,7 +40,7 @@ public class LogManagerController {
|
||||
try {
|
||||
return ResultUtil.data(systemLogService.queryLog(null, operatorName, key, searchVo, pageVo));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("日志获取错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -31,12 +31,7 @@ public class GoodsStatisticsManagerController {
|
||||
@ApiOperation(value = "获取统计列表,排行前一百的数据")
|
||||
@GetMapping
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
try {
|
||||
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取行业统计列表")
|
||||
|
@ -12,6 +12,7 @@ import cn.lili.modules.statistics.model.vo.StoreStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.service.IndexStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -25,6 +26,7 @@ import java.util.List;
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/12/15 17:53
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "管理端,首页统计数据接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/index")
|
||||
@ -42,7 +44,7 @@ public class IndexStatisticsManagerController {
|
||||
try {
|
||||
return ResultUtil.data(indexStatisticsService.indexStatistics());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("获取首页查询数据错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import cn.lili.modules.statistics.service.OrderStatisticsDataService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -27,6 +28,7 @@ import java.util.List;
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "管理端,订单统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/manager/statistics/order")
|
||||
@ -44,7 +46,7 @@ public class OrderStatisticsManagerController {
|
||||
try {
|
||||
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单概览统计错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -55,7 +57,7 @@ public class OrderStatisticsManagerController {
|
||||
try {
|
||||
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单图表统计",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -67,7 +69,7 @@ public class OrderStatisticsManagerController {
|
||||
try {
|
||||
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单统计",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.authorizeRequests();
|
||||
// 配置的url 不需要授权
|
||||
for (String url : ignoredUrlsProperties.getUrls()) {
|
||||
log.error(url);
|
||||
registry.antMatchers(url).permitAll();
|
||||
}
|
||||
registry
|
||||
|
@ -15,6 +15,7 @@ import cn.lili.modules.statistics.service.OrderStatisticsDataService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -28,6 +29,7 @@ import java.util.List;
|
||||
* @author Bulbasaur
|
||||
* @date: 2020/12/9 19:04
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "店铺端,订单统计接口")
|
||||
@RestController
|
||||
@RequestMapping("/store/statistics/order")
|
||||
@ -56,7 +58,7 @@ public class OrderStatisticsStoreController {
|
||||
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
|
||||
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单概览统计错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -68,7 +70,7 @@ public class OrderStatisticsStoreController {
|
||||
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
|
||||
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单图表统计错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -82,7 +84,7 @@ public class OrderStatisticsStoreController {
|
||||
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
|
||||
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("订单统计错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -37,6 +38,7 @@ import java.util.List;
|
||||
* @author Chopper
|
||||
* @date 2020/11/17 4:35 下午
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/store/orders")
|
||||
@Api(tags = "店铺端,订单接口")
|
||||
@ -177,7 +179,7 @@ public class OrderStoreController {
|
||||
}
|
||||
orderService.batchDeliver(orderBatchDeliverDTOList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("上传文件进行订单批量发货错误",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user