Explorar el Código

协销个人中心

chao hace 3 años
padre
commit
7ac78c16c8

+ 32 - 3
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -3,7 +3,9 @@ package com.caimei365.user.controller;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.dto.OnlineDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
+import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.service.SellerService;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
@@ -14,6 +16,8 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Map;
+
 /**
  * Description
  *
@@ -81,20 +85,45 @@ public class SellerApi {
      * @param spId 协销Id
      * @param status            机构状态
      * @param name              机构名字关键字(搜索用)
-     * @return
      */
     @ApiOperation("协销机构列表")
     @GetMapping("/club/list")
-    public ResponseJson getClubList(Integer spId,
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer spId,
                                     Integer status,
                                     String name,
                                     Integer userIdentity,
                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
         if (null == spId || null == status) {
-            return ResponseJson.error("spId 或 status 参数不全!");
+            return ResponseJson.error("spId 或 status 参数不全!", null);
         }
         return sellerService.getClubList(spId, status, name, userIdentity, pageNum, pageSize);
     }
 
+    /**
+     * 所有的机构列表
+     * 原spi的 /seller/findAllClub
+     * @param searchWord     关键字(搜索用)
+     */
+    @ApiOperation("所有的机构列表(搜索)")
+    @GetMapping("/club/all")
+    public ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord,
+                                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                         @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return sellerService.getAllClubList(searchWord, pageNum, pageSize);
+    }
+
+    /**
+     * 协销个人中心
+     *
+     * @param userId 协销userId
+     */
+    @GetMapping("/home")
+    public  ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        return sellerService.getSellerHome(userId);
+    }
+
 }

+ 7 - 7
src/main/java/com/caimei365/user/mapper/ClubMapper.java

@@ -39,13 +39,13 @@ public interface ClubMapper {
      */
     void updateClubByUpdateInfo(ClubUpdateDto club);
 
-    /**
-     * 获取订单数量
-     *
-     * @param userId
-     * @return
-     */
-    OrderCountVo getOrderCount(Integer userId);
+//    /**
+//     * 获取订单数量
+//     *
+//     * @param userId
+//     * @return
+//     */
+//    OrderCountVo getOrderCount(Integer userId);
 
     /**
      * 查询采美豆类型记录

+ 10 - 0
src/main/java/com/caimei365/user/mapper/SellerMapper.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserLoginVo;
@@ -60,4 +61,13 @@ public interface SellerMapper {
     List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, Integer userIdentity);
 
     Integer findOrderNum(ClubVo club);
+    /**
+     * 所有的机构列表
+     */
+    List<ClubVo> getAllClubList(String searchWord);
+    /**
+     * 协销信息
+     */
+    ServiceProviderPo getSellerByUserId(Integer userId);
+
 }

+ 66 - 1
src/main/java/com/caimei365/user/model/po/ServiceProviderPo.java

@@ -2,6 +2,8 @@ package com.caimei365.user.model.po;
 
 import lombok.Data;
 
+import java.io.Serializable;
+
 /**
  * 协销
  *
@@ -9,7 +11,8 @@ import lombok.Data;
  * @date : 2021/3/18
  */
 @Data
-public class ServiceProviderPo {
+public class ServiceProviderPo implements Serializable {
+    private static final long serialVersionUID = 1L;
     /**
      * 协销Id(serviceProviderID)
      */
@@ -18,4 +21,66 @@ public class ServiceProviderPo {
      * 协销状态,见表c_serviceproviderstatus或枚举ServiceProviderStatus
      */
     private Integer status;
+    /**
+     * 对应的userId
+     */
+    private Integer userId;
+    /**
+     * 小程序openid
+     */
+    private String openid;
+    /**
+     * 微信unionId
+     */
+    private String unionId;
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 联系手机
+     */
+    private String contractMobile;
+
+    /**
+     * 联系人1(默认联系人)
+     */
+    private String linkMan1;
+
+    /**
+     * 联系人1职务
+     */
+    private String duty1;
+
+    /**
+     * 联系人1手机
+     */
+    private String contractMobile1;
+    /**
+     * 审核状态
+     */
+    private String auditStatus;
+
+    /**
+     * 审核时间
+     */
+    private String auditTime;
+
+    /**
+     * 审核信息
+     */
+    private String auditNote;
+    /**
+     * 是否可用 1可用
+     */
+    private String validFlag;
+
+    /**
+     * 创建时间
+     */
+    private String addTime;
+    /**
+     * 创客经理Id
+     */
+    private Integer mainServiceProviderId;
 }

+ 39 - 39
src/main/java/com/caimei365/user/model/vo/OrderCountVo.java

@@ -1,39 +1,39 @@
-package com.caimei365.user.model.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * Description
- *
- * @author : Charles
- * @date : 2021/3/31
- */
-@Data
-public class OrderCountVo implements Serializable {
-    /**
-     * 待确认数量
-     */
-    private Integer orderCount;
-    /**
-     * 待确认数量
-     */
-    private Integer confirmedCount;
-    /**
-     * 待付款数量
-     */
-    private Integer paymentCount;
-    /**
-     * 待发货数量
-     */
-    private Integer waitShipmentsCount;
-    /**
-     * 已发货数量
-     */
-    private Integer shipmentsCount;
-    /**
-     * 退货款数量
-     */
-    private Integer salesReturnCount;
-}
+//package com.caimei365.user.model.vo;
+//
+//import lombok.Data;
+//
+//import java.io.Serializable;
+//
+///**
+// * Description
+// *
+// * @author : Charles
+// * @date : 2021/3/31
+// */
+//@Data
+//public class OrderCountVo implements Serializable {
+//    /**
+//     * 待确认数量
+//     */
+//    private Integer orderCount;
+//    /**
+//     * 待确认数量
+//     */
+//    private Integer confirmedCount;
+//    /**
+//     * 待付款数量
+//     */
+//    private Integer paymentCount;
+//    /**
+//     * 待发货数量
+//     */
+//    private Integer waitShipmentsCount;
+//    /**
+//     * 已发货数量
+//     */
+//    private Integer shipmentsCount;
+//    /**
+//     * 退货款数量
+//     */
+//    private Integer salesReturnCount;
+//}

+ 13 - 0
src/main/java/com/caimei365/user/service/SellerService.java

@@ -2,6 +2,7 @@ package com.caimei365.user.service;
 
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserLoginVo;
@@ -60,4 +61,16 @@ public interface SellerService {
      * @return
      */
     ResponseJson<String> deleteTemporaryClub(Integer id);
+
+    /**
+     * 所有的机构列表
+     * @param searchWord 搜索关键字
+     */
+    ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize);
+
+    /**
+     * 协销个人中心
+     * @param userId 协销用户id
+     */
+    ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
 }

+ 12 - 12
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -240,20 +240,20 @@ public class ClubServiceImpl implements ClubService {
         if (club == null) {
             return ResponseJson.error("机构信息不存在", null);
         }
-        Map<String, Object> map = new HashMap<>(10);
+        Map<String, Object> map = new HashMap<>(6);
         map.put("user", user);
         map.put("club", club);
-        OrderCountVo countVo = clubMapper.getOrderCount(userId);
-        //待确认数量
-        map.put("confirmedCount", countVo != null ? countVo.getConfirmedCount() : 0);
-        //待付款数量
-        map.put("paymentCount", countVo != null ? countVo.getPaymentCount() : 0);
-        //待发货数量
-        map.put("waitShipmentsCount", countVo != null ? countVo.getWaitShipmentsCount() : 0);
-        //已发货数量
-        map.put("shipmentsCount", countVo != null ? countVo.getShipmentsCount() : 0);
-        //退货款数量
-        map.put("salesReturnCount", countVo != null ? countVo.getSalesReturnCount() : 0);
+//        OrderCountVo countVo = clubMapper.getOrderCount(userId);
+//        //待确认数量
+//        map.put("confirmedCount", countVo != null ? countVo.getConfirmedCount() : 0);
+//        //待付款数量
+//        map.put("paymentCount", countVo != null ? countVo.getPaymentCount() : 0);
+//        //待发货数量
+//        map.put("waitShipmentsCount", countVo != null ? countVo.getWaitShipmentsCount() : 0);
+//        //已发货数量
+//        map.put("shipmentsCount", countVo != null ? countVo.getShipmentsCount() : 0);
+//        //退货款数量
+//        map.put("salesReturnCount", countVo != null ? countVo.getSalesReturnCount() : 0);
         //联系电话
         String contactNumber = baseMapper.getAfterSalesPhone();
         map.put("contactNumber", contactNumber);

+ 32 - 0
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -6,6 +6,7 @@ import com.caimei365.user.mapper.SellerMapper;
 import com.caimei365.user.mapper.SuperVipMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
@@ -20,6 +21,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -133,4 +135,34 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success("");
     }
 
+    /**
+     * 所有的机构列表
+     *
+     * @param searchWord 搜索关键字
+     * @param pageNum
+     * @param pageSize
+     */
+    @Override
+    public ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ClubVo> clubList = sellerMapper.getAllClubList(searchWord);
+        PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
+        return ResponseJson.success(pageData);
+    }
+
+    /**
+     * 协销个人中心
+     *
+     * @param userId 协销用户id
+     */
+    @Override
+    public ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
+        // 协销用户
+        ServiceProviderPo seller = sellerMapper.getSellerByUserId(userId);
+        if (null == seller) {
+            return ResponseJson.error("未查询到此协销人员!", null);
+        }
+        return ResponseJson.success(seller);
+    }
+
 }

+ 12 - 12
src/main/resources/mapper/ClubMapper.xml

@@ -84,18 +84,18 @@
         from club
         where clubID = #{clubId}
     </select>
-    <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">
-        select userID as userId,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0') as orderCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status = '0') as confirmedCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,13,21,22,23)) as paymentCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,21,22,31,32)) as waitShipmentsCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(12,13,22,23,32,33)) as shipmentsCount,
-        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(1,2)) as salesReturnCount
-        from cm_order
-        where  userID = #{userId} and delFlag = '0'
-        limit 1
-    </select>
+<!--    <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">-->
+<!--        select userID as userId,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0') as orderCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status = '0') as confirmedCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,13,21,22,23)) as paymentCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(11,12,21,22,31,32)) as waitShipmentsCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(12,13,22,23,32,33)) as shipmentsCount,-->
+<!--        (select COUNT(*) from cm_order where  userID = #{userId} and delFlag = '0' and status in(1,2)) as salesReturnCount-->
+<!--        from cm_order-->
+<!--        where  userID = #{userId} and delFlag = '0'-->
+<!--        limit 1-->
+<!--    </select>-->
 
     <select id="findBeansHistoryByType" resultType="integer">
         SELECT id FROM user_beans_history WHERE userId = #{userId} AND beansType = #{beansType} AND delFlag = 0

+ 25 - 2
src/main/resources/mapper/SellerMapper.xml

@@ -102,8 +102,7 @@
     </select>
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1
-        as contractEmail,
+        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1 as contractEmail,
         c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
@@ -126,4 +125,28 @@
         </if>
         order by c.clubID desc
     </select>
+    <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
+        SELECT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail1 as contractEmail,
+        c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
+        c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
+        c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status,
+        u.userIdentity
+        FROM club c
+        LEFT JOIN user u ON c.userID=u.userID
+        WHERE u.userOrganizeID = 0 AND c.status = '90'
+        <if test="searchWord != null and searchWord != ''">
+            and (
+            c.name LIKE CONCAT('%',#{searchWord},'%') or
+            c.linkMan1 LIKE CONCAT('%',#{searchWord},'%') or
+            c.contractMobile1 LIKE CONCAT('%',#{searchWord},'%')
+            )
+        </if>
+    </select>
+    <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
+        select serviceProviderID AS serviceProviderId, status, userID AS userId, openid, unionId, name, contractMobile,
+               linkMan1, duty1, contractMobile1, auditStatus, auditTime, auditNote, validFlag, addTime,
+               mainServiceProviderID AS mainServiceProviderId
+        from serviceprovider where userID = #{userId}
+    </select>
 </mapper>