Browse Source

呵呵老后台列表

zhijiezhao 1 year ago
parent
commit
5644276428
20 changed files with 639 additions and 13 deletions
  1. 19 4
      src/main/java/com/caimei365/manager/controller/hehe/order/HeHeOrderApi.java
  2. 46 0
      src/main/java/com/caimei365/manager/controller/hehe/product/HeHeProductApi.java
  3. 35 4
      src/main/java/com/caimei365/manager/controller/hehe/user/HeHeUserApi.java
  4. 3 0
      src/main/java/com/caimei365/manager/dao/hehe/HeHeOrderDao.java
  5. 18 0
      src/main/java/com/caimei365/manager/dao/hehe/HeHeProductDao.java
  6. 9 0
      src/main/java/com/caimei365/manager/dao/hehe/HeHeUserDao.java
  7. 22 2
      src/main/java/com/caimei365/manager/entity/caimei/CmUser.java
  8. 55 0
      src/main/java/com/caimei365/manager/entity/hehe/product/HeHeActivityProduct.java
  9. 0 1
      src/main/java/com/caimei365/manager/entity/hehe/product/HeHeProduct.java
  10. 19 0
      src/main/java/com/caimei365/manager/entity/hehe/product/HeHeSalesActivityProduct.java
  11. 2 0
      src/main/java/com/caimei365/manager/entity/hehe/user/HeHeUser.java
  12. 3 0
      src/main/java/com/caimei365/manager/service/hehe/order/HeHeOrderService.java
  13. 10 0
      src/main/java/com/caimei365/manager/service/hehe/order/impl/HeHeOrderServiceImpl.java
  14. 5 1
      src/main/java/com/caimei365/manager/service/hehe/product/HeHeProductService.java
  15. 46 1
      src/main/java/com/caimei365/manager/service/hehe/product/impl/HeHeProductServiceImpl.java
  16. 6 0
      src/main/java/com/caimei365/manager/service/hehe/user/HeHeUserService.java
  17. 63 0
      src/main/java/com/caimei365/manager/service/hehe/user/impl/HeHeUserServiceImpl.java
  18. 114 0
      src/main/resources/mapper/hehe/HeHeOrderDao.xml
  19. 124 0
      src/main/resources/mapper/hehe/HeHeProductDao.xml
  20. 40 0
      src/main/resources/mapper/hehe/HeHeUserDao.xml

+ 19 - 4
src/main/java/com/caimei365/manager/controller/hehe/order/HeHeOrderApi.java

@@ -4,6 +4,7 @@ package com.caimei365.manager.controller.hehe.order;
 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.order.CmOrder;
 import com.caimei365.manager.entity.order.CmOrder;
+import com.caimei365.manager.entity.order.CmReturnedPurchase;
 import com.caimei365.manager.service.hehe.order.HeHeOrderService;
 import com.caimei365.manager.service.hehe.order.HeHeOrderService;
 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;
@@ -19,6 +20,13 @@ public class HeHeOrderApi {
     @Resource
     @Resource
     private HeHeOrderService orderService;
     private HeHeOrderService orderService;
 
 
+    /**
+     * 订单列表
+     * @param order
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
     @GetMapping("/order/list")
     @GetMapping("/order/list")
     public ResponseJson<PaginationVo<CmOrder>> orderList(CmOrder order,
     public ResponseJson<PaginationVo<CmOrder>> orderList(CmOrder order,
                                                          @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                          @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@@ -26,10 +34,17 @@ public class HeHeOrderApi {
         return orderService.orderList(order, pageNum, pageSize);
         return orderService.orderList(order, pageNum, pageSize);
     }
     }
 
 
+    /**
+     * 退款单列表
+     * @param returnedPurchase
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
     @GetMapping("/returnedPurchase/list")
     @GetMapping("/returnedPurchase/list")
-    public ResponseJson<PaginationVo<CmOrder>> returnedPurchaseList(CmOrder order,
-                                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                         @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
-        return orderService.orderList(order, pageNum, pageSize);
+    public ResponseJson<PaginationVo<CmReturnedPurchase>> returnedPurchaseList(CmReturnedPurchase returnedPurchase,
+                                                                               @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                               @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return orderService.returnedPurchaseList(returnedPurchase, pageNum, pageSize);
     }
     }
 }
 }

+ 46 - 0
src/main/java/com/caimei365/manager/controller/hehe/product/HeHeProductApi.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 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;
 
 
 @RestController
 @RestController
 @RequestMapping("/HeHe")
 @RequestMapping("/HeHe")
@@ -138,4 +139,49 @@ public class HeHeProductApi {
                                                                        @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
                                                                        @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         return productService.CollageRecordList(collage, pageNum, pageSize);
         return productService.CollageRecordList(collage, pageNum, pageSize);
     }
     }
+
+    /**
+     * 分销者活动商品列表
+     *
+     * @param product
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/sales/products")
+    public ResponseJson<PaginationVo<HeHeActivityProduct>> salesProductList(HeHeActivityProduct product,
+                                                                            @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        if (null == product.getUserId() || 0 == product.getUserId()) {
+            return ResponseJson.error("分销者Id不能为空!", null);
+        }
+        return productService.salesProductList(product, pageNum, pageSize);
+    }
+
+    /**
+     * 分销者添加活动商品弹窗列表
+     * 商品取自呵呵活动商品
+     *
+     * @param userId
+     * @param name
+     * @param shopName
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/sales/activity/products")
+    public ResponseJson<PaginationVo<HeHeProduct>> salesActivityProductList(String name, Integer userId, String shopName,
+                                                                            @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        if (null == userId || 0 == userId) {
+            return ResponseJson.error("分销者Id不能为空!", null);
+        }
+        return productService.salesActivityProductList(name, userId, shopName, pageNum, pageSize);
+    }
+
+
+    /**
+     *
+     */
+
 }
 }

+ 35 - 4
src/main/java/com/caimei365/manager/controller/hehe/user/HeHeUserApi.java

@@ -5,10 +5,7 @@ import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.hehe.product.HeHeBigType;
 import com.caimei365.manager.entity.hehe.product.HeHeBigType;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import com.caimei365.manager.service.hehe.user.HeHeUserService;
 import com.caimei365.manager.service.hehe.user.HeHeUserService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 
 
@@ -39,6 +36,7 @@ public class HeHeUserApi {
 
 
     /**
     /**
      * 呵呵用户列表
      * 呵呵用户列表
+     *
      * @param man
      * @param man
      * @param pageNum
      * @param pageNum
      * @param pageSize
      * @param pageSize
@@ -50,4 +48,37 @@ public class HeHeUserApi {
                                                          @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
                                                          @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         return userService.userList(man, pageNum, pageSize);
         return userService.userList(man, pageNum, pageSize);
     }
     }
+
+    /**
+     * 添加/编辑分销者
+     *
+     * @param man
+     * @return
+     */
+    @PostMapping("/save/sales")
+    public ResponseJson userList(HeHeUser man) {
+        return userService.saveSales(man);
+    }
+
+    /**
+     * 添加分销者活动商品
+     * @param userId
+     * @param productIds
+     * @return
+     */
+    @PostMapping("/add/sales/products")
+    public ResponseJson addSalesActivityProduct(Integer userId, String productIds) {
+        return userService.addSaleActivityProducts(userId, productIds);
+    }
+
+    /**
+     * 删除分销者活动商品
+     * @param userId
+     * @param productId
+     * @return
+     */
+    @PostMapping("/del/sales/products")
+    public ResponseJson delSalesActivityProduct(Integer userId, Integer productId) {
+        return userService.delSaleActivityProducts(userId, productId);
+    }
 }
 }

+ 3 - 0
src/main/java/com/caimei365/manager/dao/hehe/HeHeOrderDao.java

@@ -2,6 +2,7 @@ package com.caimei365.manager.dao.hehe;
 
 
 
 
 import com.caimei365.manager.entity.order.CmOrder;
 import com.caimei365.manager.entity.order.CmOrder;
+import com.caimei365.manager.entity.order.CmReturnedPurchase;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
 import java.util.List;
 import java.util.List;
@@ -13,4 +14,6 @@ public interface HeHeOrderDao {
     List<CmOrder> findOrderList(CmOrder order);
     List<CmOrder> findOrderList(CmOrder order);
 
 
     List<Integer> findOrderIdInReturnPurchase(List<Integer> orderIds);
     List<Integer> findOrderIdInReturnPurchase(List<Integer> orderIds);
+
+    List<CmReturnedPurchase> findReturnList(CmReturnedPurchase returnedPurchase);
 }
 }

+ 18 - 0
src/main/java/com/caimei365/manager/dao/hehe/HeHeProductDao.java

@@ -1,5 +1,7 @@
 package com.caimei365.manager.dao.hehe;
 package com.caimei365.manager.dao.hehe;
 
 
+import com.caimei365.manager.entity.caimei.svip.CmLadderPrice;
+import com.caimei365.manager.entity.caimei.svip.CmSku;
 import com.caimei365.manager.entity.hehe.product.*;
 import com.caimei365.manager.entity.hehe.product.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
@@ -27,4 +29,20 @@ public interface HeHeProductDao {
     List<CollageRecord> findCollageRecordList(CollageRecord collage);
     List<CollageRecord> findCollageRecordList(CollageRecord collage);
 
 
     List<Integer> getCollageOrderIds(Integer id);
     List<Integer> getCollageOrderIds(Integer id);
+
+    List<CmSku> findHeHeSku(Integer productId);
+
+    List<CmLadderPrice> findLadderList(Integer skuId);
+
+    List<HeHeActivityProduct> activityProductList(HeHeActivityProduct product);
+
+    List<Integer> findUserActivityProduct(Integer userId);
+
+    List<HeHeProduct> findAllActivityProduct(HeHeProduct heHeProduct);
+
+    Integer findActivityByProductId(String productId);
+
+    void insertUserActivity(HeHeSalesActivityProduct product);
+
+    void deleteUserActivity(Integer userId, Integer productId);
 }
 }

+ 9 - 0
src/main/java/com/caimei365/manager/dao/hehe/HeHeUserDao.java

@@ -1,6 +1,7 @@
 package com.caimei365.manager.dao.hehe;
 package com.caimei365.manager.dao.hehe;
 
 
 
 
+import com.caimei365.manager.entity.caimei.CmUser;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
@@ -10,4 +11,12 @@ import java.util.List;
 public interface HeHeUserDao {
 public interface HeHeUserDao {
 
 
     List<HeHeUser> findList(HeHeUser man);
     List<HeHeUser> findList(HeHeUser man);
+
+    Integer findMobileOnly(HeHeUser man);
+
+    void saveSales(HeHeUser man);
+
+    void insertCmUser(CmUser user);
+
+    void updateCmUser(CmUser user);
 }
 }

+ 22 - 2
src/main/java/com/caimei365/manager/entity/caimei/CmUser.java

@@ -1,6 +1,7 @@
 package com.caimei365.manager.entity.caimei;
 package com.caimei365.manager.entity.caimei;
 
 
 import lombok.Data;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 
 /**
 /**
  * Description
  * Description
@@ -10,6 +11,23 @@ import lombok.Data;
  */
  */
 @Data
 @Data
 public class CmUser {
 public class CmUser {
+    /**
+     * 用户状态,1正常,0冻结
+     */
+    private Integer validFlag;
+    /**
+     * 注册时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String registerTime;
+    /**
+     * 用户类型,见表c_usertype或枚举UserType
+     */
+    private Integer registerUserTypeId;
+    /**
+     * 密码
+     */
+    private String password;
     /**
     /**
      * userId
      * userId
      */
      */
@@ -22,8 +40,10 @@ public class CmUser {
      * 会所Id
      * 会所Id
      */
      */
     private String clubId;
     private String clubId;
-
-
+    /**
+     * 企业绑定手机号
+     */
+    private String bindMobile;
     /**
     /**
      * 用户身份
      * 用户身份
      */
      */

+ 55 - 0
src/main/java/com/caimei365/manager/entity/hehe/product/HeHeActivityProduct.java

@@ -0,0 +1,55 @@
+package com.caimei365.manager.entity.hehe.product;
+
+import com.caimei365.manager.entity.caimei.svip.CmSku;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 活动商品Entity
+ */
+@Data
+public class HeHeActivityProduct {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 呵呵活动id
+     */
+    private Integer activityId;
+    /**
+     * 对应采美商品id
+     */
+    private Integer productId;
+    /**
+     * 排序值
+     */
+    private Integer sort;
+    /**
+     * 添加时间
+     */
+    private Date addTime;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 商品图片
+     */
+    private String mainImage;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 用户id
+     */
+    private Integer userId;
+    private List<CmSku> skus;
+    /**
+     * 有无活动价 0无1有
+     */
+    private Integer LadderFlag;
+
+}

+ 0 - 1
src/main/java/com/caimei365/manager/entity/hehe/product/HeHeProduct.java

@@ -5,7 +5,6 @@ import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 @Data
 @Data

+ 19 - 0
src/main/java/com/caimei365/manager/entity/hehe/product/HeHeSalesActivityProduct.java

@@ -0,0 +1,19 @@
+package com.caimei365.manager.entity.hehe.product;
+
+import lombok.Data;
+
+
+/**
+ * 呵呵分销者活动商品
+ */
+@Data
+public class HeHeSalesActivityProduct {
+    private Integer id;
+    /**
+     * 分销者userId
+     */
+    private Integer userId;
+    private Integer activityId;
+    private Integer productId;
+    private Integer sort;
+}

+ 2 - 0
src/main/java/com/caimei365/manager/entity/hehe/user/HeHeUser.java

@@ -11,6 +11,8 @@ import java.util.Date;
  */
  */
 @Data
 @Data
 public class HeHeUser {
 public class HeHeUser {
+
+    private Integer id;
     /**
     /**
      * 	对应user表用户id
      * 	对应user表用户id
      */
      */

+ 3 - 0
src/main/java/com/caimei365/manager/service/hehe/order/HeHeOrderService.java

@@ -3,7 +3,10 @@ package com.caimei365.manager.service.hehe.order;
 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.order.CmOrder;
 import com.caimei365.manager.entity.order.CmOrder;
+import com.caimei365.manager.entity.order.CmReturnedPurchase;
 
 
 public interface HeHeOrderService {
 public interface HeHeOrderService {
     ResponseJson<PaginationVo<CmOrder>> orderList(CmOrder order, int pageNum, int pageSize);
     ResponseJson<PaginationVo<CmOrder>> orderList(CmOrder order, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<CmReturnedPurchase>> returnedPurchaseList(CmReturnedPurchase returnedPurchase, int pageNum, int pageSize);
 }
 }

+ 10 - 0
src/main/java/com/caimei365/manager/service/hehe/order/impl/HeHeOrderServiceImpl.java

@@ -4,6 +4,7 @@ import com.caimei365.manager.dao.hehe.HeHeOrderDao;
 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.order.CmOrder;
 import com.caimei365.manager.entity.order.CmOrder;
+import com.caimei365.manager.entity.order.CmReturnedPurchase;
 import com.caimei365.manager.service.hehe.order.HeHeOrderService;
 import com.caimei365.manager.service.hehe.order.HeHeOrderService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -41,4 +42,13 @@ public class HeHeOrderServiceImpl implements HeHeOrderService {
         PaginationVo<CmOrder> page = new PaginationVo<>(list);
         PaginationVo<CmOrder> page = new PaginationVo<>(list);
         return ResponseJson.success(page);
         return ResponseJson.success(page);
     }
     }
+
+    @Override
+    public ResponseJson<PaginationVo<CmReturnedPurchase>> returnedPurchaseList(CmReturnedPurchase returnedPurchase, int pageNum, int pageSize) {
+        returnedPurchase.setOrderType(2);
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmReturnedPurchase> list = orderDao.findReturnList(returnedPurchase);
+        PaginationVo<CmReturnedPurchase> page = new PaginationVo<>(list);
+        return ResponseJson.success(page);
+    }
 }
 }

+ 5 - 1
src/main/java/com/caimei365/manager/service/hehe/product/HeHeProductService.java

@@ -7,7 +7,7 @@ import com.caimei365.manager.entity.hehe.product.*;
 public interface HeHeProductService {
 public interface HeHeProductService {
     ResponseJson<PaginationVo<HeHeProduct>> productList(HeHeProduct product, int pageNum, int pageSize);
     ResponseJson<PaginationVo<HeHeProduct>> productList(HeHeProduct product, int pageNum, int pageSize);
 
 
-    ResponseJson<PaginationVo<HeHeBigType>>  bigTypeList(HeHeBigType type, int pageNum, int pageSize);
+    ResponseJson<PaginationVo<HeHeBigType>> bigTypeList(HeHeBigType type, int pageNum, int pageSize);
 
 
     ResponseJson<PaginationVo<HeHeActivity>> activeList(HeHeActivity activity, int pageNum, int pageSize);
     ResponseJson<PaginationVo<HeHeActivity>> activeList(HeHeActivity activity, int pageNum, int pageSize);
 
 
@@ -20,4 +20,8 @@ public interface HeHeProductService {
     ResponseJson<PaginationVo<CollageProduct>> CollageProductList(CollageProduct collage, int pageNum, int pageSize);
     ResponseJson<PaginationVo<CollageProduct>> CollageProductList(CollageProduct collage, int pageNum, int pageSize);
 
 
     ResponseJson<PaginationVo<CollageRecord>> CollageRecordList(CollageRecord collage, int pageNum, int pageSize);
     ResponseJson<PaginationVo<CollageRecord>> CollageRecordList(CollageRecord collage, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<HeHeActivityProduct>> salesProductList(HeHeActivityProduct product, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<HeHeProduct>> salesActivityProductList(String name, Integer userId, String shopName, int pageNum, int pageSize);
 }
 }

+ 46 - 1
src/main/java/com/caimei365/manager/service/hehe/product/impl/HeHeProductServiceImpl.java

@@ -3,10 +3,12 @@ package com.caimei365.manager.service.hehe.product.impl;
 
 
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.MathUtil;
+import com.caimei.utils.StringUtil;
 import com.caimei365.manager.config.thinkgem.Global;
 import com.caimei365.manager.config.thinkgem.Global;
 import com.caimei365.manager.dao.hehe.HeHeProductDao;
 import com.caimei365.manager.dao.hehe.HeHeProductDao;
 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.svip.CmSku;
 import com.caimei365.manager.entity.hehe.product.*;
 import com.caimei365.manager.entity.hehe.product.*;
 import com.caimei365.manager.service.hehe.product.HeHeProductService;
 import com.caimei365.manager.service.hehe.product.HeHeProductService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
@@ -107,7 +109,7 @@ public class HeHeProductServiceImpl implements HeHeProductService {
     public ResponseJson<PaginationVo<CollageRecord>> CollageRecordList(CollageRecord collage, int pageNum, int pageSize) {
     public ResponseJson<PaginationVo<CollageRecord>> CollageRecordList(CollageRecord collage, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<CollageRecord> list = productDao.findCollageRecordList(collage);
         List<CollageRecord> list = productDao.findCollageRecordList(collage);
-        list.forEach(col->{
+        list.forEach(col -> {
             // 获取已拼团的订单id列表
             // 获取已拼团的订单id列表
             List<Integer> orderIdList = productDao.getCollageOrderIds(col.getId());
             List<Integer> orderIdList = productDao.getCollageOrderIds(col.getId());
             col.setOrderIdList(orderIdList);
             col.setOrderIdList(orderIdList);
@@ -116,6 +118,43 @@ public class HeHeProductServiceImpl implements HeHeProductService {
         return ResponseJson.success(page);
         return ResponseJson.success(page);
     }
     }
 
 
+    @Override
+    public ResponseJson<PaginationVo<HeHeActivityProduct>> salesProductList(HeHeActivityProduct product, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<HeHeActivityProduct> productList = productDao.activityProductList(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            item.setSkus(getProductSku(item.getProductId()));
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+        });
+        PaginationVo<HeHeActivityProduct> page = new PaginationVo<>(productList);
+        return null;
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<HeHeProduct>> salesActivityProductList(String name, Integer userId, String shopName, int pageNum, int pageSize) {
+        List<Integer> productIds = productDao.findUserActivityProduct(userId);
+        PageHelper.startPage(pageNum, pageSize);
+        HeHeProduct heHeProduct = new HeHeProduct();
+        heHeProduct.setIds(productIds);
+        heHeProduct.setName(name);
+        heHeProduct.setShopName(shopName);
+        /**
+         * todo
+         * 根据userId过滤已存在该分销的活动商品列表商品,有空改为一句sql
+         */
+        List<HeHeProduct> productList = productDao.findAllActivityProduct(heHeProduct);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+        });
+        return null;
+    }
+
     public void setShareReductionStatus(ShareReduction reduction) {
     public void setShareReductionStatus(ShareReduction reduction) {
         Date date = new Date();
         Date date = new Date();
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -151,4 +190,10 @@ public class HeHeProductServiceImpl implements HeHeProductService {
             }
             }
         }
         }
     }
     }
+
+    public List<CmSku> getProductSku(Integer productId) {
+        List<CmSku> skuList = productDao.findHeHeSku(productId);
+        skuList.forEach(s -> s.setLadderPriceList(productDao.findLadderList(s.getSkuId())));
+        return skuList;
+    }
 }
 }

+ 6 - 0
src/main/java/com/caimei365/manager/service/hehe/user/HeHeUserService.java

@@ -13,4 +13,10 @@ public interface HeHeUserService {
     ResponseJson<PaginationVo<HeHeUser>> SalesList(HeHeUser man, int pageNum, int pageSize);
     ResponseJson<PaginationVo<HeHeUser>> SalesList(HeHeUser man, int pageNum, int pageSize);
 
 
     ResponseJson<PaginationVo<HeHeUser>> userList(HeHeUser man, int pageNum, int pageSize);
     ResponseJson<PaginationVo<HeHeUser>> userList(HeHeUser man, int pageNum, int pageSize);
+
+    ResponseJson saveSales(HeHeUser man);
+
+    ResponseJson addSaleActivityProducts(Integer userId, String productIds);
+
+    ResponseJson delSaleActivityProducts(Integer userId, Integer productId);
 }
 }

+ 63 - 0
src/main/java/com/caimei365/manager/service/hehe/user/impl/HeHeUserServiceImpl.java

@@ -1,9 +1,13 @@
 package com.caimei365.manager.service.hehe.user.impl;
 package com.caimei365.manager.service.hehe.user.impl;
 
 
 
 
+import com.caimei.utils.StringUtil;
+import com.caimei365.manager.dao.hehe.HeHeProductDao;
 import com.caimei365.manager.dao.hehe.HeHeUserDao;
 import com.caimei365.manager.dao.hehe.HeHeUserDao;
 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.CmUser;
+import com.caimei365.manager.entity.hehe.product.HeHeSalesActivityProduct;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import com.caimei365.manager.entity.hehe.user.HeHeUser;
 import com.caimei365.manager.service.hehe.user.HeHeUserService;
 import com.caimei365.manager.service.hehe.user.HeHeUserService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
@@ -12,6 +16,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 @Service
 @Service
@@ -20,6 +26,8 @@ public class HeHeUserServiceImpl implements HeHeUserService {
 
 
     @Autowired
     @Autowired
     private HeHeUserDao userDao;
     private HeHeUserDao userDao;
+    @Autowired
+    private HeHeProductDao productDao;
 
 
     @Override
     @Override
     public ResponseJson<PaginationVo<HeHeUser>> SalesList(HeHeUser man, int pageNum, int pageSize) {
     public ResponseJson<PaginationVo<HeHeUser>> SalesList(HeHeUser man, int pageNum, int pageSize) {
@@ -37,4 +45,59 @@ public class HeHeUserServiceImpl implements HeHeUserService {
         PaginationVo<HeHeUser> page = new PaginationVo<>(list);
         PaginationVo<HeHeUser> page = new PaginationVo<>(list);
         return ResponseJson.success(page);
         return ResponseJson.success(page);
     }
     }
+
+    @Override
+    public ResponseJson saveSales(HeHeUser man) {
+        Integer userId = userDao.findMobileOnly(man);
+        if (userId != null && userId > 0) {
+            return ResponseJson.error("手机号重复,请更换手机号");
+        }
+        CmUser user = new CmUser();
+        user.setBindMobile("H" + man.getMobile());
+        user.setUserName(man.getName());
+        user.setName(man.getName());
+        if (null == man.getId()) {
+            man.setUserIdentity(2);
+            //保存user表
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String currentTime = simpleDateFormat.format(new Date());
+            user.setPassword("HeHe");
+            //6:呵呵商城用户
+            user.setUserIdentity(6);
+            user.setRegisterUserTypeId(6);
+            user.setRegisterTime(currentTime);
+            user.setValidFlag(1);
+            userDao.insertCmUser(user);
+            man.setUserId(user.getUserId());
+        } else {
+            user.setUserId(man.getUserId());
+            userDao.updateCmUser(user);
+        }
+        userDao.saveSales(man);
+        return ResponseJson.success();
+    }
+
+    @Override
+    public ResponseJson addSaleActivityProducts(Integer userId, String productIds) {
+        if (StringUtil.isNotBlank(productIds)) {
+            String[] strings = productIds.split(",");
+            HeHeSalesActivityProduct product = new HeHeSalesActivityProduct();
+            product.setUserId(userId);
+            for (String productId : strings) {
+                if (StringUtil.isNotBlank(productId)) {
+                    product.setProductId(Integer.valueOf(productId));
+                    Integer activityId = productDao.findActivityByProductId(productId);
+                    product.setActivityId(activityId);
+                    productDao.insertUserActivity(product);
+                }
+            }
+        }
+        return ResponseJson.success();
+    }
+
+    @Override
+    public ResponseJson delSaleActivityProducts(Integer userId, Integer productId) {
+        productDao.deleteUserActivity(userId, productId);
+        return ResponseJson.success();
+    }
 }
 }

+ 114 - 0
src/main/resources/mapper/hehe/HeHeOrderDao.xml

@@ -166,5 +166,119 @@
         and delFlag = 0
         and delFlag = 0
     </select>
     </select>
 
 
+    <select id="findReturnList" resultType="com.caimei365.manager.entity.order.CmReturnedPurchase">
+        SELECT
+        a.id AS "id",
+        a.returnedNo AS "returnedNo",
+        a.orderID AS "orderId",
+        a.shopOrderId AS "shopOrderId",
+        a.userID AS "userId",
+        a.status AS "status",
+        a.returnedWay AS "returnedWay",
+        a.payType AS "payType",
+        a.operatingOrderStatus AS "operatingOrderStatus",
+        ifnull(a.returnedPurchaseFee,0) AS "returnedPurchaseFee",
+        a.refundFee AS "refundFee",
+        a.image1 AS "image1",
+        a.image2 AS "image2",
+        a.image3 AS "image3",
+        a.image4 AS "image4",
+        a.image5 AS "image5",
+        a.remarks AS "remarks",
+        a.reviewImage1 AS "reviewImage1",
+        a.reviewImage2 AS "reviewImage2",
+        a.reviewImage3 AS "reviewImage3",
+        a.reviewImage4 AS "reviewImage4",
+        a.reviewImage5 AS "reviewImage5",
+        a.reviewRemarks AS "reviewRemarks",
+        a.returnTime AS "returnTime",
+        a.applicationUserID AS "applicationUserId",
+        a.reviewUserID AS "reviewUserId",
+        ifnull(a.refundBalanceFee,0) AS "refundBalanceFee",
+        a.refundOnlineFee AS "refundOnlineFee",
+        a.refundOfflineFee AS "refundOfflineFee",
+        a.bankAccountName AS "bankAccountName",
+        a.bankAccountNo AS "bankAccountNo",
+        a.openBank AS "openBank",
+        a.bankAccountType AS "bankAccountType",
+        a.confirmReturnTime AS "confirmReturnTime",
+        b.orderNo as "orderNo",
+        b.orderType as "orderType",
+        c.userName as "userName",
+        c.name as "name",
+        c.userOrganizeID as "userOrganizeId",
+        ifnull(a.refundType,1) as "refundType",
+        s.name AS "applicationUserName",
+        s1.name AS "reviewUserName",
+        co.organizeID AS "organizeId",
+        cso.shopOrderNo AS "shopOrderNo",
+        f.bankAccount as bankNameType
+        FROM cm_returned_purchase a
+        LEFT JOIN sys_user s on s.id = a.applicationUserID
+        LEFT JOIN sys_user s1 on s1.id = a.reviewUserID
+        LEFT JOIN cm_order co ON a.orderID=co.orderID
+        LEFT JOIN cm_shop_order cso ON a.shopOrderId=cso.shopOrderId
+        LEFT JOIN cm_offline_collection f ON a.payType = f.type
+        left join cm_order as b on a.orderID = b.orderID
+        left join user as c on a.userID = c.userID
+        <where>
+            <if test="organizeId != null and organizeId != ''">
+                AND co.organizeID = #{organizeId}
+            </if>
+            <if test="orderType == 2">
+                AND co.orderType = 2
+            </if>
+            <if test="id != null and id != ''">
+                AND a.id = #{id}
+            </if>
+            <if test="returnedNo != null and returnedNo != ''">
+                AND a.returnedNo = #{returnedNo}
+            </if>
+            <if test="orderId != null and orderId != ''">
+                AND a.orderID = #{orderId}
+            </if>
+            <if test="shopOrderId != null and shopOrderId != ''">
+                AND a.shopOrderId = #{shopOrderId}
+            </if>
+            <if test="shopOrderNo != null and shopOrderNo != ''">
+                AND cso.shopOrderNo = #{shopOrderNo}
+            </if>
+            <if test="userId != null and userId != ''">
+                AND a.userId = #{userId}
+            </if>
+            <if test="status != null and status != ''">
+                AND a.status = #{status}
+            </if>
+            <if test="returnTime != null and returnTime != ''">
+                AND a.returnTime = #{returnTime}
+            </if>
+            <if test="confirmReturnTime != null and confirmReturnTime != ''">
+                AND a.confirmReturnTime = #{confirmReturnTime}
+            </if>
+            <if test="beginTime != null and beginTime != ''">
+                AND returnTime <![CDATA[  >=  ]]> #{beginTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND returnTime <![CDATA[  <=  ]]> #{endTime}
+            </if>
+            <if test="beginConfirmReturnTime != null and beginConfirmReturnTime != ''">
+                AND STR_TO_DATE(confirmReturnTime,'%Y-%m-%d %H:%i') <![CDATA[  >  ]]>
+                STR_TO_DATE(#{beginConfirmReturnTime},'%Y-%m-%d %H:%i')
+            </if>
+            <if test="endConfirmReturnTime != null and endConfirmReturnTime != ''">
+                AND STR_TO_DATE(confirmReturnTime,'%Y-%m-%d %H:%i') <![CDATA[  <  ]]>
+                STR_TO_DATE(#{endConfirmReturnTime},'%Y-%m-%d %H:%i')
+            </if>
+            <if test="name != null and name != ''">
+            AND c.name like concat('%',#{name},'%')
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND b.orderNo = #{orderNo}
+            </if>
+            and a.delFlag = 0
+        </where>
+        order by a.returnTime desc
+    </select>
+
 
 
 </mapper>
 </mapper>

+ 124 - 0
src/main/resources/mapper/hehe/HeHeProductDao.xml

@@ -2,6 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.manager.dao.hehe.HeHeProductDao">
 <mapper namespace="com.caimei365.manager.dao.hehe.HeHeProductDao">
 
 
+    <insert id="insertUserActivity">
+        INSERT INTO `cm_hehe_user_activity` (`userId`, `activityId`, `productId`,
+                                             addTime)
+        VALUES (#{userId}, #{activityId}, #{productId},
+                NOW())
+    </insert>
+
+    <delete id="deleteUserActivity">
+        delete
+        from cm_hehe_user_activity
+        where userId = #{userId}
+          and productId = #{productId}
+    </delete>
 
 
     <select id="findProductList" resultType="com.caimei365.manager.entity.hehe.product.HeHeProduct">
     <select id="findProductList" resultType="com.caimei365.manager.entity.hehe.product.HeHeProduct">
         SELECT a.id AS "id",
         SELECT a.id AS "id",
@@ -303,5 +316,116 @@
           and co.receiptStatus = 3
           and co.receiptStatus = 3
     </select>
     </select>
 
 
+    <select id="findHeHeSku" resultType="com.caimei365.manager.entity.caimei.svip.CmSku">
+        select cs.skuId,
+               cs.productId,
+               cs.organizeId,
+               cs.unit,
+               cs.stock,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId
+                  and organizeId = cs.organizeId) as costCheckFlag,
+               cs.costPrice,
+               ifnull(cs.shopPercent, 0)          as shopPercent,
+               ifnull(cs.organizePercent, 0)      as organizePercent,
+               ifnull(cs.cmPercent, 0)            as cmPercent,
+               chs.price
+        from cm_sku cs
+                 left join cm_hehe_sku chs on cs.skuId = chs.skuId
+        where cs.productId = #{productID}
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
+    </select>
+
+    <select id="findLadderList" resultType="com.caimei365.manager.entity.caimei.svip.CmLadderPrice">
+        select id, buyPrice, buyNum
+        from cm_hehe_activity_ladder
+        where skuId = #{skuId}
+    </select>
+
+    <select id="activityProductList" resultType="com.caimei365.manager.entity.hehe.product.HeHeActivityProduct">
+        SELECT
+        a.id AS "id",
+        a.userId AS "userId",
+        a.activityId AS "activityId",
+        a.productId AS "productId",
+        a.sort AS "sort",
+        chs.price AS "price",
+        p.name AS "name",
+        p.mainImage AS "mainImage",
+        cs.unit AS "unit",
+        s.name AS "shopName"
+        FROM
+        cm_hehe_user_activity a
+        LEFT JOIN cm_hehe_product chp ON chp.productId = a.productID
+        LEFT JOIN cm_hehe_sku chs ON chp.productId = chs.productID
+        LEFT JOIN cm_sku cs ON cs.skuId = chs.skuId
+        LEFT JOIN product p ON a.productId = p.productID
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        LEFT JOIN shop s ON s.shopID = p.shopID
+        WHERE
+        a.userId = #{userId}
+        and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productId)
+        <if test="name != null and name != ''">
+            AND p.name LIKE CONCAT('%',#{name},'%')
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name LIKE CONCAT('%',#{shopName},'%')
+        </if>
+        group by a.productID
+        ORDER BY
+        - a.sort DESC
+    </select>
+
+    <select id="findUserActivityProduct" resultType="java.lang.Integer">
+        SELECT productId
+        FROM cm_hehe_user_activity
+        WHERE userId = #{userId}
+    </select>
+
+    <select id="findAllActivityProduct" resultType="com.caimei365.manager.entity.hehe.product.HeHeProduct">
+        SELECT
+        a.id AS "id",
+        a.productId AS "productId",
+        chs.price AS "price",
+        p.name AS "name",
+        p.mainImage AS "mainImage",
+        s.name AS "shopName"
+        FROM
+        cm_hehe_activity_product a
+        LEFT JOIN cm_hehe_product chp ON a.productId = chp.productId
+        LEFT JOIN cm_hehe_sku chs ON chp.productId = chs.productID
+        LEFT JOIN cm_sku cs ON cs.skuId = chs.skuId
+        LEFT JOIN product p ON a.productId = p.productID
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        LEFT JOIN shop s ON s.shopID = p.shopID
+        WHERE
+        a.delFlag = 0
+        and copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productId)
+        <if test="ids != null and ids.size() > 0 ">
+            AND a.productId NOT IN
+            <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                #{id}
+            </foreach>
+        </if>
+        <if test="productId != null">
+            AND a.productId = #{productId}
+        </if>
+        <if test="name != null and name != ''">
+            AND p.name LIKE CONCAT('%',#{name},'%')
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name LIKE CONCAT('%',#{shopName},'%')
+        </if>
+        group by a.productID
+        ORDER BY productId DESC
+    </select>
+
+    <select id="findActivityByProductId" resultType="java.lang.Integer">
+        SELECT activityId
+        FROM cm_hehe_activity_product
+        WHERE productId = #{productId}
+          AND delFlag = 0
+    </select>
 
 
 </mapper>
 </mapper>

+ 40 - 0
src/main/resources/mapper/hehe/HeHeUserDao.xml

@@ -2,6 +2,40 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.manager.dao.hehe.HeHeUserDao">
 <mapper namespace="com.caimei365.manager.dao.hehe.HeHeUserDao">
 
 
+    <insert id="saveSales">
+        INSERT INTO cm_hehe_user(userId,
+                                 name,
+                                 mobile,
+                                 userIdentity,
+                                 nickName,
+                                 openId,
+                                 addTime)
+        VALUES (#{userId},
+                #{name},
+                #{mobile},
+                #{userIdentity},
+                #{nickName},
+                #{openId},
+                now())
+    </insert>
+
+    <insert id="insertCmUser">
+        INSERT INTO USER (bindMobile, userIdentity,
+                          userName, password, name, registerTime,
+                          validFlag, registerUserTypeID)
+        VALUES (#{bindMobile}, #{userIdentity},
+                #{userName}, #{password}, #{name}, #{registerTime},
+                #{validFlag}, #{registerUserTypeID})
+    </insert>
+
+    <update id="updateCmUser">
+        UPDATE user
+        SET bindMobile = #{bindMobile},
+            userName   = #{userName},
+            name       = #{name}
+        WHERE userID = #{userId}
+    </update>
+
     <select id="findList" resultType="com.caimei365.manager.entity.hehe.user.HeHeUser">
     <select id="findList" resultType="com.caimei365.manager.entity.hehe.user.HeHeUser">
         SELECT a.id AS "id", a.userId AS "userId", a.name AS "name", a.mobile AS "mobile", a.userIdentity AS
         SELECT a.id AS "id", a.userId AS "userId", a.name AS "name", a.mobile AS "mobile", a.userIdentity AS
         "userIdentity", a.nickName AS "nickName", a.openId AS "openId", a.addTime AS "addTime"
         "userIdentity", a.nickName AS "nickName", a.openId AS "openId", a.addTime AS "addTime"
@@ -23,4 +57,10 @@
         ORDER BY addTime DESC
         ORDER BY addTime DESC
     </select>
     </select>
 
 
+    <select id="findMobileOnly" resultType="java.lang.Integer">
+        SELECT id
+        FROM cm_hehe_user
+        WHERE mobile = #{mobile}
+    </select>
+
 </mapper>
 </mapper>