Browse Source

add:商城用户统计

liujunchi 3 years ago
parent
commit
56f97bebb9

+ 42 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/AdminStatisticalController.java

@@ -0,0 +1,42 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.yonge.cooleshow.admin.dto.search.UserStatisticalSearch;
+import com.yonge.cooleshow.admin.service.OmsOrderService;
+import com.yonge.cooleshow.mall.common.api.CommonResult;
+import com.yonge.cooleshow.mbg.model.CmsPrefrenceArea;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-26
+ */
+@Controller
+@Api(tags = "首页商城统计")
+@RequestMapping("/statistical")
+public class AdminStatisticalController {
+
+    @Autowired
+    private OmsOrderService orderService;
+
+
+    @ApiOperation("商城用户统计")
+    @RequestMapping(value = "/user", method = RequestMethod.POST)
+    @ResponseBody
+    public CommonResult<List<CmsPrefrenceArea>> userStatistical(@RequestBody UserStatisticalSearch search) {
+
+        orderService.userStatistical(search);
+        return CommonResult.failed();
+
+    }
+}

+ 3 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dao/OmsOrderDao.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.admin.dao;
 import com.yonge.cooleshow.admin.dto.OmsOrderDeliveryParam;
 import com.yonge.cooleshow.admin.dto.OmsOrderDetail;
 import com.yonge.cooleshow.admin.dto.OmsOrderQueryParam;
+import com.yonge.cooleshow.admin.dto.search.UserStatisticalSearch;
 import com.yonge.cooleshow.mbg.model.OmsOrder;
 import org.apache.ibatis.annotations.Param;
 
@@ -27,4 +28,6 @@ public interface OmsOrderDao {
      * 获取订单详情
      */
     OmsOrderDetail getDetail(@Param("id") Long id);
+
+    void userStatistical(@Param("search") UserStatisticalSearch search);
 }

+ 47 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dto/search/UserStatisticalSearch.java

@@ -0,0 +1,47 @@
+package com.yonge.cooleshow.admin.dto.search;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-26
+ */
+@ApiModel("admin首页商城用户统计查询参数")
+public class UserStatisticalSearch {
+
+    @ApiModelProperty("类型 YEAR:年度 MONTH:月度")
+    private String type;
+
+    @ApiModelProperty("年")
+    private Integer year;
+
+    @ApiModelProperty("月")
+    private Integer month;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Integer getYear() {
+        return year;
+    }
+
+    public void setYear(Integer year) {
+        this.year = year;
+    }
+
+    public Integer getMonth() {
+        return month;
+    }
+
+    public void setMonth(Integer month) {
+        this.month = month;
+    }
+}

+ 8 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/OmsOrderService.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.admin.service;
 
 import com.yonge.cooleshow.admin.dto.*;
+import com.yonge.cooleshow.admin.dto.search.UserStatisticalSearch;
 import com.yonge.cooleshow.mbg.model.OmsOrder;
 import com.yonge.cooleshow.admin.dto.*;
 import org.springframework.transaction.annotation.Transactional;
@@ -56,4 +57,11 @@ public interface OmsOrderService {
      */
     @Transactional
     int updateNote(Long id, String note, Integer status);
+
+    /**
+     * 商城用户统计
+     *
+     * @param search 参数
+     */
+    void userStatistical(UserStatisticalSearch search);
 }

+ 6 - 0
cooleshow-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.yonge.cooleshow.admin.dao.OmsOrderDao;
 import com.yonge.cooleshow.admin.dao.OmsOrderOperateHistoryDao;
 import com.yonge.cooleshow.admin.dto.*;
+import com.yonge.cooleshow.admin.dto.search.UserStatisticalSearch;
 import com.yonge.cooleshow.mbg.mapper.OmsOrderMapper;
 import com.yonge.cooleshow.mbg.mapper.OmsOrderOperateHistoryMapper;
 import com.yonge.cooleshow.mbg.model.OmsOrder;
@@ -151,4 +152,9 @@ public class OmsOrderServiceImpl implements OmsOrderService {
         orderOperateHistoryMapper.insert(history);
         return count;
     }
+
+    @Override
+    public void userStatistical(UserStatisticalSearch search) {
+        orderDao.userStatistical(search);
+    }
 }

+ 4 - 0
cooleshow-mall/mall-admin/src/main/resources/config/mybatis/OmsOrderDao.xml

@@ -87,4 +87,8 @@
             o.id = #{id}
         ORDER BY oi.id ASC,oh.create_time DESC
     </select>
+
+    <select id="userStatistical" resultType="void">
+
+    </select>
 </mapper>

+ 2 - 0
cooleshow-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/config/ResourceServerConfig.java

@@ -24,6 +24,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
     @Override
     public void configure(HttpSecurity http) throws Exception {
         http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
+            .authorizeRequests().antMatchers("/task/**").hasIpAddress("0.0.0.0/0")
+                .and()
                 .authorizeRequests().antMatchers("/wechat/*","/v2/api-docs", "/code/*").permitAll().anyRequest().permitAll().and().httpBasic();
     }