浏览代码

Merge remote-tracking branch 'origin/developerD' into developer

huangzhiguo 2 年之前
父节点
当前提交
39b95f4662

+ 14 - 0
src/main/java/com/caimei365/user/mapper/RegisterMapper.java

@@ -7,6 +7,8 @@ import com.caimei365.user.model.vo.ClubTemporaryVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -23,6 +25,18 @@ public interface RegisterMapper {
      */
     int insertClubUser(UserPo user);
 
+    /**
+     * 查询新注册的用户
+     * @return
+     */
+    List<UserPo> selUser(@Param("registerTime") String registerTime);
+
+    /**
+     * 用户状态添加
+     * @param userID
+     * @return
+     */
+    int insertOrgan(@Param("userID") Integer userID);
     /**
      * 保存普通机构(club)
      *

+ 8 - 0
src/main/java/com/caimei365/user/model/vo/ClubVo.java

@@ -179,5 +179,13 @@ public class ClubVo implements Serializable {
      * 是否有行为记录链接 1.是 0.否
      */
     private Integer recordCount;
+    /**
+     *  活跃状态
+     */
+    private String activeState;
+    /**
+     *  客户价值
+     */
+    private String customerValue;
 
 }

+ 8 - 0
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -189,6 +189,14 @@ public class RegisterServiceImpl implements RegisterService {
         if (insertFlag < 1) {
             throw new RuntimeException("插入数据库异常user:" + user.toString());
         }
+
+        /*
+          保存用户状态
+         */
+        List<UserPo> userPos = registerMapper.selUser(current);
+        for(UserPo userInfo: userPos) {
+            registerMapper.insertOrgan(userInfo.getUserId());
+        }
         /*
             组装机构数据
          */

+ 8 - 0
src/main/resources/mapper/RegisterMapper.xml

@@ -5,6 +5,14 @@
         insert into user(`userOrganizeID`,`registerTime`,`registerIP`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `userPermission`,`guideFlag`,`clubStatus`, `password`, `agreeFlag`, `validFlag`, `serviceProviderID`, `serviceProviderStatus`, userBeans)
                   values(#{organizeId},#{registerTime},#{registerIp},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{guideFlag},#{clubStatus},#{password},#{agreeFlag},#{validFlag},#{serviceProviderId},#{serviceProviderStatus}, #{userBeans})
     </insert>
+    <select id="selUser" resultType="com.caimei365.user.model.po.UserPo">
+        select * from user where registerTime = #{registerTime}
+    </select>
+    <insert id="insertOrgan">
+        insert into cm_organ_value_system
+            (userID, activeState, customerValue, stage, delType)
+            values(#{userID},"新增用户","一般挽留客户",0,1)
+    </insert>
     <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
         insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`, `scanFlag`)
                   values(#{name},#{shortName},#{contractMobile},#{linkMan},#{userId},#{addTime},#{status},#{serviceProviderId},#{scanFlag})

+ 82 - 160
src/main/resources/mapper/SellerMapper.xml

@@ -2,85 +2,85 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.SellerMapper">
     <select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
-        select u.userID         as userId,
-               u.clubID         as clubId,
-               u.shopID         as shopId,
-               u.userName       as userName,
-               u.name           as name,
-               u.mobile         as mobile,
-               u.bindMobile     as bindMobile,
-               u.email          as email,
-               u.guideFlag      as guideFlag,
-               u.userPermission as userPermission,
-               u.userIdentity   as userIdentity,
-               u.password       as password
+        select u.userID as userId,
+            u.clubID as clubId,
+            u.shopID as shopId,
+            u.userName as userName,u.name as name,
+            u.mobile as mobile,
+            u.bindMobile as bindMobile,
+            u.email as email,
+            u.guideFlag as guideFlag,
+            u.userPermission as userPermission,
+            u.userIdentity as userIdentity,
+            u.password as password
         from user u
-        where u.mobile = #{mobile}
+        where
+          u.mobile = #{mobile}
           and u.userIdentity = 1
           and u.userPermission = 4
           and u.validFlag = 1
     </select>
     <update id="updateServiceProviderByUserId">
         update serviceprovider
-        set openid  = #{openId},
-            unionId = #{unionId}
+        set openid = #{openId}, unionId = #{unionId}
         where userID = #{userId}
     </update>
 
     <select id="findClubTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
         SELECT
-        `id`,
-        `userId`,
-        `name`,
-        `shortName`,
-        `bindMobile`,
-        `contractEmail`,
-        `linkMan`,
-        `provinceId`,
-        `cityId`,
-        `townId`,
-        `address`,
-        `shopPhoto`,
-        `businessLicense`,
-        `socialCreditCode`,
-        `firstClubType`,
-        `secondClubType`,
-        `department`,
-        `medicalPracticeLicense`,
-        `mainProduct`,
-        `isAgreed`
+          `id`,
+          `userId`,
+          `name`,
+          `shortName`,
+          `bindMobile`,
+          `contractEmail`,
+          `linkMan`,
+          `provinceId`,
+          `cityId`,
+          `townId`,
+          `address`,
+          `shopPhoto`,
+          `businessLicense`,
+          `socialCreditCode`,
+          `firstClubType`,
+          `secondClubType`,
+          `department`,
+          `medicalPracticeLicense`,
+          `mainProduct`,
+          `isAgreed`
         FROM
-        club_temporary
+          club_temporary
         WHERE
-        userId = #{userId}
-        <if test="searchName != null and searchName != ''">
-            AND (name LIKE CONCAT('%',#{searchName},'%') OR linkMan LIKE CONCAT('%',#{searchName},'%'))
-        </if>
+          userId = #{userId}
+          <if test="searchName != null and searchName != ''">
+              AND (name LIKE CONCAT('%',#{searchName},'%') OR linkMan LIKE CONCAT('%',#{searchName},'%'))
+          </if>
         ORDER BY
-        id DESC
+          id DESC
     </select>
 
     <update id="updateClubTemporary">
         UPDATE
-            `club_temporary`
-        SET `name`                   = #{name},
-            `shortName`              = #{shortName},
-            `bindMobile`             = #{bindMobile},
-            `contractEmail`          = #{contractEmail},
-            `linkMan`                = #{linkMan},
-            `provinceId`             = #{provinceId},
-            `cityId`                 = #{cityId},
-            `townId`                 = #{townId},
-            `address`                = #{address},
-            `shopPhoto`              = #{shopPhoto},
-            `businessLicense`        = #{businessLicense},
-            `socialCreditCode`       = #{socialCreditCode},
-            `firstClubType`          = #{firstClubType},
-            `secondClubType`         = #{secondClubType},
-            `department`             = #{department},
-            `medicalPracticeLicense` = #{medicalPracticeLicense},
-            `mainProduct`            = #{mainProduct},
-            `isAgreed`               = #{isAgreed}
+          `club_temporary`
+        SET
+          `name` = #{name},
+          `shortName` = #{shortName},
+          `bindMobile` = #{bindMobile},
+          `contractEmail` = #{contractEmail},
+          `linkMan` = #{linkMan},
+          `provinceId` = #{provinceId},
+          `cityId` = #{cityId},
+          `townId` = #{townId},
+          `address` = #{address},
+          `shopPhoto` = #{shopPhoto},
+          `businessLicense` = #{businessLicense},
+          `socialCreditCode` = #{socialCreditCode},
+          `firstClubType` = #{firstClubType},
+          `secondClubType` = #{secondClubType},
+          `department` = #{department},
+          `medicalPracticeLicense` = #{medicalPracticeLicense},
+          `mainProduct` = #{mainProduct},
+          `isAgreed` = #{isAgreed}
         WHERE `id` = #{id}
     </update>
 
@@ -104,37 +104,19 @@
     </select>
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
-        c.contractEmail as contractEmail,
+        select DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail 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,
-        c.lastCheckOrderDate,
-        u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount
-        <if test="2 == type">
-            ,s.linkMan as serviceName
-        </if>
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status, c.lastCheckOrderDate,
+        u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
+        covs.activeState AS activeState,
+        covs.customerValue AS customerValue
         from club c
         left join user u on c.userID = u.userID
         LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
-        <if test="2 == type">
-            left join serviceprovider s on s.serviceProviderID=c.spID
-        </if>
-        where
-        <if test="1 == type">
-            c.spID = #{serviceProviderId}
-        </if>
-        <if test="2 == type">
-            c.spID in
-            <foreach collection="serviceIds" item="id" index="index" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-        <if test="3 == type">
-            r.clubId IS NOT NULL
-            AND c.spId=1342
-        </if>
+        LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
+        where c.spID = #{serviceProviderId}
         <if test="status != null and status != 66">
             AND c.status = #{status}
         </if>
@@ -150,13 +132,11 @@
         order by c.clubID desc
     </select>
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
-        SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
-        c.contractEmail as contractEmail,
+        SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail 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,
-        c.lastCheckOrderDate,
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status, c.lastCheckOrderDate,
         u.userIdentity
         FROM club c
         LEFT JOIN user u ON c.userID=u.userID
@@ -170,84 +150,26 @@
         </if>
     </select>
     <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
-        select serviceProviderID     AS serviceProviderId,
-               status,
-               userID                AS userId,
-               openid,
-               unionId,
-               name,
-               contractMobile,
-               linkMan,
-               duty,
-               contractEmail,
-               auditStatus,
-               auditTime,
-               auditNote,
-               validFlag,
-               addTime,
+        select serviceProviderID AS serviceProviderId, status, userID AS userId, openid, unionId, name, contractMobile,
+               linkMan, duty, contractEmail, auditStatus, auditTime, auditNote, validFlag, addTime,
                mainServiceProviderID AS mainServiceProviderId
-        from serviceprovider
-        where userID = #{userId}
+        from serviceprovider where userID = #{userId}
     </select>
     <select id="findManager" resultType="java.lang.Integer">
-        SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
-        FROM cm_serviceteam_manager csm
-                 LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
-                 LEFT JOIN USER u ON s.userId = u.userId
-        WHERE u.bindmobile = #{mobile}
-           OR u.mobile = #{mobile}
+        SELECT IF(csm.serviceProviderId IS NULL,2,1) AS manager FROM  cm_serviceteam_manager csm
+        LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
+        LEFT JOIN USER u ON s.userId = u.userId
+        WHERE u.bindmobile = #{mobile} OR u.mobile = #{mobile}
     </select>
     <select id="findManagerByUser" resultType="java.lang.Integer">
-        SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
-        FROM cm_serviceteam_manager csm
-                 LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
-        WHERE s.userID = #{userId}
+        SELECT IF(csm.serviceProviderId IS NULL,2,1) AS manager
+        FROM  cm_serviceteam_manager csm
+        LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
+        WHERE s.userID  = #{userId}
     </select>
     <select id="findLeaderId" resultType="java.lang.Integer">
-        SELECT leaderId
-        FROM cm_serviceteam_role csr
-                 LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
+        SELECT leaderId FROM cm_serviceteam_role csr
+        LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
         WHERE s.userId = #{userId}
     </select>
-    <select id="findLeaderIdByServiceId" resultType="java.lang.Integer">
-        select leaderId
-        FROM cm_serviceteam_role
-        WHERE leaderId = #{serviceProviderId}
-    </select>
-    <select id="findmanagerIdByServiceId" resultType="java.lang.Integer">
-        SELECT serviceProviderId
-        FROM cm_serviceteam_manager
-        where serviceProviderId = #{serviceProviderId}
-    </select>
-    <select id="findServiceIds" resultType="java.lang.Integer">
-        SELECT csg.serviceId
-        FROM cm_serviceteam_group csg
-                 LEFT JOIN cm_serviceteam_role csr ON csr.id = csg.teamId
-        WHERE csr.leaderId = #{serviceProviderId}
-          AND csg.serviceId != #{serviceProviderId}
-    </select>
-    <select id="findAllServiceIds" resultType="java.lang.Integer">
-        SELECT csg.serviceId
-        FROM cm_serviceteam_group csg
-        WHERE csg.serviceId != #{serviceProviderId}
-    </select>
-    <select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
-        SELECT csg.serviceId as serviceProviderId,s.linkMan as name
-        FROM cm_serviceteam_group csg
-        LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
-        left join serviceprovider s on csg.serviceId=s.serviceProviderID
-        WHERE csr.leaderId = #{spId}
-        <if test="status == 1">
-            AND csg.serviceId != #{spId}
-        </if>
-    </select>
-    <select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
-        SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
-        FROM cm_serviceteam_group csg
-        LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
-        <if test="status == 1">
-            WHERE csg.serviceId != #{spId}
-        </if>
-    </select>
-
 </mapper>