去除e.printStackTrace();使用slf4j实现

This commit is contained in:
lifenlong 2021-06-07 16:49:59 +08:00
commit a51e86fd98
57 changed files with 193 additions and 653 deletions

View File

@ -17,6 +17,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -29,6 +30,7 @@ import java.io.IOException;
* @author Chopper * @author Chopper
* @date 2020-11-25 19:29 * @date 2020-11-25 19:29
*/ */
@Slf4j
@RestController @RestController
@Api(tags = "买家端,web联合登录") @Api(tags = "买家端,web联合登录")
@RequestMapping("/buyer/connect") @RequestMapping("/buyer/connect")
@ -92,7 +94,7 @@ public class ConnectBuyerWebController {
try { try {
return ResultUtil.data(connectService.appLoginCallback(authUser, uuid)); return ResultUtil.data(connectService.appLoginCallback(authUser, uuid));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("unionID登录错误",e);
} }
return null; return null;
} }

View File

@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -26,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
* @author Chopper * @author Chopper
* @date 2020-12-18 16:59 * @date 2020-12-18 16:59
*/ */
@Slf4j
@RestController @RestController
@Api(tags = "买家端,收银台接口") @Api(tags = "买家端,收银台接口")
@RequestMapping("/buyer/cashier") @RequestMapping("/buyer/cashier")
@ -66,7 +68,7 @@ public class CashierController {
try { try {
return cashierSupport.payment(paymentMethodEnum, paymentClientEnum, request, response, payParam); return cashierSupport.payment(paymentMethodEnum, paymentClientEnum, request, response, payParam);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("收银台支付错误",e);
} }
return null; return null;

View File

@ -5,6 +5,7 @@ import cn.lili.modules.file.plugin.FileManagerPlugin;
import cn.lili.modules.goods.entity.dos.Brand; import cn.lili.modules.goods.entity.dos.Brand;
import cn.lili.modules.goods.service.BrandService; import cn.lili.modules.goods.service.BrandService;
import com.xkcoding.http.util.StringUtil; import com.xkcoding.http.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +20,7 @@ import java.util.List;
* @author paulG * @author paulG
* @since 2020/11/14 * @since 2020/11/14
**/ **/
@Slf4j
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
class FileTest { class FileTest {
@ -43,7 +45,7 @@ class FileTest {
// 上传至第三方云服务或服务器 // 上传至第三方云服务或服务器
brand.setLogo(fileManagerPlugin.inputStreamUpload(inputStream, brand.getId() + ".png")); brand.setLogo(fileManagerPlugin.inputStreamUpload(inputStream, brand.getId() + ".png"));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("上传你文件出错",e);
} }
} }
brandService.updateBatchById(categoryList); brandService.updateBatchById(categoryList);

View File

@ -8,6 +8,7 @@ import cn.lili.common.verification.service.VerificationService;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -17,8 +18,9 @@ import org.springframework.web.bind.annotation.*;
* @author Chopper * @author Chopper
* @date 2020/11/26 15:41 * @date 2020/11/26 15:41
*/ */
@RequestMapping("/common/slider") @Slf4j
@RestController @RestController
@RequestMapping("/common/slider")
@Api(tags = "滑块验证码接口") @Api(tags = "滑块验证码接口")
public class SliderImageController { public class SliderImageController {
@ -35,7 +37,7 @@ public class SliderImageController {
} catch (ServiceException e) { } catch (ServiceException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取校验接口错误",e);
return null; return null;
} }
} }

View File

@ -36,7 +36,7 @@ public class BillExecute implements EveryDayExecute {
@Override @Override
public void execute() { public void execute() {
//获取当前时间的前一 //获取当前
int day = DateUtil.date().dayOfMonth(); int day = DateUtil.date().dayOfMonth();
//获取待结算商家列表 //获取待结算商家列表

View File

@ -1,6 +1,7 @@
package cn.lili.common.cache.impl; package cn.lili.common.cache.impl;
import cn.lili.common.cache.Cache; import cn.lili.common.cache.Cache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.*; import org.springframework.data.redis.core.*;
@ -18,6 +19,7 @@ import java.util.function.Consumer;
* *
* @author Chopepr * @author Chopepr
*/ */
@Slf4j
@Component @Component
public class RedisCache implements Cache { public class RedisCache implements Cache {
@ -158,7 +160,7 @@ public class RedisCache implements Cache {
return null; return null;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("scan错误",e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });

View File

@ -74,7 +74,7 @@ public abstract class AbstractDelayQueueMachineFactory {
try { try {
TimeUnit.SECONDS.sleep(5L); TimeUnit.SECONDS.sleep(5L);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); log.error("延时队列机器开始运作错误",e);
} }
} }

View File

@ -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()); log.info(" Indicates whether the requisite number of shard copies were started for each shard in the index before timing out :{}", createIndexResponse.isShardsAcknowledged());
return; return;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("创建索引错误",e);
throw new ElasticsearchException("创建索引 {" + index + "} 失败:" + e.getMessage()); throw new ElasticsearchException("创建索引 {" + index + "} 失败:" + e.getMessage());
} }
} }
@ -420,7 +420,7 @@ public abstract class BaseElasticsearchService {
try { try {
searchResponse = client.search(searchRequest, COMMON_OPTIONS); searchResponse = client.search(searchRequest, COMMON_OPTIONS);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("es 搜索错误",e);
} }
return searchResponse; return searchResponse;
} }

View File

@ -135,7 +135,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
try { try {
SendSmsResponse response = client.sendSms(sendSmsRequest); SendSmsResponse response = client.sendSms(sendSmsRequest);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("发送短信错误",e);
} }
} }
@ -171,7 +171,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
try { try {
client.sendBatchSms(sendBatchSmsRequest); client.sendBatchSms(sendBatchSmsRequest);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("批量发送短信错误",e);
} }
} }
@ -346,7 +346,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
config.endpoint = "dysmsapi.aliyuncs.com"; config.endpoint = "dysmsapi.aliyuncs.com";
return new com.aliyun.dysmsapi20170525.Client(config); return new com.aliyun.dysmsapi20170525.Client(config);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("短信初始化错误",e);
} }
return null; return null;
} }

View File

@ -1,5 +1,6 @@
package cn.lili.common.utils; package cn.lili.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Base64; import java.util.Base64;
@ -12,6 +13,7 @@ import java.io.*;
* *
* @author Chopper * @author Chopper
*/ */
@Slf4j
public class Base64DecodeMultipartFile implements MultipartFile { public class Base64DecodeMultipartFile implements MultipartFile {
private final byte[] imgContent; private final byte[] imgContent;
@ -64,7 +66,7 @@ public class Base64DecodeMultipartFile implements MultipartFile {
stream = new FileOutputStream(dest); stream = new FileOutputStream(dest);
stream.write(imgContent); stream.write(imgContent);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("transferTo错误",e);
}finally { }finally {
stream.close(); stream.close();
} }
@ -92,7 +94,7 @@ public class Base64DecodeMultipartFile implements MultipartFile {
byte[] bytes = Base64.getDecoder().decode(base64); byte[] bytes = Base64.getDecoder().decode(base64);
stream = new ByteArrayInputStream(bytes); stream = new ByteArrayInputStream(bytes);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("base64ToInputStream错误",e);
} }
return stream; return stream;
} }
@ -109,13 +111,13 @@ public class Base64DecodeMultipartFile implements MultipartFile {
} }
data = swapStream.toByteArray(); data = swapStream.toByteArray();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("转码错误",e);
} finally { } finally {
if (in != null) { if (in != null) {
try { try {
in.close(); in.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("inputStreamToStream错误",e);
} }
} }
} }

View File

@ -1,5 +1,7 @@
package cn.lili.common.utils; package cn.lili.common.utils;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -11,24 +13,9 @@ import javax.servlet.http.HttpServletResponse;
* @version v1.0 * @version v1.0
* 2020-12-14 09:32 * 2020-12-14 09:32
*/ */
@Slf4j
public class CookieUtil { 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 * 新增cookie
@ -45,7 +32,7 @@ public class CookieUtil {
c.setPath("/"); c.setPath("/");
response.addCookie(c); response.addCookie(c);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("新增cookie错误",e);
} }
} }
@ -61,7 +48,7 @@ public class CookieUtil {
c.setMaxAge(0); c.setMaxAge(0);
response.addCookie(c); response.addCookie(c);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("删除cookie错误",e);
} }
} }
@ -83,7 +70,7 @@ public class CookieUtil {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取cookie错误",e);
} }
return null; return null;
} }

View File

@ -1,9 +1,12 @@
package cn.lili.common.utils; 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.HttpRequestRetryHandler;
import org.apache.http.client.config.RequestConfig; 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.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost; 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.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import javax.net.ssl.SSLException; import javax.net.ssl.SSLException;
@ -30,10 +32,9 @@ import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.net.URI; import java.net.URI;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j
public class HttpClientUtils { public class HttpClientUtils {
// org.apache.http.impl.client.CloseableHttpClient // org.apache.http.impl.client.CloseableHttpClient
@ -146,11 +147,9 @@ public class HttpClientUtils {
// 判断返回状态是否为200 // 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) { if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8"); resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
} else {
System.out.println(response.getStatusLine().getStatusCode());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("get请求错误",e);
} finally { } finally {
try { try {
if (response != null) { if (response != null) {
@ -158,71 +157,9 @@ public class HttpClientUtils {
} }
httpClient.close(); httpClient.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("Get错误",e);
} }
} }
return resultString; 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;
}
} }

View File

@ -1,13 +1,12 @@
package cn.lili.common.utils; package cn.lili.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.DefaultTypedTuple; import org.springframework.data.redis.core.DefaultTypedTuple;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -17,6 +16,7 @@ import java.util.concurrent.TimeUnit;
* @author paulG * @author paulG
* @since 2020/11/7 * @since 2020/11/7
**/ **/
@Slf4j
@Component @Component
public class RedisUtil { public class RedisUtil {
@Autowired @Autowired
@ -38,51 +38,11 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("指定缓存失效时间错误",e);
return false; 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============================= //============================String=============================
@ -120,7 +80,7 @@ public class RedisUtil {
redisTemplate.opsForValue().set(key, value); redisTemplate.opsForValue().set(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("缓存放入错误",e);
return false; return false;
} }
@ -143,215 +103,13 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("普通缓存放入并设置时间错误",e);
return false; 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================================= //================================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缓存 * 将数据放入set缓存
@ -364,112 +122,11 @@ public class RedisUtil {
try { try {
return redisTemplate.opsForSet().add(key, values); return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将数据放入set缓存错误",e);
return 0; 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放入缓存 * 将list放入缓存
@ -483,7 +140,7 @@ public class RedisUtil {
redisTemplate.opsForList().rightPush(key, value); redisTemplate.opsForList().rightPush(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将list放入缓存错误",e);
return false; return false;
} }
} }
@ -504,7 +161,7 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将list放入缓存错误",e);
return false; return false;
} }
} }
@ -521,27 +178,11 @@ public class RedisUtil {
redisTemplate.opsForList().rightPushAll(key, value); redisTemplate.opsForList().rightPushAll(key, value);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将list放入缓存错误",e);
return false; 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放入缓存 * 将list放入缓存
@ -559,46 +200,12 @@ public class RedisUtil {
} }
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将list放入缓存错误",e);
return false; 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================================= //===============================ZSet=================================
/** /**

View File

@ -82,7 +82,7 @@ public class VerificationServiceImpl implements VerificationService {
} catch (ServiceException e) { } catch (ServiceException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("创建校验错误",e);
return null; return null;
} }
} }

View File

@ -1,6 +1,7 @@
package cn.lili.config.elasticsearch; package cn.lili.config.elasticsearch;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
@ -27,6 +28,7 @@ import java.util.List;
* @author paulG * @author paulG
* @since 2020/10/13 * @since 2020/10/13
**/ **/
@Slf4j
@Configuration @Configuration
@RequiredArgsConstructor(onConstructor_ = @Autowired) @RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ElasticsearchConfig extends AbstractElasticsearchConfiguration { public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
@ -96,7 +98,7 @@ public class ElasticsearchConfig extends AbstractElasticsearchConfiguration {
try { try {
this.client.close(); this.client.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("es clientClose错误",e);
} }
} }

View File

@ -1,8 +1,9 @@
package cn.lili.modules.base.serviceimpl; 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.HttpClientUtils;
import cn.lili.common.utils.SnowFlake; import cn.lili.common.utils.SnowFlake;
import cn.lili.common.utils.StringUtils;
import cn.lili.modules.base.mapper.RegionMapper; import cn.lili.modules.base.mapper.RegionMapper;
import cn.lili.modules.base.service.RegionService; import cn.lili.modules.base.service.RegionService;
import cn.lili.modules.system.entity.dos.Region; 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.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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"; private String syncUrl = "https://restapi.amap.com/v3/config/district?subdistrict=4&key=e456d77800e2084a326f7b777278f89d";
@Autowired
private Cache cache;
@Override @Override
public void synchronizationData(String url) { public void synchronizationData(String url) {
try { try {
@ -51,8 +55,10 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
int endPoint = Math.min((100 + (i * 100)), regions.size()); int endPoint = Math.min((100 + (i * 100)), regions.size());
this.saveBatch(regions.subList(i * 100, endPoint)); this.saveBatch(regions.subList(i * 100, endPoint));
} }
//删除缓存
cache.vagueDel("{regions}");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("同步行政数据错误",e);
} }
} }

View File

@ -6,7 +6,6 @@ import org.springframework.stereotype.Component;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Date; import java.util.Date;
@ -95,10 +94,8 @@ public class WechatMediaUtil {
reader.close(); reader.close();
resultIn.close(); resultIn.close();
urlConn.disconnect(); urlConn.disconnect();
} catch (MalformedURLException e) { } catch (Exception e) {
e.printStackTrace(); log.error("微信媒体上传失败",e);
} catch (IOException e) {
e.printStackTrace();
} }
JSONObject jsonObject=new JSONObject(resultStr.toString()); JSONObject jsonObject=new JSONObject(resultStr.toString());
return jsonObject.get("media_id").toString(); return jsonObject.get("media_id").toString();

View File

@ -339,7 +339,7 @@ public class ConnectServiceImpl extends ServiceImpl<ConnectMapper, Connect> impl
return JSONUtil.parseObj(result); return JSONUtil.parseObj(result);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("解密,获取微信信息错误",e);
} }
throw new ServiceException(ResultCode.USER_CONNECT_ERROR); throw new ServiceException(ResultCode.USER_CONNECT_ERROR);
} }

View File

@ -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.dto.connect.dto.WechatConnectSettingItem;
import cn.lili.modules.system.entity.enums.SettingEnum; import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService; import cn.lili.modules.system.service.SettingService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -41,6 +42,7 @@ import java.io.IOException;
* @version v1.0 * @version v1.0
* 2020-11-25 21:16 * 2020-11-25 21:16
*/ */
@Slf4j
@Component @Component
public class ConnectUtil { public class ConnectUtil {
@ -98,7 +100,7 @@ public class ConnectUtil {
try { try {
httpServletResponse.sendRedirect(url); httpServletResponse.sendRedirect(url);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("登录回调错误",e);
} }
} }

View File

@ -1,5 +1,7 @@
package cn.lili.modules.connect.util; package cn.lili.modules.connect.util;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -11,6 +13,7 @@ import java.net.UnknownHostException;
* @version v1.0 * @version v1.0
* 2020-12-08 15:32 * 2020-12-08 15:32
*/ */
@Slf4j
public class IpUtils { public class IpUtils {
/** /**
@ -22,7 +25,7 @@ public class IpUtils {
try { try {
return InetAddress.getLocalHost().getHostAddress(); return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
e.printStackTrace(); log.error("获取本机IP错误",e);
return null; return null;
} }
} }

View File

@ -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.entity.dos.MemberPointsHistory;
import cn.lili.modules.member.service.MemberPointsHistoryService; import cn.lili.modules.member.service.MemberPointsHistoryService;
import cn.lili.modules.member.service.MemberService; import cn.lili.modules.member.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
* @author Chopper * @author Chopper
* @date 2020/11/17 7:22 下午 * @date 2020/11/17 7:22 下午
*/ */
@Slf4j
@Aspect @Aspect
@Component @Component
public class PointLogInterceptor { public class PointLogInterceptor {
@ -62,7 +64,7 @@ public class PointLogInterceptor {
memberPointsHistoryService.save(memberPointsHistory); memberPointsHistoryService.save(memberPointsHistory);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("积分操作错误",e);
} }

View File

@ -136,7 +136,7 @@ public class MemberSignServiceImpl extends ServiceImpl<MemberSignMapper, MemberS
memberService.updateMemberPoint(point, true, memberId, content); memberService.updateMemberPoint(point, true, memberId, content);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("会员签到错误",e);
} }
} }

View File

@ -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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -25,6 +26,7 @@ import java.util.Map;
* @author Chopper * @author Chopper
* @date 2021/1/30 4:27 下午 * @date 2021/1/30 4:27 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> implements SmsSignService { public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> implements SmsSignService {
@ -42,7 +44,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
smsSign.setSignStatus(0); smsSign.setSignStatus(0);
this.save(smsSign); this.save(smsSign);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("添加短信签名错误",e);
} }
} }
@ -55,7 +57,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
this.removeById(id); this.removeById(id);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("删除短信签名错误",e);
} }
} }
@ -74,7 +76,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
this.updateById(smsSign); this.updateById(smsSign);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("查询短信签名错误",e);
} }
} }
@ -84,7 +86,7 @@ public class SmsSignServiceImpl extends ServiceImpl<SmsSignMapper, SmsSign> impl
aliSmsUtil.modifySmsSign(smsSign); aliSmsUtil.modifySmsSign(smsSign);
this.updateById(smsSign); this.updateById(smsSign);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("更新短信签名错误",e);
} }
} }

View File

@ -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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -23,6 +24,7 @@ import java.util.Map;
* @author Chopper * @author Chopper
* @date 2021/1/30 4:27 下午 * @date 2021/1/30 4:27 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTemplate> implements SmsTemplateService { public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTemplate> implements SmsTemplateService {
@ -38,7 +40,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
smsTemplate.setTemplateType(1); smsTemplate.setTemplateType(1);
this.save(smsTemplate); this.save(smsTemplate);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("添加短信模板错误",e);
} }
} }
@ -51,7 +53,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
} }
this.removeById(id); this.removeById(id);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("删除短信模板错误",e);
} }
} }
@ -71,7 +73,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
this.updateById(smsTemplate); this.updateById(smsTemplate);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("查询短信模板错误",e);
} }
} }
@ -82,7 +84,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl<SmsTemplateMapper, SmsTe
smsTemplate.setTemplateStatus(0); smsTemplate.setTemplateStatus(0);
this.updateById(smsTemplate); this.updateById(smsTemplate);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("重新提交短信模板错误",e);
} }
} }

View File

@ -170,7 +170,7 @@ public class WechatMessageUtil {
try { try {
content = HttpUtil.post(url, JSONUtil.toJsonStr(map)); content = HttpUtil.post(url, JSONUtil.toJsonStr(map));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("微信消息发送错误",e);
} }
JSONObject json = new JSONObject(content); JSONObject json = new JSONObject(content);
log.info("微信消息发送结果:" + content); log.info("微信消息发送结果:" + content);

View File

@ -5,9 +5,8 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.security.enums.UserEnums; import cn.lili.common.security.enums.UserEnums;
import cn.lili.common.utils.SpelUtil; import cn.lili.common.utils.SpelUtil;
import cn.lili.common.utils.ThreadPoolUtil; import cn.lili.common.utils.ThreadPoolUtil;
import cn.lili.modules.order.trade.entity.dos.AfterSaleLog;
import cn.lili.modules.order.order.service.AfterSaleLogService; 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 lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
@ -51,7 +50,7 @@ public class AfterSaleOperationLogAspect {
//调用线程保存 //调用线程保存
ThreadPoolUtil.getPool().execute(new SaveAfterSaleLogThread(afterSaleLog, afterSaleLogService)); ThreadPoolUtil.getPool().execute(new SaveAfterSaleLogThread(afterSaleLog, afterSaleLogService));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("售后日志错误",e);
} }
} }

View File

@ -6,7 +6,7 @@ import cn.lili.common.utils.SpelUtil;
import cn.lili.common.utils.ThreadPoolUtil; import cn.lili.common.utils.ThreadPoolUtil;
import cn.lili.modules.order.trade.entity.dos.OrderLog; import cn.lili.modules.order.trade.entity.dos.OrderLog;
import cn.lili.modules.order.trade.service.OrderLogService; 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.JoinPoint;
import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
@ -23,6 +23,7 @@ import java.util.Map;
* @author Chopper * @author Chopper
* @date: 2020/11/17 7:22 下午 * @date: 2020/11/17 7:22 下午
*/ */
@Slf4j
@Aspect @Aspect
@Component @Component
public class OrderOperationLogAspect { public class OrderOperationLogAspect {
@ -48,7 +49,7 @@ public class OrderOperationLogAspect {
//调用线程保存 //调用线程保存
ThreadPoolUtil.getPool().execute(new SaveOrderLogThread(orderLog, orderLogService)); ThreadPoolUtil.getPool().execute(new SaveOrderLogThread(orderLog, orderLogService));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单日志错误",e);
} }
} }

View File

@ -528,7 +528,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
out = response.getOutputStream(); out = response.getOutputStream();
writer.flush(out, true); writer.flush(out, true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("获取待发货订单编号列表错误",e);
} finally { } finally {
writer.close(); writer.close();
} }

View File

@ -1,6 +1,7 @@
package cn.lili.modules.payment.kit.core.kit; package cn.lili.modules.payment.kit.core.kit;
import cn.lili.modules.payment.kit.core.http.AbstractHttpDelegate; import cn.lili.modules.payment.kit.core.http.AbstractHttpDelegate;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -13,6 +14,7 @@ import java.util.Map;
* *
* @author * @author
*/ */
@Slf4j
public class HttpKit { public class HttpKit {
private static AbstractHttpDelegate delegate = new DefaultHttpKit(); private static AbstractHttpDelegate delegate = new DefaultHttpKit();
@ -44,7 +46,7 @@ public class HttpKit {
try { try {
br.close(); br.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("readData错误",e);
} }
} }
} }

View File

@ -8,6 +8,7 @@ import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.digest.HmacAlgorithm; import cn.hutool.crypto.digest.HmacAlgorithm;
import cn.lili.modules.payment.kit.core.XmlHelper; import cn.lili.modules.payment.kit.core.XmlHelper;
import cn.lili.modules.payment.kit.core.enums.RequestMethodEnums; import cn.lili.modules.payment.kit.core.enums.RequestMethodEnums;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
@ -33,6 +34,7 @@ import java.util.*;
* @Description: * @Description:
* @since 2020/12/18 15:24 * @since 2020/12/18 15:24
*/ */
@Slf4j
public class PayKit { public class PayKit {
/** /**
@ -173,7 +175,7 @@ public class PayKit {
try { try {
return URLEncoder.encode(src, CharsetUtil.UTF_8).replace("+", "%20"); return URLEncoder.encode(src, CharsetUtil.UTF_8).replace("+", "%20");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); log.error("URL 编码错误",e);
return null; return null;
} }
} }

View File

@ -7,12 +7,11 @@ import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer; import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import lombok.extern.slf4j.Slf4j;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map; import java.util.Map;
@ -22,6 +21,7 @@ import java.util.Map;
* *
* @author * @author
*/ */
@Slf4j
public class QrCodeKit { public class QrCodeKit {
/** /**
* 图形码生成工具 * 图形码生成工具
@ -50,40 +50,11 @@ public class QrCodeKit {
bufImg = MatrixToImageWriter.toBufferedImage(bitMatrix, config); bufImg = MatrixToImageWriter.toBufferedImage(bitMatrix, config);
bool = writeToFile(bufImg, format, saveImgFilePath); bool = writeToFile(bufImg, format, saveImgFilePath);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("图形码生成工具生成错误",e);
} }
return bool; 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 要解码的图片地址 * @param srcImgFilePath 要解码的图片地址
* @return {Result} * @return {Result}
@ -105,7 +76,7 @@ public class QrCodeKit {
throw new IllegalArgumentException("Could not decode image."); throw new IllegalArgumentException("Could not decode image.");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("图片解码错误",e);
} }
return result; return result;
} }
@ -123,7 +94,7 @@ public class QrCodeKit {
try { try {
bool = ImageIO.write(bufImg, format, new File(saveImgFilePath)); bool = ImageIO.write(bufImg, format, new File(saveImgFilePath));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("将BufferedImage对象写入文件错误",e);
} }
return bool; return bool;
} }

View File

@ -2,6 +2,7 @@ package cn.lili.modules.payment.kit.core.kit;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -19,6 +20,7 @@ import java.util.Map;
* *
* @author * @author
*/ */
@Slf4j
public class RsaKit { public class RsaKit {
/** /**
@ -77,29 +79,7 @@ public class RsaKit {
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2); RSAPublicKeySpec keySpec = new RSAPublicKeySpec(b1, b2);
return (RSAPublicKey) keyFactory.generatePublic(keySpec); return (RSAPublicKey) keyFactory.generatePublic(keySpec);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("使用模和指数生成RSA公钥错误",e);
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();
return null; return null;
} }
} }

View File

@ -37,7 +37,7 @@ public class BankTransferPlugin implements Payment {
refundLog.setIsRefund(true); refundLog.setIsRefund(true);
refundLogService.save(refundLog); refundLogService.save(refundLog);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("线下收款错误",e);
} }
} }

View File

@ -90,7 +90,7 @@ public class WalletPlugin implements Payment {
refundLog.setIsRefund(true); refundLog.setIsRefund(true);
refundLogService.save(refundLog); refundLogService.save(refundLog);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单取消错误",e);
} }
} }
@ -114,7 +114,7 @@ public class WalletPlugin implements Payment {
refundLog.setIsRefund(true); refundLog.setIsRefund(true);
refundLogService.save(refundLog); refundLogService.save(refundLog);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("退款失败",e);
} }
} }

View File

@ -137,7 +137,7 @@ public class WechatPlugin implements Payment {
return ResultUtil.data(JSONUtil.toJsonStr(response.getBody())); return ResultUtil.data(JSONUtil.toJsonStr(response.getBody()));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("微信H5支付错误",e);
throw new ServiceException(ResultCode.PAY_ERROR); throw new ServiceException(ResultCode.PAY_ERROR);
} }
} }
@ -558,7 +558,7 @@ public class WechatPlugin implements Payment {
refundLogService.save(refundLog); refundLogService.save(refundLog);
} }
} catch (Exception e) { } 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); WechatPaymentSetting wechatPaymentSetting = JSONUtil.toBean(systemSetting.getSettingValue(), WechatPaymentSetting.class);
return wechatPaymentSetting; return wechatPaymentSetting;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("微信支付暂不支持",e);
throw new ServiceException(ResultCode.PAY_NOT_SUPPORT); throw new ServiceException(ResultCode.PAY_NOT_SUPPORT);
} }
} }
@ -624,7 +624,7 @@ public class WechatPlugin implements Payment {
} }
return PayKit.getCertificate(publicCert); return PayKit.getCertificate(publicCert);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("证书获取失败",e);
} }
return null; return null;
} }

View File

@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -38,6 +39,7 @@ import java.util.stream.Collectors;
* @author Chopper * @author Chopper
* @date 2020/11/17 3:46 下午 * @date 2020/11/17 3:46 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService { public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService {
@ -114,7 +116,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
try { try {
return managerTokenGenerate.createToken(username, false); return managerTokenGenerate.createToken(username, false);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("管理员登录错误",e);
} }
return null; return null;

View File

@ -11,7 +11,7 @@ import cn.lili.modules.permission.service.DepartmentRoleService;
import cn.lili.modules.permission.service.DepartmentService; import cn.lili.modules.permission.service.DepartmentService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -25,6 +25,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @date 2020/11/17 3:47 下午 * @date 2020/11/17 3:47 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService { public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {
@ -65,7 +66,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
return tree; return tree;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("部门业务错误",e);
return null; return null;
} }
} }

View File

@ -16,6 +16,7 @@ import cn.lili.modules.permission.service.MenuService;
import cn.lili.modules.permission.service.RoleMenuService; import cn.lili.modules.permission.service.RoleMenuService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -30,6 +31,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @date 2020/11/17 3:49 下午 * @date 2020/11/17 3:49 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService { 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(); List<Menu> menus = this.list();
return tree(menus); return tree(menus);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("菜单树错误",e);
} }
return null; return null;
} }

View File

@ -7,10 +7,11 @@ import cn.lili.modules.permission.mapper.RoleMenuMapper;
import cn.lili.modules.permission.service.RoleMenuService; import cn.lili.modules.permission.service.RoleMenuService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -19,12 +20,13 @@ import java.util.List;
* @author Chopper * @author Chopper
* @date 2020/11/22 11:43 * @date 2020/11/22 11:43
*/ */
@Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService { public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements RoleMenuService {
//菜单 //菜单
@Autowired @Resource
private MenuMapper menuMapper; private MenuMapper menuMapper;
@Override @Override
@ -48,7 +50,7 @@ public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> i
//重新保存角色菜单关系 //重新保存角色菜单关系
this.saveBatch(roleMenus); this.saveBatch(roleMenus);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("修改用户权限错误",e);
} }
} }

View File

@ -40,7 +40,7 @@ public class CustomWordsServiceImpl extends ServiceImpl<CustomWordsMapper, Custo
response.setHeader("Last-Modified", customWords.getCreateTime().toString()); response.setHeader("Last-Modified", customWords.getCreateTime().toString());
response.setHeader("ETag", customWords.getUpdateTime().toString()); response.setHeader("ETag", customWords.getUpdateTime().toString());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("自定义分词错误",e);
} }
builder.append(customWords.getName()); builder.append(customWords.getName());
flag = false; flag = false;

View File

@ -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.PageViewPoint;
import cn.lili.modules.statistics.aop.enums.PageViewEnum; import cn.lili.modules.statistics.aop.enums.PageViewEnum;
import cn.lili.modules.statistics.util.StatisticsSuffix; import cn.lili.modules.statistics.util.StatisticsSuffix;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
@ -85,7 +84,7 @@ public class PageViewInterceptor {
//店铺UV 统计则需要对id去重复所以如下处理 //店铺UV 统计则需要对id去重复所以如下处理
cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip); cache.cumulative(CachePrefix.STORE_UV.getPrefix() + StatisticsSuffix.suffix(storeId), ip);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("页面出错",e);
} }
} }

View File

@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
/** /**
@ -50,6 +51,12 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements Bi
//商家流水 //商家流水
@Autowired @Autowired
private StoreFlowService storeFlowService; private StoreFlowService storeFlowService;
<<<<<<< HEAD
=======
//结算单
@Resource
private BillMapper billMapper;
>>>>>>> master
@Override @Override
public void createBill(String storeId, Date startTime, DateTime endTime) { 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("store_id",storeId)
.eq("flow_type",FlowTypeEnum.PAY.name()) .eq("flow_type",FlowTypeEnum.PAY.name())
.between("create_time",startTime,endTime)); .between("create_time",startTime,endTime));
<<<<<<< HEAD
=======
>>>>>>> master
Double orderPrice = 0D; Double orderPrice = 0D;
if (orderBill != null) { if (orderBill != null) {
bill.setOrderPrice(orderBill.getOrderPrice()); bill.setOrderPrice(orderBill.getOrderPrice());

View File

@ -20,8 +20,7 @@ import cn.lili.modules.system.entity.vo.InstantDeliveryResultVO;
import cn.lili.modules.system.service.InstantDeliveryLogService; import cn.lili.modules.system.service.InstantDeliveryLogService;
import cn.lili.modules.system.utils.HttpUtils; import cn.lili.modules.system.utils.HttpUtils;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -38,11 +37,10 @@ import java.util.Map;
* @Description: * @Description:
* @since 2020/12/01 15:58 * @since 2020/12/01 15:58
*/ */
@Slf4j
@Component("ddPlugin") @Component("ddPlugin")
public class DadaPlugin implements InstantDeliveryPlugin { public class DadaPlugin implements InstantDeliveryPlugin {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired @Autowired
private StoreDetailService storeDetailService; private StoreDetailService storeDetailService;
@Autowired @Autowired
@ -186,7 +184,7 @@ public class DadaPlugin implements InstantDeliveryPlugin {
//组织返回参数 //组织返回参数
InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class); InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
if (instantDeliveryResultVO.getStatus().equals("fail")) { if (instantDeliveryResultVO.getStatus().equals("fail")) {
logger.error("达达店铺信息修改失败" + instantDeliveryResultVO.getMsg()); log.error("达达店铺信息修改失败",instantDeliveryResultVO.getMsg());
} }
return instantDeliveryResultVO; return instantDeliveryResultVO;
} }
@ -273,17 +271,17 @@ public class DadaPlugin implements InstantDeliveryPlugin {
} }
InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class); InstantDeliveryResultVO instantDeliveryResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
if (instantDeliveryResultVO.getStatus().equals("fail")) { if (instantDeliveryResultVO.getStatus().equals("fail")) {
logger.error("达达订单发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg()); log.error("达达订单发送失败,订单号为",order.getSn() + "," + instantDeliveryResultVO.getMsg());
//如果发送失败择等待一秒重新发送如果失败择记录日志 //如果发送失败择等待一秒重新发送如果失败择记录日志
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("达达订单发布失败",e);
} }
result = HttpUtils.doPostWithJson(url + InstantDeliveryUrl.DD_RE_ADD_ORDER.getUrl(), requstJson); result = HttpUtils.doPostWithJson(url + InstantDeliveryUrl.DD_RE_ADD_ORDER.getUrl(), requstJson);
InstantDeliveryResultVO instantDeliveryResResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class); InstantDeliveryResultVO instantDeliveryResResultVO = JSONUtil.toBean(result, InstantDeliveryResultVO.class);
if (instantDeliveryResResultVO.getStatus().equals("fail")) { if (instantDeliveryResResultVO.getStatus().equals("fail")) {
logger.error("达达订单重试发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg()); log.error("达达订单重试发送失败,订单号为" + order.getSn() + "," + instantDeliveryResultVO.getMsg());
} }
} }
return instantDeliveryResultVO; return instantDeliveryResultVO;

View File

@ -1,13 +1,13 @@
package cn.lili.modules.system.serviceimpl; package cn.lili.modules.system.serviceimpl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.enums.SwitchEnum; 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.Logistics;
import cn.lili.modules.system.entity.dos.Setting; 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.dto.KuaidiSetting;
import cn.lili.modules.system.entity.enums.SettingEnum; 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.mapper.LogisticsMapper;
import cn.lili.modules.system.service.LogisticsService; import cn.lili.modules.system.service.LogisticsService;
import cn.lili.modules.system.service.SettingService; 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.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson; import com.google.gson.Gson;
import lombok.RequiredArgsConstructor; import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -36,6 +36,7 @@ import java.util.Map;
* @author Chopper * @author Chopper
* @date 2020/11/17 8:02 下午 * @date 2020/11/17 8:02 下午
*/ */
@Slf4j
@Service @Service
@Transactional @Transactional
public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics> implements LogisticsService { public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics> implements LogisticsService {
@ -47,7 +48,8 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
try { try {
return getOrderTracesByJson(logisticsId, logisticsNo); return getOrderTracesByJson(logisticsId, logisticsNo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取物流公司错误",e);
} }
return null; return null;
} }
@ -214,7 +216,7 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
result.append(line); result.append(line);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("向指定 URL 发送POST方法的请求错误",e);
} }
//使用finally块来关闭输出流输入流 //使用finally块来关闭输出流输入流
finally { finally {

View File

@ -1,6 +1,7 @@
package cn.lili.modules.system.utils; package cn.lili.modules.system.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@ -16,6 +17,7 @@ import java.util.Map;
* @author pikachu * @author pikachu
* @date 2018/3/13 * @date 2018/3/13
*/ */
@Slf4j
public final class HttpUtils { public final class HttpUtils {
public static final int HTTP_CONN_TIMEOUT = 100000; public static final int HTTP_CONN_TIMEOUT = 100000;
@ -73,7 +75,7 @@ public final class HttpUtils {
return res; return res;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("post请求错误",e);
} }
return "error"; // 自定义错误信息 return "error"; // 自定义错误信息
@ -116,7 +118,7 @@ public final class HttpUtils {
return res; return res;
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("post错误",e);
} }
return "error"; // 自定义错误信息 return "error"; // 自定义错误信息

View File

@ -2,6 +2,7 @@ package cn.lili.modules.system.utils;
import cn.lili.modules.system.entity.dos.SensitiveWords; import cn.lili.modules.system.entity.dos.SensitiveWords;
import cn.lili.modules.system.service.SensitiveWordsService; import cn.lili.modules.system.service.SensitiveWordsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
@ -20,6 +21,7 @@ import java.util.NavigableSet;
* @since v1.0 * @since v1.0
* 2020-02-25 14:10:16 * 2020-02-25 14:10:16
*/ */
@Slf4j
@Component @Component
public class SensitiveWordsFilter implements Serializable, ApplicationRunner { public class SensitiveWordsFilter implements Serializable, ApplicationRunner {
@ -240,7 +242,7 @@ public class SensitiveWordsFilter implements Serializable, ApplicationRunner {
} }
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("初始化敏感词错误",e);
} }

View File

@ -8,6 +8,7 @@ import cn.lili.modules.page.service.ArticleCategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -20,6 +21,7 @@ import java.util.List;
* @author pikachu * @author pikachu
* @date 2020-05-5 15:10:16 * @date 2020-05-5 15:10:16
*/ */
@Slf4j
@RestController @RestController
@Api(tags = "管理端,文章分类管理接口") @Api(tags = "管理端,文章分类管理接口")
@RequestMapping("/manager/article-category") @RequestMapping("/manager/article-category")
@ -37,7 +39,7 @@ public class ArticleCategoryManagerController {
try { try {
return ResultUtil.data(this.articleCategoryService.allChildren()); return ResultUtil.data(this.articleCategoryService.allChildren());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("查询分类列表错误",e);
} }
return null; return null;
} }

View File

@ -7,6 +7,7 @@ import cn.lili.modules.search.service.CustomWordsService;
import cn.lili.modules.system.entity.dos.Setting; import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.service.SettingService; import cn.lili.modules.system.service.SettingService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -20,6 +21,7 @@ import java.nio.charset.StandardCharsets;
* @author paulG * @author paulG
* @since 2020/10/16 * @since 2020/10/16
**/ **/
@Slf4j
@RestController @RestController
@Api(tags = "管理端,自定义分词接口") @Api(tags = "管理端,自定义分词接口")
@RequestMapping("/manager/custom-words") @RequestMapping("/manager/custom-words")
@ -54,7 +56,7 @@ public class CustomWordsController {
try { try {
return new String(res.getBytes(), StandardCharsets.UTF_8); return new String(res.getBytes(), StandardCharsets.UTF_8);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取分词错误",e);
} }
return ""; return "";
} }

View File

@ -148,7 +148,7 @@ public class AdminUserManagerController {
} }
adminUserService.saveAdminUser(adminUser, roles); adminUserService.saveAdminUser(adminUser, roles);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("添加用户错误",e);
} }
return ResultUtil.success(); return ResultUtil.success();
} }

View File

@ -1,6 +1,5 @@
package cn.lili.controller.permission; package cn.lili.controller.permission;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.permission.entity.dos.Menu; 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.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -22,6 +22,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @date 2020/11/20 12:07 * @date 2020/11/20 12:07
*/ */
@Slf4j
@RestController @RestController
@Api(tags = "管理端,菜单管理接口") @Api(tags = "管理端,菜单管理接口")
@RequestMapping("/manager/menu") @RequestMapping("/manager/menu")
@ -41,7 +42,7 @@ public class MenuManagerController {
try { try {
menuService.save(menu); menuService.save(menu);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("添加菜单错误",e);
} }
return ResultUtil.data(menu); return ResultUtil.data(menu);
} }

View File

@ -1,6 +1,5 @@
package cn.lili.controller.setting; package cn.lili.controller.setting;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil; import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO; import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage; import cn.lili.common.vo.ResultMessage;
@ -41,7 +40,7 @@ public class LogManagerController {
try { try {
return ResultUtil.data(systemLogService.queryLog(null, operatorName, key, searchVo, pageVo)); return ResultUtil.data(systemLogService.queryLog(null, operatorName, key, searchVo, pageVo));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("日志获取错误",e);
} }
return null; return null;
} }

View File

@ -31,12 +31,7 @@ public class GoodsStatisticsManagerController {
@ApiOperation(value = "获取统计列表,排行前一百的数据") @ApiOperation(value = "获取统计列表,排行前一百的数据")
@GetMapping @GetMapping
public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) { public ResultMessage<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
try { return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
return ResultUtil.data(goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
} catch (Exception e) {
e.printStackTrace();
}
return null;
} }
@ApiOperation(value = "获取行业统计列表") @ApiOperation(value = "获取行业统计列表")

View File

@ -12,6 +12,7 @@ import cn.lili.modules.statistics.model.vo.StoreStatisticsDataVO;
import cn.lili.modules.statistics.service.IndexStatisticsService; import cn.lili.modules.statistics.service.IndexStatisticsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -25,6 +26,7 @@ import java.util.List;
* @author Bulbasaur * @author Bulbasaur
* @date: 2020/12/15 17:53 * @date: 2020/12/15 17:53
*/ */
@Slf4j
@Api(tags = "管理端,首页统计数据接口") @Api(tags = "管理端,首页统计数据接口")
@RestController @RestController
@RequestMapping("/manager/statistics/index") @RequestMapping("/manager/statistics/index")
@ -42,7 +44,7 @@ public class IndexStatisticsManagerController {
try { try {
return ResultUtil.data(indexStatisticsService.indexStatistics()); return ResultUtil.data(indexStatisticsService.indexStatistics());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("获取首页查询数据错误",e);
} }
return null; return null;
} }

View File

@ -14,6 +14,7 @@ import cn.lili.modules.statistics.service.OrderStatisticsDataService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -27,6 +28,7 @@ import java.util.List;
* @author Bulbasaur * @author Bulbasaur
* @date: 2020/12/9 19:04 * @date: 2020/12/9 19:04
*/ */
@Slf4j
@Api(tags = "管理端,订单统计接口") @Api(tags = "管理端,订单统计接口")
@RestController @RestController
@RequestMapping("/manager/statistics/order") @RequestMapping("/manager/statistics/order")
@ -44,7 +46,7 @@ public class OrderStatisticsManagerController {
try { try {
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam)); return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单概览统计错误",e);
} }
return null; return null;
} }
@ -55,7 +57,7 @@ public class OrderStatisticsManagerController {
try { try {
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam)); return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单图表统计",e);
} }
return null; return null;
} }
@ -67,7 +69,7 @@ public class OrderStatisticsManagerController {
try { try {
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO)); return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单统计",e);
} }
return null; return null;
} }

View File

@ -49,7 +49,6 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests(); .authorizeRequests();
// 配置的url 不需要授权 // 配置的url 不需要授权
for (String url : ignoredUrlsProperties.getUrls()) { for (String url : ignoredUrlsProperties.getUrls()) {
log.error(url);
registry.antMatchers(url).permitAll(); registry.antMatchers(url).permitAll();
} }
registry registry

View File

@ -15,6 +15,7 @@ import cn.lili.modules.statistics.service.OrderStatisticsDataService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -28,6 +29,7 @@ import java.util.List;
* @author Bulbasaur * @author Bulbasaur
* @date: 2020/12/9 19:04 * @date: 2020/12/9 19:04
*/ */
@Slf4j
@Api(tags = "店铺端,订单统计接口") @Api(tags = "店铺端,订单统计接口")
@RestController @RestController
@RequestMapping("/store/statistics/order") @RequestMapping("/store/statistics/order")
@ -56,7 +58,7 @@ public class OrderStatisticsStoreController {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId()); statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam)); return ResultUtil.data(orderStatisticsDataService.overview(statisticsQueryParam));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单概览统计错误",e);
} }
return null; return null;
} }
@ -68,7 +70,7 @@ public class OrderStatisticsStoreController {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId()); statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam)); return ResultUtil.data(orderStatisticsDataService.statisticsChart(statisticsQueryParam));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单图表统计错误",e);
} }
return null; return null;
} }
@ -82,7 +84,7 @@ public class OrderStatisticsStoreController {
statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId()); statisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO)); return ResultUtil.data(orderService.getStatistics(statisticsQueryParam, pageVO));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("订单统计错误",e);
} }
return null; return null;
} }

View File

@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -37,6 +38,7 @@ import java.util.List;
* @author Chopper * @author Chopper
* @date 2020/11/17 4:35 下午 * @date 2020/11/17 4:35 下午
**/ **/
@Slf4j
@RestController @RestController
@RequestMapping("/store/orders") @RequestMapping("/store/orders")
@Api(tags = "店铺端,订单接口") @Api(tags = "店铺端,订单接口")
@ -177,7 +179,7 @@ public class OrderStoreController {
} }
orderService.batchDeliver(orderBatchDeliverDTOList); orderService.batchDeliver(orderBatchDeliverDTOList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("上传文件进行订单批量发货错误",e);
} }
} }