Browse Source

fixed 操作日志完善

fushengqian 11 tháng trước cách đây
mục cha
commit
ae539e4674

+ 27 - 4
fuint-application/src/main/java/com/fuint/common/aspect/TActionLogAop.java

@@ -1,12 +1,15 @@
 package com.fuint.common.aspect;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.fuint.common.dto.AccountInfo;
+import com.fuint.common.service.AccountService;
 import com.fuint.common.service.ActionLogService;
 import com.fuint.common.util.CommonUtil;
 import com.fuint.common.util.TokenUtil;
 import com.fuint.framework.annoation.OperationServiceLog;
 import com.fuint.repository.model.TActionLog;
+import com.fuint.utils.StringUtil;
 import org.apache.commons.lang.StringUtils;
 import org.apache.ibatis.javassist.*;
 import org.apache.ibatis.javassist.bytecode.CodeAttribute;
@@ -23,7 +26,6 @@ import org.springframework.stereotype.Component;
 import javax.servlet.http.HttpServletRequest;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
-
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.util.Date;
@@ -46,6 +48,10 @@ public class TActionLogAop {
     @Autowired
     private ActionLogService tActionLogService;
 
+    @Lazy
+    @Autowired
+    private AccountService tAccountService;
+
     private String userName = ""; // 用户名
     private Integer merchantId = 0; // 商户ID
     private Integer storeId = 0; // 店铺ID
@@ -146,10 +152,27 @@ public class TActionLogAop {
                 userName = accountInfo.getAccountName();
                 merchantId = accountInfo.getMerchantId() == null ? 0 : accountInfo.getMerchantId();
                 storeId = accountInfo.getStoreId() == null ? 0 : accountInfo.getStoreId();
+            } else {
+                if (StringUtil.isNotEmpty(param)) {
+                    JSONObject jsonObject = JSON.parseObject(param);
+                    if (jsonObject != null) {
+                        JSONObject tAccount = jsonObject.getJSONObject("tAccount");
+                        if (tAccount != null) {
+                            String accountName = tAccount.getString("username");
+                            AccountInfo accountInfo = tAccountService.getAccountByName(accountName);
+                            if (accountInfo != null) {
+                                userName = accountInfo.getAccountName();
+                                merchantId = accountInfo.getMerchantId();
+                                storeId = accountInfo.getStoreId();
+                            }
+                        }
+                    }
+                }
             }
-            this.printOptLog();
+            printOptLog();
         } catch (Exception e) {
-            // empty
+            logger.error("保存后台日志出错:{}", e.getMessage());
+            e.printStackTrace();
         }
     }
 
@@ -179,7 +202,7 @@ public class TActionLogAop {
         }
         hal.setParam(param.equals("{}") ? "" : param);
         if (StringUtils.isNotEmpty(module) && userName != null && StringUtils.isNotEmpty(userName)) {
-            this.tActionLogService.saveActionLog(hal);
+            tActionLogService.saveActionLog(hal);
         }
     }
 

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/dto/OrderUserDto.java

@@ -18,6 +18,9 @@ public class OrderUserDto implements Serializable {
     @ApiModelProperty("会员ID")
     private Integer id;
 
+    @ApiModelProperty("会员号")
+    private String no;
+
     @ApiModelProperty("会员姓名")
     private String name;
 

+ 3 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -189,7 +189,7 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
         String type =  orderListParam.getType() == null ? "": orderListParam.getType();
         String orderSn =  orderListParam.getOrderSn() == null ? "": orderListParam.getOrderSn();
         String mobile =  orderListParam.getMobile() == null ? "": orderListParam.getMobile();
-        String orderMode =  orderListParam.getOrderMode() == null ? "": orderListParam.getOrderMode();
+        String orderMode =  orderListParam.getOrderMode() == null ? OrderModeEnum.ONESELF.getKey(): orderListParam.getOrderMode();
         String staffId = orderListParam.getStaffId() == null ? "" : orderListParam.getStaffId();
         String couponId = orderListParam.getCouponId() == null ? "" : orderListParam.getCouponId();
         String storeIds = orderListParam.getStoreIds() == null ? "" : orderListParam.getStoreIds();
@@ -1564,9 +1564,10 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
         MtUser user = memberService.queryMemberById(orderInfo.getUserId());
         if (user != null) {
             userInfo.setId(user.getId());
+            userInfo.setNo(user.getUserNo());
             userInfo.setName(user.getName());
             userInfo.setMobile(user.getMobile());
-            userInfo.setCardNo(user.getCarNo());
+            userInfo.setCardNo(user.getIdcard());
             userInfo.setAddress(user.getAddress());
             userOrderDto.setUserInfo(userInfo);
         }

+ 3 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendActionLogController.java

@@ -32,6 +32,9 @@ import java.util.Map;
 @RequestMapping(value = "/backendApi/actlog")
 public class BackendActionLogController extends BaseController {
 
+    /**
+     * 管理员接口
+     * */
     private ActionLogService tActionLogService;
 
     /**