diff --git a/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java b/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java index 0f475c12..807d09dd 100644 --- a/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java +++ b/buyer-api/src/main/java/cn/lili/controller/passport/connect/ConnectBuyerWebController.java @@ -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; } diff --git a/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java b/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java index aad6f2d4..17784d5b 100644 --- a/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java +++ b/buyer-api/src/main/java/cn/lili/controller/payment/CashierController.java @@ -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; diff --git a/buyer-api/src/test/java/cn/lili/buyer/test/cart/FileTest.java b/buyer-api/src/test/java/cn/lili/buyer/test/cart/FileTest.java index 9fedbd63..8076a648 100644 --- a/buyer-api/src/test/java/cn/lili/buyer/test/cart/FileTest.java +++ b/buyer-api/src/test/java/cn/lili/buyer/test/cart/FileTest.java @@ -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); diff --git a/common-api/src/main/java/cn/lili/controller/common/SliderImageController.java b/common-api/src/main/java/cn/lili/controller/common/SliderImageController.java index 745ae80d..cae8d3ef 100644 --- a/common-api/src/main/java/cn/lili/controller/common/SliderImageController.java +++ b/common-api/src/main/java/cn/lili/controller/common/SliderImageController.java @@ -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; } } diff --git a/consumer/src/main/java/cn/lili/timetask/handler/impl/bill/BillExecute.java b/consumer/src/main/java/cn/lili/timetask/handler/impl/bill/BillExecute.java index 2c62d650..89b8bf35 100644 --- a/consumer/src/main/java/cn/lili/timetask/handler/impl/bill/BillExecute.java +++ b/consumer/src/main/java/cn/lili/timetask/handler/impl/bill/BillExecute.java @@ -36,7 +36,7 @@ public class BillExecute implements EveryDayExecute { @Override public void execute() { - //获取当前时间的前一天 + //获取当前天数 int day = DateUtil.date().dayOfMonth(); //获取待结算商家列表 diff --git a/framework/src/main/java/cn/lili/common/cache/impl/RedisCache.java b/framework/src/main/java/cn/lili/common/cache/impl/RedisCache.java index 39925133..a22f9b79 100644 --- a/framework/src/main/java/cn/lili/common/cache/impl/RedisCache.java +++ b/framework/src/main/java/cn/lili/common/cache/impl/RedisCache.java @@ -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); } }); diff --git a/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java b/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java index 6f8bfbad..ea9abfc4 100644 --- a/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java +++ b/framework/src/main/java/cn/lili/common/delayqueue/AbstractDelayQueueMachineFactory.java @@ -74,7 +74,7 @@ public abstract class AbstractDelayQueueMachineFactory { try { TimeUnit.SECONDS.sleep(5L); } catch (InterruptedException e) { - e.printStackTrace(); + log.error("延时队列机器开始运作错误",e); } } diff --git a/framework/src/main/java/cn/lili/common/elasticsearch/BaseElasticsearchService.java b/framework/src/main/java/cn/lili/common/elasticsearch/BaseElasticsearchService.java index 1cf15c42..a257a2ba 100644 --- a/framework/src/main/java/cn/lili/common/elasticsearch/BaseElasticsearchService.java +++ b/framework/src/main/java/cn/lili/common/elasticsearch/BaseElasticsearchService.java @@ -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; } diff --git a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java index fead89fb..19fc0fec 100644 --- a/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java +++ b/framework/src/main/java/cn/lili/common/sms/impl/SmsUtilAliImplService.java @@ -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; } diff --git a/framework/src/main/java/cn/lili/common/utils/Base64DecodeMultipartFile.java b/framework/src/main/java/cn/lili/common/utils/Base64DecodeMultipartFile.java index 85a74350..757d4839 100644 --- a/framework/src/main/java/cn/lili/common/utils/Base64DecodeMultipartFile.java +++ b/framework/src/main/java/cn/lili/common/utils/Base64DecodeMultipartFile.java @@ -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); } } } diff --git a/framework/src/main/java/cn/lili/common/utils/CookieUtil.java b/framework/src/main/java/cn/lili/common/utils/CookieUtil.java index a430ebfb..db9d479e 100644 --- a/framework/src/main/java/cn/lili/common/utils/CookieUtil.java +++ b/framework/src/main/java/cn/lili/common/utils/CookieUtil.java @@ -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; } diff --git a/framework/src/main/java/cn/lili/common/utils/HttpClientUtils.java b/framework/src/main/java/cn/lili/common/utils/HttpClientUtils.java index 12b2ccc5..30ffb53c 100644 --- a/framework/src/main/java/cn/lili/common/utils/HttpClientUtils.java +++ b/framework/src/main/java/cn/lili/common/utils/HttpClientUtils.java @@ -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 param) { - // 创建HttpClient对象 - CloseableHttpClient httpClient = getHttpClient(); - CloseableHttpResponse response = null; - String resultString = ""; - try { - // 创建Http Post请求 - HttpPost httpPost = new HttpPost(url); - // 创建参数列表 - if (param != null) { - List 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; - } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/common/utils/RedisUtil.java b/framework/src/main/java/cn/lili/common/utils/RedisUtil.java index 959ad346..2f01f7c8 100644 --- a/framework/src/main/java/cn/lili/common/utils/RedisUtil.java +++ b/framework/src/main/java/cn/lili/common/utils/RedisUtil.java @@ -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 hmget(String key) { - return redisTemplate.opsForHash().entries(key); - } - - /** - * HashSet - * - * @param key 键 - * @param map 对应多个键值 - * @return true 成功 false 失败 - */ - public boolean hmset(String key, Map 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 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 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 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 boolean lPush(String key, List 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================================= /** diff --git a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java index acf28828..c73c085c 100644 --- a/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java +++ b/framework/src/main/java/cn/lili/common/verification/service/impl/VerificationServiceImpl.java @@ -82,7 +82,7 @@ public class VerificationServiceImpl implements VerificationService { } catch (ServiceException e) { throw e; } catch (Exception e) { - e.printStackTrace(); + log.error("创建校验错误",e); return null; } } diff --git a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java index 86212804..3aac32dd 100644 --- a/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java +++ b/framework/src/main/java/cn/lili/config/elasticsearch/ElasticsearchConfig.java @@ -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); } } diff --git a/framework/src/main/java/cn/lili/modules/base/serviceimpl/RegionServiceImpl.java b/framework/src/main/java/cn/lili/modules/base/serviceimpl/RegionServiceImpl.java index 183fbe64..2bec4e95 100644 --- a/framework/src/main/java/cn/lili/modules/base/serviceimpl/RegionServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/base/serviceimpl/RegionServiceImpl.java @@ -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 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 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); } } diff --git a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java index 3f7650fe..ad6cef2b 100644 --- a/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java +++ b/framework/src/main/java/cn/lili/modules/broadcast/util/WechatMediaUtil.java @@ -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(); diff --git a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java index 200374ec..f9168a55 100644 --- a/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/connect/serviceimpl/ConnectServiceImpl.java @@ -339,7 +339,7 @@ public class ConnectServiceImpl extends ServiceImpl impl return JSONUtil.parseObj(result); } } catch (Exception e) { - e.printStackTrace(); + log.error("解密,获取微信信息错误",e); } throw new ServiceException(ResultCode.USER_CONNECT_ERROR); } diff --git a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java index f0234882..e93a3a25 100644 --- a/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java +++ b/framework/src/main/java/cn/lili/modules/connect/util/ConnectUtil.java @@ -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); } } diff --git a/framework/src/main/java/cn/lili/modules/connect/util/IpUtils.java b/framework/src/main/java/cn/lili/modules/connect/util/IpUtils.java index 35a9e3b6..00fc0c92 100644 --- a/framework/src/main/java/cn/lili/modules/connect/util/IpUtils.java +++ b/framework/src/main/java/cn/lili/modules/connect/util/IpUtils.java @@ -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; } } diff --git a/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java index 8e16afd5..7d6708ab 100644 --- a/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java +++ b/framework/src/main/java/cn/lili/modules/member/entity/aop/interceptor/PointLogInterceptor.java @@ -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); } diff --git a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberSignServiceImpl.java b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberSignServiceImpl.java index 42d864bf..74ab3170 100644 --- a/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberSignServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/member/serviceimpl/MemberSignServiceImpl.java @@ -136,7 +136,7 @@ public class MemberSignServiceImpl extends ServiceImpl implements SmsSignService { @@ -42,7 +44,7 @@ public class SmsSignServiceImpl extends ServiceImpl impl smsSign.setSignStatus(0); this.save(smsSign); } catch (Exception e) { - e.printStackTrace(); + log.error("添加短信签名错误",e); } } @@ -55,7 +57,7 @@ public class SmsSignServiceImpl extends ServiceImpl impl this.removeById(id); } } catch (Exception e) { - e.printStackTrace(); + log.error("删除短信签名错误",e); } } @@ -74,7 +76,7 @@ public class SmsSignServiceImpl extends ServiceImpl impl this.updateById(smsSign); } } catch (Exception e) { - e.printStackTrace(); + log.error("查询短信签名错误",e); } } @@ -84,7 +86,7 @@ public class SmsSignServiceImpl extends ServiceImpl impl aliSmsUtil.modifySmsSign(smsSign); this.updateById(smsSign); } catch (Exception e) { - e.printStackTrace(); + log.error("更新短信签名错误",e); } } diff --git a/framework/src/main/java/cn/lili/modules/message/serviceimpl/SmsTemplateServiceImpl.java b/framework/src/main/java/cn/lili/modules/message/serviceimpl/SmsTemplateServiceImpl.java index 5de67750..d3286192 100644 --- a/framework/src/main/java/cn/lili/modules/message/serviceimpl/SmsTemplateServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/message/serviceimpl/SmsTemplateServiceImpl.java @@ -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 implements SmsTemplateService { @@ -38,7 +40,7 @@ public class SmsTemplateServiceImpl extends ServiceImpl implements out = response.getOutputStream(); writer.flush(out, true); } catch (IOException e) { - e.printStackTrace(); + log.error("获取待发货订单编号列表错误",e); } finally { writer.close(); } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/HttpKit.java b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/HttpKit.java index 767d4ad1..d6541fe1 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/HttpKit.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/HttpKit.java @@ -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); } } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/PayKit.java b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/PayKit.java index 9f94e796..1f8b549e 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/PayKit.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/PayKit.java @@ -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; } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/QrCodeKit.java b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/QrCodeKit.java index 2048d45d..f8e19145 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/QrCodeKit.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/QrCodeKit.java @@ -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 hints = new HashMap(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; } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/RsaKit.java b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/RsaKit.java index f6d5f06a..f205e4c3 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/RsaKit.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/core/kit/RsaKit.java @@ -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; } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/bankTransfer/BankTransferPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/bankTransfer/BankTransferPlugin.java index 77acc875..a42e97b3 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/bankTransfer/BankTransferPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/bankTransfer/BankTransferPlugin.java @@ -37,7 +37,7 @@ public class BankTransferPlugin implements Payment { refundLog.setIsRefund(true); refundLogService.save(refundLog); } catch (Exception e) { - e.printStackTrace(); + log.error("线下收款错误",e); } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java index 16be59f3..6caca9ef 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wallet/WalletPlugin.java @@ -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); } } diff --git a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java index e08484ca..f8222308 100644 --- a/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java +++ b/framework/src/main/java/cn/lili/modules/payment/kit/plugin/wechat/WechatPlugin.java @@ -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; } diff --git a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java index ffe3c787..844f760b 100644 --- a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/AdminUserServiceImpl.java @@ -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 implements AdminUserService { @@ -114,7 +116,7 @@ public class AdminUserServiceImpl extends ServiceImpl implements DepartmentService { @@ -65,7 +66,7 @@ public class DepartmentServiceImpl extends ServiceImpl implements MenuService { @@ -96,7 +98,7 @@ public class MenuServiceImpl extends ServiceImpl implements Me List menus = this.list(); return tree(menus); } catch (Exception e) { - e.printStackTrace(); + log.error("菜单树错误",e); } return null; } diff --git a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleMenuServiceImpl.java b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleMenuServiceImpl.java index e582a873..cd49e058 100644 --- a/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleMenuServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/permission/serviceimpl/RoleMenuServiceImpl.java @@ -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 implements RoleMenuService { //菜单 - @Autowired + @Resource private MenuMapper menuMapper; @Override @@ -48,7 +50,7 @@ public class RoleMenuServiceImpl extends ServiceImpl i //重新保存角色菜单关系 this.saveBatch(roleMenus); } catch (Exception e) { - e.printStackTrace(); + log.error("修改用户权限错误",e); } } diff --git a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java index b5514bcc..4eb7ea7a 100644 --- a/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/search/serviceimpl/CustomWordsServiceImpl.java @@ -40,7 +40,7 @@ public class CustomWordsServiceImpl extends ServiceImpl 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 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()); diff --git a/framework/src/main/java/cn/lili/modules/system/entity/plugin/InstantDelivery/dada/DadaPlugin.java b/framework/src/main/java/cn/lili/modules/system/entity/plugin/InstantDelivery/dada/DadaPlugin.java index 9d1a913d..876c15cc 100644 --- a/framework/src/main/java/cn/lili/modules/system/entity/plugin/InstantDelivery/dada/DadaPlugin.java +++ b/framework/src/main/java/cn/lili/modules/system/entity/plugin/InstantDelivery/dada/DadaPlugin.java @@ -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; diff --git a/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java b/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java index 32e869b3..5228eef1 100644 --- a/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/system/serviceimpl/LogisticsServiceImpl.java @@ -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 implements LogisticsService { @@ -47,7 +48,8 @@ public class LogisticsServiceImpl extends ServiceImpl> 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 = "获取行业统计列表") diff --git a/manager-api/src/main/java/cn/lili/controller/statistics/IndexStatisticsManagerController.java b/manager-api/src/main/java/cn/lili/controller/statistics/IndexStatisticsManagerController.java index 1477776b..669d9e30 100644 --- a/manager-api/src/main/java/cn/lili/controller/statistics/IndexStatisticsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/statistics/IndexStatisticsManagerController.java @@ -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; } diff --git a/manager-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsManagerController.java b/manager-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsManagerController.java index 4aa5dff7..2094c62f 100644 --- a/manager-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsManagerController.java @@ -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; } diff --git a/manager-api/src/main/java/cn/lili/security/ManagerSecurityConfig.java b/manager-api/src/main/java/cn/lili/security/ManagerSecurityConfig.java index aac90fec..b4fc86b4 100644 --- a/manager-api/src/main/java/cn/lili/security/ManagerSecurityConfig.java +++ b/manager-api/src/main/java/cn/lili/security/ManagerSecurityConfig.java @@ -49,7 +49,6 @@ public class ManagerSecurityConfig extends WebSecurityConfigurerAdapter { .authorizeRequests(); // 配置的url 不需要授权 for (String url : ignoredUrlsProperties.getUrls()) { - log.error(url); registry.antMatchers(url).permitAll(); } registry diff --git a/seller-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsStoreController.java b/seller-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsStoreController.java index 3de478a3..4a17cdef 100644 --- a/seller-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/statistics/OrderStatisticsStoreController.java @@ -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; } diff --git a/seller-api/src/main/java/cn/lili/controller/trade/OrderStoreController.java b/seller-api/src/main/java/cn/lili/controller/trade/OrderStoreController.java index 69e0deb5..f328490c 100644 --- a/seller-api/src/main/java/cn/lili/controller/trade/OrderStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/trade/OrderStoreController.java @@ -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); } }