Browse Source

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

# Conflicts:
#	src/main/java/com/caimei365/manager/service/caimei/impl/KeyWordServiceImpl.java
huangzhiguo 1 year ago
parent
commit
fa0eb6e574

+ 68 - 0
src/main/java/com/caimei365/manager/config/GlobalControllerAdvice.java

@@ -0,0 +1,68 @@
+package com.caimei365.manager.config;
+
+import cn.hutool.core.date.DateUtil;
+import com.caimei365.manager.entity.ResponseJson;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.WebDataBinder;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.ConstraintViolation;
+import javax.validation.ConstraintViolationException;
+import java.beans.PropertyEditorSupport;
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Set;
+
+import static cn.hutool.core.date.DatePattern.NORM_DATETIME_PATTERN;
+import static cn.hutool.core.date.DatePattern.NORM_DATE_PATTERN;
+@Slf4j
+@ControllerAdvice
+public class GlobalControllerAdvice {
+
+    @ResponseBody
+    @ExceptionHandler(value = ConstraintViolationException.class)
+    public ResponseJson ConstraintViolationExceptionHandler(ConstraintViolationException ex) {
+        Set<ConstraintViolation<?>> constraintViolations = ex.getConstraintViolations();
+        Iterator<ConstraintViolation<?>> iterator = constraintViolations.iterator();
+        String msg ="入参错误!";
+        if (iterator.hasNext()) {
+            ConstraintViolation<?> cvl = iterator.next();
+            msg=cvl.getPropertyPath().toString().split("\\.")[1] + " " + cvl.getMessageTemplate();
+        }
+        return ResponseJson.error(msg);
+    }
+
+    @ResponseBody
+    @ExceptionHandler(value = Exception.class)
+    public ResponseJson Exception(HttpServletRequest request, Exception e){
+        log.error("出错了:[\u001B[31m {} \u001B[0m]",e.toString());
+        e.printStackTrace();
+        return ResponseJson.error("操作失败!");
+    }
+
+    @InitBinder
+    public void initBinder(WebDataBinder binder) {
+        binder.registerCustomEditor(LocalDateTime.class, new PropertyEditorSupport() {
+            @Override
+            public void setAsText(String text) {
+                if (StringUtils.isNotBlank(text)) {
+                    setValue(DateUtil.parseLocalDateTime(text));
+                }
+            }
+        });
+        binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
+            @Override
+            public void setAsText(String text) {
+                if (StringUtils.isNotBlank(text)) {
+                    setValue(DateUtil.parse(text, NORM_DATETIME_PATTERN, NORM_DATE_PATTERN));
+                }
+            }
+        });
+    }
+}

+ 241 - 1
src/main/java/com/caimei365/manager/config/utils/DateUtil.java

@@ -1,11 +1,17 @@
 package com.caimei365.manager.config.utils;
 package com.caimei365.manager.config.utils;
 
 
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
 
 
-public class DateUtil {
+public class DateUtil extends org.apache.commons.lang3.time.DateUtils {
+    private static String[] parsePatterns = {
+            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
+            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
+            "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
     private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
     private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
     private static Calendar calendar = Calendar.getInstance();
     private static Calendar calendar = Calendar.getInstance();
 
 
@@ -52,6 +58,240 @@ public class DateUtil {
         return format;
         return format;
     }
     }
 
 
+
+    /**
+     * 得到当前日期字符串 格式(yyyy-MM-dd)
+     */
+    public static String getDate() {
+        return getDate("yyyy-MM-dd");
+    }
+
+    /**
+     * 得到当前日期字符串 格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E"
+     */
+    public static String getDate(String pattern) {
+        return DateFormatUtils.format(new Date(), pattern);
+    }
+
+    /**
+     * 得到当前日期字符串 格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E"
+     */
+    public static String setDate(Date date, String pattern) {
+        if (date == null) {
+            return "";
+        }
+        return DateFormatUtils.format(date, pattern);
+    }
+    /**
+     * 得到当前日期字符串 格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E"
+     */
+    public static Date setFormatDate(String dateString, String pattern) {
+        Date date = null;
+        try {
+            date = new SimpleDateFormat(pattern).parse(dateString);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 得到日期字符串 默认格式(yyyy-MM-dd) pattern可以为:"yyyy-MM-dd" "HH:mm:ss" "E"
+     */
+    public static String formatDate(Date date, Object... pattern) {
+        String formatDate = null;
+        if (pattern != null && pattern.length > 0) {
+            formatDate = DateFormatUtils.format(date, pattern[0].toString());
+        } else {
+            formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
+        }
+        return formatDate;
+    }
+
+
+    /**
+     * 得到日期时间字符串,转换格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public static String formatDateTime(Date date) {
+        return formatDate(date, "yyyy-MM-dd HH:mm:ss");
+    }
+
+
+    /**
+     * 得到当前时间字符串 格式(HH:mm:ss)
+     */
+    public static String getTime() {
+        return formatDate(new Date(), "HH:mm:ss");
+    }
+
+    /**
+     * 得到当前日期和时间字符串 格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public static String getDateTime() {
+        return formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
+    }
+
+    /**
+     * 得到当前年份字符串 格式(yyyy)
+     */
+    public static String getYear() {
+        return formatDate(new Date(), "yyyy");
+    }
+
+    /**
+     * 得到当前月份字符串 格式(MM)
+     */
+    public static String getMonth() {
+        return formatDate(new Date(), "MM");
+    }
+
+    /**
+     * 得到当天字符串 格式(dd)
+     */
+    public static String getDay() {
+        return formatDate(new Date(), "dd");
+    }
+
+    /**
+     * 得到当前星期字符串 格式(E)星期几
+     */
+    public static String getWeek() {
+        return formatDate(new Date(), "E");
+    }
+
+    /**
+     * 日期型字符串转化为日期 格式
+     * { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm",
+     * "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm",
+     * "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm" }
+     */
+    public static Date parseDate(Object str) {
+        if (str == null) {
+            return null;
+        }
+        try {
+            return parseDate(str.toString(), parsePatterns);
+        } catch (ParseException e) {
+            return null;
+        }
+    }
+
+    /**
+     * 获取过去的天数
+     *
+     * @param date
+     * @return
+     */
+    public static long pastDays(Date date) {
+        long t = new Date().getTime() - date.getTime();
+        return t / (24 * 60 * 60 * 1000);
+    }
+
+    /**
+     * 获取过去的小时
+     *
+     * @param date
+     * @return
+     */
+    public static long pastHour(Date date) {
+        long t = new Date().getTime() - date.getTime();
+        return t / (60 * 60 * 1000);
+    }
+
+    /**
+     * 获取过去的分钟
+     *
+     * @param date
+     * @return
+     */
+    public static long pastMinutes(Date date) {
+        long t = new Date().getTime() - date.getTime();
+        return t / (60 * 1000);
+    }
+
+    /**
+     * 转换为时间(天,时:分:秒.毫秒)
+     *
+     * @param timeMillis
+     * @return
+     */
+    public static String formatDateTime(long timeMillis) {
+        long day = timeMillis / (24 * 60 * 60 * 1000);
+        long hour = (timeMillis / (60 * 60 * 1000) - day * 24);
+        long min = ((timeMillis / (60 * 1000)) - day * 24 * 60 - hour * 60);
+        long s = (timeMillis / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+        long sss = (timeMillis - day * 24 * 60 * 60 * 1000 - hour * 60 * 60 * 1000 - min * 60 * 1000 - s * 1000);
+        return (day > 0 ? day + "," : "") + hour + ":" + min + ":" + s + "." + sss;
+    }
+
+    /**
+     * 获取两个日期之间的天数
+     *
+     * @param before
+     * @param after
+     * @return
+     */
+    public static double getDistanceOfTwoDate(Date before, Date after) {
+        long beforeTime = before.getTime();
+        long afterTime = after.getTime();
+        return (afterTime - beforeTime) / (1000 * 60 * 60 * 24);
+    }
+
+    /**
+     * @param nowTime   当前时间
+     * @param startTime 开始时间
+     * @param endTime   结束时间
+     * @return
+     * @author sunran   判断当前时间在时间区间内
+     */
+    public static boolean isEffectiveDate(Date nowTime, Date startTime, Date endTime) {
+        if (nowTime.getTime() == startTime.getTime()
+                || nowTime.getTime() == endTime.getTime()) {
+            return true;
+        }
+
+        Calendar date = Calendar.getInstance();
+        date.setTime(nowTime);
+
+        Calendar begin = Calendar.getInstance();
+        begin.setTime(startTime);
+
+        Calendar end = Calendar.getInstance();
+        end.setTime(endTime);
+
+        if (date.after(begin) && date.before(end)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+    /**
+     * 获取当天00:00:00的时间戳
+     *
+     * @return 时间戳
+     */
+    public static Date getStartTime(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        return calendar.getTime();
+    }
+
+    /**
+     * 获取当天23:59:59的时间戳
+     *
+     * @return 时间戳
+     */
+    public static Date getEndTime(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        calendar.set(Calendar.MINUTE, 59);
+        calendar.set(Calendar.SECOND, 59);
+        return calendar.getTime();
+    }
 //    public static void main(String[] args) throws ParseException {
 //    public static void main(String[] args) throws ParseException {
 //        String month = "2020-02";
 //        String month = "2020-02";
 //        System.out.println(getMinDateMonth(month));
 //        System.out.println(getMinDateMonth(month));

+ 39 - 0
src/main/java/com/caimei365/manager/controller/caimei/HomeApi.java

@@ -1,12 +1,17 @@
 package com.caimei365.manager.controller.caimei;
 package com.caimei365.manager.controller.caimei;
 
 
+import cn.hutool.core.date.DateTime;
+import com.caimei365.manager.config.utils.DateUtil;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.service.caimei.HomeService;
 import com.caimei365.manager.service.caimei.HomeService;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -15,6 +20,7 @@ import java.util.Map;
  * @author : Charles
  * @author : Charles
  * @date : 2022/3/23
  * @date : 2022/3/23
  */
  */
+@Validated
 @RestController
 @RestController
 @RequestMapping("/home")
 @RequestMapping("/home")
 public class HomeApi {
 public class HomeApi {
@@ -28,4 +34,37 @@ public class HomeApi {
     public ResponseJson<Map<String, Object>> getDashboardData() {
     public ResponseJson<Map<String, Object>> getDashboardData() {
         return homeService.getDashboardData();
         return homeService.getDashboardData();
     }
     }
+
+    /**
+     * 机构统计
+     */
+    @GetMapping("/getClubCount")
+    public ResponseJson<Map<String, Object>> getClubCount(Date startCreateTime, Date endCreateTime) {
+        if (null != endCreateTime) {
+            endCreateTime = DateUtil.getEndTime(endCreateTime);
+        }
+        return homeService.getClubCount(startCreateTime, endCreateTime);
+    }
+
+    /**
+     * 机构趋势
+     */
+    @GetMapping("/getClubTrend")
+    public ResponseJson<Map<String, Object>> getClubTrend(Date startCreateTime, Date endCreateTime) {
+        if (null != endCreateTime) {
+            endCreateTime = DateUtil.getEndTime(endCreateTime);
+        }
+        return homeService.getClubTrend(startCreateTime, endCreateTime);
+    }
+
+    /**
+     * 访问统计
+     */
+    @GetMapping("/getAccessRecordCount")
+    public ResponseJson<Map<String, Object>> getAccessRecordCount(Date startCreateTime, Date endCreateTime) {
+        if (null != endCreateTime) {
+            endCreateTime = DateUtil.getEndTime(endCreateTime);
+        }
+        return homeService.getAccessRecordCount(startCreateTime, endCreateTime);
+    }
 }
 }

+ 4 - 1
src/main/java/com/caimei365/manager/controller/caimei/user/CustomerApi.java

@@ -2,6 +2,7 @@ package com.caimei365.manager.controller.caimei.user;
 
 
 import com.caimei365.manager.config.security.ConstantKey;
 import com.caimei365.manager.config.security.ConstantKey;
 import com.caimei365.manager.config.security.JwtService;
 import com.caimei365.manager.config.security.JwtService;
+import com.caimei365.manager.config.utils.DateUtil;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.CmShop;
@@ -359,7 +360,9 @@ public class CustomerApi {
     public ResponseJson<PaginationVo<CmShopAdvertisingImage>> getShopAdvertisingImage(CmShopAdvertisingImage cmShopAdvertisingImage,
     public ResponseJson<PaginationVo<CmShopAdvertisingImage>> getShopAdvertisingImage(CmShopAdvertisingImage cmShopAdvertisingImage,
                                                                                       @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                                       @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                                       @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
                                                                                       @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
-
+        if (null != cmShopAdvertisingImage.getEndPvCreateTime()) {
+            cmShopAdvertisingImage.setEndPvCreateTime(DateUtil.getEndTime(cmShopAdvertisingImage.getEndPvCreateTime()));
+        }
         return customerService.getShopAdvertisingImage(cmShopAdvertisingImage, pageNum, pageSize);
         return customerService.getShopAdvertisingImage(cmShopAdvertisingImage, pageNum, pageSize);
     }
     }
 
 

+ 47 - 0
src/main/java/com/caimei365/manager/dao/HomeDao.java

@@ -1,6 +1,11 @@
 package com.caimei365.manager.dao;
 package com.caimei365.manager.dao;
 
 
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * Description
  * Description
@@ -18,12 +23,54 @@ public interface HomeDao {
      * 统计采美商品数量
      * 统计采美商品数量
      */
      */
     int countAllProducts();
     int countAllProducts();
+
     /**
     /**
      * 统计采美订单数量
      * 统计采美订单数量
      */
      */
     int countAllOrders();
     int countAllOrders();
+
     /**
     /**
      * 统计采美订单总额
      * 统计采美订单总额
      */
      */
     int countAllOrderMoney();
     int countAllOrderMoney();
+
+
+    /**
+     * 机构统计
+     */
+    int countClub(@Param("userIdentity") Integer userIdentity, @Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 机构活跃度统计
+     */
+    int countClubActivity( @Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 机构订单趋势
+     */
+    int countClubOrder(@Param("userIdentity") Integer userIdentity, @Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 机构咨询统计
+     */
+    int countClubRemarks(@Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 游客咨询统计
+     */
+    int countClubVisitorRemarks(@Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 访问统计
+     */
+    int countRecord(@Param("userId") Integer userId, @Param("userIdentity") Integer userIdentity, @Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     *
+     * 热门商品
+     */
+    List<Map<String, String>> countProductSalesRecord(@Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     *
+     * 热门品牌
+     */
+    List<Map<String, String>>  countBrandProductSalesRecord(@Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
+    /**
+     * 热门搜索词
+     */
+    List<String> countKeyword(@Param("startCreateTime") Date startCreateTime, @Param("endCreateTime") Date endCreateTime);
 }
 }

+ 1 - 0
src/main/java/com/caimei365/manager/dao/KeyWordDao.java

@@ -8,6 +8,7 @@ import com.caimei365.manager.entity.caimei.cmUser.ServiceProviderModel;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 

+ 1 - 1
src/main/java/com/caimei365/manager/dao/WeChatDao.java

@@ -39,7 +39,7 @@ public interface WeChatDao {
      * 根据父级Id统计同级别菜单数量
      * 根据父级Id统计同级别菜单数量
      * @param parentId 父级ID
      * @param parentId 父级ID
      */
      */
-    Integer countChildByParentId(Integer parentId);
+    Integer countChildByParentId(Integer parentId,String wxType);
 
 
     /**
     /**
      * 获取微信公众号菜单列表
      * 获取微信公众号菜单列表

+ 11 - 0
src/main/java/com/caimei365/manager/entity/caimei/KeyWord.java

@@ -2,6 +2,7 @@ package com.caimei365.manager.entity.caimei;
 
 
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 import lombok.experimental.Accessors;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -76,4 +77,14 @@ public class KeyWord implements Serializable {
      * shi发支持选择
      * shi发支持选择
      */
      */
     private Boolean flag;
     private Boolean flag;
+
+    //点击量统计
+    /** 开始点击量时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startPvCreateTime;
+    /** 结束点击量时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endPvCreateTime;
+    /** 点击量 */
+    private Integer pv;
 }
 }

+ 12 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/CmShopAdvertisingImage.java

@@ -1,8 +1,10 @@
 package com.caimei365.manager.entity.caimei.cmUser;
 package com.caimei365.manager.entity.caimei.cmUser;
 
 
 import com.caimei365.manager.entity.caimei.CmShop;
 import com.caimei365.manager.entity.caimei.CmShop;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -50,6 +52,16 @@ public class CmShopAdvertisingImage {
      * 删除标记:0未删除,1已删除
      * 删除标记:0未删除,1已删除
      */
      */
     private Integer delFlag;
     private Integer delFlag;
+
+    //点击量统计
+    /** 开始点击量时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startPvCreateTime;
+    /** 结束点击量时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endPvCreateTime;
+    /** 点击量 */
+    private Integer pv;
     /**
     /**
      * 供应商信息
      * 供应商信息
      */
      */

+ 14 - 0
src/main/java/com/caimei365/manager/service/caimei/HomeService.java

@@ -1,7 +1,9 @@
 package com.caimei365.manager.service.caimei;
 package com.caimei365.manager.service.caimei;
 
 
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.ResponseJson;
+import org.apache.ibatis.annotations.Param;
 
 
+import java.util.Date;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -15,4 +17,16 @@ public interface HomeService {
      * 仪表盘数据
      * 仪表盘数据
      */
      */
     ResponseJson<Map<String, Object>> getDashboardData();
     ResponseJson<Map<String, Object>> getDashboardData();
+    /**
+     * 机构统计
+     */
+    ResponseJson<Map<String, Object>> getClubCount(Date startCreateTime, Date endCreateTime);
+    /**
+     * 机构趋势
+     */
+    ResponseJson<Map<String, Object>> getClubTrend(Date startCreateTime, Date endCreateTime);
+    /**
+     * 访问统计
+     */
+    ResponseJson<Map<String, Object>> getAccessRecordCount(Date startCreateTime, Date endCreateTime);
 }
 }

+ 167 - 2
src/main/java/com/caimei365/manager/service/caimei/impl/HomeServiceImpl.java

@@ -1,5 +1,6 @@
 package com.caimei365.manager.service.caimei.impl;
 package com.caimei365.manager.service.caimei.impl;
 
 
+import com.caimei365.manager.config.utils.DateUtil;
 import com.caimei365.manager.dao.HomeDao;
 import com.caimei365.manager.dao.HomeDao;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.service.caimei.HomeService;
 import com.caimei365.manager.service.caimei.HomeService;
@@ -7,8 +8,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
+import javax.xml.crypto.Data;
+import java.util.*;
 
 
 /**
 /**
  * Description
  * Description
@@ -21,6 +22,8 @@ import java.util.Map;
 public class HomeServiceImpl implements HomeService {
 public class HomeServiceImpl implements HomeService {
     @Resource
     @Resource
     private HomeDao homeDao;
     private HomeDao homeDao;
+
+
     /**
     /**
      * 仪表盘数据
      * 仪表盘数据
      */
      */
@@ -41,4 +44,166 @@ public class HomeServiceImpl implements HomeService {
         data.put("money", money);
         data.put("money", money);
         return ResponseJson.success(data);
         return ResponseJson.success(data);
     }
     }
+
+    @Override
+    public ResponseJson<Map<String, Object>> getClubCount(Date startCreateTime, Date endCreateTime) {
+        int count = homeDao.countClub(null, startCreateTime, endCreateTime);
+        //机构统计
+        Map<String, Object> dataClub = new LinkedHashMap<>(5);
+        dataClub.put("个人机构", homeDao.countClub(1, startCreateTime, endCreateTime));
+        dataClub.put("医美机构", homeDao.countClub(2, startCreateTime, endCreateTime));
+        dataClub.put("生美机构", homeDao.countClub(3, startCreateTime, endCreateTime));
+        dataClub.put("项目公司", homeDao.countClub(4, startCreateTime, endCreateTime));
+        dataClub.put("其他", homeDao.countClub(-1, startCreateTime, endCreateTime));
+
+        Map<String, Object> mapclubCount = new HashMap<>(3);
+        mapclubCount.put("name", "机构统计");
+        mapclubCount.put("count", count);
+        mapclubCount.put("data", dataClub);
+
+        // 机构活跃度统计
+        Map<String, Object> clubActivity = new LinkedHashMap<>(2);
+        int countClubActivity = homeDao.countClubActivity(startCreateTime, endCreateTime);
+        clubActivity.put("活跃机构", countClubActivity);
+        clubActivity.put("不活跃机构",count-countClubActivity);
+
+        Map<String, Object> mapclubActivityCount = new HashMap<>(3);
+        mapclubActivityCount.put("name", "机构活跃度统计");
+        mapclubActivityCount.put("count", count);
+        mapclubActivityCount.put("data", clubActivity);
+
+        //封装数据
+        Map<String, Object> data = new HashMap<>(2);
+        data.put("clubCount", mapclubCount);
+        data.put("clubActivityCount", mapclubActivityCount);
+        return ResponseJson.success(data);
+    }
+
+    @Override
+    public ResponseJson<Map<String, Object>> getClubTrend(Date startCreateTime, Date endCreateTime) {
+        List<Map<String, Object>> mapCreateTimeList = setCreateTime(startCreateTime, endCreateTime);
+        //机构新增趋势
+        Map<String, Object> dataClub = new LinkedHashMap<>(5);
+        dataClub.put("个人机构", setClubTrend(1,1,mapCreateTimeList));
+        dataClub.put("医美机构", setClubTrend(1,2,mapCreateTimeList));
+        dataClub.put("生美机构", setClubTrend(1,3,mapCreateTimeList));
+        dataClub.put("项目公司", setClubTrend(1,4,mapCreateTimeList));
+        dataClub.put("其他", setClubTrend(1,-1,mapCreateTimeList));
+
+        Map<String, Object> mapclubCount = new HashMap<>(3);
+        mapclubCount.put("name", "机构新增趋势");
+        mapclubCount.put("count", homeDao.countClub(null, startCreateTime, endCreateTime));
+        mapclubCount.put("data", dataClub);
+
+
+        // 机构订单趋势
+        Map<String, Object> clubOrder = new LinkedHashMap<>(5);
+        clubOrder.put("个人机构", setClubTrend(2,1,mapCreateTimeList));
+        clubOrder.put("医美机构", setClubTrend(2,2,mapCreateTimeList));
+        clubOrder.put("生美机构", setClubTrend(2,3,mapCreateTimeList));
+        clubOrder.put("项目公司", setClubTrend(2,4,mapCreateTimeList));
+        clubOrder.put("其他", setClubTrend(2,-1,mapCreateTimeList));
+
+        Map<String, Object> mapclubOrder = new HashMap<>(3);
+        mapclubOrder.put("name", "机构订单趋势");
+        mapclubOrder.put("count", homeDao.countClubOrder(null, startCreateTime, endCreateTime));
+        mapclubOrder.put("data", clubOrder);
+
+        //封装数据
+        Map<String, Object> data = new HashMap<>(2);
+        data.put("clubCount", mapclubCount);
+        data.put("clubOrder", mapclubOrder);
+        return ResponseJson.success(data);
+    }
+
+    @Override
+    public ResponseJson<Map<String, Object>> getAccessRecordCount(Date startCreateTime, Date endCreateTime) {
+        // 咨询统计
+        int clubRemarks = homeDao.countClubRemarks(startCreateTime, endCreateTime);
+        int clubVisitorRemarks = homeDao.countClubVisitorRemarks(startCreateTime, endCreateTime);
+        Map<String, Object> countClubRemarks = new LinkedHashMap<>(2);
+        countClubRemarks.put("机构咨询", clubRemarks);
+        countClubRemarks.put("游客咨询", clubVisitorRemarks);
+
+        Map<String, Object> mapRemarks = new HashMap<>(3);
+        mapRemarks.put("name", "咨询统计");
+        mapRemarks.put("count", (clubRemarks + clubVisitorRemarks));
+        mapRemarks.put("data", countClubRemarks);
+
+        //访问统计
+        Map<String, Object> countRecord = new LinkedHashMap<>(7);
+        countRecord.put("个人机构", homeDao.countRecord(null, 1, startCreateTime, endCreateTime));
+        countRecord.put("医美机构", homeDao.countRecord(null, 2, startCreateTime, endCreateTime));
+        countRecord.put("生美机构", homeDao.countRecord(null, 3, startCreateTime, endCreateTime));
+        countRecord.put("项目公司", homeDao.countRecord(null, 4, startCreateTime, endCreateTime));
+        countRecord.put("其他", homeDao.countRecord(null, -1, startCreateTime, endCreateTime));
+        countRecord.put("游客", homeDao.countRecord(0, null, startCreateTime, endCreateTime));
+        countRecord.put("供应商", homeDao.countRecord(null, 5, startCreateTime, endCreateTime));
+
+        Map<String, Object> mapRecord = new HashMap<>(3);
+        mapRecord.put("name", "访问统计");
+        mapRecord.put("count", homeDao.countRecord(null, null, startCreateTime, endCreateTime));
+        mapRecord.put("data", countRecord);
+
+        // 热门品牌
+        List<Map<String, String>> mapBrandProductSalesRecord = homeDao.countBrandProductSalesRecord(startCreateTime, endCreateTime);
+        // 热门商品
+        List<Map<String, String>> mapProductSalesRecord = homeDao.countProductSalesRecord(startCreateTime, endCreateTime);
+        // 热门搜索词
+        List<String> mapKeyword = homeDao.countKeyword(startCreateTime, endCreateTime);
+
+        //封装数据
+        Map<String, Object> data = new HashMap<>(5);
+        data.put("record", mapRecord);
+        data.put("remarks", mapRemarks);
+        data.put("brandProductSalesRecords", mapBrandProductSalesRecord);
+        data.put("productSalesRecords", mapProductSalesRecord);
+        data.put("keywords", mapKeyword);
+        return ResponseJson.success(data);
+    }
+
+    public List<Map<String, Object>> setCreateTime(Date startCreateTime, Date endCreateTime) {
+        List<Map<String, Object>> list = new ArrayList<>();
+        // Calendar获取日期字符串
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(startCreateTime);
+        int ofTwoDate = (int) DateUtil.getDistanceOfTwoDate(startCreateTime, endCreateTime);
+        int ofTwoMonth = (int) ofTwoDate / 30;
+        int dates, cycle, count;
+        if (ofTwoMonth > 1) {
+            dates = ofTwoMonth;
+            cycle = Calendar.MONTH;
+            count = 1;
+        } else if (ofTwoMonth == 1 && ofTwoDate > 7) {
+            dates = 4;
+            cycle = Calendar.DATE;
+            count = 7;
+        } else {
+            dates = 7;
+            cycle = Calendar.DATE;
+            count = 1;
+        }
+        for (int i = 0; i < dates; i++) {
+            Map<String, Object> mapCreateTime = new HashMap<>(2);
+            mapCreateTime.put("startCreateTime", calendar.getTime());
+            calendar.add(cycle, count);
+            mapCreateTime.put("endCreateTime",calendar.getTime());
+            list.add(mapCreateTime);
+        }
+        return list;
+    }
+
+    public List<Map<String, Object>> setClubTrend(Integer type,Integer userType, List<Map<String, Object>> mapCreateTimeList) {
+        List<Map<String, Object>> list = new ArrayList<>();
+        Date startCreateTime, endCreateTime;
+        for (Map<String, Object> map : mapCreateTimeList) {
+            Map<String, Object> mapClubTrend = new HashMap<>(2);
+            startCreateTime = (Date) map.get("startCreateTime");
+            endCreateTime =(Date) map.get("endCreateTime");
+            mapClubTrend.put("time", DateUtil.setDate(startCreateTime,"yyyy/MM/dd"));
+            mapClubTrend.put("num", type==1?homeDao.countClub(userType, startCreateTime, endCreateTime):homeDao.countClubOrder(userType, startCreateTime, endCreateTime));
+            list.add(mapClubTrend);
+        }
+        return list;
+    }
 }
 }

+ 1 - 0
src/main/java/com/caimei365/manager/service/caimei/impl/KeyWordServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;

+ 1 - 1
src/main/java/com/caimei365/manager/service/wechat/impl/WechatMenuServiceImpl.java

@@ -153,7 +153,7 @@ public class WechatMenuServiceImpl implements WechatMenuService {
         }
         }
         menu.setWxType(parentMenu.getWxType());
         menu.setWxType(parentMenu.getWxType());
         // 根据父级Id统计同级别菜单数量
         // 根据父级Id统计同级别菜单数量
-        Integer count = weChatDao.countChildByParentId(menu.getParentId());
+        Integer count = weChatDao.countChildByParentId(menu.getParentId(),menu.getWxType());
         // 一级菜单
         // 一级菜单
         if (menu.getParentId() == 1 || menu.getParentId() == 2) {
         if (menu.getParentId() == 1 || menu.getParentId() == 2) {
             if (count >= 3) {
             if (count >= 3) {

+ 6 - 3
src/main/resources/config/beta/application-beta.yml

@@ -66,9 +66,12 @@ wechat:
     appid: wx0938e78f38bc203d
     appid: wx0938e78f38bc203d
     secret: a3b417fc249a964ad0df2813a1f19102
     secret: a3b417fc249a964ad0df2813a1f19102
   hehe:
   hehe:
-    id: gh_7890123
-    appid: wx7890123
-    secret: abc7890123
+#    id: gh_7890123
+#    appid: wx7890123
+#    secret: abc7890123
+    id: gh_4d0a30254952
+    appid: wx778caddd81b66a2f
+    secret: eb5987c766198f45d7f2c489b5fd5100
   caimei-old:
   caimei-old:
     id: gh_123456
     id: gh_123456
     appid: wx123456
     appid: wx123456

+ 4 - 0
src/main/resources/config/dev/application-dev.yml

@@ -83,3 +83,7 @@ fdfs:
     height: 150
     height: 150
   tracker-list:            #TrackerList参数,支持多个
   tracker-list:            #TrackerList参数,支持多个
     - 192.168.2.100:22122
     - 192.168.2.100:22122
+
+mybatis:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 4 - 0
src/main/resources/config/prod/application-prod.yml

@@ -68,6 +68,10 @@ wechat:
     appid: wx91c4152b60ca91a3
     appid: wx91c4152b60ca91a3
     secret: a563dd2c07c9c815a4e697c8b6cb73dc
     secret: a563dd2c07c9c815a4e697c8b6cb73dc
   hehe:
   hehe:
+    id: gh_4d0a30254952
+    appid: wx778caddd81b66a2f
+    secret: eb5987c766198f45d7f2c489b5fd5100
+  hehe-old:
     id: gh_eecada09617d
     id: gh_eecada09617d
     appid: wxd81864ddacc0ed25
     appid: wxd81864ddacc0ed25
     secret: 7873323db2984c75556f8d04e76d1f02
     secret: 7873323db2984c75556f8d04e76d1f02

+ 142 - 3
src/main/resources/mapper/HomeDao.xml

@@ -5,12 +5,151 @@
         SELECT IFNULL(COUNT(*), 0) FROM user
         SELECT IFNULL(COUNT(*), 0) FROM user
     </select>
     </select>
     <select id="countAllProducts" resultType="java.lang.Integer">
     <select id="countAllProducts" resultType="java.lang.Integer">
-        SELECT IFNULL(COUNT(*), 0) FROM product p left join cm_organize_product_info copi ON copi.productId = p.productId WHERE copi.validFlag != '0'
+        SELECT IFNULL(COUNT(*), 0)
+        FROM product p
+                 left join cm_organize_product_info copi ON copi.productId = p.productId
+        WHERE copi.validFlag != '0'
     </select>
     </select>
     <select id="countAllOrders" resultType="java.lang.Integer">
     <select id="countAllOrders" resultType="java.lang.Integer">
-        SELECT IFNULL(COUNT(*), 0) FROM cm_order WHERE delFlag != '0'
+        SELECT IFNULL(COUNT(*), 0)
+        FROM cm_order
+        WHERE delFlag != '0'
     </select>
     </select>
     <select id="countAllOrderMoney" resultType="java.lang.Integer">
     <select id="countAllOrderMoney" resultType="java.lang.Integer">
-        SELECT SUM(IFNULL(payTotalFee, 0)) FROM cm_order WHERE delFlag != '0'
+        SELECT SUM(IFNULL(payTotalFee, 0))
+        FROM cm_order
+        WHERE delFlag != '0'
     </select>
     </select>
+
+
+    <select id="countClub" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        WHERE 1=1 and u.userIdentity!=8
+        <if test="userIdentity != null and userIdentity !=-1">
+            and c.firstClubType=#{userIdentity}
+        </if>
+        <if test="userIdentity != null and userIdentity ==-1">
+            and (c.firstClubType not in(1,2,3,4) or c.firstClubType is null)
+        </if>
+        <if test="startCreateTime != null ">AND str_to_date(u.registerTime, '%Y-%m-%d') >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND str_to_date(u.registerTime, '%Y-%m-%d') <![CDATA[ <= ]]> #{endCreateTime}</if>
+    </select>
+
+    <select id="countClubActivity" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        WHERE 1=1 and u.userIdentity!=8
+        <if test="startCreateTime != null ">AND str_to_date(u.registerTime, '%Y-%m-%d') >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND str_to_date(u.registerTime, '%Y-%m-%d') <![CDATA[ <= ]]> #{endCreateTime}</if>
+        and (u.loginTime is not null
+        or c.userID  in(SELECT DISTINCT co.userID FROM cm_order co
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND co.orderTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND co.orderTime <![CDATA[ <= ]]> #{endCreateTime}</if>)
+        or c.clubId  in(SELECT DISTINCT ccr.clubId FROM cm_club_remarks ccr
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND ccr.addTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND ccr.addTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+        ))
+    </select>
+
+    <select id="countClubOrder" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM cm_order co
+        LEFT JOIN user u ON u.userID = co.userID
+        LEFT JOIN club c ON c.userID = u.userID
+        WHERE 1=1
+        <if test="userIdentity != null and userIdentity !=-1">
+            and c.firstClubType=#{userIdentity}
+        </if>
+        <if test="userIdentity != null and userIdentity ==-1">
+            and (c.firstClubType not in(1,2,3,4) or c.firstClubType is null)
+        </if>
+        <if test="startCreateTime != null ">AND co.orderTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND co.orderTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+    </select>
+
+    <select id="countClubRemarks" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM cm_club_remarks ccr
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND ccr.addTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND ccr.addTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+    </select>
+
+    <select id="countClubVisitorRemarks" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM cm_visitor_remarks cvr
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND cvr.addTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND cvr.addTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+    </select>
+
+    <select id="countRecord" resultType="java.lang.Integer">
+        SELECT IFNULL(COUNT(*), 0)
+        FROM cm_behavior_record_index cbri
+        LEFT JOIN user u ON u.userID = cbri.userID
+        LEFT JOIN club c ON c.userID = u.userID
+        WHERE 1=1
+        <if test="userId != null ">
+            and cbri.userID=#{userId}
+        </if>
+        <if test="userIdentity != null and userIdentity !=-1">
+            <if test="userIdentity == 5">
+                and u.userIdentity=3
+            </if>
+            <if test="userIdentity != 5">
+                and c.firstClubType=#{userIdentity}
+            </if>
+        </if>
+        <if test="userIdentity != null and userIdentity ==-1">
+            and (c.firstClubType not in(1,2,3,4) or c.firstClubType is null)
+        </if>
+        <if test="startCreateTime != null ">AND cbri.accessTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND cbri.accessTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+    </select>
+
+    <select id="countProductSalesRecord" resultType="java.util.HashMap">
+        SELECT
+        p.mainImage as image,
+        p.name
+        FROM cm_product_sales_record cpsr
+        LEFT JOIN product p ON p.productID = cpsr.productID
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND cpsr.saleTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND cpsr.saleTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+        group by cpsr.productID
+        order by sum(cpsr.sales) desc
+        limit 0,10
+    </select>
+
+    <select id="countBrandProductSalesRecord" resultType="java.util.HashMap">
+        SELECT
+        cb.logo  as image,
+        cb.name
+        FROM cm_product_sales_record cpsr
+        LEFT JOIN product p ON p.productID = cpsr.productID
+        LEFT JOIN cm_brand  cb ON cb.id = p.brandID
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND cpsr.saleTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND cpsr.saleTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+        group by p.brandID
+        order by sum(cpsr.sales) desc
+        limit 0,10
+    </select>
+
+    <select id="countKeyword" resultType="String">
+        SELECT
+        cusf.keyword
+        FROM cm_user_search_frequency cusf
+        WHERE 1=1
+        <if test="startCreateTime != null ">AND cusf.searchTime >= #{startCreateTime}</if>
+        <if test="endCreateTime != null ">AND cusf.searchTime <![CDATA[ <= ]]> #{endCreateTime}</if>
+        order by cusf.frequency desc
+        limit 0,10
+    </select>
+
 </mapper>
 </mapper>

+ 4 - 3
src/main/resources/mapper/KeyWordDao.xml

@@ -54,12 +54,13 @@
         SELECT cusf.id AS id, cusf.frequency, cusf.keyword as keyword, cusf.addTime, cusf.linkageStatus,
         SELECT cusf.id AS id, cusf.frequency, cusf.keyword as keyword, cusf.addTime, cusf.linkageStatus,
         cusf.searchTime as searchTime,cusf.trueStatus as labelStatus,cusf.fromSearch as fromSearch,
         cusf.searchTime as searchTime,cusf.trueStatus as labelStatus,cusf.fromSearch as fromSearch,
         cusf.dynamicStatus, s.linkMan as name
         cusf.dynamicStatus, s.linkMan as name
+        ,IFNULL((select sum(c.pv) from cm_praise_statistics c where  c.delFlag = 0 and c.type = 6 and cusf.id = c.authorId  <if test="beginTime != null and beginTime !=''">AND c.createTime >= #{beginTime} </if><if test="endTime != null and endTime !=''">AND c.createTime <![CDATA[ <= ]]> #{endTime} </if>), 0) as pv
         FROM cm_user_search_frequency cusf
         FROM cm_user_search_frequency cusf
         left join serviceprovider s on cusf.serviceProviderId = s.serviceProviderID
         left join serviceprovider s on cusf.serviceProviderId = s.serviceProviderID
         WHERE cusf.delStatus = 1
         WHERE cusf.delStatus = 1
-        <if test="beginTime !=null and beginTime !=''">
-            AND (cusf.searchTime BETWEEN #{beginTime} AND #{endTime} or cusf.searchTime IS NULL)
-        </if>
+<!--        <if test="beginTime !=null and beginTime !=''">-->
+<!--            AND (cusf.searchTime BETWEEN #{beginTime} AND #{endTime} or cusf.searchTime IS NULL)-->
+<!--        </if>-->
         <if test="keyword !=null and keyword !=''">
         <if test="keyword !=null and keyword !=''">
             AND cusf.keyword LIKE CONCAT('%',#{keyword},'%')
             AND cusf.keyword LIKE CONCAT('%',#{keyword},'%')
         </if>
         </if>

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

@@ -14,7 +14,7 @@
         FROM wechat_menu a WHERE a.id = #{id}
         FROM wechat_menu a WHERE a.id = #{id}
     </select>
     </select>
     <select id="countChildByParentId" resultType="java.lang.Integer">
     <select id="countChildByParentId" resultType="java.lang.Integer">
-        SELECT IFNULL(COUNT(*),0) FROM wechat_menu WHERE parent_id = #{parentId}
+        SELECT IFNULL(COUNT(*),0) FROM wechat_menu WHERE parent_id = #{parentId} and wx_type= #{wxType}
     </select>
     </select>
     <update id="updateWechatMenu">
     <update id="updateWechatMenu">
         UPDATE wechat_menu SET parent_id = #{parentId}, parent_ids = #{parentIds}, name = #{name}, sort = #{sort},
         UPDATE wechat_menu SET parent_id = #{parentId}, parent_ids = #{parentIds}, name = #{name}, sort = #{sort},

+ 1 - 0
src/main/resources/mapper/user/CustomerServiceDao.xml

@@ -266,6 +266,7 @@
             csa.addTime,
             csa.addTime,
             csa.status,
             csa.status,
             csa.delFlag
             csa.delFlag
+            ,IFNULL((select sum(c.pv) from cm_praise_statistics c where  c.delFlag = 0 and c.type = 5 and csa.id = c.authorId  <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
             from cm_shop_advertisingImage csa
             from cm_shop_advertisingImage csa
             left join shop s on s.shopId = csa.shopId
             left join shop s on s.shopId = csa.shopId
             <where>
             <where>