1
0
Selaa lähdekoodia

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

zcb 4 vuotta sitten
vanhempi
commit
952f6eef8a
18 muutettua tiedostoa jossa 396 lisäystä ja 426 poistoa
  1. 20 0
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java
  2. 20 0
      kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java
  3. 89 0
      kmall-admin/src/main/java/com/kmall/admin/controller/statistics/MonthlyCustomersController.java
  4. 10 0
      kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java
  5. 10 0
      kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java
  6. 25 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  7. 55 41
      kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml
  8. 117 97
      kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml
  9. 1 1
      kmall-admin/src/main/resources/mybatis/mapper/statistics/MonthlyCustomersDao.xml
  10. 1 0
      kmall-admin/src/main/resources/mybatis/mapper/statistics/WechatFollowersDao.xml
  11. 1 0
      kmall-admin/src/main/webapp/WEB-INF/page/sale/top10ByBrandAndSupplier.html
  12. 1 0
      kmall-admin/src/main/webapp/WEB-INF/page/sale/wechatFollowersGrowth.html
  13. 6 1
      kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html
  14. 3 0
      kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html
  15. 10 278
      kmall-admin/src/main/webapp/js/sale/top10ByBrandAndSupplier.js
  16. 15 0
      kmall-admin/src/main/webapp/js/sale/wechatFollowersGrowth.js
  17. 6 4
      kmall-admin/src/main/webapp/js/shop/goods.js
  18. 6 4
      kmall-admin/src/main/webapp/js/shop/storeProductStock.js

+ 20 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -57,6 +57,16 @@ public class GoodsController {
     public R list(@RequestParam Map<String, Object> params) {
         ParamUtils.setQueryPowerByRoleType(params, "storeKey", "merchSn", "thirdPartyMerchCode");
         ParamUtils.setName(params, "name");
+        String lastSaleTime = (String) params.get("lastSaleTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
+            try {
+                lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            lastSaleTime = DateUtils.getDate(lastSaleTime);
+            params.put("lastSaleTime", lastSaleTime + " 00:00:00");
+        }
         //查询列表数据
         Query query = new Query(params);
 
@@ -355,6 +365,16 @@ public class GoodsController {
     public R export(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
         params.put("isDelete", 0);
+        String lastSaleTime = (String) params.get("lastSaleTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
+            try {
+                lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            lastSaleTime = DateUtils.getDate(lastSaleTime);
+            params.put("lastSaleTime", lastSaleTime + " 00:00:00");
+        }
         // 根据条件查询出列表
         List<GoodsEntity> goodsList = goodsService.queryExportList(params);
 

+ 20 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java

@@ -50,6 +50,16 @@ public class ProductStoreRelaController {
     public R list(@RequestParam Map<String, Object> params) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
         ParamUtils.setName(params, "goodsName");
+        String lastSaleTime = (String) params.get("lastSaleTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
+            try {
+                lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            lastSaleTime = DateUtils.getDate(lastSaleTime);
+            params.put("lastSaleTime", lastSaleTime + " 00:00:00");
+        }
         //查询列表数据
         Query query = new Query(params);
 
@@ -297,6 +307,16 @@ public class ProductStoreRelaController {
     public R export(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
         ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
         params.put("isDelete", 0);
+        String lastSaleTime = (String) params.get("lastSaleTime");
+        if(org.apache.commons.lang.StringUtils.isNotEmpty(lastSaleTime)) {
+            try {
+                lastSaleTime = new String(lastSaleTime.getBytes("iso-8859-1"), "utf-8");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            lastSaleTime = DateUtils.getDate(lastSaleTime);
+            params.put("lastSaleTime", lastSaleTime + " 00:00:00");
+        }
         // 根据条件查询出列表
         List<ProductStoreRelaEntity> productStoreRelaEntityList = productStoreRelaService.queryExportList(params);
         for (ProductStoreRelaEntity pro: productStoreRelaEntityList) {

+ 89 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/statistics/MonthlyCustomersController.java

@@ -226,6 +226,60 @@ public class MonthlyCustomersController {
         return R.ok(map);
     }
 
+    @RequestMapping("/top10ByBrandAndSupplierExport")
+    public R top10ByBrandAndSupplierExport(@RequestParam("startDate") String startDate,
+                                     @RequestParam("endDate") String endDate, HttpServletResponse response, HttpServletRequest request){
+
+        String merchSn = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+        }
+
+        Map<String,Object> map = monthlyCustomersService.top10ByBrandAndSupplier(startDate,endDate,merchSn);
+        List<MonthlySalesGrowthEntity> top10ByBrand = (List<MonthlySalesGrowthEntity>) map.get("top10ByBrand");
+        List<MonthlySalesGrowthEntity> top10BySupplier = (List<MonthlySalesGrowthEntity>) map.get("top10BySupplier");
+
+        ExcelExport ee = new ExcelExport("产品销量前10");
+        String[] header1 = new String[]{"序号","商户名称","品牌","产品规格","销售数量"};
+        String[] header2 = new String[]{"序号","商户名称","供应商","产品规格","销售数量"};
+        List<Map<String, Object>> list1 = new ArrayList<>();
+        List<Map<String, Object>> list2 = new ArrayList<>();
+        int count = 1;
+        if (top10ByBrand!=null && top10ByBrand.size()>0) {
+            for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : top10ByBrand) {
+                LinkedHashMap<String, Object> tempMap = new LinkedHashMap<>();
+                tempMap.put("OrderNumber",count++);
+                tempMap.put("MerchName",monthlySalesGrowthEntity.getMerchName());
+                tempMap.put("Brand",monthlySalesGrowthEntity.getBrand());
+                tempMap.put("GoodsSpecificationNameValue",monthlySalesGrowthEntity.getGoodsSpecificationNameValue());
+                tempMap.put("sales",monthlySalesGrowthEntity.getSales());
+                list1.add(tempMap);
+            }
+        }
+        count=1;
+        if (top10BySupplier!=null && top10BySupplier.size()>0) {
+            for (MonthlySalesGrowthEntity monthlySalesGrowthEntity : top10BySupplier) {
+                LinkedHashMap<String, Object> tempMap = new LinkedHashMap<>();
+                tempMap.put("OrderNumber",count++);
+                tempMap.put("MerchName",monthlySalesGrowthEntity.getMerchName());
+                tempMap.put("Supplier",monthlySalesGrowthEntity.getSupplier());
+                tempMap.put("GoodsSpecificationNameValue",monthlySalesGrowthEntity.getGoodsSpecificationNameValue());
+                tempMap.put("sales",monthlySalesGrowthEntity.getSales());
+                list2.add(tempMap);
+            }
+        }
+
+
+
+        ee.addSheetByMap("top10ByBrand", list1, header1);
+        ee.addSheetByMap("top10BySupplier", list2, header2);
+        ee.export(response);
+
+
+        return R.ok(map);
+    }
+
     /**
      * 每周销售额销售量图表查询
      * @param startWeek
@@ -430,6 +484,41 @@ public class MonthlyCustomersController {
         return R.ok("添加成功");
     }
 
+    @RequestMapping("/wechatFollowersGrowthExport")
+    public R wechatFollowersGrowthExport(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
+        if (Objects.isNull(params.get("startMonth"))  || "".equals(params.get("startMonth"))){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(params.get("endMonth"))  || "".equals(params.get("endMonth"))){
+            return R.error("请先选择结束时间");
+        }
+        String merchSn = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+        }
+        List<WechatFollowersEntity> wechatFollowersEntities = wechatFollowersDao.queryMonthlyWechatFollowers((String) params.get("startMonth"), (String) params.get("endMonth"), merchSn);
+        ExcelExport ee = new ExcelExport("Wechat Followers Growth");
+        String[] header = new String[]{"序号","商户编号","好友数量","年-月"};
+        List<Map<String, Object>> list = new ArrayList<>();
+        int count = 1;
+        if (wechatFollowersEntities!=null && wechatFollowersEntities.size()>0) {
+            for (WechatFollowersEntity wechatFollowersEntity : wechatFollowersEntities) {
+                LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+                map.put("OrderNumber",count++);
+                map.put("MerchSn",wechatFollowersEntity.getMerchSn());
+                map.put("WechatFollowers",wechatFollowersEntity.getWechatFollowers());
+                map.put("YearAndMonth",wechatFollowersEntity.getYearAndMonth());
+                list.add(map);
+            }
+        }
+        ee.addSheetByMap("Wechat Followers Growth", list, header);
+        ee.export(response);
+        return R.ok();
+    }
+
+
 
     /**
      * 品牌销售数量

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java

@@ -220,6 +220,16 @@ public class GoodsEntity implements Serializable {
     // 日常价
     private BigDecimal dailyPrice;
 
+    // 最后销售时间
+    private Date lastSaleTime;
+
+    public Date getLastSaleTime() {
+        return lastSaleTime;
+    }
+
+    public void setLastSaleTime(Date lastSaleTime) {
+        this.lastSaleTime = lastSaleTime;
+    }
 
     public String getOriCntName() {
         return oriCntName;

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -139,6 +139,16 @@ public class ProductStoreRelaEntity implements Serializable {
     private String bottomLinePrice;
     //园区库存  park_stock
     private String parkStock;
+    // 最后销售时间
+    private Date lastSaleTime;
+
+    public Date getLastSaleTime() {
+        return lastSaleTime;
+    }
+
+    public void setLastSaleTime(Date lastSaleTime) {
+        this.lastSaleTime = lastSaleTime;
+    }
 
     public String getBrandName() {
         return brandName;

+ 25 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -1402,6 +1402,29 @@ public class OrderServiceImpl implements OrderService {
                 orderEntity.setOrderSnWx(orderSnWx);
             }
         }
+//        Date now = new Date();
+//        Integer storeId = orderEntity.getStoreId();
+//        Map queryParams = new HashMap();
+//        queryParams.put("orderId", orderEntity.getId());
+//        List<OrderGoodsEntity> orderGoodsList = orderGoodsDao.queryList(queryParams);
+//        // 遍历订单下的详情商品,修改商品的最后销售时间
+//        if (orderGoodsList!=null && orderGoodsList.size()>0){
+//            orderGoodsList.forEach(orderGoods ->{
+//                Integer goodsId = orderGoods.getGoodsId();
+//                GoodsEntity goodsEntity = goodsDao.queryObject(goodsId);
+//                if (Objects.nonNull(goodsEntity)){
+//                    goodsEntity.setLastSaleTime(now);
+//                    goodsDao.update(goodsEntity);
+//                }
+//                if (Objects.nonNull(storeId)){
+//                    ProductStoreRelaEntity productStoreRelaEntity = productStoreRelaDao.queryByGoodsIdAndStoreId(Long.valueOf(storeId), Long.valueOf(goodsId));
+//                    if (Objects.nonNull(productStoreRelaEntity)){
+//                        productStoreRelaEntity.setLastSaleTime(now);
+//                        productStoreRelaDao.update(productStoreRelaEntity);
+//                    }
+//                }
+//            });
+//        }
         orderDao.update(orderEntity);
         return 0;
     }
@@ -1721,10 +1744,12 @@ public class OrderServiceImpl implements OrderService {
                         productInfo.setStockNum(productInfo.getStockNum() - sellVolume);
                         productInfo.setStoreId(Long.valueOf(storeId));
                         productInfo.addSellVolume();
+                        productInfo.setLastSaleTime(new Date());
                         productStoreRelaDao.updateStockNum(productInfo);//修改普通商品库存
 
                         if(goodsEntity != null) {
                             goodsEntity.setGoodsNumber(goodsEntity.getGoodsNumber() - sellVolume);
+                            goodsEntity.setLastSaleTime(new Date());
                             goodsDao.update(goodsEntity);
                         }
                     }

+ 55 - 41
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -70,6 +70,7 @@
 
         <result column="cost_price" property="costPrice"/>
         <result property="dailyPrice" column="daily_price"/>
+        <result column="last_sale_time" property="lastSaleTime" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">
@@ -250,6 +251,7 @@
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.GoodsEntity">
+        select * from (
         select
         mall_goods.*,
         case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
@@ -341,12 +343,16 @@
             )
         </if>
 
+        ) temp where 1=1
+         <if test="lastSaleTime != null and lastSaleTime != ''">
+        AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
             </when>
             <otherwise>
-                order by mall_goods.id desc
+                order by temp.id desc
             </otherwise>
         </choose>
         <if test="offset != null and limit != null">
@@ -596,7 +602,8 @@
             <if test="createTime != null">`create_time` = #{createTime},</if>
             <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
             <if test="modTime != null">`mod_time` = #{modTime},</if>
-            <if test="tstm != null">`tstm` = #{tstm}</if>
+            <if test="tstm != null">`tstm` = #{tstm},</if>
+            <if test="lastSaleTime != null">`last_sale_time` = #{lastSaleTime}</if>
         </set>
         where id = #{id}
     </update>
@@ -631,45 +638,52 @@
             AND (g.goods_sn=#{keyword} OR g.prod_barcode=#{keyword})
     </select>
     <select id="queryExportList" resultType="com.kmall.admin.entity.GoodsEntity">
-        select
-        mall_goods.*,
-        case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
-        m.merch_name merchName, mb.is_stock_share isStockShare,
-        catagory.keywords as categoryName,
-        scnc.`name` as oriCntName
-        from mall_goods
-        left join mall_merch m on mall_goods.merch_sn = m.merch_sn
-        left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
-        left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
-        mb.merch_sn=mall_goods.merch_sn
-        left join mall_category catagory on catagory.id = mall_goods.category_id
-        left join sys_cus_nation_code scnc on  mall_goods.ori_cnt_code = scnc.code
-        WHERE 1=1
-        <!--  数据过滤  -->
-        ${filterSql}
-        <if test="merchSn != null and merchSn.trim() != ''">
-            AND mall_goods.merch_sn = #{merchSn}
-        </if>
-        <if test="prodBarcode != null and prodBarcode.trim() != ''">
-            AND mall_goods.prod_barcode = #{prodBarcode}
-        </if>
-        <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
-            AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
-        </if>
-        <if test="goodsSn != null and goodsSn != ''">
-            AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
-        </if>
-        <if test="name != null and name != ''">
-            AND mall_goods.name LIKE concat('%',#{name},'%')
-        </if>
-        <if test="englishName != null and englishName != ''">
-            AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
-        </if>
-        <if test="goodsBizType != null and goodsBizType != ''">
-            AND mall_goods.goods_biz_type = #{goodsBizType}
-        </if>
-        <if test="isDelete != null">
-            AND mall_goods.is_Delete = #{isDelete}
+        select * from (
+            select
+            mall_goods.*,
+            case when mall_goods_group.id > 0 then 2 else 0 end as goodsType,
+            m.merch_name merchName, mb.is_stock_share isStockShare,
+            catagory.keywords as categoryName,
+            scnc.`name` as oriCntName
+            from mall_goods
+            left join mall_merch m on mall_goods.merch_sn = m.merch_sn
+            left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
+            left join third_merchant_biz mb on mb.third_party_merch_code = mall_goods.third_party_merch_code and
+            mb.merch_sn=mall_goods.merch_sn
+            left join mall_category catagory on catagory.id = mall_goods.category_id
+            left join sys_cus_nation_code scnc on  mall_goods.ori_cnt_code = scnc.code
+            WHERE 1=1
+            <!--  数据过滤  -->
+            ${filterSql}
+            <if test="merchSn != null and merchSn.trim() != ''">
+                AND mall_goods.merch_sn = #{merchSn}
+            </if>
+            <if test="prodBarcode != null and prodBarcode.trim() != ''">
+                AND mall_goods.prod_barcode = #{prodBarcode}
+            </if>
+            <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
+                AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
+            </if>
+            <if test="goodsSn != null and goodsSn != ''">
+                AND mall_goods.goods_sn like concat('%',#{goodsSn},'%')
+            </if>
+            <if test="name != null and name != ''">
+                AND mall_goods.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="englishName != null and englishName != ''">
+                AND mall_goods.english_name LIKE concat('%',#{englishName},'%')
+            </if>
+            <if test="goodsBizType != null and goodsBizType != ''">
+                AND mall_goods.goods_biz_type = #{goodsBizType}
+            </if>
+            <if test="isDelete != null">
+                AND mall_goods.is_Delete = #{isDelete}
+            </if>
+        ) temp
+        where 1=1
+        <if test="lastSaleTime != null and lastSaleTime != ''">
+            AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
         </if>
+
     </select>
 </mapper>

+ 117 - 97
kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml

@@ -48,6 +48,7 @@
         <result column="batch_expire_date" property="batchExpireDate" />
         <result column="bottom_line_price" property="bottomLinePrice" />
         <result column="park_stock" property="parkStock" />
+        <result column="last_sale_time" property="lastSaleTime" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
@@ -152,103 +153,112 @@
     </select>
 
     <select id="queryList" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
-        select
-        a.`id`,
-        a.`store_id`,
-        a.`merch_sn`,
-        a.`product_id`,
-        a.`stock_num`,
-        a.`goods_id`,
-        a.`retail_price`,
-        a.`market_price`,
-        a.`stock_price`,
-        a.`sell_volume`,
-        a.`batch_sn`,
-        a.`batch_expire_date`,
-        a.`bottom_line_price`,
-        b.goods_number as parkStock,
-        b.is_hot 'isHot',
-        b.is_on_sale 'isOnSale',
-        b.sell_volume 'goodsSellVolume',
-        b.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
-        b.goods_sn goodsSn,
-        b.list_pic_url,
-        c.goods_sn productSn,
-        b.name goodsName,
-        cg.name categoryName,
-        s.store_name storeName,
-        m.merch_name,
-        b.merch_sn goods_merch_sn,
-        a.category_id,
-        a.attribute_category,
-        a.brand_id,
-        a.freight_id,
-        b.goods_number goodsNumber,
-        b.third_party_merch_code thirdPartyMerchCode,
-        mb.is_stock_share isStockShare,
-        b.list_pic_url,supplier_third_id, a.hot_sort_num
-        from mall_product_store_rela a
-        left join mall_goods b on a.goods_id = b.id
-        left join third_merchant_biz mb on mb.third_party_merch_code = b.third_party_merch_code and mb.merch_sn=b.merch_sn
-        left join mall_merch m on a.merch_sn = m.merch_sn
-        left join mall_product c on a.product_id = c.id
-        LEFT JOIN mall_category cg ON a.category_id = cg.id
-        left join mall_store s on a.store_id = s.id AND s.third_party_merch_code = b.third_party_merch_code
-        WHERE 1=1 and b.is_delete = 0
-        <if test="categoryId != null and categoryId != '' ">
-            AND a.category_id = #{categoryId}
-        </if>
-        <if test="brandId != null and brandId != '' ">
-            AND a.brand_id = #{brandId}
-        </if>
-        <if test="category != null and category != ''">
-            AND a.category_id IN (select id from mall_category where parent_id = #{category})
-        </if>
-        <if test="categoryTwo != null and categoryTwo != ''">
-            AND a.category_id = #{categoryTwo}
-        </if>
-        <if test="prodBarcode != null and prodBarcode != ''">
-            AND b.prod_barcode = #{prodBarcode}
-        </if>
-        <if test="storeId != null and storeId != '' ">
-            AND a.store_id = #{storeId}
-        </if>
-        <if test="merchSn != null and merchSn.trim() != '' ">
-            AND a.merch_sn = #{merchSn}
-        </if>
-        <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
-            AND b.third_party_merch_code = #{thirdPartyMerchCode}
-        </if>
-        <if test="goodsId != null">
-            AND a.goods_id = #{goodsId}
-        </if>
-        <if test="goodsName != null and goodsName != '' ">
-            AND b.name LIKE concat('%',#{goodsName},'%')
-        </if>
-        <if test="goodsSn != null and goodsSn != '' ">
-            AND b.goods_sn = #{goodsSn}
-        </if>
-        <if test="productSn != null and productSn != '' ">
-            AND c.goods_sn = #{productSn}
-        </if>
-        <if test="productId != null">
-            AND a.product_id = #{productId}
-        </if>
+        select * from (
+            select
+            a.`id`,
+            a.`store_id`,
+            a.`merch_sn`,
+            a.`product_id`,
+            a.`stock_num`,
+            a.`goods_id`,
+            a.`retail_price`,
+            a.`market_price`,
+            a.`stock_price`,
+            a.`sell_volume`,
+            a.`batch_sn`,
+            a.`batch_expire_date`,
+            a.`bottom_line_price`,
+            a.last_sale_time,
+            b.goods_number as parkStock,
+            b.is_hot 'isHot',
+            b.is_on_sale 'isOnSale',
+            b.sell_volume 'goodsSellVolume',
+            b.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
+            b.goods_sn goodsSn,
+            b.list_pic_url,
+            c.goods_sn productSn,
+            b.name goodsName,
+            cg.name categoryName,
+            s.store_name storeName,
+            m.merch_name,
+            b.merch_sn goods_merch_sn,
+            a.category_id,
+            a.attribute_category,
+            a.brand_id,
+            a.freight_id,
+            b.goods_number goodsNumber,
+            b.third_party_merch_code thirdPartyMerchCode,
+            mb.is_stock_share isStockShare,
+            supplier_third_id,
+             a.hot_sort_num
+            from mall_product_store_rela a
+            left join mall_goods b on a.goods_id = b.id
+            left join third_merchant_biz mb on mb.third_party_merch_code = b.third_party_merch_code and mb.merch_sn=b.merch_sn
+            left join mall_merch m on a.merch_sn = m.merch_sn
+            left join mall_product c on a.product_id = c.id
+            LEFT JOIN mall_category cg ON a.category_id = cg.id
+            left join mall_store s on a.store_id = s.id AND s.third_party_merch_code = b.third_party_merch_code
+            WHERE 1=1 and b.is_delete = 0
+            <if test="categoryId != null and categoryId != '' ">
+                AND a.category_id = #{categoryId}
+            </if>
+            <if test="brandId != null and brandId != '' ">
+                AND a.brand_id = #{brandId}
+            </if>
+            <if test="category != null and category != ''">
+                AND a.category_id IN (select id from mall_category where parent_id = #{category})
+            </if>
+            <if test="categoryTwo != null and categoryTwo != ''">
+                AND a.category_id = #{categoryTwo}
+            </if>
+            <if test="prodBarcode != null and prodBarcode != ''">
+                AND b.prod_barcode = #{prodBarcode}
+            </if>
+            <if test="storeId != null and storeId != '' ">
+                AND a.store_id = #{storeId}
+            </if>
+            <if test="merchSn != null and merchSn.trim() != '' ">
+                AND a.merch_sn = #{merchSn}
+            </if>
+            <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
+                AND b.third_party_merch_code = #{thirdPartyMerchCode}
+            </if>
+            <if test="goodsId != null">
+                AND a.goods_id = #{goodsId}
+            </if>
+            <if test="goodsName != null and goodsName != '' ">
+                AND b.name LIKE concat('%',#{goodsName},'%')
+            </if>
+            <if test="goodsSn != null and goodsSn != '' ">
+                AND b.goods_sn = #{goodsSn}
+            </if>
+            <if test="productSn != null and productSn != '' ">
+                AND c.goods_sn = #{productSn}
+            </if>
+            <if test="productId != null">
+                AND a.product_id = #{productId}
+            </if>
 
-        <if test="goodsBizType != null and goodsBizType != ''">
-            AND b.goods_biz_type = #{goodsBizType}
-        </if>
-        <choose>
-            <when test="sidx != null and sidx.trim() != ''">
-                order by ${sidx} ${order}
-            </when>
-            <otherwise>
-                order by a.id desc
-            </otherwise>
-        </choose>
-        <if test="offset != null and limit != null">
-            limit #{offset}, #{limit}
+            <if test="goodsBizType != null and goodsBizType != ''">
+                AND b.goods_biz_type = #{goodsBizType}
+            </if>
+            <choose>
+                <when test="sidx != null and sidx.trim() != ''">
+                    order by ${sidx} ${order}
+                </when>
+                <otherwise>
+                    order by a.id desc
+                </otherwise>
+            </choose>
+            <if test="offset != null and limit != null">
+                limit #{offset}, #{limit}
+            </if>
+        )  temp
+        where 1=1
+        <if test="lastSaleTime != null and lastSaleTime != ''">
+            AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
         </if>
+
     </select>
 
     <select id="querySameList" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
@@ -549,7 +559,10 @@
                 park_stock = #{parkStock,jdbcType=VARCHAR},
             </if>
             <if test="bottomLinePrice != null" >
-                bottom_line_price = #{bottomLinePrice,jdbcType=VARCHAR}
+                bottom_line_price = #{bottomLinePrice,jdbcType=VARCHAR},
+            </if>
+            <if test="lastSaleTime != null" >
+                last_sale_time = #{lastSaleTime,jdbcType=TIMESTAMP}
             </if>
         </set>
         where id = #{id}
@@ -767,6 +780,7 @@
 
     </select>
     <select id="queryExportList" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
+        select * from (
         select
         a.`id`,
         a.`store_id`,
@@ -799,10 +813,11 @@
         a.brand_id,
         mall_brand.name as brandName,
         a.freight_id,
+        a.last_sale_time,
         b.goods_number goodsNumber,
         b.third_party_merch_code thirdPartyMerchCode,
         mb.is_stock_share isStockShare,
-        b.list_pic_url,supplier_third_id, a.hot_sort_num
+        supplier_third_id, a.hot_sort_num
         from mall_product_store_rela a
         left join mall_goods b on a.goods_id = b.id
         left join third_merchant_biz mb on mb.third_party_merch_code = b.third_party_merch_code and mb.merch_sn=b.merch_sn
@@ -834,6 +849,11 @@
         <if test="goodsBizType != null and goodsBizType != ''">
             AND b.goods_biz_type = #{goodsBizType}
         </if>
+        )  temp
+        where 1=1
+        <if test="lastSaleTime != null and lastSaleTime != ''">
+            AND temp.last_sale_time &gt;= #{lastSaleTime} or temp.last_sale_time is null
+        </if>
     </select>
 
 </mapper>

+ 1 - 1
kmall-admin/src/main/resources/mybatis/mapper/statistics/MonthlyCustomersDao.xml

@@ -181,7 +181,7 @@
 			sum( og.number ) AS sales,
 			cg.NAME AS cgname,
 			sum( o.order_price ) AS totalSales,
-			DATE_FORMAT(o.pay_time,'%Y-%m')
+			DATE_FORMAT(o.pay_time,'%Y-%m') as yearAndMonth
 		FROM
 			mall_order o
 			LEFT JOIN mall_order_goods og ON o.id = og.order_id

+ 1 - 0
kmall-admin/src/main/resources/mybatis/mapper/statistics/WechatFollowersDao.xml

@@ -65,6 +65,7 @@
 	</select>
 	<select id="queryMonthlyWechatFollowers" resultType="com.kmall.admin.entity.WechatFollowersEntity">
 		SELECT
+		merch_sn,
 		sum(mwf.wechat_followers) wechatFollowers,
 		DATE_FORMAT(mwf.create_time,'%Y-%m') as yearAndMonth
 		FROM

+ 1 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/top10ByBrandAndSupplier.html

@@ -49,6 +49,7 @@
             <input type="date" name="startDate" id="startDate"/>&nbsp;
             <input type="date" name="endDate" id="endDate" />&nbsp;
                 <input type="button" name="queryButton" value="查询" onclick="queryMonthly()" />
+                <input type="button" name="exportButton" value="导出" onclick="exportMonthly()" />
             </div>
         </div>
     </header>

+ 1 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/wechatFollowersGrowth.html

@@ -45,6 +45,7 @@
             <input type="month" name="startMonth" id="startMonth"/>&nbsp;
             <input type="month" name="endMonth" id="endMonth" />&nbsp;
             <input type="button" name="queryButton" value="查询" onclick="queryMonthly()" />
+            <input type="button" name="exportButton" value="导出" onclick="exportMonthly()" />
         </div>
     </div>
 </header>

+ 6 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html

@@ -88,6 +88,7 @@
                 <i-col span="3">
                     <i-input v-model="q.englishName" @on-enter="query" placeholder="英文名称"/>
                 </i-col>
+
                 <!--<i-col span="3">-->
                 <!--<i-input v-model="q.plu" @on-enter="query" placeholder="PLU"/>-->
                 <!--</i-col>-->
@@ -97,7 +98,11 @@
                         <i-option v-for="macro in macros" :value="macro.value" :key="macro.id">{{macro.name}}
                         </i-option>
                     </i-select>
-                </i-col><!--
+                </i-col>
+                <i-col span="3">
+                    <Date-picker v-model="q.lastSaleTime" placeholder="未销售时间至今"/>
+                </i-col>
+                <!--
                 <i-col span="3">
                     <i-select v-model="q.category" placeholder="商品分类" filterable @on-change="changeQueryCategories"
                               label-in-value>

+ 3 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/storeProductStock.html

@@ -92,6 +92,9 @@
                         </i-option>
                     </i-select>
                 </i-col>
+                <i-col span="3">
+                    <Date-picker v-model="q.lastSaleTime" placeholder="未销售时间至今"/>
+                </i-col>
                 <!--<i-col span="4">
                     <i-input v-model="q.productSn" @on-enter="query" placeholder="规格编码"/>
                 </i-col>-->

+ 10 - 278
kmall-admin/src/main/webapp/js/sale/top10ByBrandAndSupplier.js

@@ -49,283 +49,15 @@ function createLi(title,sales,ulId,flag){
 
 }
 
-// var li=document.createElement("li");
-// var span_1=document.createElement("span");
-// li.innerHTML = title;
-// span_1.setAttribute("class","spanClass")
-// var span_2=document.createElement("span");
-// span_2.innerHTML = sales;
-// span_2.setAttribute("class","spanClass")
-// li.appendChild(span_1);
-// li.appendChild(span_2);
-let vm = new Vue({
-    el: '#rrapp',
-    data: {
-        date: '',
-        refreshTime: 10,
-        type: 'store',
-        refreshCount:0,
-
-        storeId: '',
-        merchSn: '',
-        merchName: '',
-        storeName: '',
-        salesDate: '',
-        totalSales: '',
-        actualSales: '',
-        preferentialLoss: '',
-        totalCost: '',
-        grossProfit: '',
-        grossProfitRatio: '',
-        proportion: '',
-        guestNumber: '',
-        guestUnitPrice: '',
-        lastSalesTime: '',
-        categoryId: '',
-        categoryName: '',
-
-        showList: false,
-        compareDate: '',//比较日期
-        storeId2: '',
-        merchSn2: '',
-        merchName2: '',
-        storeName2: '',
-        salesDate2: '',
-        totalSales2: '',
-        actualSales2: '',
-        preferentialLoss2: '',
-        totalCost2: '',
-        grossProfit2: '',
-        grossProfitRatio2: '',
-        proportion2: '',
-        guestNumber2: '',
-        guestUnitPrice2: '',
-        lastSalesTime2: '',
-        intervalId: 0,
-        isCompare: false,
-        compare2: '',
-
-
-        temp: {
-            date: '',
-            refreshTime: 10,
-            type: '',
-            storeId: '',
-            merchSn: '',
-            salesDate: '',
-            categoryId: ''
-        },
-
-
-        rateList: [
-            {
-                id: '0',
-                name: '含税'
-            },
-            {
-                id: '1',
-                name: '不含税'
-
-            }
-        ],
-        projectList: [
-            {
-                id: '0',
-                name: '销售总额'
-            },
-            {
-                id: '1',
-                name: '客单价'
-
-            }
-        ],
-        seriesTypeList: [
-            {
-                id: 'bar',
-                name: '垂直柱状图'
-            },
-            {
-                id: 'line',
-                name: '折线图'
-
-            },
-            {
-                id: 'pie',
-                name: '饼图'
-
-            }
-        ],
-        formatsList: [
-            {
-                id: '0',
-                name: '<全部>'
-            },
-            {
-                id: '1',
-                name: '<非全部>'
-
-            }
-        ],
-        salesList: [
-            {
-                store: {storeId: '11106', storeName: '前海店'},
-                totalSales: 43046.18,
-                actualSales: 35593.46
-            }
-        ],
-        dept: {
-            deptId: '',
-            deptName: ''
-        },
-        category: {
-            categoryId: '',
-            categoryName: ''
-        },
-        seriesList: [], //保存饼图数据
-        seriesList2: [],
-        xAxisList: {    //主要用于保存 启动刷新时的条件和数据
-            storeId: '',
-            storeName: '',
-            merchSn: '',
-            merchName: '',
-            totalSales: '',
-            actualSales: '',
-            preferentialLoss: '',
-            totalCost: '',
-            grossProfit: '',
-            grossProfitRatio: '',
-            proportion: '',
-            guestNumber: '',
-            guestUnitPrice: '',
-            lastSalesTime: '',
-
-            salesDate: '0',
-            projectSelect: '0',
-            type:''
-        },
-        dataList: [],
-        tooltip: {},
-        today:''
-    },
-    created() {
-        this.rateSelect = this.rateList[0].id;
-        this.projectSelect = this.projectList[0].id;
-        this.seriesTypeSelect = this.seriesTypeList[0].id;
-        this.formatsSelect = this.formatsList[0].id;
-    },
-    methods: {
-
-        seriesTypeSwitch: function () {
-            console.log(vm.seriesTypeSelect);
-        },
-        showEcharts: function () {
-            // 基于准备好的dom,初始化echarts实例
-            myChart = echarts.init(document.getElementById('main'));
-            myChart.clear();
-            //加载动画
-            myChart.showLoading();
-
-
-            //项目下拉框判断       6-19,饼图设置 vm.xAxisList
-            var temp = '';
-            if (vm.xAxisList.projectSelect == '0') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.totalSales);
-                vm.seriesList.push({value: vm.xAxisList.totalSales, name: temp});
-
-            } else if (vm.xAxisList.projectSelect == '1') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.guestUnitPrice);
-                vm.seriesList.push({value: vm.xAxisList.guestUnitPrice, name: temp});
-
-            }
-
-            vm.dataList = [temp];
-
-            if (vm.seriesTypeSelect == "pie") {
-                vm.seriesList2 = vm.seriesList.concat();
-            }
-
-            // console.log('vm.seriesList2');
-            // console.log(vm.seriesList2);
-
-            // 指定图表的配置项和数据
-            //销售量
-            var option = {
-                title: {
-                    // textAlign: 'right',
-                    text: 'Monthly Customers & Avg Basket',
-                    x: 'center',
-                    textStyle: {
-                        //文字颜色
-                        color: '#17233d',
-                        //字体风格,'normal','italic','oblique'
-                        fontStyle: 'normal',
-                        //字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
-                        fontWeight: 'bold',
-                        //字体系列
-                        fontFamily: 'sans-serif',
-                        //字体大小
-                        fontSize: 28
-                    }
-                },
-                tooltip: {
-                    formatter: function (params) {
-                        return params.name;
-                    }
-                },
-                legend: {
-                    data: ['/销售总额']
-                },
-                xAxis: {
-                    data: vm.dataList,
-                    axisLabel: {
-                        interval: 0
-                    }
-                },
-                yAxis: {},
-                series: [{
-                    barMaxWidth: '20%',
-                    barWidth: '50%',
-                    radius: '55%',
-                    roseType: 'angle',
-                    type: vm.seriesTypeSelect,
-                    color: ['#dd6b66', '#759aa0'],
-                    data: vm.seriesList2
-                }]
-            };
-
-            //隐藏
-            myChart.hideLoading();
-            // 使用刚指定的配置项和数据显示图表。
-            myChart.setOption(option);
-
-        },
-        tooltipFormatter: function () {
-            if (vm.type == 'dept') {
-                return '[' + vm.merchSn + ']' + vm.merchName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-            }
-            return '[' + vm.storeId + ']' + vm.storeName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-        },
-        showTable: function (postParam) {
-
-            console.log(postParam);
+function exportMonthly(){
+    var startDate = document.getElementById("startDate").value;
+    var endDate = document.getElementById("endDate").value;
 
-            $("#jqGrid").jqGrid('setGridParam', {
-                postData: postParam
+    var params = {
+        startDate:startDate,
+        endDate:endDate
+    };
+    console.log(params);
+    exportFile('#rrapp', '../monthly/top10ByBrandAndSupplierExport', params);
 
-            }).trigger("reloadGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
-        },
-        switchProjectView: function () {
-            console.log(vm.projectSelect);
-        }
-    }
-});
+}

+ 15 - 0
kmall-admin/src/main/webapp/js/sale/wechatFollowersGrowth.js

@@ -123,3 +123,18 @@ function addWechatFollowers(){
     });
 
 }
+
+
+function exportMonthly(){
+    var startMonth = document.getElementById("startMonth").value;
+    var endMonth = document.getElementById("endMonth").value;
+
+    var params = {
+        startMonth:startMonth,
+        endMonth:endMonth
+    };
+    console.log(params);
+    exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params);
+
+}
+

+ 6 - 4
kmall-admin/src/main/webapp/js/shop/goods.js

@@ -151,7 +151,7 @@ var vm = new Vue({
                 {required: true, message: '名称不能为空', trigger: 'blur'}
             ]*/
         },
-        q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: '',thirdPartyMerchCode:'',englishName:''},
+        q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: '',thirdPartyMerchCode:'',englishName:'',lastSaleTime:''},
         attributes: [],
         attributeEntityList: [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}],
         productEntityList: [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}],
@@ -215,7 +215,8 @@ var vm = new Vue({
                 goodsBizType: '',
                 merchSn: '',
                 thirdPartyMerchCode:'',
-                englishName:''
+                englishName:'',
+                lastSaleTime:''
             }
         },
         query: function () {
@@ -479,7 +480,8 @@ var vm = new Vue({
                     'prodBarcode': vm.q.prodBarcode,
                     'goodsBizType': vm.q.goodsBizType,
                     'merchSn': vm.q.merchSn,
-                    'thirdPartyMerchCode': vm.q.thirdPartyMerchCode
+                    'thirdPartyMerchCode': vm.q.thirdPartyMerchCode,
+                    'lastSaleTime': vm.q.lastSaleTime
                 },
                 page: page
             }).trigger("reloadGrid");
@@ -731,7 +733,7 @@ var vm = new Vue({
             params.name = vm.q.name, params.englishName = vm.q.englishName, params.plu = vm.q.plu,
                 params.goodsSn = vm.q.goodsSn, params.prodBarcode = vm.q.prodBarcode,
                 params.goodsBizType = vm.q.goodsBizType,params.merchSn = vm.q.merchSn,
-                params.thirdPartyMerchCode = vm.q.thirdPartyMerchCode;
+                params.thirdPartyMerchCode = vm.q.thirdPartyMerchCode,params.lastSaleTime = vm.q.lastSaleTime;
             exportFile('#rrapp', '../goods/export', params);
 
         }

+ 6 - 4
kmall-admin/src/main/webapp/js/shop/storeProductStock.js

@@ -182,7 +182,8 @@ var vm = new Vue({
             category: '',
             categoryTwo: '',
             goodsBizType:'',
-            thirdPartyMerchCode:''
+            thirdPartyMerchCode:'',
+            lastSaleTime:''
         },
         stores: [],
         macros: [],//商品单位
@@ -296,7 +297,7 @@ var vm = new Vue({
                 goodsName: '',
                 productSn: '',
                 goodsSn: '', category: '', categoryTwo: '', goodsBizType:'',
-                thirdPartyMerchCode: ''
+                thirdPartyMerchCode: '',lastSaleTime:''
             }
             vm.reload();
         },
@@ -669,7 +670,8 @@ var vm = new Vue({
                     goodsName: vm.q.goodsName,
                     goodsSn: vm.q.goodsSn,
                     productSn: vm.q.productSn, category: vm.q.category, categoryTwo: vm.q.categoryTwo, goodsBizType:vm.q.goodsBizType,
-                    thirdPartyMerchCode: vm.q.thirdPartyMerchCode
+                    thirdPartyMerchCode: vm.q.thirdPartyMerchCode,
+                    lastSaleTime:vm.q.lastSaleTime
                 },
                 page: page
             }).trigger("reloadGrid");
@@ -781,7 +783,7 @@ var vm = new Vue({
             var params = {};
             params.storeId = vm.q.storeId, params.goodsName = vm.q.goodsName, params.goodsSn = vm.q.goodsSn,
                 params.category = vm.q.category, params.categoryTwo = vm.q.categoryTwo,
-                params.goodsBizType = vm.q.goodsBizType,params.thirdPartyMerchCode = vm.q.thirdPartyMerchCode;
+                params.goodsBizType = vm.q.goodsBizType,params.thirdPartyMerchCode = vm.q.thirdPartyMerchCode,lastSaleTime=vm.q.lastSaleTime;
             exportFile('#rrapp', '../productstorerela/export', params);
         }
     },