Ver código fonte

用户行为优化1.0.1

huangzhiguo 1 ano atrás
pai
commit
bdfb582174

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

@@ -32,11 +32,17 @@ public interface RegisterMapper {
     List<UserPo> selUser(@Param("registerTime") String registerTime);
 
     /**
-     * 用户状态添加
+     * 用户价值添加
      * @param userID
      * @return
      */
     int insertOrgan(@Param("userID") Integer userID);
+
+    /**
+     * 用户活跃状态
+     * @param userID
+     */
+    void insertActiveOrgan(@Param("userId") Integer userID);
     /**
      * 保存普通机构(club)
      *

+ 4 - 1
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -241,6 +241,7 @@ public class RegisterServiceImpl implements RegisterService {
         List<UserPo> userPos = registerMapper.selUser(current);
         for (UserPo userInfo : userPos) {
             registerMapper.insertOrgan(userInfo.getUserId());
+            registerMapper.insertActiveOrgan(userInfo.getUserId());
         }
         /*
             组装机构数据
@@ -537,6 +538,7 @@ public class RegisterServiceImpl implements RegisterService {
         List<UserPo> userPos = registerMapper.selUser(current);
         for (UserPo userInfo : userPos) {
             registerMapper.insertOrgan(userInfo.getUserId());
+            registerMapper.insertActiveOrgan(userInfo.getUserId());
         }
         /*
             组装机构数据
@@ -945,7 +947,7 @@ public class RegisterServiceImpl implements RegisterService {
 
         if(user.getUserId() != null) {
             registerMapper.insertOrgan(user.getUserId());
-            log.info("插入数据库用户价值表,cm_organ_value_system表userid=====》" + user.getUserId());
+            registerMapper.insertActiveOrgan(user.getUserId());
         }
         /*
             组装机构数据
@@ -1848,6 +1850,7 @@ public class RegisterServiceImpl implements RegisterService {
         List<UserPo> userPos = registerMapper.selUser(current);
         for (UserPo userInfo : userPos) {
             registerMapper.insertOrgan(userInfo.getUserId());
+            registerMapper.insertActiveOrgan(userInfo.getUserId());
         }
         /*
             组装机构数据

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

@@ -245,7 +245,7 @@
                lastCheckOrderDate,
                newDeal                   as newDeal,
                (select userIdentity from user where userId = c.userId) as userIdentity,
-                (select activeState from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as activeState,
+                (select activeState from cm_organ_active_system where stage = 0 and delType = 1 and userId = c.userId) as activeState,
                 (select customerValue from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as customerValue
         from club c
         where clubID = #{clubId}

+ 10 - 2
src/main/resources/mapper/RegisterMapper.xml

@@ -8,11 +8,19 @@
     <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, activeStatus, customerStatus, stage, delType)
-            values(#{userID}, '活跃用户', '低价值客户', 0, 3, 0, 1)
+            (userID, customerValue, customerStatus, stage, addTime, delType)
+            values(#{userID}, '低价值客户', 3, 0, now(), 1)
+    </insert>
+
+    <insert id="insertActiveOrgan">
+        insert into cm_organ_active_system
+        (userID, activeState, activeStatus, stage, addTime, delType)
+        values(#{userID}, '活跃用户', 0, 0, now(), 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`, provinceID, cityID, townID, address, headpic, businessLicenseImage, medicalPracticeLicenseImg, socialCreditCode,newDeal)
                   values(#{name},#{shortName},#{contractMobile},#{linkMan},#{userId},#{addTime},#{status}, #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto}, #{businessLicense},#{medicalPracticeLicense}, #{socialCreditCode},1)

+ 7 - 5
src/main/resources/mapper/SellerMapper.xml

@@ -129,13 +129,14 @@
         c.lastCheckOrderDate,
         u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
         sp.name AS serviceName,
-        covs.activeState AS activeState,
+        coas.activeState AS activeState,
         covs.customerValue AS customerValue,
         cpr.createTime AS providerTime
         from club c
         left join user u on c.userID = u.userID
         LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
-        LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
+        LEFT JOIN (SELECT userId, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON coas.userId = c.userId
+        LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON covs.userID = c.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
         LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
@@ -518,14 +519,15 @@
                u.userIdentity,
                c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
                sp.name AS serviceName,
-               covs.activeState AS activeState,
+               coas.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`
-            LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
+            LEFT JOIN (SELECT userId, activeState, activeStatus FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) AS coas ON coas.userId = c.userId
+            LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) AS covs ON covs.userId = c.userId
             LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
-        WHERE covs.delType = 1 AND covs.stage = 0 AND covs.activeStatus = 1
+        WHERE coas.activeStatus = 1
           AND sp.serviceProviderID = #{serviceProviderId}
         GROUP BY covs.userID
     </select>