Browse Source

fixed 移动端商家管理功能接口迭代

fushengqian 6 months ago
parent
commit
581283eaff

+ 64 - 0
fuint-application/src/main/java/com/fuint/common/dto/StaffDto.java

@@ -0,0 +1,64 @@
+package com.fuint.common.dto;
+
+import com.fuint.repository.model.MtMerchant;
+import com.fuint.repository.model.MtStore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 员工实体
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ * */
+@Data
+public class StaffDto implements Serializable {
+
+    @ApiModelProperty("自增ID")
+    private Integer id;
+
+    @ApiModelProperty("员工类别")
+    private Integer category;
+
+    @ApiModelProperty("用户ID")
+    private Integer userId;
+
+    @ApiModelProperty("手机号码")
+    private String mobile;
+
+    @ApiModelProperty("真实姓名")
+    private String realName;
+
+    @ApiModelProperty("微信号")
+    private String wechat;
+
+    @ApiModelProperty("商户ID")
+    private Integer merchantId;
+
+    @ApiModelProperty("店铺ID")
+    private Integer storeId;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("更新时间")
+    private Date updateTime;
+
+    @ApiModelProperty("审核状态,A:审核通过;U:未审核;D:无效; ")
+    private String auditedStatus;
+
+    @ApiModelProperty("审核时间")
+    private Date auditedTime;
+
+    @ApiModelProperty("备注")
+    private String description;
+
+    @ApiModelProperty("商户信息")
+    private MtMerchant merchantInfo;
+
+    @ApiModelProperty("店铺信息")
+    private MtStore storeInfo;
+
+}

+ 10 - 0
fuint-application/src/main/java/com/fuint/common/service/StaffService.java

@@ -1,6 +1,7 @@
 package com.fuint.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fuint.common.dto.StaffDto;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
@@ -76,4 +77,13 @@ public interface StaffService extends IService<MtStaff> {
      * @return
      */
     MtStaff queryStaffByUserId(Integer userId) throws BusinessCheckException;
+
+    /**
+     * 根据手机号获取员工信息
+     *
+     * @param  mobile 手机
+     * @throws BusinessCheckException
+     * @return
+     */
+    StaffDto getStaffInfoByMobile(String mobile) throws BusinessCheckException;
 }

+ 40 - 4
fuint-application/src/main/java/com/fuint/common/service/impl/StaffServiceImpl.java

@@ -3,17 +3,16 @@ package com.fuint.common.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fuint.common.dto.StaffDto;
 import com.fuint.common.enums.StatusEnum;
 import com.fuint.common.enums.YesOrNoEnum;
-import com.fuint.common.service.MemberService;
-import com.fuint.common.service.SendSmsService;
-import com.fuint.common.service.StaffService;
-import com.fuint.common.service.StoreService;
+import com.fuint.common.service.*;
 import com.fuint.framework.annoation.OperationServiceLog;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.repository.mapper.MtStaffMapper;
+import com.fuint.repository.model.MtMerchant;
 import com.fuint.repository.model.MtStaff;
 import com.fuint.repository.model.MtStore;
 import com.fuint.repository.model.MtUser;
@@ -22,6 +21,7 @@ import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.stereotype.Service;
@@ -54,6 +54,11 @@ public class StaffServiceImpl extends ServiceImpl<MtStaffMapper, MtStaff> implem
      */
     private StoreService storeService;
 
+    /**
+     * 商户接口
+     */
+    private MerchantService merchantService;
+
     /**
      * 员工查询列表
      *
@@ -265,4 +270,35 @@ public class StaffServiceImpl extends ServiceImpl<MtStaffMapper, MtStaff> implem
     public MtStaff queryStaffByUserId(Integer userId) {
         return mtStaffMapper.queryStaffByUserId(userId);
     }
+
+    /**
+     * 根据手机号获取员工信息
+     *
+     * @param mobile 手机号
+     * @throws BusinessCheckException
+     * @return
+     */
+    @Override
+    public StaffDto getStaffInfoByMobile(String mobile) throws BusinessCheckException {
+        MtStaff mtStaff =  mtStaffMapper.queryStaffByMobile(mobile);
+        StaffDto staffDto = new StaffDto();
+        if (mtStaff != null) {
+            BeanUtils.copyProperties(mtStaff, staffDto);
+            if (staffDto.getStoreId() != null && staffDto.getStoreId() > 0) {
+                MtStore mtStore = storeService.queryStoreById(staffDto.getStoreId());
+                if (mtStore != null) {
+                    staffDto.setStoreInfo(mtStore);
+                }
+            }
+            if (staffDto.getMerchantId() != null && staffDto.getMerchantId() > 0) {
+                MtMerchant mtMerchant = merchantService.getById(staffDto.getMerchantId());
+                if (mtMerchant != null) {
+                    staffDto.setMerchantInfo(mtMerchant);
+                }
+            }
+        } else {
+            return null;
+        }
+        return staffDto;
+    }
 }

+ 2 - 1
fuint-application/src/main/java/com/fuint/module/merchantApi/controller/MerchantController.java

@@ -1,5 +1,6 @@
 package com.fuint.module.merchantApi.controller;
 
+import com.fuint.common.dto.StaffDto;
 import com.fuint.common.dto.UserInfo;
 import com.fuint.common.service.ConfirmLogService;
 import com.fuint.common.service.MemberService;
@@ -73,7 +74,7 @@ public class MerchantController extends BaseController {
         Map<String, Object> outParams = new HashMap<>();
         outParams.put("userInfo", mtUser);
 
-        MtStaff staffInfo = staffService.queryStaffByMobile(mtUser.getMobile());
+        StaffDto staffInfo = staffService.getStaffInfoByMobile(mtUser.getMobile());
         if (null == staffInfo) {
             return getFailureResult(1002, "该账号不是商户");
         }