From 1aa70f3b0a1411d0de3f4ca78b639bf065168be2 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期五, 10 九月 2021 18:29:10 +0800
Subject: [PATCH] Merge branch 'zzj' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into discuss
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java | 117 +++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 78 insertions(+), 39 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java
index 21d40a5..6790db0 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopOperLogServiceImpl.java
@@ -1,24 +1,25 @@
package com.panzhihua.service_community.service.impl;
+import javax.annotation.Resource;
+
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import com.alibaba.fastjson.JSONObject;
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.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.PageDTO;
+import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.shop.PageShopStoreVO;
import com.panzhihua.common.model.vos.shop.ShopOperLogVO;
+import com.panzhihua.common.service.user.UserService;
import com.panzhihua.service_community.dao.ComShopOperLogDAO;
-import com.panzhihua.service_community.dao.ComShopOrderDAO;
import com.panzhihua.service_community.model.dos.ComShopOperLogDO;
-import com.panzhihua.service_community.model.dos.ComShopOrderDO;
-import com.panzhihua.service_community.model.dos.ComShopStoreDO;
import com.panzhihua.service_community.service.ComShopOperLogService;
-import com.panzhihua.service_community.service.ComShopOrderService;
+
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
/**
* @auther cedoo
@@ -27,7 +28,11 @@
*/
@Slf4j
@Service
-public class ComShopOperLogServiceImpl extends ServiceImpl<ComShopOperLogDAO, ComShopOperLogDO> implements ComShopOperLogService {
+public class ComShopOperLogServiceImpl extends ServiceImpl<ComShopOperLogDAO, ComShopOperLogDO>
+ implements ComShopOperLogService {
+
+ @Resource
+ private UserService userService;
@Override
public R saveLog(ShopOperLogVO shopOperLogVO) {
@@ -44,38 +49,72 @@
public R pageShopOperLog(PageDTO pageDTO) {
Page page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize());
IPage<ComShopOperLogDO> comShopOperLogDOIPage =
- this.baseMapper.selectPage(page, new LambdaQueryWrapper<ComShopOperLogDO>().eq(ComShopOperLogDO::getUserId, pageDTO.getUserId()));
+ this.baseMapper.selectPage(page, new LambdaQueryWrapper<ComShopOperLogDO>()
+ .orderByDesc(ComShopOperLogDO::getOperTime).eq(ComShopOperLogDO::getUserId, pageDTO.getUserId()));
- IPage<ShopOperLogVO> comShopOperLogVOIPage =
- comShopOperLogDOIPage.convert(comShopOperLogDO -> {
- ShopOperLogVO shopOperLogVO = new ShopOperLogVO();
- BeanUtils.copyProperties(comShopOperLogDO, shopOperLogVO);
- /**
- * 隐藏敏感信息
- */
- shopOperLogVO.setJsonResult("****");
- shopOperLogVO.setOperParam("****");
+ IPage<ShopOperLogVO> comShopOperLogVOIPage = comShopOperLogDOIPage.convert(comShopOperLogDO -> {
+ ShopOperLogVO shopOperLogVO = new ShopOperLogVO();
+ BeanUtils.copyProperties(comShopOperLogDO, shopOperLogVO);
+ /**
+ * 隐藏敏感信息
+ */
+ shopOperLogVO.setJsonResult("****");
+ shopOperLogVO.setOperParam("****");
- String businessTypeName = "";
- switch (comShopOperLogDO.getBusinessType()){
- case 1: businessTypeName = "登录";break;
- case 2: businessTypeName = "修改密码";break;
- case 3: businessTypeName = "添加商品";break;
- case 4: businessTypeName = "编辑商品";break;
- case 5: businessTypeName = "下架商品";break;
- case 6: businessTypeName = "上架商品";break;
- case 7: businessTypeName = "删除商品";break;
- case 8: businessTypeName = "取消订单";break;
- case 9: businessTypeName = "发货";break;
- case 10: businessTypeName = "配送";break;
- case 11:businessTypeName = "查看订单详情";break;
- case 12:businessTypeName = "导出订单";break;
- case 13:businessTypeName = "导出资金流水";break;
- default: break;
- }
- shopOperLogVO.setBusinessName(businessTypeName);
- return shopOperLogVO;
- });
+ String businessTypeName = "";
+ switch (comShopOperLogDO.getBusinessType()) {
+ case 1:
+ businessTypeName = "登录";
+ break;
+ case 2:
+ businessTypeName = "修改密码";
+ break;
+ case 3:
+ businessTypeName = "添加商品";
+ break;
+ case 4:
+ businessTypeName = "编辑商品";
+ break;
+ case 5:
+ businessTypeName = "下架商品";
+ break;
+ case 6:
+ businessTypeName = "上架商品";
+ break;
+ case 7:
+ businessTypeName = "删除商品";
+ break;
+ case 8:
+ businessTypeName = "取消订单";
+ break;
+ case 9:
+ businessTypeName = "发货";
+ break;
+ case 10:
+ businessTypeName = "配送";
+ break;
+ case 11:
+ businessTypeName = "查看订单详情";
+ break;
+ case 12:
+ businessTypeName = "导出订单";
+ break;
+ case 13:
+ businessTypeName = "导出资金流水";
+ break;
+ default:
+ break;
+ }
+ shopOperLogVO.setBusinessName(businessTypeName);
+
+ R<LoginUserInfoVO> usrInfo = userService.getUserInfoByUserId(comShopOperLogDO.getUserId() + "");
+ if (R.isOk(usrInfo)) {
+ LoginUserInfoVO loginUserInfoVO =
+ JSONObject.parseObject(JSONObject.toJSONString(usrInfo.getData()), LoginUserInfoVO.class);
+ shopOperLogVO.setUserName(loginUserInfoVO.getName());
+ }
+ return shopOperLogVO;
+ });
return R.ok(comShopOperLogVOIPage);
}
}
--
Gitblit v1.7.1