Prechádzať zdrojové kódy

用户行为优化1.0.4

huangzhiguo 1 rok pred
rodič
commit
b8cee3f37b

+ 5 - 1
src/main/java/com/caimei/modules/newhome/dao/NewPageFirstNavigationDao.java

@@ -5,6 +5,8 @@ import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.newhome.entity.NewPageFirstNavigation;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 新首页一级导航栏DAO接口
  *
@@ -15,4 +17,6 @@ import org.apache.ibatis.annotations.Param;
 public interface NewPageFirstNavigationDao extends CrudDao<NewPageFirstNavigation> {
 
     void saveSort(@Param("sort") String sort, @Param("id") String id);
-}
+
+    List<Integer> getEnableNumber(@Param("www") String www, @Param("crm") String crm);
+}

+ 7 - 1
src/main/java/com/caimei/modules/newhome/service/NewPageFirstNavigationService.java

@@ -58,4 +58,10 @@ public class NewPageFirstNavigationService extends CrudService<NewPageFirstNavig
     public void saveSort(String sort, String id) {
         newPageFirstNavigationDao.saveSort(sort, id);
     }
-}
+
+    @Transactional(readOnly = false)
+    public Integer getNumber(String www, String crm) {
+        List<Integer> enableNumber = newPageFirstNavigationDao.getEnableNumber(www, crm);
+        return null == enableNumber ? 0 : enableNumber.size();
+    }
+}

+ 28 - 6
src/main/java/com/caimei/modules/newhome/web/NewPageFirstNavigationController.java

@@ -70,15 +70,19 @@ public class NewPageFirstNavigationController extends BaseController {
         }
         newPageFirstNavigation.setStatisticsType("4");
         Page<NewPageFirstNavigation> page = newPageFirstNavigationService.findPage(new Page<NewPageFirstNavigation>(request, response), newPageFirstNavigation);
+        Integer number = newPageFirstNavigationService.getNumber("www", null);
         model.addAttribute("page", page);
         model.addAttribute("newPageFirstNavigation", newPageFirstNavigation);
+        model.addAttribute("number", number);
         return "modules/newhome/newPageFirstNavigationList";
     }
 
     @RequiresPermissions("newhome:newPageFirstNavigation:view")
     @RequestMapping(value = "form")
     public String form(NewPageFirstNavigation newPageFirstNavigation, Model model) {
+        Integer number = newPageFirstNavigationService.getNumber("www", null);
         model.addAttribute("newPageFirstNavigation", newPageFirstNavigation);
+        model.addAttribute("number", number);
         return "modules/newhome/newPageFirstNavigationForm";
     }
 
@@ -89,15 +93,21 @@ public class NewPageFirstNavigationController extends BaseController {
             return form(newPageFirstNavigation, model);
         }
         // 判断如果已经存在10条数据则不允许添加(产品控制数量显示)
-        NewPageFirstNavigation navigation = new NewPageFirstNavigation();
+        /*NewPageFirstNavigation navigation = new NewPageFirstNavigation();
         navigation.setType(newPageFirstNavigation.getType());
-        /*List<NewPageFirstNavigation> list = newPageFirstNavigationService.findList(navigation);
+        List<NewPageFirstNavigation> list = newPageFirstNavigationService.findList(navigation);
         if (StringUtils.isEmpty(newPageFirstNavigation.getId())) {
             if (CollectionUtils.isNotEmpty(list) && list.size() >= 10) {
                 addMessage(model, "最多添加10个主菜单!删除旧菜单后才能继续添加");
                 return form(newPageFirstNavigation, model);
             }
         }*/
+        Integer number = newPageFirstNavigationService.getNumber("www", null);
+        if (!"2".equals(newPageFirstNavigation.getType()) && null != number && number >= 8 && "1".equals(newPageFirstNavigation.getWwwEnabledStatus())) {
+            addMessage(redirectAttributes, "网站端最多只能启用8个菜单,请停用其他菜单后再重新添加");
+            model.addAttribute("message", "网站端最多只能启用8个菜单,请停用其他菜单后再重新添加");
+            return form(newPageFirstNavigation, model);
+        }
         // 上传图片
         if ("2".equals(newPageFirstNavigation.getType())) {
             String image = newPageFirstNavigation.getIcon();
@@ -132,12 +142,24 @@ public class NewPageFirstNavigationController extends BaseController {
     @RequiresPermissions("newhome:newPageFirstNavigation:edit")
     @ResponseBody
     @RequestMapping(value = "updateEnabledStatus")
-    public Map<String, Object> updateEnabledStatus(String enabledStatus, String[] ids, String www, String[] supplierIDs, HttpServletRequest request, HttpServletResponse response) {
+    public Map<String, Object> updateEnabledStatus(String enabledStatus, String[] ids, String www, String type, String[] supplierIDs, HttpServletRequest request, HttpServletResponse response) {
         Map<String, Object> map = Maps.newLinkedHashMap();
         try {
-            newPageFirstNavigationService.updateEnabledStatusByIds(enabledStatus, ids);
-            map.put("success", true);
-            map.put("msg", "修改成功");
+            Integer number = newPageFirstNavigationService.getNumber(www, null);
+            if ("0".equals(enabledStatus)) {
+                newPageFirstNavigationService.updateEnabledStatusByIds(enabledStatus, ids);
+                map.put("success", true);
+                map.put("msg", "修改成功");
+            } else {
+                if (("0".equals(type) && null != number && number < 8) || "2".equals(type)) {
+                    newPageFirstNavigationService.updateEnabledStatusByIds(enabledStatus, ids);
+                    map.put("success", true);
+                    map.put("msg", "修改成功");
+                } else {
+                    map.put("success", false);
+                    map.put("msg", "网站端最多只能启用8个菜单,请停用其他菜单后再重新启用本菜单。");
+                }
+            }
             cleanRedisCache();// 清理缓存
         } catch (Exception e) {
             logger.debug(e.toString(), e);

+ 5 - 2
src/main/java/com/caimei/modules/user/service/ClubPortraitService.java

@@ -9,6 +9,7 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.DecimalFormat;
 import java.text.NumberFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -739,11 +740,13 @@ public class ClubPortraitService {
                     unActive += clubData.getNumber();
                 }
             }
-            orderPortrait.setName("活跃机构 " + MathUtil.mul(MathUtil.div(active, max, 2), 100) + "%" + active + " 个");
+            // 格式化,去除小数点后位数
+            DecimalFormat df = new DecimalFormat("#");
+            orderPortrait.setName("活跃机构 " + df.format(MathUtil.mul(MathUtil.div(active, max), 100, 2).doubleValue()) + "% " + active + "  个");
             orderPortrait.setValue(active);
             orderPortraits.add(orderPortrait);
             orderPortrait = new OrderPortrait();
-            orderPortrait.setName("不活跃机构 " + MathUtil.mul(MathUtil.div(unActive, max, 2), 100) + "%" + unActive + " 个");
+            orderPortrait.setName("不活跃机构 " + df.format(MathUtil.mul(MathUtil.div(unActive, max), 100, 2).doubleValue()) + "% " + unActive + "  个");
             orderPortrait.setValue(unActive);
             orderPortraits.add(orderPortrait);
             clubSales.setClubProportionTotal(max);

+ 12 - 0
src/main/resources/mappings/modules/newhome/NewPageFirstNavigationMapper.xml

@@ -127,6 +127,18 @@
 		WHERE id = #{id}
 	</delete>
 
+	<select id="getEnableNumber" resultType="java.lang.Integer">
+		select id from new_page_first_navigation
+		<where>
+			delFlag = 0 and (type = 0 OR type IS NULL)
+			<if test="www != null and www != ''">
+				and wwwEnabledStatus = 1
+			</if>
+			<if test="crm != null and crm != ''">
+				and crmEnabledStatus = 1
+			</if>
+		</where>
+	</select>
 	<update id="updateEnabledStatusByIds">
 		UPDATE new_page_first_navigation a SET a.wwwEnabledStatus = #{param1}
 		WHERE  a.id IN

+ 7 - 6
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -106,7 +106,6 @@
         LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = a.clubId
         LEFT JOIN (SELECT userID, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON a.userID = covs.userID
         LEFT JOIN (SELECT userID, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) AS coas ON coas.userID = a.userID
-        left join (select clubId, label, dynamicStatus, addTime from cm_club_label) ccl on ccl.clubId = a.clubId
         <where>
             (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 AND u.userIdentity != 8
             <if test="clubID != null and clubID != ''">
@@ -163,16 +162,16 @@
                 OR cpr.createTime <![CDATA[ <= ]]> #{allocationEndTime})
             </if>
             <if test="trendsLabel != null and trendsLabel != ''">
-                AND ccl.label like concat('%', #{trendsLabel}, '%')
+                AND a.clubId in (select clubId from cm_club_label where label like concat('%', #{trendsLabel}, '%') AND dynamicStatus = 0)
             </if>
             <if test="stateLabel != null and stateLabel != ''">
-                AND ccl.label like concat('%', #{trendsLabel}, '%')
+                AND a.clubId in (select clubId from cm_club_label where label like concat('%', #{stateLabel}, '%') AND dynamicStatus = 1)
             </if>
             <if test="labelStartTime != null and labelStartTime != ''">
-                AND ccl.addTime <![CDATA[ >= ]]> #{labelStartTime}
+                AND a.clubId in (select clubId from cm_club_label where addTime <![CDATA[ >= ]]> #{labelStartTime})
             </if>
             <if test="labelEndTime != null and labelEndTime != ''">
-                AND ccl.addTime <![CDATA[ <= ]]> #{labelEndTime})
+                AND a.clubId in (select clubId from cm_club_label where addTime <![CDATA[ <= ]]> #{labelEndTime})
             </if>
             <if test="startLoginTime != null and startLoginTime != ''">
                 AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR a.clubId in (select a.clubId
@@ -1486,7 +1485,9 @@
         LEFT JOIN city ct ON ct.cityID = c.cityID
         LEFT JOIN province d ON d.provinceID = c.provinceID
         LEFT JOIN (SELECT userId, MAX(accessTime) AS accessTime FROM cm_behavior_record WHERE delFlag = 0 AND userId != 0 GROUP BY userId) cb ON cb.userId = c.userId
-        LEFT JOIN (SELECT clubId, addTime FROM cm_club_remarks UNION SELECT clubId, addTime FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '') ccr ON ccr.clubId = c.clubId
+        LEFT JOIN (SELECT clubId, ADDTIME FROM (SELECT clubId, ADDTIME FROM cm_club_remarks
+                UNION SELECT clubId, ADDTIME FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '') remark
+                GROUP BY remark.clubId ORDER BY remark.addTime DESC) ccr ON ccr.clubId = c.clubId
         LEFT JOIN (SELECT userId, MAX(orderTime) AS orderTime FROM cm_shop_order  GROUP BY userId) cso ON cso.userId = c.userId
         <where>
             coas.stage = 0

+ 9 - 1
src/main/webapp/WEB-INF/views/modules/newhome/newPageFirstNavigationForm.jsp

@@ -82,6 +82,13 @@
 						alertx("请上传图标");
 						return;
 					}
+					const type = $('#type').val()
+					const number = $('#number').val()
+					const status = $('.wwwEnabledStatus').val()
+					if (type != 2 && '1' == status && number >= 8) {
+						top.$.jBox.confirm("网站端最多只能启用8个菜单,请停用其他菜单后再重新启用本菜单。", "提示");
+						return;
+					}
 					loading('正在提交,请稍等...');
 					form.submit();
 				},
@@ -169,6 +176,7 @@
 	</ul><br/>
 	<form:form id="inputForm" modelAttribute="newPageFirstNavigation" action="${ctx}/newhome/newPageFirstNavigation/save" method="post" class="form-horizontal">
 		<form:hidden path="id"/>
+		<input id="number" name="number" type="hidden" value="${number}"/>
 		<form:hidden path="type"/>
 		<sys:message content="${message}"/>
 		<div class="control-group">
@@ -212,7 +220,7 @@
 		<div class="control-group">
 			<label class="control-label"><font color="red">*</font>网站状态:</label>
 			<div class="controls">
-				<form:select path="wwwEnabledStatus" class="input-xlarge ">
+				<form:select path="wwwEnabledStatus" class="input-xlarge wwwEnabledStatus">
 					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 				</form:select>
 			</div>

+ 8 - 1
src/main/webapp/WEB-INF/views/modules/newhome/newPageFirstNavigationList.jsp

@@ -21,13 +21,19 @@
 
 		//PC端状态修改
 		function updateEnabledStatus(status,ids,www){
+			const number = $('#number').val()
+			const type = $('#type').val()
 			var msg='确定启用该菜单吗?';
 			if('0'==status){
 				msg='确定停用该菜单吗?';
 			}
+			if (type != 2 && '1'==status && number >= 8) {
+				top.$.jBox.confirm("网站端最多只能启用8个菜单,请停用其他菜单后再重新启用本菜单。", "提示");
+				return;
+			}
 			top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
 				if(v=='ok'){
-					$.post("${ctx}/newhome/newPageFirstNavigation/updateEnabledStatus",{'enabledStatus':status,'ids':ids,'www':www}, function(data) {
+					$.post("${ctx}/newhome/newPageFirstNavigation/updateEnabledStatus",{'enabledStatus':status,'ids':ids,'www':www, 'type': type}, function(data) {
 						if(true==data.success){
 							$.jBox.tip(data.msg, 'info');
 						} else {
@@ -118,6 +124,7 @@
 <form:form id="searchForm" modelAttribute="newPageFirstNavigation" action="${ctx}/newhome/newPageFirstNavigation" method="get" class="breadcrumb form-search">
 	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<input id="number" name="number" type="hidden" value="${number}"/>
 	<input id="type" name="type" type="hidden" value="${newPageFirstNavigation.type}"/>
 	<c:if test="${newPageFirstNavigation.type==2}">
 		<label>点击时间:</label>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/newhome/newPageHomeimageForm.jsp

@@ -75,7 +75,7 @@
 				<sys:ckfinder input="crmImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
 			</div>
 			<div class="controls" style="padding-top: 20px;">
-				<p style="color:#D0D0D0 ;">建议尺寸:750 * 366 / PX</p>
+				<p style="color:#D0D0D0 ;">建议尺寸:702 * 280 / PX</p>
 			</div>
 		</div>
 		<div class="control-group">

+ 9 - 3
src/main/webapp/WEB-INF/views/modules/userNew/activeClubInfoList.jsp

@@ -389,9 +389,6 @@
     }
 
     $(function () {
-        console.log('$("#orderByType").val()', $("#orderByType").val());
-        console.log('$("#activeStatus").val()', $("#activeStatus").val());
-        console.log('----****-----', $('#activeStatus').val());
         const activeStatus = $('#activeStatus').val() * 1;
         if (activeStatus === 0) {
             // 活跃机构
@@ -437,6 +434,15 @@
             $('#searchForm').submit();
         })
     })
+    function stringToDate(dateString) {
+        const parts = dateString.split(/[- :]/);
+        return new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);
+    }
+    // 当天0点0分时间
+    function getZeroTimeToday() {
+        const today = new Date();
+        return new Date(today.getFullYear(), today.getMonth(), today.getDate());
+    }
 </script>
 </body>
 </html>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/userNew/cmClubSales.jsp

@@ -108,7 +108,7 @@
                 <H4 class="H_tag">机构活跃占比</H4>
                 <a id="clubActiceDetails" href="${ctx}/new/user/agency/findActiveClubInfo?orderByType=1&activeStatus=0">详情></a>
             </div>
-            <div class="box-eachts">
+            <div class="box-eachts"  style="height: 350px">
                 <div class="eachts-data" id="clubProportion" style="">
                     <!-- keyWordsEacths表 -->
                 </div>

+ 5 - 2
src/main/webapp/static/modules/cmClubSales/cmClubSales.css

@@ -24,10 +24,10 @@
     border-radius: 10px;
 }
 .flex-content .flex-box.max{
-    width: 60%;
+    width: 1000px;
 }
 .flex-content .flex-box.clubProportion{
-    width: 21.5%;
+    width: 400px;
 }
 .flex-content .flex-box.box1{
     width: 1415px;
@@ -52,6 +52,9 @@
     font-weight: normal;
     color: #40E0D0;
 }
+#clubActiceDetails {
+    float: right;
+}
 .flex-box .box-title span em{
     font-style: normal;
     font-weight: normal;

+ 1 - 1
src/main/webapp/static/modules/cmClubSales/cmClubSalesEachs.js

@@ -469,7 +469,7 @@ const getclubProportionEacths = function (handleFn,id,data) {
             {
                 name: data.name,
                 type: 'pie',
-                radius: ['50%', '70%'],
+                radius: ['30%', '50%'],
                 center: ['50%', '50%'],
                 avoidLabelOverlap: false,
                 emphasis: {