Pārlūkot izejas kodu

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

kaick 1 gadu atpakaļ
vecāks
revīzija
1cdeff69b5
63 mainītis faili ar 9123 papildinājumiem un 54 dzēšanām
  1. 4 0
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  2. 25 1
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  3. 28 5
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  4. 165 0
      src/main/java/com/caimei/modules/product/dao/CmDistributionProductMapper.java
  5. 113 0
      src/main/java/com/caimei/modules/product/dao/CmDistributionSkuMapper.java
  6. 217 0
      src/main/java/com/caimei/modules/product/entity/CmDistributionProduct.java
  7. 145 0
      src/main/java/com/caimei/modules/product/entity/CmDistributionSku.java
  8. 72 0
      src/main/java/com/caimei/modules/product/entity/CmDistributionTeamProduct.java
  9. 255 0
      src/main/java/com/caimei/modules/product/service/CmDistributionProductService.java
  10. 198 0
      src/main/java/com/caimei/modules/product/web/CmDistributionProductController.java
  11. 120 0
      src/main/java/com/caimei/modules/user/dao/CmDistributionMapper.java
  12. 115 0
      src/main/java/com/caimei/modules/user/dao/CmRelatedImageMapper.java
  13. 115 0
      src/main/java/com/caimei/modules/user/dao/CmReportingClubMapper.java
  14. 123 0
      src/main/java/com/caimei/modules/user/dao/CmReportingMemberMapper.java
  15. 1 1
      src/main/java/com/caimei/modules/user/dao/CmUserDao.java
  16. 2 0
      src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java
  17. 250 0
      src/main/java/com/caimei/modules/user/entity/CmDistribution.java
  18. 104 0
      src/main/java/com/caimei/modules/user/entity/CmRelatedImage.java
  19. 385 0
      src/main/java/com/caimei/modules/user/entity/CmReportingClub.java
  20. 224 0
      src/main/java/com/caimei/modules/user/entity/CmReportingMember.java
  21. 123 0
      src/main/java/com/caimei/modules/user/service/CmDistributionService.java
  22. 128 0
      src/main/java/com/caimei/modules/user/service/CmReportingClubService.java
  23. 23 1
      src/main/java/com/caimei/modules/user/service/CmUserService.java
  24. 6 0
      src/main/java/com/caimei/modules/user/service/NewCmClubService.java
  25. 230 0
      src/main/java/com/caimei/modules/user/web/CmDistributionController.java
  26. 211 0
      src/main/java/com/caimei/modules/user/web/CmReportingClubController.java
  27. 89 0
      src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java
  28. 6 3
      src/main/java/com/caimei/modules/utils/MessageUtil.java
  29. 33 32
      src/main/java/com/thinkgem/jeesite/common/persistence/interceptor/SQLHelper.java
  30. 0 1
      src/main/java/com/thinkgem/jeesite/common/service/CrudService.java
  31. 14 0
      src/main/resources/mappings/modules/order/OrderMapper.xml
  32. 2 1
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  33. 654 0
      src/main/resources/mappings/modules/product/CmDistributionProductMapper.xml
  34. 289 0
      src/main/resources/mappings/modules/product/CmDistributionSkuMapper.xml
  35. 455 0
      src/main/resources/mappings/modules/user/CmDistributionMapper.xml
  36. 320 0
      src/main/resources/mappings/modules/user/CmRelatedImageMapper.xml
  37. 441 0
      src/main/resources/mappings/modules/user/CmReportingClubMapper.xml
  38. 394 0
      src/main/resources/mappings/modules/user/CmReportingMemberMapper.xml
  39. 8 1
      src/main/resources/mappings/modules/user/CmUserMapper.xml
  40. 75 2
      src/main/resources/mappings/modules/user/NewCmClubMapper.xml
  41. 6 6
      src/main/webapp/WEB-INF/views/modules/info/infoTypeForm.jsp
  42. 2 0
      src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp
  43. 144 0
      src/main/webapp/WEB-INF/views/modules/product/cmDistributionAddProduct.jsp
  44. 561 0
      src/main/webapp/WEB-INF/views/modules/product/cmDistributionProductForm.jsp
  45. 167 0
      src/main/webapp/WEB-INF/views/modules/product/cmDistributionProductList.jsp
  46. 189 0
      src/main/webapp/WEB-INF/views/modules/product/cmDistributionTeamProductList.jsp
  47. 65 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionClubFrom.jsp
  48. 169 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionClubList.jsp
  49. 105 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionFrom.jsp
  50. 150 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionList.jsp
  51. 99 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionMemberSettleFrom.jsp
  52. 150 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionMemberSettleList.jsp
  53. 92 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionSettleFrom.jsp
  54. 102 0
      src/main/webapp/WEB-INF/views/modules/user/cmDistributionSettleList.jsp
  55. 118 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingClubFrom.jsp
  56. 126 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingClubList.jsp
  57. 98 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingClubSettleFrom.jsp
  58. 107 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingClubSettleList.jsp
  59. 167 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberFrom.jsp
  60. 117 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberList.jsp
  61. 110 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberSettleFrom.jsp
  62. 116 0
      src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberSettleList.jsp
  63. 1 0
      src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyList.jsp

+ 4 - 0
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -369,4 +369,8 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     Double findPayOrganize(String shopOrderId);
 
     String findOrganizeSplitByShopOrder(String shopOrderId);
+
+    Integer findUserIdentityByOrder(Integer orderId);
+
+    Integer findOrderId(Integer shopOrderId);
 }

+ 25 - 1
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -13,7 +13,9 @@ import com.caimei.modules.order.utils.RSA;
 import com.caimei.modules.order.utils.SettlePostFormUtil;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.caimei.modules.user.dao.CmReportingClubMapper;
 import com.caimei.modules.user.dao.NewCmShopDao;
+import com.caimei.modules.user.entity.CmReportingClub;
 import com.caimei.modules.user.entity.NewCmShop;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.StringUtil;
@@ -71,6 +73,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
     private HeHeNewOrderDao heHeNewOrderDao;
     @Resource
     private CmRefundShopDao cmRefundShopDao;
+    @Resource
+    private CmReportingClubMapper cmReportingClubMapper;
 
 
     public List<CmPayShop> exports(Page<CmPayShop> cmPayShopPage, CmPayShop cmPayShop) {
@@ -1405,6 +1409,8 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
 
     @Transactional(readOnly = false, rollbackFor = Exception.class)
     public void settlement(String shopOrderId) throws Exception {
+        Integer orderId = newOrderDao.findOrderId(Integer.valueOf(shopOrderId));
+        Integer identity = newOrderDao.findUserIdentityByOrder(orderId);
         // 结算付供应商
         String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
         String substring = format.substring(20);
@@ -1419,7 +1425,25 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         // 有组织佣金/付第三方的情况下,还需要结算组织佣金,付第三方
         Double payOrganize = newOrderDao.findPayOrganize(shopOrderId);
         if (null != payOrganize && payOrganize > 0) {
-            String split = newOrderDao.findOrganizeSplitByShopOrder(shopOrderId);
+            String split = null;
+            //分销人员分账修改报备记录
+            if (identity == 8) {
+                CmReportingClub cmReportingClubById = cmReportingClubMapper.getByCmReportingClub(new CmReportingClub().orderId(orderId).orderStatus(1));
+                if (null != cmReportingClubById) {
+                    //分销团队分账号
+                    split = cmReportingClubById.splitCode();
+                    cmReportingClubMapper.updateCmReportingClub(new CmReportingClub()
+                            .id(cmReportingClubById.id())
+                            .splitSettleStatus(3)
+                            .splitSettleTime(new Date())
+                    );
+                } else {
+                    logger.info("分销订单分账结算异常,子订单Id:" + shopOrderId + ">>>>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+                    return;
+                }
+            } else {
+                split = newOrderDao.findOrganizeSplitByShopOrder(shopOrderId);
+            }
             settleOrder("JSZZ" + shopOrderId + substring, payOrganize, split, shopOrderId, 3);
         }
         Double payOther = newOrderDao.getOtherPaid(shopOrderId);

+ 28 - 5
src/main/java/com/caimei/modules/order/service/SplitAccountService.java

@@ -6,6 +6,8 @@ import com.caimei.modules.order.dao.NewOrderDao;
 import com.caimei.modules.order.dao.NewShopOrderDao;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.order.utils.Disguiser;
+import com.caimei.modules.user.dao.CmReportingClubMapper;
+import com.caimei.modules.user.entity.CmReportingClub;
 import com.caimei.redis.RedisService;
 import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.service.BaseService;
@@ -40,6 +42,8 @@ public class SplitAccountService extends BaseService {
     private RedisService redisService;
     @Resource
     private NewShopOrderDao newShopOrderDao;
+    @Resource
+    private CmReportingClubMapper cmReportingClubMapper;
 
     @Transactional(readOnly = false, rollbackFor = Exception.class)
     public void SplitAccount(String[] shopOrderIds) {
@@ -113,19 +117,38 @@ public class SplitAccountService extends BaseService {
              */
             if (organizeCostPrice.get() > 0) {
                 SplitAccountPo splitAccount = new SplitAccountPo();
+                Integer identity = newOrderDao.findUserIdentityByOrder(shopOrder.getOrderId());
                 splitAccount.setShopOrderId(shopOrder.getShopOrderId());
                 splitAccount.setOrderId(shopOrder.getOrderId());
                 splitAccount.setSplitAccount(organizeCostPrice.get());
-                splitAccount.setProductType(5);
+                splitAccount.setProductType(identity == 8 ? 7 : 5);
                 // 该商品设置了商户号
                 splitAccount.setType(4);
-                String code = newOrderDao.findSplitCodeByOrganize(shopOrder.getOrganizeId());
+                String code = null;
+                //分销人员分账修改报备记录
+                if (identity == 8) {
+                    CmReportingClub cmReportingClubById = cmReportingClubMapper.getByCmReportingClub(new CmReportingClub().orderId(shopOrder.getOrderId()).orderStatus(1));
+                    if (null != cmReportingClubById) {
+                        //分销团队分账号
+                        code = cmReportingClubById.splitCode();
+                        cmReportingClubMapper.updateCmReportingClub(new CmReportingClub()
+                                .id(cmReportingClubById.id())
+                                .splitSettleStatus(2)
+                        );
+                    } else {
+                        logger.info("分销订单分账异常,订单Id:" + shopOrder.getOrderId() + ">>>>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+                        return;
+                    }
+                } else {
+                    code = newOrderDao.findSplitCodeByOrganize(shopOrder.getOrganizeId());
+                }
+                String splitName = identity == 8 ? "分销团队" : "组织";
                 if (StringUtils.isBlank(code)) {
-                    logger.info("组织的分帐号未空,无法分帐组织佣金!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+                    logger.info(splitName + "的分帐号未空,无法分帐" + splitName + "佣金!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                     return;
                 }
                 splitAccount.setSubUserNo(code);
-                logger.info("组织佣金分账参数------------->" + splitAccount.toString());
+                logger.info(splitName + "佣金分账参数------------->" + splitAccount.toString());
                 splitBillDetail.add(splitAccount);
             }
             /**  当前版本还要考虑分组织/集团佣金
@@ -421,4 +444,4 @@ public class SplitAccountService extends BaseService {
         }
     }
 
-}
+}

+ 165 - 0
src/main/java/com/caimei/modules/product/dao/CmDistributionProductMapper.java

@@ -0,0 +1,165 @@
+package com.caimei.modules.product.dao;
+
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmDistributionProduct;
+import com.caimei.modules.product.entity.CmDistributionSku;
+import com.caimei.modules.product.entity.CmDistributionTeamProduct;
+import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@MyBatisDao
+public interface CmDistributionProductMapper extends CrudDao<CmDistributionProduct>
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmDistributionProduct
+     * @return 集合
+     */
+    public List<CmDistributionProduct> getCmDistributionProductList(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过对象查询分销团队商品列表
+     *
+     * @param cmDistributionProduct
+     * @return 集合
+     */
+    public List<CmDistributionProduct> findTeamProductPage(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过Id查询对象
+     *
+     * @param id 主键
+     * @return
+     */
+    public CmDistributionProduct getCmDistributionProductById(String id);
+
+    /**
+     * 通过对象查询对象
+     *
+     * @param cmDistributionProduct
+     * @return
+     */
+    public CmDistributionProduct getByCmDistributionProduct(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmDistributionProduct
+     * @return String
+     */
+    public String getById(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过对象查询Ids
+     *
+     * @param cmDistributionProduct
+     * @return List<String>
+     */
+    public List<String> getByIds(CmDistributionProduct cmDistributionProduct);
+    /**
+     * 通过对象查询商品Ids
+     *
+     * @param cmDistributionProduct
+     * @return List<String>
+     */
+    public List<Integer> getByProductIds(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过对象查询分销团队商品Ids
+     *
+     * @param cmDistributionProduct
+     * @return List<String>
+     */
+    public List<Integer> getByTeamProductIds(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmDistributionProduct
+     * @return Integer
+     */
+    public int getCmDistributionProductCount(CmDistributionProduct cmDistributionProduct);
+
+
+    /**
+     * 查询采美所有上架的商品
+     *
+     * @param product
+     * @return
+     */
+    List<Product> findAllProduct(Product product);
+    /**
+     * 查询分销所有上架的商品
+     *
+     * @param product
+     * @return
+     */
+    List<Product> findCmDistributionAllProduct(Product product);
+
+    /**
+     * 新增
+     *
+     * @param cmDistributionProduct
+     * @return 结果
+     */
+    public int addCmDistributionProduct(CmDistributionProduct cmDistributionProduct);
+    /**
+     * 新增
+     *
+     * @param cmDistributionTeamProduct
+     * @return 结果
+     */
+    public int addCmDistributionTeamProduct(CmDistributionTeamProduct cmDistributionTeamProduct);
+    /**
+     * 修改
+     *
+     * @param cmDistributionProduct
+     * @return 结果
+     */
+    public int updateCmDistributionProduct(CmDistributionProduct cmDistributionProduct);
+
+
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionProduct(CmDistributionProduct cmDistributionProduct);
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionProductByIds(@Param("ids") String[] ids);
+
+
+
+    /**
+     * 修改
+     *
+     * @param cmDistributionTeamProduct
+     * @return 结果
+     */
+    public int updateCmDistributionTeamProduct(CmDistributionTeamProduct cmDistributionTeamProduct);
+
+
+    /**
+     * 批量删除
+     * @return 结果
+     */
+    public int delCmDistributionTeamProduct(CmDistributionTeamProduct cmDistributionTeamProduct);
+}

+ 113 - 0
src/main/java/com/caimei/modules/product/dao/CmDistributionSkuMapper.java

@@ -0,0 +1,113 @@
+package com.caimei.modules.product.dao;
+
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmDistributionSku;
+import com.caimei.modules.product.entity.CmDistributionTeamProduct;
+import com.caimei.modules.product.entity.CmOrganizeProductInfo;
+import com.caimei.modules.product.entity.CmSku;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@MyBatisDao
+public interface CmDistributionSkuMapper extends CrudDao<CmDistributionSku>
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmDistributionSku
+     * @return 集合
+     */
+    public List<CmDistributionSku> getCmDistributionSkuList(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 通过Id查询对象
+     *
+     * @param skuId 主键
+     * @return
+     */
+    public CmDistributionSku getCmDistributionSkuBySkuId(String skuId);
+
+    /**
+     * 通过对象查询对象
+     *
+     * @param cmDistributionSku
+     * @return
+     */
+    public CmDistributionSku getByCmDistributionSku(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmDistributionSku
+     * @return String
+     */
+    public String getById(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 通过对象查询Ids
+     *
+     * @param cmDistributionSku
+     * @return List<String>
+     */
+    public List<String> getByIds(CmDistributionSku cmDistributionSku);
+
+    public List<CmSku> findDistributionSku(Integer productId);
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmDistributionSku
+     * @return Integer
+     */
+    public int getCmDistributionSkuCount(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 新增
+     *
+     * @param cmDistributionSku
+     * @return 结果
+     */
+    public int addCmDistributionSku(CmDistributionSku cmDistributionSku);
+
+
+
+    /**
+     * 修改
+     *
+     * @param cmDistributionSku
+     * @return 结果
+     */
+    public int updateCmDistributionSku(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 删除
+     *
+     * @param skuId 主键
+     * @return 结果
+     */
+    public int delCmDistributionSkuBySkuId(String skuId);
+
+    /**
+     * 批量删除
+     *
+     * @param skuIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionSku(CmDistributionSku cmDistributionSku);
+
+    /**
+     * 批量删除
+     *
+     * @param skuIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionSkuBySkuIds(@Param("skuIds") String[] skuIds);
+
+}

+ 217 - 0
src/main/java/com/caimei/modules/product/entity/CmDistributionProduct.java

@@ -0,0 +1,217 @@
+package com.caimei.modules.product.entity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 对象 cm_distribution_product
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistributionProduct")
+public class CmDistributionProduct  extends DataEntity<CmDistributionProduct> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String id;
+
+    /** 对应采美商品id */
+    private Integer productId;
+
+    /** 上架状态:1上架,2下架 */
+    private String validFlag;
+
+    /** 是否含税 0不含税,1含税 */
+    private String includedTax;
+
+    /** 发票类型(基于是否含税基础) 1增值税专用发票,2增值税普通发票, 3不能开票 */
+    private String invoiceType;
+
+    /** 机构税率 :增值税默认13%,普通票6%取值范围[0-100] */
+    private BigDecimal clubTaxPoint;
+
+    /** 供应商税率:增值专用发票默认13%,增值税普通发票6%取值范围[0-100] */
+    private BigDecimal shopTaxPoint;
+
+    /** 报备佣金 */
+    private BigDecimal commission;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date addTime;
+
+
+
+    /** 团队Id */
+    private Integer distributionId;
+
+    /** 商品名称 */
+    private String name;
+    /** 供应商Id */
+    private String shopID;
+    /** 供应商名称 */
+    private String shopName;
+    /** mainImage */
+    private String mainImage;
+
+
+
+    /** skuId */
+    private String skuId;
+    /** 机构价格(同为二手商品的交易价) */
+    private BigDecimal price;
+
+    /** 机构价格(同为二手商品的交易价) */
+    private List<CmDistributionSku> skus;
+
+    public Integer getDistributionId() {
+        return distributionId;
+    }
+
+    public void setDistributionId(Integer distributionId) {
+        this.distributionId = distributionId;
+    }
+
+    public List<CmDistributionSku> getSkus() {
+        return skus;
+    }
+
+    public void setSkus(List<CmDistributionSku> skus) {
+        this.skus = skus;
+    }
+
+    public String getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(String skuId) {
+        this.skuId = skuId;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getShopID() {
+        return shopID;
+    }
+
+    public void setShopID(String shopID) {
+        this.shopID = shopID;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    public void setMainImage(String mainImage) {
+        this.mainImage = mainImage;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(String validFlag) {
+        this.validFlag = validFlag;
+    }
+
+    public String getIncludedTax() {
+        return includedTax;
+    }
+
+    public void setIncludedTax(String includedTax) {
+        this.includedTax = includedTax;
+    }
+
+    public String getInvoiceType() {
+        return invoiceType;
+    }
+
+    public void setInvoiceType(String invoiceType) {
+        this.invoiceType = invoiceType;
+    }
+
+    public BigDecimal getClubTaxPoint() {
+        return clubTaxPoint;
+    }
+
+    public void setClubTaxPoint(BigDecimal clubTaxPoint) {
+        this.clubTaxPoint = clubTaxPoint;
+    }
+
+    public BigDecimal getShopTaxPoint() {
+        return shopTaxPoint;
+    }
+
+    public void setShopTaxPoint(BigDecimal shopTaxPoint) {
+        this.shopTaxPoint = shopTaxPoint;
+    }
+
+    public BigDecimal getCommission() {
+        return commission;
+    }
+
+    public void setCommission(BigDecimal commission) {
+        this.commission = commission;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+}

+ 145 - 0
src/main/java/com/caimei/modules/product/entity/CmDistributionSku.java

@@ -0,0 +1,145 @@
+package com.caimei.modules.product.entity;
+
+import java.math.BigDecimal;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 对象 cm_distribution_sku
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistributionSku")
+public class CmDistributionSku  extends DataEntity<CmDistributionSku> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** skuId */
+    private String skuId;
+
+    /** 商品Id */
+    private Integer productId;
+
+    /** 机构价格(同为二手商品的交易价) */
+    private BigDecimal price;
+
+    /** 分账供应商成本比例 */
+    private Integer shopPercent;
+
+    /** 分账组织佣金比例 */
+    private Integer organizePercent;
+
+    /** 分账采美佣金比例 */
+    private Integer cmPercent;
+
+    /** 成本类型:1固定成本 2比例成本 */
+    private String costCheckFlag;
+    /** 规格 */
+    private String unit;
+
+    /** 成本价 */
+    private BigDecimal costPrice;
+    /** 采美成本 */
+    private BigDecimal cmCostPrice;
+    /** 集团成本 */
+    private BigDecimal organizeCostPrice;
+
+    public BigDecimal getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(BigDecimal costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public BigDecimal getCmCostPrice() {
+        return cmCostPrice;
+    }
+
+    public void setCmCostPrice(BigDecimal cmCostPrice) {
+        this.cmCostPrice = cmCostPrice;
+    }
+
+    public BigDecimal getOrganizeCostPrice() {
+        return organizeCostPrice;
+    }
+
+    public void setOrganizeCostPrice(BigDecimal organizeCostPrice) {
+        this.organizeCostPrice = organizeCostPrice;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(String skuId) {
+        this.skuId = skuId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public BigDecimal getPrice() {
+        return price;
+    }
+
+    public void setPrice(BigDecimal price) {
+        this.price = price;
+    }
+
+    public Integer getShopPercent() {
+        return shopPercent;
+    }
+
+    public void setShopPercent(Integer shopPercent) {
+        this.shopPercent = shopPercent;
+    }
+
+    public Integer getOrganizePercent() {
+        return organizePercent;
+    }
+
+    public void setOrganizePercent(Integer organizePercent) {
+        this.organizePercent = organizePercent;
+    }
+
+    public Integer getCmPercent() {
+        return cmPercent;
+    }
+
+    public void setCmPercent(Integer cmPercent) {
+        this.cmPercent = cmPercent;
+    }
+
+    public String getCostCheckFlag() {
+        return costCheckFlag;
+    }
+
+    public void setCostCheckFlag(String costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
+}

+ 72 - 0
src/main/java/com/caimei/modules/product/entity/CmDistributionTeamProduct.java

@@ -0,0 +1,72 @@
+package com.caimei.modules.product.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 对象 cm_distribution_team_product
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistributionTeamProduct")
+public class CmDistributionTeamProduct  extends DataEntity<CmDistributionTeamProduct> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** cm_distribution表id */
+    private Integer distributionId;
+
+    /** cm_distribution_product表商品id */
+    private Integer productId;
+
+    /** 上架状态:1上架,2下架 */
+    private String validFlag;
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getDistributionId() {
+        return distributionId;
+    }
+
+    public void setDistributionId(Integer distributionId) {
+        this.distributionId = distributionId;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(String validFlag) {
+        this.validFlag = validFlag;
+    }
+}
+

+ 255 - 0
src/main/java/com/caimei/modules/product/service/CmDistributionProductService.java

@@ -0,0 +1,255 @@
+package com.caimei.modules.product.service;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+import com.caimei.modules.product.dao.CmBigtypeDao;
+import com.caimei.modules.product.dao.CmDistributionProductMapper;
+import com.caimei.modules.product.dao.CmDistributionSkuMapper;
+import com.caimei.modules.product.entity.*;
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+import static com.caimei.modules.order.utils.OrderUtil.productDao;
+
+/**
+ * Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@Service
+public class CmDistributionProductService extends CrudService<CmDistributionProductMapper, CmDistributionProduct> {
+    @Resource
+    private CmDistributionProductMapper cmDistributionProductMapper;
+    @Resource
+    private CmDistributionSkuMapper cmDistributionSkuMapper;
+
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmDistributionProduct
+     * @return
+     */
+
+    public List<CmDistributionProduct> getCmDistributionProductList(CmDistributionProduct cmDistributionProduct) {
+        return cmDistributionProductMapper.getCmDistributionProductList(cmDistributionProduct);
+    }
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+
+    public CmDistributionProduct getCmDistributionProductById(String id) {
+        return cmDistributionProductMapper.getCmDistributionProductById(id);
+    }
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmDistributionProduct
+     * @return
+     */
+
+    public CmDistributionProduct getByCmDistributionProduct(CmDistributionProduct cmDistributionProduct) {
+        return cmDistributionProductMapper.getByCmDistributionProduct(cmDistributionProduct);
+    }
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmDistributionProduct
+     * @return String
+     */
+
+    public String getById(CmDistributionProduct cmDistributionProduct) {
+        return cmDistributionProductMapper.getById(cmDistributionProduct);
+    }
+
+    /**
+     * 通过对象查询Ids
+     *
+     * @param cmDistributionProduct
+     * @return List<String>
+     */
+
+    public List<String> getByIds(CmDistributionProduct cmDistributionProduct) {
+        return cmDistributionProductMapper.getByIds(cmDistributionProduct);
+    }
+
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmDistributionProduct
+     * @return int
+     */
+
+    public int getCmDistributionProductCount(CmDistributionProduct cmDistributionProduct) {
+        return cmDistributionProductMapper.getCmDistributionProductCount(cmDistributionProduct);
+    }
+
+    public Page<CmDistributionProduct> findTeamProductPage(Page<CmDistributionProduct> cmDistributionProductPage, CmDistributionProduct cmDistributionProduct) {
+        cmDistributionProduct.setPage(cmDistributionProductPage);
+        List<CmDistributionProduct> productList = cmDistributionProductMapper.findTeamProductPage(cmDistributionProduct);
+        cmDistributionProductPage.setList(productList);
+        return cmDistributionProductPage;
+    }
+    public Page<Product> findProductPage(Page<Product> productPage, Product product) {
+        List<Integer> ids = cmDistributionProductMapper.getByProductIds(null);
+        product.setIds(ids);
+        product.setPage(productPage);
+        List<Product> productList = cmDistributionProductMapper.findAllProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+            item.setSkuList(cmDistributionSkuMapper.findDistributionSku(item.getProductID()));
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+    public Page<Product> findTeamProductPage(Page<Product> productPage, Product product,Integer distributionId) {
+        List<Integer> ids = cmDistributionProductMapper.getByTeamProductIds(new CmDistributionProduct().distributionId(distributionId));
+        product.setIds(ids);
+        product.setPage(productPage);
+        List<Product> productList = cmDistributionProductMapper.findCmDistributionAllProduct(product);
+        String wwwServer = Global.getConfig("wwwServer");
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, wwwServer));
+            }
+            item.setSkuList(cmDistributionSkuMapper.findDistributionSku(item.getProductID()));
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
+
+    /**
+     * 新增
+     *
+     * @param cmDistributionProduct
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int addCmDistributionProduct(CmDistributionProduct cmDistributionProduct) {
+        cmDistributionProduct.skus().forEach(cmDistributionSku -> {
+            cmDistributionSkuMapper.addCmDistributionSku(cmDistributionSku);
+        });
+        cmDistributionProduct.setAddTime(new Date());
+        return cmDistributionProductMapper.addCmDistributionProduct(cmDistributionProduct);
+    }
+
+    /**
+     * 新增
+     *
+     * @param cmDistributionProduct
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int addTeamCmDistributionProduct(CmDistributionTeamProduct cmDistributionTeamProduct) {
+        return cmDistributionProductMapper.addCmDistributionTeamProduct(cmDistributionTeamProduct);
+    }
+
+    /**
+     * 删除
+     *
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int delCmDistributionTeamProduct(CmDistributionTeamProduct cmDistributionTeamProduct) {
+        return cmDistributionProductMapper.delCmDistributionTeamProduct(cmDistributionTeamProduct);
+    }
+
+    /**
+     * 修改
+     *
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int updateCmDistributionTeamProduct(CmDistributionTeamProduct cmDistributionTeamProduct) {
+        return cmDistributionProductMapper.updateCmDistributionTeamProduct(cmDistributionTeamProduct);
+    }
+
+    /**
+     * 修改
+     *
+     * @param cmDistributionProduct
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int updateCmDistributionProduct(CmDistributionProduct cmDistributionProduct) {
+        if (CollectionUtils.isNotEmpty(cmDistributionProduct.skus())) {
+            cmDistributionSkuMapper.delCmDistributionSku(new CmDistributionSku().productId(cmDistributionProduct.productId()));
+            cmDistributionProduct.skus().forEach(cmDistributionSku -> {
+                cmDistributionSkuMapper.addCmDistributionSku(cmDistributionSku);
+            });
+        }
+        return cmDistributionProductMapper.updateCmDistributionProduct(cmDistributionProduct);
+    }
+
+
+    /**
+     * 删除信息
+     *
+     * @param id 主键
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public int delCmDistributionProductById(Integer productId) {
+        cmDistributionSkuMapper.delCmDistributionSku(new CmDistributionSku().productId(productId));
+        return cmDistributionProductMapper.delCmDistributionProduct(new CmDistributionProduct().productId(productId));
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的主键
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+
+    public int delCmDistributionProductByIds(String[] ids) {
+        return cmDistributionProductMapper.delCmDistributionProductByIds(ids);
+    }
+
+    /**
+     * 批量新增
+     *
+     * @param cmDistributionProductList 列表
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public void batchAddCmDistributionProduct(List<CmDistributionProduct> cmDistributionProductList) {
+        for (CmDistributionProduct cmDistributionProduct : cmDistributionProductList) {
+            cmDistributionProductMapper.addCmDistributionProduct(cmDistributionProduct);
+        }
+    }
+
+    /**
+     * 批量修改
+     *
+     * @param cmDistributionProductList 列表
+     * @return 结果
+     */
+    @Transactional(readOnly = false)
+    public void batchUpdateCmDistributionProduct(List<CmDistributionProduct> cmDistributionProductList) {
+        for (CmDistributionProduct cmDistributionProduct : cmDistributionProductList) {
+            cmDistributionProductMapper.updateCmDistributionProduct(cmDistributionProduct);
+        }
+    }
+}
+
+

+ 198 - 0
src/main/java/com/caimei/modules/product/web/CmDistributionProductController.java

@@ -0,0 +1,198 @@
+package com.caimei.modules.product.web;
+
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson.JSON;
+import com.caimei.modules.product.dao.CmDistributionSkuMapper;
+import com.caimei.modules.product.entity.CmDistributionProduct;
+import com.caimei.modules.product.entity.CmDistributionSku;
+import com.caimei.modules.product.entity.CmDistributionTeamProduct;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.product.service.CmDistributionProductService;
+import com.caimei.utils.StringUtils;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+/**
+ * Controller
+ *
+ * @author Kaick
+ * @date 2023-09-18
+ */
+@Controller
+@RequestMapping("${adminPath}/product/cmDistributionProduct")
+public class CmDistributionProductController extends BaseController {
+    @Resource
+    private CmDistributionProductService cmDistributionProductService;
+    @Resource
+    private CmDistributionSkuMapper cmDistributionSkuMapper;
+
+
+    @ModelAttribute
+    public CmDistributionProduct get(@RequestParam(required = false) String id) {
+        CmDistributionProduct entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmDistributionProductService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmDistributionProduct();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmDistributionProduct cmDistributionProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmDistributionProduct> page = cmDistributionProductService.findPage(new Page<CmDistributionProduct>(request, response), cmDistributionProduct);
+        model.addAttribute("cmDistributionProduct", cmDistributionProduct);
+        model.addAttribute("page", page);
+        return "modules/product/cmDistributionProductList";
+    }
+
+    @RequestMapping(value = {"TeamList"})
+    public String TeamList(CmDistributionProduct cmDistributionProduct, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmDistributionProduct> page = cmDistributionProductService.findTeamProductPage(new Page<CmDistributionProduct>(request, response), cmDistributionProduct);
+        model.addAttribute("cmDistributionProduct", cmDistributionProduct);
+        model.addAttribute("page", page);
+        return "modules/product/cmDistributionTeamProductList";
+    }
+
+    @RequestMapping(value = "findProductPage")
+    public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmDistributionProductService.findProductPage(new Page<Product>(request, response), product);
+        model.addAttribute("url", "/product/cmDistributionProduct/findProductPage");
+        model.addAttribute("page", page);
+        model.addAttribute("productList", JSON.toJSONString(page.getList()));
+        return "modules/product/cmDistributionAddProduct";
+    }
+
+    @RequestMapping(value = "findTeamProductPage")
+    public String findTeamProductPage(Product product,Integer distributionId, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmDistributionProductService.findTeamProductPage(new Page<Product>(request, response), product,distributionId);
+        model.addAttribute("page", page);
+        model.addAttribute("url", "/product/cmDistributionProduct/findTeamProductPage");
+        model.addAttribute("distributionId", distributionId);
+        model.addAttribute("productList", JSON.toJSONString(page.getList()));
+        return "modules/product/cmDistributionAddProduct";
+    }
+
+    /**
+     * 获取分销人员详细信息
+     */
+    @RequestMapping(value = "form")
+    public String form(CmDistributionProduct cmDistributionProduct, Model model) {
+        if (null!=cmDistributionProduct.productId()) {
+            List<CmDistributionSku> cmDistributionSkuList = cmDistributionSkuMapper.getCmDistributionSkuList(new CmDistributionSku().productId(cmDistributionProduct.productId()));
+            cmDistributionProduct.setSkus(cmDistributionSkuList);
+        }
+        model.addAttribute("cmDistributionProduct", cmDistributionProduct);
+        return "modules/product/cmDistributionProductForm";
+    }
+
+    /**
+     * 新增分销人员
+     */
+
+    @RequestMapping(value = "save")
+    public String save(CmDistributionProduct cmDistributionProduct, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+
+        if (cmDistributionProduct.getId() == null || cmDistributionProduct.getId() == "") {
+            cmDistributionProductService.addCmDistributionProduct(cmDistributionProduct);
+            addMessage(redirectAttributes, "保存商品成功");
+        } else {
+            cmDistributionProductService.updateCmDistributionProduct(cmDistributionProduct);
+            addMessage(redirectAttributes, "修改商品成功");
+        }
+        return "redirect:" + Global.getAdminPath() + "/product/cmDistributionProduct";
+    }
+    @ResponseBody
+    @RequestMapping(value = "TeamSave")
+    public Map<String, Object> TeamSave(CmDistributionTeamProduct cmDistributionTeamProduct, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+
+        try {
+            if (StringUtils.isBlank(cmDistributionTeamProduct.getId())) {
+                cmDistributionTeamProduct.validFlag("1");
+                cmDistributionProductService.addTeamCmDistributionProduct(cmDistributionTeamProduct);
+                addMessage(redirectAttributes, "保存分销人员成功");
+            }
+            map.put("success", true);
+            map.put("msg", "保存成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "保存失败");
+        }
+        return map;
+    }
+
+    @RequestMapping(value = "TeamDel")
+    public String TeamDel(CmDistributionTeamProduct cmDistributionTeamProduct, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+        if (null!=cmDistributionTeamProduct.productId()&&null!=cmDistributionTeamProduct.distributionId()) {
+            cmDistributionProductService.delCmDistributionTeamProduct(cmDistributionTeamProduct);
+            addMessage(redirectAttributes, "删除分销商品成功");
+        } else {
+            addMessage(redirectAttributes, "请求参数异常!");
+        }
+        return "redirect:" + Global.getAdminPath() + "/product/cmDistributionProduct/TeamList?distributionId="+cmDistributionTeamProduct.distributionId();
+    }
+
+
+    @RequestMapping(value = {"del"})
+    public String del(CmDistributionProduct cmDistributionProduct, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+        if (null!=cmDistributionProduct.productId()) {
+            cmDistributionProductService.delCmDistributionProductById(cmDistributionProduct.productId());
+            addMessage(redirectAttributes, "删除分销商品成功");
+        } else {
+            addMessage(redirectAttributes, "请求参数异常!");
+        }
+        return "redirect:" + Global.getAdminPath() + "/product/cmDistributionProduct";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "updateEnabledStatus")
+    public Map<String, Object> updateEnabledStatus(CmDistributionProduct cmDistributionProduct, HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            cmDistributionProductService.updateCmDistributionProduct(new CmDistributionProduct()
+                    .id(cmDistributionProduct.id())
+                    .validFlag(cmDistributionProduct.validFlag())
+            );
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+    @ResponseBody
+    @RequestMapping(value = "updateTeamEnabledStatus")
+    public Map<String, Object> updateTeamEnabledStatus(CmDistributionTeamProduct cmDistributionTeamProduct, HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            cmDistributionProductService.updateCmDistributionTeamProduct(new CmDistributionTeamProduct()
+                    .distributionId(cmDistributionTeamProduct.distributionId())
+                    .productId(cmDistributionTeamProduct.productId())
+                    .validFlag(cmDistributionTeamProduct.validFlag())
+            );
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+}

+ 120 - 0
src/main/java/com/caimei/modules/user/dao/CmDistributionMapper.java

@@ -0,0 +1,120 @@
+package com.caimei.modules.user.dao;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import com.caimei.modules.user.entity.CmUser;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+import com.caimei.modules.user.entity.CmDistribution;
+
+/**
+ * Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-15
+ */
+@MyBatisDao
+public interface CmDistributionMapper extends CrudDao<CmDistribution>
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmDistribution
+     * @return 集合
+     */
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution);
+
+    /**
+     * 通过Id查询对象
+     *
+     * @param id 主键
+     * @return
+     */
+    public CmDistribution getCmDistributionById(String id);
+
+    /**
+     * 通过对象查询对象
+     *
+     * @param cmDistribution
+     * @return
+     */
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution);
+
+
+    CmDistribution findDistributionIsMobile(@Param("mobile") String mobile, @Param("oldMobile") String oldMobile);
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmDistribution
+     * @return String
+     */
+    public String getById(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询Ids
+     *
+     * @param cmDistribution
+     * @return List<String>
+     */
+    public List<String> getByIds(CmDistribution cmDistribution);
+
+    public   BigDecimal getByCommissions(@Param("id") Integer id,@Param("payWay")Integer payWay);
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmDistribution
+     * @return Integer
+     */
+    public int getCmDistributionCount(CmDistribution cmDistribution);
+
+    /**
+     * 新增
+     *
+     * @param cmDistribution
+     * @return 结果
+     */
+    public int addCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 修改
+     *
+     * @param cmDistribution
+     * @return 结果
+     */
+    public int updateCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 删除
+     *
+     * @param id 主键
+     * @return 结果
+     */
+    public int delCmDistributionById(String id);
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmDistributionByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 115 - 0
src/main/java/com/caimei/modules/user/dao/CmRelatedImageMapper.java

@@ -0,0 +1,115 @@
+package com.caimei.modules.user.dao;
+
+import java.util.List;
+
+import com.caimei.modules.user.entity.CmPortrait;
+import com.caimei.modules.user.entity.CmRelatedImage;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 相关图片Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@MyBatisDao
+public interface CmRelatedImageMapper extends CrudDao<CmRelatedImage>
+{
+    /**
+     * 通过对象查询相关图片列表
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片集合
+     */
+    public List<CmRelatedImage> getCmRelatedImageList(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 通过Id查询相关图片对象
+     *
+     * @param id 相关图片主键
+     * @return 相关图片
+     */
+    public CmRelatedImage getCmRelatedImageById(String id);
+
+    /**
+     * 通过对象查询相关图片对象
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片
+     */
+    public CmRelatedImage getByCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 通过对象查询相关图片Id
+     *
+     * @param cmRelatedImage 相关图片
+     * @return String
+     */
+    public String getById(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 通过对象查询相关图片Ids
+     *
+     * @param cmRelatedImage 相关图片
+     * @return List<String>
+     */
+    public List<String> getByIds(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 通过对象查询相关图片记录总数
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片Integer
+     */
+    public int getCmRelatedImageCount(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 新增相关图片
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 结果
+     */
+    public int addCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 修改相关图片
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 结果
+     */
+    public int updateCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 删除相关图片
+     *
+     * @param id 相关图片主键
+     * @return 结果
+     */
+    public int delCmRelatedImageById(String id);
+
+    /**
+     * 批量删除相关图片
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 批量删除相关图片
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmRelatedImageByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除相关图片
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmRelatedImageByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 115 - 0
src/main/java/com/caimei/modules/user/dao/CmReportingClubMapper.java

@@ -0,0 +1,115 @@
+package com.caimei.modules.user.dao;
+
+import java.util.List;
+
+import com.caimei.modules.user.entity.CmPortrait;
+import com.caimei.modules.user.entity.CmReportingClub;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 机构报备Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@MyBatisDao
+public interface CmReportingClubMapper extends CrudDao<CmReportingClub>
+{
+    /**
+     * 通过对象查询机构报备列表
+     *
+     * @param cmReportingClub 机构报备
+     * @return 机构报备集合
+     */
+    public List<CmReportingClub> getCmReportingClubList(CmReportingClub cmReportingClub);
+
+    /**
+     * 通过Id查询机构报备对象
+     *
+     * @param id 机构报备主键
+     * @return 机构报备
+     */
+    public CmReportingClub getCmReportingClubById(String id);
+
+    /**
+     * 通过对象查询机构报备对象
+     *
+     * @param cmReportingClub 机构报备
+     * @return 机构报备
+     */
+    public CmReportingClub getByCmReportingClub(CmReportingClub cmReportingClub);
+
+    /**
+     * 通过对象查询机构报备Id
+     *
+     * @param cmReportingClub 机构报备
+     * @return String
+     */
+    public String getById(CmReportingClub cmReportingClub);
+
+    /**
+     * 通过对象查询机构报备Ids
+     *
+     * @param cmReportingClub 机构报备
+     * @return List<String>
+     */
+    public List<String> getByIds(CmReportingClub cmReportingClub);
+
+    /**
+     * 通过对象查询机构报备记录总数
+     *
+     * @param cmReportingClub 机构报备
+     * @return 机构报备Integer
+     */
+    public int getCmReportingClubCount(CmReportingClub cmReportingClub);
+
+    /**
+     * 新增机构报备
+     *
+     * @param cmReportingClub 机构报备
+     * @return 结果
+     */
+    public int addCmReportingClub(CmReportingClub cmReportingClub);
+
+    /**
+     * 修改机构报备
+     *
+     * @param cmReportingClub 机构报备
+     * @return 结果
+     */
+    public int updateCmReportingClub(CmReportingClub cmReportingClub);
+
+    /**
+     * 删除机构报备
+     *
+     * @param id 机构报备主键
+     * @return 结果
+     */
+    public int delCmReportingClubById(String id);
+
+    /**
+     * 批量删除机构报备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmReportingClub(CmReportingClub cmReportingClub);
+
+    /**
+     * 批量删除机构报备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmReportingClubByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除机构报备
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmReportingClubByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 123 - 0
src/main/java/com/caimei/modules/user/dao/CmReportingMemberMapper.java

@@ -0,0 +1,123 @@
+package com.caimei.modules.user.dao;
+
+import java.util.List;
+
+import com.caimei.modules.user.entity.CmRelatedImage;
+import com.caimei.modules.user.entity.CmReportingMember;
+import com.thinkgem.jeesite.common.persistence.CrudDao;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 分销报备成员Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@MyBatisDao
+public interface CmReportingMemberMapper extends CrudDao<CmReportingMember>
+{
+    /**
+     * 通过对象查询分销报备成员列表
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 分销报备成员集合
+     */
+    public List<CmReportingMember> getCmReportingMemberList(CmReportingMember cmReportingMember);
+
+    /**
+     * 通过Id查询分销报备成员对象
+     *
+     * @param id 分销报备成员主键
+     * @return 分销报备成员
+     */
+    public CmReportingMember getCmReportingMemberById(String id);
+
+    /**
+     * 通过对象查询分销报备成员对象
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 分销报备成员
+     */
+    public CmReportingMember getByCmReportingMember(CmReportingMember cmReportingMember);
+
+    /**
+     * 通过对象查询分销报备成员Id
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return String
+     */
+    public String getById(CmReportingMember cmReportingMember);
+
+    /**
+     * 通过对象查询分销报备成员Ids
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return List<String>
+     */
+    public List<String> getByIds(CmReportingMember cmReportingMember);
+
+    /**
+     * 通过对象查询分销报备成员记录总数
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 分销报备成员Integer
+     */
+    public Integer getCmReportingMemberCount(CmReportingMember cmReportingMember);
+
+    /**
+     * 通过对象查询分销报备成员记录总数
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 分销报备成员Integer
+     */
+    public Double getCmReportingMembercCommissions(CmReportingMember cmReportingMember);
+
+    /**
+     * 新增分销报备成员
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 结果
+     */
+    public int addCmReportingMember(CmReportingMember cmReportingMember);
+
+    /**
+     * 修改分销报备成员
+     *
+     * @param cmReportingMember 分销报备成员
+     * @return 结果
+     */
+    public int updateCmReportingMember(CmReportingMember cmReportingMember);
+
+    /**
+     * 删除分销报备成员
+     *
+     * @param id 分销报备成员主键
+     * @return 结果
+     */
+    public int delCmReportingMemberById(String id);
+
+    /**
+     * 批量删除分销报备成员
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmReportingMember(CmReportingMember cmReportingMember);
+
+    /**
+     * 批量删除分销报备成员
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmReportingMemberByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除分销报备成员
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmReportingMemberByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 1 - 1
src/main/java/com/caimei/modules/user/dao/CmUserDao.java

@@ -41,7 +41,7 @@ public interface CmUserDao extends CrudDao<CmUser> {
      */
     void updateUserInfo(@Param("realName") String realName, @Param("name") String name, @Param("userName") String userName, @Param("bindMobile") String bindMobile, @Param("email") String email, @Param("userID") Integer userID);
 
-    CmUser findUserByMobile(@Param("mobile") String mobile);
+    CmUser findUserByMobile(@Param("mobile") String mobile,@Param("oldUserId") String oldUserId,@Param("userIdentity") Integer userIdentity);
 
     List<CmUser> findListBuyBindMobile(CmUser cmUser);
 

+ 2 - 0
src/main/java/com/caimei/modules/user/dao/NewCmClubDao.java

@@ -21,6 +21,8 @@ public interface NewCmClubDao extends CrudDao<NewCmClub> {
 
     List<NewCmClub> findProviderList(NewCmClub userClub);
 
+    List<NewCmClub> findDistributionCLubList(NewCmClub userClub);
+
     List<NewCmClub> findClubById(Integer clubID);
 
     List<NewCmClub> textUserValue();

+ 250 - 0
src/main/java/com/caimei/modules/user/entity/CmDistribution.java

@@ -0,0 +1,250 @@
+package com.caimei.modules.user.entity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 对象 cm_distribution
+ *
+ * @author Kaick
+ * @date 2023-09-15
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistribution")
+public class CmDistribution extends DataEntity<CmDistribution> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 用户id */
+    private Integer userId;
+
+    /** 名称 */
+    private String name;
+
+    /** 联系人 */
+    private String linkMan;
+    /** 手机号 */
+    private String mobile;
+    /** 密码 */
+    private String password;
+
+    /** 公司名称 */
+    private String corporateName;
+
+    /** 分账号 */
+    private String splitCode;
+
+    /** 所属银行 */
+    private String bankName;
+
+    /** 银行卡号 */
+    private String bankAccount;
+
+    /** 状态:90上线,91下线 */
+    private Integer status;
+
+    /** 分销二维码 */
+    private String qrCode;
+
+    /** 父级团队Id:0表示团队 */
+    private Integer parentId;
+
+    /** 父级团队Id集合 */
+    private String parentIds;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date addTime;
+
+    /** 删除状态 0正常,其他删除 */
+    private String delFlag;
+
+    /** 结算状态 1已完结 ,0未完结*/
+    private String settleStatus;
+    /** (线上订单)待返佣金*/
+    private BigDecimal onLineCommission;
+    /** (线下订单)待返佣金*/
+    private BigDecimal offlineCommission;
+
+    public String getSettleStatus() {
+        return settleStatus;
+    }
+
+    public void setSettleStatus(String settleStatus) {
+        this.settleStatus = settleStatus;
+    }
+
+    public BigDecimal getOnLineCommission() {
+        return onLineCommission;
+    }
+
+    public void setOnLineCommission(BigDecimal onLineCommission) {
+        this.onLineCommission = onLineCommission;
+    }
+
+    public BigDecimal getOfflineCommission() {
+        return offlineCommission;
+    }
+
+    public void setOfflineCommission(BigDecimal offlineCommission) {
+        this.offlineCommission = offlineCommission;
+    }
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLinkMan() {
+        return linkMan;
+    }
+
+    public void setLinkMan(String linkMan) {
+        this.linkMan = linkMan;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getCorporateName() {
+        return corporateName;
+    }
+
+    public void setCorporateName(String corporateName) {
+        this.corporateName = corporateName;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getParentIds() {
+        return parentIds;
+    }
+
+    public void setParentIds(String parentIds) {
+        this.parentIds = parentIds;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    @Override
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+}
+

+ 104 - 0
src/main/java/com/caimei/modules/user/entity/CmRelatedImage.java

@@ -0,0 +1,104 @@
+package com.caimei.modules.user.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 相关图片对象 cm_related_image
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmRelatedImage")
+public class CmRelatedImage implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 分类:1分销报备凭证图片(cm_reporting_member) */
+    private String type;
+
+    /** 归属者Id(type字段表Id) */
+    private String authorId;
+
+    /** 图片 */
+    private String image;
+
+    /** 删除状态 0正常,其他删除 */
+    private Integer delFlag;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getAuthorId() {
+        return authorId;
+    }
+
+    public void setAuthorId(String authorId) {
+        this.authorId = authorId;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}
+

+ 385 - 0
src/main/java/com/caimei/modules/user/entity/CmReportingClub.java

@@ -0,0 +1,385 @@
+package com.caimei.modules.user.entity;
+
+import com.caimei.modules.user.dao.CmReportingClubMapper;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 机构报备对象 cm_reporting_club
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmReportingClub")
+public class CmReportingClub extends DataEntity<CmReportingClub> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+
+
+    /** 机构名称 */
+    private String clubName;
+
+    /** 联系人 */
+    private String linkMan;
+
+    /** 手机号 */
+    private String mobile;
+
+    /** 商品id */
+    private Integer productId;
+
+    /** 商品名称 */
+    private String productName;
+
+    /** 商品图片 */
+    private String productImage;
+
+    /** 备注 */
+    private String remarks;
+    /** 订单id */
+    private Integer orderId;
+    /** 订单状态 :1已成交,0未成交 */
+    private Integer orderStatus;
+
+    /** 锁定状态 :1锁定,0未锁定 */
+    private Integer lockStatus;
+
+    /** 锁定时间 */
+    private Date lockTime;
+
+    /** 分销报备人数量 */
+    private Integer distributionCount;
+
+    /** 分销报备锁定人id */
+    private Integer distributionId;
+
+    /** 分销报备锁定人名称 */
+    private String distributionName;
+
+    /** 分销报备锁定人手机号 */
+    private String distributionMobile;
+
+    /** 删除状态 0正常,其他删除 */
+    private String delFlag;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /** 商品总佣金 */
+    private BigDecimal commission;
+    /** 已付商品总佣金 */
+    private BigDecimal paidCommission;
+
+    /** 结算状态: 1已完结 ,0未完结 */
+    private Integer settleStatus;
+
+
+    /** 分账结算状态: 0待确认 1待手动分账 ,2待手动结算,3已结算 */
+    private Integer splitSettleStatus;
+
+    /** 所有父级编号 */
+    private String parentIds;
+
+    /** 分账结算时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date splitSettleTime;
+
+    /** 结算时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date settleTime;
+
+    /** 分账号 */
+    private String splitCode;
+
+    /** 付款方式 :1线上,2线下 */
+    private Integer payWay;
+
+    /** 订单提交时间 */
+    private Date orderTime;
+
+    /** 订单销售佣金 */
+    private BigDecimal organizeCostPrice;
+
+    /** 报备成员 */
+    private CmReportingMember cmReportingMember;
+    /** 报备成员集合 */
+    private List<CmReportingMember> cmReportingMemberList;
+
+    public String getParentIds() {
+        return parentIds;
+    }
+
+    public void setParentIds(String parentIds) {
+        this.parentIds = parentIds;
+    }
+
+    public BigDecimal getPaidCommission() {
+        return paidCommission;
+    }
+
+    public Date getSettleTime() {
+        return settleTime;
+    }
+
+    public void setSettleTime(Date settleTime) {
+        this.settleTime = settleTime;
+    }
+
+    public Date getSplitSettleTime() {
+        return splitSettleTime;
+    }
+
+    public void setSplitSettleTime(Date splitSettleTime) {
+        this.splitSettleTime = splitSettleTime;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public Integer getSplitSettleStatus() {
+        return splitSettleStatus;
+    }
+
+    public void setSplitSettleStatus(Integer splitSettleStatus) {
+        this.splitSettleStatus = splitSettleStatus;
+    }
+
+    public Integer getPayWay() {
+        return payWay;
+    }
+
+    public void setPayWay(Integer payWay) {
+        this.payWay = payWay;
+    }
+
+    public Date getOrderTime() {
+        return orderTime;
+    }
+
+    public void setOrderTime(Date orderTime) {
+        this.orderTime = orderTime;
+    }
+
+    public BigDecimal getOrganizeCostPrice() {
+        return organizeCostPrice;
+    }
+
+    public void setOrganizeCostPrice(BigDecimal organizeCostPrice) {
+        this.organizeCostPrice = organizeCostPrice;
+    }
+
+    public void setPaidCommission(BigDecimal paidCommission) {
+        this.paidCommission = paidCommission;
+    }
+    public void setLockTime(Date lockTime) {
+        this.lockTime = lockTime;
+    }
+
+    public String getDistributionMobile() {
+        return distributionMobile;
+    }
+
+    public void setDistributionMobile(String distributionMobile) {
+        this.distributionMobile = distributionMobile;
+    }
+
+    public Date getLockTime() {
+        return lockTime;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public BigDecimal getCommission() {
+        return commission;
+    }
+
+    public void setCommission(BigDecimal commission) {
+        this.commission = commission;
+    }
+
+    public Integer getSettleStatus() {
+        return settleStatus;
+    }
+
+    public void setSettleStatus(Integer settleStatus) {
+        this.settleStatus = settleStatus;
+    }
+
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getProductImage() {
+        return productImage;
+    }
+
+    public void setProductImage(String productImage) {
+        this.productImage = productImage;
+    }
+
+
+    public Integer getDistributionCount() {
+        return distributionCount;
+    }
+
+    public void setDistributionCount(Integer distributionCount) {
+        this.distributionCount = distributionCount;
+    }
+
+    public String getDistributionName() {
+        return distributionName;
+    }
+
+    public void setDistributionName(String distributionName) {
+        this.distributionName = distributionName;
+    }
+
+    public CmReportingMember getCmReportingMember() {
+        return cmReportingMember;
+    }
+
+    public void setCmReportingMember(CmReportingMember cmReportingMember) {
+        this.cmReportingMember = cmReportingMember;
+    }
+
+    public List<CmReportingMember> getCmReportingMemberList() {
+        return cmReportingMemberList;
+    }
+
+    public void setCmReportingMemberList(List<CmReportingMember> cmReportingMemberList) {
+        this.cmReportingMemberList = cmReportingMemberList;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getClubName() {
+        return clubName;
+    }
+
+    public void setClubName(String clubName) {
+        this.clubName = clubName;
+    }
+
+    public String getLinkMan() {
+        return linkMan;
+    }
+
+    public void setLinkMan(String linkMan) {
+        this.linkMan = linkMan;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public Integer getOrderStatus() {
+        return orderStatus;
+    }
+
+    public void setOrderStatus(Integer orderStatus) {
+        this.orderStatus = orderStatus;
+    }
+
+    public Integer getLockStatus() {
+        return lockStatus;
+    }
+
+    public void setLockStatus(Integer lockStatus) {
+        this.lockStatus = lockStatus;
+    }
+
+    public Integer getDistributionId() {
+        return distributionId;
+    }
+
+    public void setDistributionId(Integer distributionId) {
+        this.distributionId = distributionId;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}
+

+ 224 - 0
src/main/java/com/caimei/modules/user/entity/CmReportingMember.java

@@ -0,0 +1,224 @@
+package com.caimei.modules.user.entity;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 分销报备成员对象 cm_reporting_member
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmReportingMember")
+public class CmReportingMember  extends DataEntity<CmReportingMember> implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 分销报备人id */
+    private Integer distributionId;
+
+    /** 报备机构id */
+    private Integer clubReportingId;
+
+    /** 审核人用户id */
+    private Integer auditBy;
+
+    /** 审核人用户名称 */
+    private Integer auditName;
+
+    /** 审核状态:1待审核,2审核通过,3审核失败 */
+    private String auditStatus;
+
+    /** 审核备注 */
+    private String auditText;
+
+    /** 审核时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date auditTime;
+
+    /**备注 */
+    private String remarks;
+
+    /** 删除状态 0正常,其他删除 */
+    private String delFlag;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+
+    /** 商品佣金 */
+    private BigDecimal commission;
+
+    /** 结算状态: 1待确认 ,2待结算 ,3已结算 */
+    private Integer settleStatus;
+
+    /** 结算时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date settleTime;
+    /** 报备人详情 */
+    private CmDistribution cmDistribution;
+    /** 凭证图片集合 */
+    private List<CmRelatedImage> cmRelatedImageList;
+
+    @Override
+    public String getRemarks() {
+        return remarks;
+    }
+
+    @Override
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public BigDecimal getCommission() {
+        return commission;
+    }
+
+    public void setCommission(BigDecimal commission) {
+        this.commission = commission;
+    }
+
+    public Integer getSettleStatus() {
+        return settleStatus;
+    }
+
+    public void setSettleStatus(Integer settleStatus) {
+        this.settleStatus = settleStatus;
+    }
+
+    public Date getSettleTime() {
+        return settleTime;
+    }
+
+    public void setSettleTime(Date settleTime) {
+        this.settleTime = settleTime;
+    }
+
+    public Integer getAuditBy() {
+        return auditBy;
+    }
+
+    public void setAuditBy(Integer auditBy) {
+        this.auditBy = auditBy;
+    }
+
+    public Integer getAuditName() {
+        return auditName;
+    }
+
+    public void setAuditName(Integer auditName) {
+        this.auditName = auditName;
+    }
+
+    public CmDistribution getCmDistribution() {
+        return cmDistribution;
+    }
+
+    public void setCmDistribution(CmDistribution cmDistribution) {
+        this.cmDistribution = cmDistribution;
+    }
+
+    public List<CmRelatedImage> getCmRelatedImageList() {
+        return cmRelatedImageList;
+    }
+
+    public void setCmRelatedImageList(List<CmRelatedImage> cmRelatedImageList) {
+        this.cmRelatedImageList = cmRelatedImageList;
+    }
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getDistributionId() {
+        return distributionId;
+    }
+
+    public void setDistributionId(Integer distributionId) {
+        this.distributionId = distributionId;
+    }
+
+    public Integer getClubReportingId() {
+        return clubReportingId;
+    }
+
+    public void setClubReportingId(Integer clubReportingId) {
+        this.clubReportingId = clubReportingId;
+    }
+
+    public String getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(String auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    public String getAuditText() {
+        return auditText;
+    }
+
+    public void setAuditText(String auditText) {
+        this.auditText = auditText;
+    }
+
+    public Date getAuditTime() {
+        return auditTime;
+    }
+
+    public void setAuditTime(Date auditTime) {
+        this.auditTime = auditTime;
+    }
+
+    @Override
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}
+

+ 123 - 0
src/main/java/com/caimei/modules/user/service/CmDistributionService.java

@@ -0,0 +1,123 @@
+package com.caimei.modules.user.service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.caimei.modules.user.dao.CmClubinfoDao;
+import com.caimei.modules.user.entity.CmClubinfo;
+import com.caimei.modules.user.entity.CmUser;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.springframework.stereotype.Service;
+import com.caimei.modules.user.dao.CmDistributionMapper;
+import com.caimei.modules.user.entity.CmDistribution;
+import com.caimei.modules.user.service.CmDistributionService;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-09-15
+ */
+@Service
+public class CmDistributionService extends CrudService<CmDistributionMapper, CmDistribution>
+{
+    @Resource
+    private CmDistributionMapper cmDistributionMapper;
+
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmDistribution
+     * @return
+     */
+
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution)
+    {
+        return cmDistributionMapper.getCmDistributionList(cmDistribution);
+    }
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+
+    public CmDistribution getCmDistributionById(String id)
+    {
+        return cmDistributionMapper.getCmDistributionById(id);
+    }
+
+    /**
+     * 根据手机号码查询用户
+     *
+     * @param mobile
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public CmDistribution findDistributionIsMobile(String mobile, String oldMobile) {
+        return cmDistributionMapper.findDistributionIsMobile(mobile,oldMobile);
+    }
+    /**
+     * 通过对象查询
+     *
+     * @param cmDistribution
+     * @return
+     */
+
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution)
+    {
+        return cmDistributionMapper.getByCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmDistribution
+     * @return String
+     */
+
+    public String getById(CmDistribution cmDistribution)
+    {
+        return cmDistributionMapper.getById(cmDistribution);
+    }
+
+
+    /**
+     * 新增
+     *
+     * @param cmDistribution
+     * @return 结果
+     */
+    @Transactional(readOnly = false )
+    public int addCmDistribution(CmDistribution cmDistribution)
+    {
+        cmDistribution.addTime(new Date());
+        return cmDistributionMapper.addCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 修改
+     *
+     * @param cmDistribution
+     * @return 结果
+     */
+    @Transactional(readOnly = false )
+    public int updateCmDistribution(CmDistribution cmDistribution)
+    {
+        cmDistribution.updateTime(new Date());
+        return cmDistributionMapper.updateCmDistribution(cmDistribution);
+    }
+
+    public BigDecimal getByCommissions(Integer id,Integer payWay )
+    {
+        return cmDistributionMapper.getByCommissions(id,payWay);
+    }
+
+}
+
+//

+ 128 - 0
src/main/java/com/caimei/modules/user/service/CmReportingClubService.java

@@ -0,0 +1,128 @@
+package com.caimei.modules.user.service;
+
+import java.util.Date;
+import java.util.List;
+
+import com.caimei.modules.product.entity.CmDistributionProduct;
+import com.caimei.modules.user.dao.CmDistributionMapper;
+import com.caimei.modules.user.dao.CmRelatedImageMapper;
+import com.caimei.modules.user.dao.CmReportingClubMapper;
+import com.caimei.modules.user.dao.CmReportingMemberMapper;
+import com.caimei.modules.user.entity.CmDistribution;
+import com.caimei.modules.user.entity.CmRelatedImage;
+import com.caimei.modules.user.entity.CmReportingClub;
+import com.caimei.modules.user.entity.CmReportingMember;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * 机构报备Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Service
+public class CmReportingClubService extends CrudService<CmReportingClubMapper, CmReportingClub> {
+    @Resource
+    private CmReportingClubMapper cmReportingClubMapper;
+    @Resource
+    private CmReportingMemberMapper cmReportingMemberMapper;
+    @Resource
+    private CmRelatedImageMapper cmRelatedImageMapper;
+    @Resource
+    private CmDistributionMapper cmDistributionMapper;
+
+    /**
+     * 通过对象查询机构报备列表
+     *
+     * @param cmReportingClub 机构报备
+     * @return 机构报备
+     */
+
+    public Page<CmReportingClub> getCmReportingClubPage(Page<CmReportingClub> cmReportingClubPage, CmReportingClub cmReportingClub)  {
+        cmReportingClub.setPage(cmReportingClubPage);
+        List<CmReportingClub> cmReportingMemberList = cmReportingClubMapper.getCmReportingClubList(cmReportingClub);
+        cmReportingClubPage.setList(cmReportingMemberList);
+        return cmReportingClubPage;
+    }
+
+    public Page<CmReportingMember> findMemberPage(Page<CmReportingMember> cmReportingMemberPage, CmReportingMember cmReportingMember) {
+        cmReportingMember.setPage(cmReportingMemberPage);
+        List<CmReportingMember> cmReportingMemberList = cmReportingMemberMapper.findList(cmReportingMember);
+        cmReportingMemberList.forEach(s -> {
+            s.cmDistribution(cmDistributionMapper.getCmDistributionById(String.valueOf(s.distributionId())));
+        });
+        cmReportingMemberPage.setList(cmReportingMemberList);
+        return cmReportingMemberPage;
+    }
+
+    public Integer getCmReportingMemberCount( CmReportingMember cmReportingMember) {
+        Integer cmReportingMemberCount = cmReportingMemberMapper.getCmReportingMemberCount(cmReportingMember);
+        return cmReportingMemberCount;
+    }
+
+    public Double getCmReportingMembercCommissions( CmReportingMember cmReportingMember) {
+        Double cmReportingMembercCommissions = cmReportingMemberMapper.getCmReportingMembercCommissions(cmReportingMember);
+        return cmReportingMembercCommissions;
+    }
+
+
+    /**
+     * 报备人详情
+     * @return 机构报备
+     */
+
+    public CmReportingMember getByCmReportingMember(CmReportingMember cmReportingMember) {
+        cmReportingMember = cmReportingMemberMapper.getCmReportingMemberById(cmReportingMember.id());
+        cmReportingMember.cmDistribution(cmDistributionMapper.getCmDistributionById(String.valueOf(cmReportingMember.distributionId())));
+        cmReportingMember.cmRelatedImageList(cmRelatedImageMapper.getCmRelatedImageList(new CmRelatedImage()
+                .type("1")
+                .authorId(cmReportingMember.id()
+                )));
+        return cmReportingMember;
+    }
+
+    /**
+     * 通过对象查询机构报备
+     *
+     * @param cmReportingClub 机构报备
+     * @return 机构报备
+     */
+
+    public CmReportingClub getByCmReportingClub(CmReportingClub cmReportingClub) {
+        return cmReportingClubMapper.getByCmReportingClub(cmReportingClub);
+    }
+
+
+
+    /**
+     * 修改机构报备
+     *
+     * @param cmReportingClub 机构报备
+     * @return 结果
+     */
+    @Transactional(readOnly = false )
+    public int updateCmReportingClub(CmReportingClub cmReportingClub) {
+        cmReportingClub.setUpdateTime(new Date());
+        return cmReportingClubMapper.updateCmReportingClub(cmReportingClub);
+    }
+
+    /**
+     * 修改报备成员
+     *
+     * @param 报备成员
+     * @return 结果
+     */
+    @Transactional(readOnly = false )
+    public int updateCmReportingMember(CmReportingMember cmReportingMember) {
+        cmReportingMember.setUpdateTime(new Date());
+        return cmReportingMemberMapper.updateCmReportingMember(cmReportingMember);
+    }
+
+
+
+}

+ 23 - 1
src/main/java/com/caimei/modules/user/service/CmUserService.java

@@ -107,7 +107,29 @@ public class CmUserService extends CrudService<CmUserDao, CmUser> {
      */
     @Transactional(readOnly = true)
     public CmUser findUserByMobile(String mobile) {
-        return cmUserDao.findUserByMobile(mobile);
+        return cmUserDao.findUserByMobile(mobile,null,null);
+    }
+
+    /**
+     * 根据手机号码查询用户
+     *
+     * @param mobile
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public CmUser findUserIsMobile(String mobile,String oldUserId) {
+        return cmUserDao.findUserByMobile(mobile,oldUserId,null);
+    }
+
+    /**
+     * 根据手机号码查询用户
+     *
+     * @param mobile
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public CmUser findUserIsMobile(String mobile,String oldUserId,Integer userIdentity) {
+        return cmUserDao.findUserByMobile(mobile,oldUserId,userIdentity);
     }
 
     /**

+ 6 - 0
src/main/java/com/caimei/modules/user/service/NewCmClubService.java

@@ -66,6 +66,12 @@ public class NewCmClubService extends CrudService<NewCmClubDao, NewCmClub> {
         page.setList(providerList);
         return page;
     }
+    public Page<NewCmClub> findDistributionCLubList(Page<NewCmClub> page,NewCmClub userClub) {
+        userClub.setPage(page);
+        List<NewCmClub> providerList = newCmClubDao.findDistributionCLubList(userClub);
+        page.setList(providerList);
+        return page;
+    }
 
     @Transactional(readOnly = false)
     public void save(NewCmClub userClub) {

+ 230 - 0
src/main/java/com/caimei/modules/user/web/CmDistributionController.java

@@ -0,0 +1,230 @@
+package com.caimei.modules.user.web;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.sys.utils.SMSUtils;
+import com.caimei.modules.sys.utils.ValidateUtils;
+import com.caimei.modules.user.entity.CmUser;
+import com.caimei.modules.user.service.CmUserService;
+import com.caimei.utils.AppKeys;
+import com.caimei.utils.DateUtils;
+import com.caimei.utils.MD5Utils;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import com.caimei.modules.user.entity.CmDistribution;
+import com.caimei.modules.user.service.CmDistributionService;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+/**
+ * Controller
+ *
+ * @author Kaick
+ * @date 2023-09-15
+ */
+@Controller
+@RequestMapping("${adminPath}/user/distribution")
+public class CmDistributionController extends BaseController {
+    @Resource
+    private CmDistributionService cmDistributionService;
+    @Resource
+    private CmUserService cmUserService;
+
+    @ModelAttribute
+    public CmDistribution get(@RequestParam(required = false) String id) {
+        CmDistribution entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmDistributionService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmDistribution();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmDistribution cmDistribution, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmDistribution> page = cmDistributionService.findPage(new Page<CmDistribution>(request, response), cmDistribution);
+        model.addAttribute("cmDistribution", cmDistribution);
+        model.addAttribute("page", page);
+        return "modules/user/cmDistributionList";
+    }
+
+    /**
+     * 功能描述:分销订单佣金列表
+     *
+     * @param cmDistribution
+     * @param request
+     * @param response
+     * @param model
+     * @return [cmDistribution, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/10/12 17:13
+     */
+
+    @RequestMapping(value = {"settleList"})
+    public String settleList(CmDistribution cmDistribution, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmDistribution> page = cmDistributionService.findPage(new Page<CmDistribution>(request, response), cmDistribution);
+        page.getList().forEach(s -> {
+            s.onLineCommission(cmDistributionService.getByCommissions(Integer.valueOf(s.getId()), 1));
+            s.offlineCommission(cmDistributionService.getByCommissions(Integer.valueOf(s.getId()), 2));
+            s.settleStatus(s.onLineCommission().compareTo(s.offlineCommission()) == 0 &&
+                    s.onLineCommission().compareTo(new BigDecimal(0)) == 0 ? "1" : "0");
+
+        });
+        model.addAttribute("cmDistribution", cmDistribution);
+        model.addAttribute("page", page);
+        return "modules/user/cmDistributionSettleList";
+    }
+
+
+    /**
+     * 获取分销人员详细信息
+     */
+    @RequestMapping(value = "form")
+    public String form(CmDistribution cmDistribution, Model model) {
+        model.addAttribute("cmDistribution", cmDistribution);
+        return "modules/user/cmDistributionFrom";
+    }
+
+    /**
+     * 获取分销人员详细信息
+     */
+    @RequestMapping(value = "settleFrom")
+    public String settleFrom(CmDistribution cmDistribution, Model model) {
+        cmDistribution.onLineCommission(cmDistributionService.getByCommissions(Integer.valueOf(cmDistribution.getId()),1));
+        cmDistribution.offlineCommission(cmDistributionService.getByCommissions(Integer.valueOf(cmDistribution.getId()),2));
+        cmDistribution.settleStatus(cmDistribution.onLineCommission().compareTo(cmDistribution.offlineCommission()) == 0&&
+                cmDistribution.onLineCommission().compareTo(new BigDecimal(0)) == 0?"1":"0");
+        model.addAttribute("cmDistribution", cmDistribution);
+        return "modules/user/cmDistributionSettleFrom";
+    }
+
+    /**
+     * 新增分销人员
+     */
+
+    @RequestMapping(value = "save")
+    public String save(CmDistribution cmDistribution, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request,HttpServletResponse response) {
+        if (!ValidateUtils.validateMobile(cmDistribution.mobile())) {
+            addMessage(redirectAttributes, "手机号码错误");
+            return "redirect:" + Global.getAdminPath() + "/user/distribution/form?id=" + cmDistribution.id() + "&parentId=0";
+        }
+        cmDistribution.linkMan(cmDistribution.name());
+        CmUser cmUser = new CmUser();
+        cmUser.setMobile(cmDistribution.mobile());
+        cmUser.setBindMobile(cmDistribution.mobile());
+        cmUser.setServiceProviderStatus(cmDistribution.status().toString());
+        cmUser.setRealName(cmDistribution.name());
+        cmUser.setUserName(cmDistribution.name());
+        cmUser.setName(cmDistribution.name());
+        cmUser.setAuditStatus(AppKeys.FLAG_YES);
+        cmUser.setAuditTime(DateUtils.getDateTime());
+        cmUser.setValidFlag(cmDistribution.status()==90?"1":"0");
+        if (StringUtils.isBlank(cmDistribution.getId())) {
+            String password="1111aaaa";
+            cmUser.setUserOrganizeID(0);
+            cmUser.setUserIdentity(7);//外部协销
+            cmUser.setRegisterUserTypeID(com.caimei.constants.UserType.SERVICEEMPLOYEE.getCode() + "");
+            cmUser.setRegisterTime(DateUtils.getDateTime());
+//            cmUser.setServiceProviderID(cmDistribution.getId());
+            if (0==cmDistribution.getParentId()) {
+                cmDistribution.setParentIds("0");
+            } else {
+                CmDistribution cmDistribution1= cmDistributionService.get(cmDistribution.getParentId().toString());
+                cmDistribution.setParentIds(cmDistribution1.getParentIds() + "," + cmDistribution.getParentId());
+            }
+            try {
+                cmDistribution.setPassword(MD5Utils.MD5(password));
+                cmUser.setPassword(cmDistribution.getPassword());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            cmUserService.save(cmUser);
+            cmDistribution.userId(cmUser.getUserID());
+            cmDistributionService.addCmDistribution(cmDistribution);
+            String content = "【分销系统】您的分销系统登录账号 :"+cmDistribution.mobile()+",密码:"+password;
+            if (cmDistribution.mobile()!= null && cmDistribution.mobile() != "") {
+                SMSUtils.sendSms(4,cmDistribution.mobile(), content);
+            }
+            addMessage(redirectAttributes, "保存分销人员成功");
+        } else {
+            cmDistributionService.updateCmDistribution(cmDistribution);
+            cmUser.setUserID(cmDistribution.userId());
+            cmUserService.update(cmUser);
+
+            List<CmDistribution> cmDistributionList = cmDistributionService.getCmDistributionList(new CmDistribution().parentIds(cmDistribution.id()));
+            cmDistributionList.forEach(s->{
+                cmDistributionService.updateCmDistribution(new CmDistribution()
+                        .userId(s.userId())
+                        .status(cmDistribution.status())
+                );
+                CmUser sonCmUser = new CmUser();
+                sonCmUser.setUserID(s.userId());
+                sonCmUser.setServiceProviderStatus(cmDistribution.status().toString());
+                sonCmUser.setValidFlag(cmDistribution.status()==90?"1":"0");
+                cmUserService.update(sonCmUser);
+            });
+            addMessage(redirectAttributes, "修改分销人员成功");
+        }
+        return "redirect:" + Global.getAdminPath() + "/user/distribution?parentId=0";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "updateEnabledStatus")
+    public Map<String, Object> updateEnabledStatus(CmDistribution cmDistribution, HttpServletRequest request, HttpServletResponse response) {
+
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            if(null==cmDistribution.userId()){
+                map.put("success", false);
+                map.put("msg", "参数异常!");
+                return map;
+            }
+            cmDistributionService.updateCmDistribution(new CmDistribution()
+                    .userId(cmDistribution.userId())
+                    .status(cmDistribution.status())
+            );
+            CmUser cmUser = new CmUser();
+            cmUser.setUserID(cmDistribution.userId());
+            cmUser.setServiceProviderStatus(cmDistribution.status().toString());
+            cmUser.setValidFlag(cmDistribution.status()==90?"1":"0");
+            cmUserService.update(cmUser);
+            String byId = cmDistributionService.getById(new CmDistribution().userId(cmDistribution.userId()));
+            List<CmDistribution> cmDistributionList = cmDistributionService.getCmDistributionList(new CmDistribution().parentIds(byId));
+            cmDistributionList.forEach(s->{
+                cmDistributionService.updateCmDistribution(new CmDistribution()
+                        .userId(s.userId())
+                        .status(cmDistribution.status())
+                );
+                CmUser sonCmUser = new CmUser();
+                sonCmUser.setUserID(s.userId());
+                sonCmUser.setServiceProviderStatus(cmDistribution.status().toString());
+                sonCmUser.setValidFlag(cmDistribution.status()==90?"1":"0");
+                cmUserService.update(sonCmUser);
+            });
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+}

+ 211 - 0
src/main/java/com/caimei/modules/user/web/CmReportingClubController.java

@@ -0,0 +1,211 @@
+package com.caimei.modules.user.web;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.caimei.modules.product.entity.CmDistributionProduct;
+import com.caimei.modules.user.entity.CmReportingClub;
+import com.caimei.modules.user.entity.CmReportingMember;
+import com.caimei.modules.user.service.CmReportingClubService;
+import com.caimei.utils.StringUtils;
+import com.google.common.collect.Maps;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.web.BaseController;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 机构报备Controller
+ *
+ * @author Kaick
+ * @date 2023-09-20
+ */
+@Controller
+@RequestMapping("${adminPath}/user/reporting")
+public class CmReportingClubController extends BaseController
+{
+    @Resource
+    private CmReportingClubService cmReportingClubService;
+
+
+    @ModelAttribute
+    public CmReportingClub get(@RequestParam(required = false) String id) {
+        CmReportingClub entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmReportingClubService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmReportingClub();
+        }
+        return entity;
+    }
+
+    @RequestMapping(value = {"list", ""})
+    public String list(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmReportingClub> page = cmReportingClubService.findPage(new Page<CmReportingClub>(request, response), cmReportingClub);
+        page.getList().forEach(s -> {
+            s.distributionCount(cmReportingClubService.getCmReportingMemberCount(new CmReportingMember()
+                    .clubReportingId(Integer.valueOf(s.id()))
+                    .auditStatus("not in=2")
+            ));
+        });
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        model.addAttribute("page", page);
+        return "modules/user/cmReportingClubList";
+    }
+
+    /**
+     * 功能描述: 分销报备佣金明细列表
+     *
+     * @param cmReportingClub
+     * @param request
+     * @param response
+     * @param model
+     * @return [cmReportingClub, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/10/12 17:19
+     */
+
+    @RequestMapping(value = {"settleList"})
+    public String settleList(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClub.lockStatus(1).orderStatus(1);
+        Page<CmReportingClub> page = cmReportingClubService.findPage(new Page<CmReportingClub>(request, response), cmReportingClub);
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        model.addAttribute("page", page);
+        return "modules/user/cmReportingClubSettleList";
+    }
+
+    /**
+     * 功能描述: 分销订单佣金明细列表
+     *
+     * @param cmReportingClub
+     * @param request
+     * @param response
+     * @param model
+     * @return [cmReportingClub, request, response, model]
+     * @auther: Kaick
+     * @date: 2023/10/12 17:19
+     */
+
+    @RequestMapping(value = {"settleClubList"})
+    public String settleClubList(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClub.lockStatus(1).orderStatus(1);
+        Page<CmReportingClub> page = cmReportingClubService.getCmReportingClubPage(new Page<CmReportingClub>(request, response), cmReportingClub);
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        model.addAttribute("page", page);
+        return "modules/user/cmDistributionMemberSettleList";
+    }
+
+
+
+    @RequestMapping(value = {"memberlist"})
+    public String memberlist(CmReportingMember cmReportingMember, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmReportingMember> page = cmReportingClubService.findMemberPage(new Page<CmReportingMember>(request, response), cmReportingMember);
+        model.addAttribute("cmReportingMember", cmReportingMember);
+        model.addAttribute("page", page);
+        return "modules/user/cmReportingMemberList";
+    }
+
+    @RequestMapping(value = {"memberSettleList"})
+    public String memberSettlelist(CmReportingMember cmReportingMember, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<CmReportingMember> page = cmReportingClubService.findMemberPage(new Page<CmReportingMember>(request, response), cmReportingMember);
+        model.addAttribute("cmReportingMember", cmReportingMember);
+        model.addAttribute("page", page);
+        return "modules/user/cmReportingMemberSettleList";
+    }
+    @RequestMapping(value = {"form"})
+    public String form(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClub.distributionCount(cmReportingClubService.getCmReportingMemberCount(new CmReportingMember()
+                        .clubReportingId(Integer.valueOf(cmReportingClub.id()))
+                        .auditStatus("not in=2")
+                ));
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        return "modules/user/cmReportingClubFrom";
+    }
+
+    @RequestMapping(value = {"settleForm"})
+    public String settleForm(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        return "modules/user/cmReportingClubSettleFrom";
+    }
+    @RequestMapping(value = {"settleClubFrom"})
+    public String settleClubFrom(CmReportingClub cmReportingClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClub=cmReportingClubService.getByCmReportingClub(new CmReportingClub().id(cmReportingClub.id()));
+        model.addAttribute("cmReportingClub", cmReportingClub);
+        return "modules/user/cmDistributionMemberSettleFrom";
+    }
+    @RequestMapping(value = {"memberForm"})
+    public String memberForm(CmReportingMember cmReportingMember, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if(null!=cmReportingMember.getAuditStatus()){
+            model.addAttribute("auditType",1);
+        }
+        CmReportingMember byCmReportingMember = cmReportingClubService.getByCmReportingMember(cmReportingMember);
+        model.addAttribute("cmReportingMember",byCmReportingMember);
+        return "modules/user/cmReportingMemberFrom";
+    }
+
+    @RequestMapping(value = {"memberSettleForm"})
+    public String memberSettleForm(CmReportingMember cmReportingMember, HttpServletRequest request, HttpServletResponse response, Model model) {
+        CmReportingMember byCmReportingMember = cmReportingClubService.getByCmReportingMember(cmReportingMember);
+        model.addAttribute("cmReportingMember",byCmReportingMember);
+        return "modules/user/cmReportingMemberSettleFrom";
+    }
+
+    @RequestMapping(value = {"memberAudit"})
+    public String memberAudit(CmReportingMember cmReportingMember, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClubService.updateCmReportingMember(new CmReportingMember()
+                .id(cmReportingMember.id())
+                .auditStatus(cmReportingMember.auditStatus())
+                .auditBy(cmReportingMember.auditBy())
+                .auditText(cmReportingMember.auditText())
+                .auditTime(new Date())
+        );
+        addMessage(redirectAttributes, "审核成功");
+        return "redirect:" + Global.getAdminPath() + "/user/reporting/memberlist?clubReportingId=" + cmReportingMember.clubReportingId();
+    }
+
+    @RequestMapping(value = {"settleStatus"})
+    public String settleStatus(CmReportingMember cmReportingMember, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClubService.updateCmReportingMember(new CmReportingMember()
+                .id(cmReportingMember.id())
+                .settleStatus(cmReportingMember.settleStatus())
+                .settleTime(new Date())
+        );
+        Integer cmReportingMemberCount = cmReportingClubService.getCmReportingMemberCount(new CmReportingMember()
+                .clubReportingId(cmReportingMember.clubReportingId())
+                .settleStatus(2)
+        );
+        Double cmReportingMembercCommissions = cmReportingClubService.getCmReportingMembercCommissions(new CmReportingMember()
+                .clubReportingId(cmReportingMember.clubReportingId()));
+        CmReportingClub cmReportingClub = new CmReportingClub()
+                .id(cmReportingMember.id())
+                .paidCommission(new BigDecimal(cmReportingMembercCommissions));
+        if (cmReportingMemberCount == 0) {
+            cmReportingClub.settleStatus(1);
+        }
+        cmReportingClubService.updateCmReportingClub(cmReportingClub);
+        addMessage(redirectAttributes, "结算成功");
+        return "redirect:" + Global.getAdminPath() + "/user/reporting/memberSettleList?clubReportingId=" + cmReportingMember.clubReportingId();
+    }
+
+    @RequestMapping(value = {"splitSettleStatus"})
+    public String splitSettleStatus(CmReportingClub cmReportingClub, Integer parentId, RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response, Model model) {
+        cmReportingClubService.updateCmReportingClub(new CmReportingClub()
+                .id(cmReportingClub.id())
+                .splitSettleStatus(0)
+                .splitSettleTime(new Date())
+        );
+        addMessage(redirectAttributes, "结算成功");
+        return "redirect:" + Global.getAdminPath() + "/user/reporting/settleClubList?parentId=" + parentId + "&payWay=" + cmReportingClub.payWay();
+    }
+}

+ 89 - 0
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -171,6 +171,47 @@ public class AgencyController extends BaseController {
         model.addAttribute("spNameList", spNameList);
         return "modules/userNew/cmAgencyList";
     }
+
+    /**
+     * 列表展示
+     *
+     * @param newCmClub
+     * @param request
+     * @param response
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = {"distributionCLubList"})
+    public String distributionCLubList(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        newCmClub.setUserIdentity("8");
+        if (null != newCmClub.getSearchStartTime() && !"".equals(newCmClub.getSearchStartTime()) && !newCmClub.getSearchStartTime().endsWith("00:00:00")) {
+            newCmClub.setStartTime(newCmClub.getSearchStartTime() + " 00:00:00");
+        }
+        if (null != newCmClub.getSearchEndTime() && !"".equals(newCmClub.getSearchEndTime()) && !newCmClub.getSearchEndTime().endsWith("23:59:59")) {
+            newCmClub.setEndTime(newCmClub.getSearchEndTime() + " 23:59:59");
+        }
+        Page<NewCmClub> page = newCmClubService.findDistributionCLubList(new Page<NewCmClub>(request, response, 20), newCmClub);
+        model.addAttribute("newCmClub", newCmClub);
+        model.addAttribute("page", page);
+        return "modules/user/cmDistributionClubList";
+    }
+
+    /**
+     * 列表展示
+     *
+     * @param newCmClub
+     * @param request
+     * @param response
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = {"distributionCLubFrom"})
+    public String distributionCLubFrom(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response, Model model) {
+        newCmClub = newCmClubService.get(String.valueOf(newCmClub.getClubID()));
+        model.addAttribute("newCmClub", newCmClub);
+        return "modules/user/cmDistributionClubFrom";
+    }
+
     /**
      * 功能描述:新分配机构跟踪管理
      *
@@ -1858,4 +1899,52 @@ public class AgencyController extends BaseController {
         model.addAttribute("cmClub", club);
         return "modules/userNew/cmSpProviderLogs";
     }
+
+    @ResponseBody
+    @RequestMapping(value = "updateEnabledStatus")
+    public Map<String, Object> updateEnabledStatus(NewCmClub newCmClub, HttpServletRequest request, HttpServletResponse response) {
+
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            if (null == newCmClub.getUserID()) {
+                map.put("success", false);
+                map.put("msg", "参数异常!");
+                return map;
+            }
+            newCmClubService.update(newCmClub);
+            CmUser cmUser = new CmUser();
+            cmUser.setUserID(newCmClub.getUserID());
+            cmUser.setValidFlag(newCmClub.getStatus() == 90 ? "1" : "0");
+            cmUserService.update(cmUser);
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+
+
+    @ResponseBody
+    @RequestMapping(value = "findUserIsMobile")
+    public Map<String, Object> findUserIsMobile(String mobile, String oldUserId, Integer userIdentity, HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            CmUser userIsMobile = cmUserService.findUserIsMobile(mobile, oldUserId, userIdentity);
+            if (null == userIsMobile) {
+                map.put("success", true);
+                map.put("msg", "手机号不存在");
+            } else {
+                map.put("success", false);
+                map.put("msg", "手机号已存在");
+            }
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
 }

+ 6 - 3
src/main/java/com/caimei/modules/utils/MessageUtil.java

@@ -45,18 +45,21 @@ public class MessageUtil {
         ArrayList<String> keyWords = new ArrayList<>();
         keyWords.add("name"+"...等"+7+"家机构客户");
         keyWords.add("pageLabel");
-        keyWords.add("2023-09-12");
+        keyWords.add("2023-09-18");
         MessageModel<WechatTemplateMessage> wechatTemplateMessageMessageModel = new MessageModel<WechatTemplateMessage>()
                 .code(MessageType.WECHAT_TEMPLATE_MESSAGE)
                 .mqInfo(new MqInfo().topic("MessageLine").delay(3).async(0))
                 .info(new WechatTemplateMessage()
                         .first("")
-                        .openId("o9nzn5yD6IOcFuhG4b3OG1droVJw")
+//                        .openId("o9nzn5yD6IOcFuhG4b3OG1droVJw")
+//                        .openId("o9nzn51aTKY5u26FDoD5zf0wU6UM")
+                        .openId("o9nzn581OysHNNsDwJJlzKpWoQ4o")
                         .appid("wxf3cd4ae0cdd11c36")
                         .templateId("Zd7ewJw9-bN-gIgra9flKW96W3YehikRPPkDXPfhmQ0")
                         .keyWords(keyWords)
                         .remark("为了更好给您服务,请及时联系采美客服!")
-                        .pagePath("pages/seller/notice/service/Institutional_visits?spId="+1340+"&accDateTime="+"2023-09-14"));
+                        .pagePath("pages/seller/notice/service/Institutional_visits?spId="+1340+"&accDateTime="+"2023-09-18"));
+//                        .pagePath("pages/seller/notice/service/visits_details?spId="+1340+"&clubId="+"99930"+"&accessTime="+"2023-09-18"));
         sendMessage(wechatTemplateMessageMessageModel);
 //        //站内信
 //        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();

+ 33 - 32
src/main/java/com/thinkgem/jeesite/common/persistence/interceptor/SQLHelper.java

@@ -37,7 +37,7 @@ import java.util.regex.Pattern;
  * @version 2013-8-28
  */
 public class SQLHelper {
-	
+
     /**
      * 对SQL参数(?)设值,参考org.apache.ibatis.executor.parameter.DefaultParameterHandler
      *
@@ -103,12 +103,13 @@ public class SQLHelper {
     							final BoundSql boundSql, Log log) throws SQLException {
     	String dbName = Global.getConfig("jdbc.type");
 		final String countSql;
-		if("oracle".equals(dbName)){
-			countSql = "select count(1) from (" + sql + ") tmp_count";
-		}else{
-			countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
-//	        countSql = "select count(1) " + removeSelect(removeOrders(sql));
-		}
+        countSql = "select count(1) from (" + sql + ") tmp_count";
+//        if("oracle".equals(dbName)){
+//            countSql = "select count(1) from (" + sql + ") tmp_count";
+//		}else{
+//			countSql = "select count(1) from (" + removeOrders(sql) + ") tmp_count";
+////	        countSql = "select count(1) " + removeSelect(removeOrders(sql));
+//		}
         Connection conn = connection;
         PreparedStatement ps = null;
         ResultSet rs = null;
@@ -127,7 +128,7 @@ public class SQLHelper {
 				MetaObject mo = (MetaObject) Reflections.getFieldValue(boundSql, "metaParameters");
 				Reflections.setFieldValue(countBS, "metaParameters", mo);
 			}
-			//解决MyBatis 分页foreach 参数失效 end 
+			//解决MyBatis 分页foreach 参数失效 end
             SQLHelper.setParameters(ps, mappedStatement, countBS, parameterObject);
             rs = ps.executeQuery();
             int count = 0;
@@ -163,33 +164,33 @@ public class SQLHelper {
             return sql;
         }
     }
-    
-    /** 
-     * 去除qlString的select子句。 
-     * @param hql 
-     * @return 
-     */  
+
+    /**
+     * 去除qlString的select子句。
+     * @param hql
+     * @return
+     */
     @SuppressWarnings("unused")
-	private static String removeSelect(String qlString){  
-        int beginPos = qlString.toLowerCase().indexOf("from");  
-        return qlString.substring(beginPos);  
-    }  
-      
-    /** 
-     * 去除hql的orderBy子句。 
-     * @param hql 
-     * @return 
-     */  
+	private static String removeSelect(String qlString){
+        int beginPos = qlString.toLowerCase().indexOf("from");
+        return qlString.substring(beginPos);
+    }
+
+    /**
+     * 去除hql的orderBy子句。
+     * @param hql
+     * @return
+     */
     @SuppressWarnings("unused")
-	private static String removeOrders(String qlString) {  
-        Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE);  
-        Matcher m = p.matcher(qlString);  
-        StringBuffer sb = new StringBuffer();  
-        while (m.find()) {  
-            m.appendReplacement(sb, "");  
+	private static String removeOrders(String qlString) {
+        Pattern p = Pattern.compile("order\\s*by[\\w|\\W|\\s|\\S]*", Pattern.CASE_INSENSITIVE);
+        Matcher m = p.matcher(qlString);
+        StringBuffer sb = new StringBuffer();
+        while (m.find()) {
+            m.appendReplacement(sb, "");
         }
         m.appendTail(sb);
-        return sb.toString();  
+        return sb.toString();
     }
-    
+
 }

+ 0 - 1
src/main/java/com/thinkgem/jeesite/common/service/CrudService.java

@@ -68,7 +68,6 @@ public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>>
 	 */
 	public Page<T> findPage(Page<T> page, T entity) {
 		entity.setPage(page);
-
 		page.setList(dao.findList(entity));
 		return page;
 	}

+ 14 - 0
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -2086,6 +2086,20 @@
         left join cm_shop_order cso on cmo.id = cso.organizeID
         where cso.shopOrderID = #{shopOrderId}
     </select>
+    <select id="findUserIdentityByOrder" resultType="Integer">
+        select u.userIdentity
+        from user u
+        left join cm_shop_order cso on u.userId = cso.userId
+        where cso.orderID = #{orderId}
+        limit 0,1
+    </select>
+
+    <select id="findOrderId" resultType="Integer">
+        select cso.orderID
+        from  cm_shop_order cso
+        where cso.shopOrderId = #{shopOrderId}
+        limit 0,1
+    </select>
 
     <insert id="addCmOrder" parameterType="com.caimei.modules.order.entity.NewOrder" useGeneratedKeys="true" keyProperty="orderID">
         insert into cm_order

+ 2 - 1
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -877,7 +877,8 @@
             <if test="shopOrderNo != null and shopOrderNo != ''">
                 AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
             </if>
-            and (co.confirmFlag = '1' or co.confirmFlag = '2')
+--             and (co.confirmFlag = '1' or co.confirmFlag = '2')
+            and a.shopStatus = '1'
             <if test="operatingMode != null and operatingMode == '1'.toString()">
                 and a.payStatus != 3 and co.status NOT IN (6,7)
             </if>

+ 654 - 0
src/main/resources/mappings/modules/product/CmDistributionProductMapper.xml

@@ -0,0 +1,654 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.product.dao.CmDistributionProductMapper">
+
+    <resultMap type="com.caimei.modules.product.entity.CmDistributionProduct" id="CmDistributionProductResult">
+        <result property="id"    column="id"    />
+        <result property="productId"    column="productId"    />
+        <result property="validFlag"    column="validFlag"    />
+        <result property="includedTax"    column="includedTax"    />
+        <result property="invoiceType"    column="invoiceType"    />
+        <result property="clubTaxPoint"    column="clubTaxPoint"    />
+        <result property="shopTaxPoint"    column="shopTaxPoint"    />
+        <result property="commission"    column="commission"    />
+        <result property="addTime"    column="addTime"    />
+        <result property="name"    column="name"    />
+        <result property="mainImage"    column="mainImage"    />
+        <result property="shopID"    column="shopID"    />
+        <result property="shopName"    column="shopName"    />
+        <result property="skuId"    column="skuId"    />
+        <result property="price"    column="price"    />
+    </resultMap>
+
+    <sql id="selectCmDistributionProductVo">
+        select
+            cm_distribution_product.id,
+            cm_distribution_product.productId,
+            cm_distribution_product.validFlag,
+            cm_distribution_product.includedTax,
+            cm_distribution_product.invoiceType,
+            ifnull(cm_distribution_product.clubTaxPoint,0) AS clubTaxPoint,
+            ifnull(cm_distribution_product.shopTaxPoint,0) AS shopTaxPoint,
+            ifnull(cm_distribution_product.commission,0) AS commission,
+            p.name,
+            p.mainImage,
+            p.shopID,
+            s.name AS shopName,
+            cm_distribution_product.addTime,
+            (select cds.skuId from cm_distribution_sku cds where cds.productId = p.productID ORDER  by cds.price asc limit 1 ) AS skuId,
+            ifnull((select cds.price from cm_distribution_sku cds where cds.productId = p.productID ORDER  by cds.price asc  limit 1),0) AS price
+    </sql>
+
+    <select id="getByCmDistributionProduct" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultMap="CmDistributionProductResult">
+        <include refid="selectCmDistributionProductVo"/>
+        from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</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>
+        </where>
+        group by cm_distribution_product.id
+        order by cm_distribution_product.addTime desc
+        limit 0,1
+    </select>
+
+    <select id="findList" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultMap="CmDistributionProductResult">
+        <include refid="selectCmDistributionProductVo"/>
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</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>
+        </where>
+        group by cm_distribution_product.id
+        order by cm_distribution_product.addTime desc
+    </select>
+
+    <select id="findTeamProductPage" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultMap="CmDistributionProductResult">
+        select
+        cm_distribution_product.id,
+        cm_distribution_product.productId,
+        cdtp.validFlag,
+        cm_distribution_product.includedTax,
+        cm_distribution_product.invoiceType,
+        ifnull(cm_distribution_product.clubTaxPoint,0) AS clubTaxPoint,
+        ifnull(cm_distribution_product.shopTaxPoint,0) AS shopTaxPoint,
+        ifnull(cm_distribution_product.commission,0) AS commission,
+        p.name,
+        p.mainImage,
+        p.shopID,
+        s.name AS shopName,
+        cm_distribution_product.addTime,
+        (select cds.skuId from cm_distribution_sku cds where cds.productId = p.productID  limit 1) AS skuId,
+        ifnull((select cds.price from cm_distribution_sku cds where cds.productId = p.productID  limit 1),0) AS price,
+        cdtp.distributionId
+       from cm_distribution_team_product AS cdtp
+        LEFT JOIN cm_distribution AS cm_distribution on cdtp.distributionId=cm_distribution.id
+        LEFT JOIN cm_distribution_product AS cm_distribution_product  on cdtp.productId=cm_distribution_product.productId
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            cm_distribution_product.validFlag=1
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cdtp.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</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>
+            <if test="distributionId != null "> and cdtp.distributionId = #{distributionId}</if>
+        </where>
+        group by cm_distribution_product.id
+        order by cm_distribution_product.addTime desc
+    </select>
+
+    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        a.*,s.name AS "shopName"
+        FROM product a
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        LEFT JOIN shop s on s.shopID = a.shopID
+        <where>
+             copi.validFlag=2
+            <if test="productID != null">
+                AND a.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="ids != null and ids.size() > 0 ">
+                AND a.productID NOT IN
+                <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        group by a.productID
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findCmDistributionAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        p.*,s.name AS "shopName"
+        from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on s.shopID = p.shopID
+        <where>
+            cm_distribution_product.validFlag=1
+            <if test="productID != null">
+                AND p.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>
+            <if test="ids != null and ids.size() > 0 ">
+                AND p.productID NOT IN
+                <foreach collection="ids" open="(" close=")" item="id" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        group by p.productID
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by p.productID
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="getCmDistributionProductList" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultMap="CmDistributionProductResult">
+        <include refid="selectCmDistributionProductVo"/>
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</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>
+        </where>
+        group by cm_distribution_product.id
+        order by cm_distribution_product.addTime desc
+    </select>
+
+    <select id="getCmDistributionProductCount" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="String">
+        select count(1)
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and  id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution_product.id
+    </select>
+
+    <select id="get" parameterType="String" resultMap="CmDistributionProductResult">
+        <include refid="selectCmDistributionProductVo"/>
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        where  cm_distribution_product.id = #{id} group by cm_distribution_product.id
+    </select>
+    <select id="getCmDistributionProductById" parameterType="String" resultMap="CmDistributionProductResult">
+        <include refid="selectCmDistributionProductVo"/>
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        where    cm_distribution_product.id = #{id} group by cm_distribution_product.id
+    </select>
+
+    <select id="getByIds" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="Int">
+        select cm_distribution_product.id
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution_product.id
+    </select>
+    <select id="getByProductIds" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="Int">
+        select cm_distribution_product.productId
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution_product.id
+    </select>
+
+    <select id="getByTeamProductIds" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="Int">
+        select cm_distribution_team_product.productId
+       from cm_distribution_team_product AS cm_distribution_team_product
+        <where>
+            <if test="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
+        </where>
+        group by cm_distribution_team_product.id
+    </select>
+
+    <select id="getById" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" resultType="String">
+        select id
+       from cm_distribution_product AS cm_distribution_product
+        LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+        LEFT JOIN shop s on p.shopID = s.shopID
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toString().toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toString().toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution_product.id
+        limit 0,1
+    </select>
+
+    <insert id="addCmDistributionProduct" parameterType="com.caimei.modules.product.entity.CmDistributionProduct" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_distribution_product
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="productId != null">productId,</if>
+            <if test="validFlag != null and validFlag != ''">validFlag,</if>
+            <if test="includedTax != null and includedTax != ''">includedTax,</if>
+            <if test="invoiceType != null and invoiceType != ''">invoiceType,</if>
+            <if test="clubTaxPoint != null">clubTaxPoint,</if>
+            <if test="shopTaxPoint != null">shopTaxPoint,</if>
+            <if test="commission != null">commission,</if>
+            <if test="addTime != null">addTime,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="productId != null">#{productId},</if>
+            <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
+            <if test="includedTax != null and includedTax != ''">#{includedTax},</if>
+            <if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
+            <if test="clubTaxPoint != null">#{clubTaxPoint},</if>
+            <if test="shopTaxPoint != null">#{shopTaxPoint},</if>
+            <if test="commission != null">#{commission},</if>
+            <if test="addTime != null">#{addTime},</if>
+        </trim>
+    </insert>
+
+    <insert id="addCmDistributionTeamProduct" parameterType="com.caimei.modules.product.entity.CmDistributionTeamProduct" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_distribution_team_product
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="distributionId != null">distributionId,</if>
+            <if test="productId != null">productId,</if>
+            <if test="validFlag != null and validFlag != ''">validFlag,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="distributionId != null">#{distributionId},</if>
+            <if test="productId != null">#{productId},</if>
+            <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
+        </trim>
+    </insert>
+    <update id="updateCmDistributionProduct" parameterType="com.caimei.modules.product.entity.CmDistributionProduct">
+        update cm_distribution_product
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="productId != null">productId = #{productId},</if>
+            <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
+            <if test="includedTax != null and includedTax != ''">includedTax = #{includedTax},</if>
+            <if test="invoiceType != null and invoiceType != ''">invoiceType = #{invoiceType},</if>
+            <if test="clubTaxPoint != null">clubTaxPoint = #{clubTaxPoint},</if>
+            <if test="shopTaxPoint != null">shopTaxPoint = #{shopTaxPoint},</if>
+            <if test="commission != null">commission = #{commission},</if>
+            <if test="addTime != null">addTime = #{addTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+
+
+    <delete id="delCmDistributionProductById" parameterType="String">
+        delete
+        from cm_distribution_product where id = #{id}
+    </delete>
+
+    <delete id="delCmDistributionProduct" parameterType="com.caimei.modules.product.entity.CmDistributionProduct">
+        delete
+       from cm_distribution_product AS cm_distribution_product
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_product.validFlag = #{validFlag}</if>
+            <if test="includedTax != null  and includedTax != ''"> and cm_distribution_product.includedTax = #{includedTax}</if>
+            <if test="invoiceType != null  and invoiceType != ''">
+                and cm_distribution_product.invoiceType
+                <if test="invoiceType.toUpperCase().indexOf('=')==-1">
+                    = #{invoiceType}
+                </if>
+                <if test="invoiceType.toUpperCase().indexOf('=')!=-1">
+                    <if test="invoiceType.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="invoiceType.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="invoiceType.substring(invoiceType.toUpperCase().indexOf('=')+1,invoiceType.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="clubTaxPoint != null "> and cm_distribution_product.clubTaxPoint = #{clubTaxPoint}</if>
+            <if test="shopTaxPoint != null "> and cm_distribution_product.shopTaxPoint = #{shopTaxPoint}</if>
+            <if test="commission != null "> and cm_distribution_product.commission = #{commission}</if>
+            <if test="addTime != null "> and cm_distribution_product.addTime = #{addTime}</if>
+        </where>
+    </delete>
+
+    <delete id="delCmDistributionProductByIds" parameterType="String">
+        delete from cm_distribution_product where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <delete id="delCmDistributionTeamProduct" parameterType="com.caimei.modules.product.entity.CmDistributionTeamProduct">
+        delete
+        from cm_distribution_team_product AS cm_distribution_team_product
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution_team_product.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="distributionId != null "> and cm_distribution_team_product.distributionId = #{distributionId}</if>
+            <if test="productId != null "> and cm_distribution_team_product.productId = #{productId}</if>
+            <if test="validFlag != null  and validFlag != ''"> and cm_distribution_team_product.validFlag = #{validFlag}</if>
+        </where>
+    </delete>
+    <update id="updateCmDistributionTeamProduct" parameterType="com.caimei.modules.product.entity.CmDistributionTeamProduct">
+        update cm_distribution_team_product
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
+        </trim>
+        where distributionId = #{distributionId} and productId = #{productId}
+    </update>
+</mapper>

+ 289 - 0
src/main/resources/mappings/modules/product/CmDistributionSkuMapper.xml

@@ -0,0 +1,289 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.product.dao.CmDistributionSkuMapper">
+
+    <resultMap type="CmDistributionSku" id="CmDistributionSkuResult">
+        <result property="skuId"    column="skuId"    />
+        <result property="productId"    column="productId"    />
+        <result property="price"    column="price"    />
+        <result property="shopPercent"    column="shopPercent"    />
+        <result property="organizePercent"    column="organizePercent"    />
+        <result property="cmPercent"    column="cmPercent"    />
+        <result property="costCheckFlag"    column="costCheckFlag"    />
+        <result property="unit"    column="unit"    />
+        <result property="costPrice"    column="costPrice"    />
+        <result property="cmCostPrice"    column="cmCostPrice"    />
+        <result property="organizeCostPrice"    column="organizeCostPrice"    />
+    </resultMap>
+
+    <sql id="selectCmDistributionSkuVo">
+        select
+            cm_distribution_sku.skuId,
+            cm_distribution_sku.productId,
+            ifnull(cm_distribution_sku.price,0) AS price,
+            cm_distribution_sku.shopPercent,
+            cm_distribution_sku.organizePercent,
+            cm_distribution_sku.cmPercent,
+            cm_distribution_sku.costCheckFlag,
+            cs.unit,
+            ifnull(cm_distribution_sku.costPrice,0) AS costPrice,
+            ifnull(cm_distribution_sku.cmCostPrice,0) AS cmCostPrice,
+            ifnull(cm_distribution_sku.organizeCostPrice,0) AS organizeCostPrice
+    </sql>
+
+    <select id="getByCmDistributionSku" parameterType="com.caimei.modules.product.entity.CmDistributionSku" resultMap="CmDistributionSkuResult">
+        <include refid="selectCmDistributionSkuVo"/>
+        from cm_distribution_sku AS cm_distribution_sku
+        LEFT JOIN cm_sku cs ON  cs.skuId = cm_distribution_sku.skuId
+        <where>
+            <if test="skuId != null  and skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.substring(skuId.toUpperCase().indexOf('=')+1,skuId.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+        group by cm_distribution_sku.skuId
+        order by cm_distribution_sku.skuId desc
+        limit 0,1
+    </select>
+
+    <select id="getCmDistributionSkuList" parameterType="com.caimei.modules.product.entity.CmDistributionSku" resultMap="CmDistributionSkuResult">
+        <include refid="selectCmDistributionSkuVo"/>
+        from cm_distribution_sku AS cm_distribution_sku
+        LEFT JOIN cm_sku cs ON  cs.skuId = cm_distribution_sku.skuId
+        <where>
+            <if test="skuId != null  and skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.substring(skuId.toUpperCase().indexOf('=')+1,skuId.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+        group by cm_distribution_sku.skuId
+        order by cm_distribution_sku.price asc
+    </select>
+
+    <select id="findDistributionSku" resultType="com.caimei.modules.product.entity.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,
+               cs.cmCostPrice,
+               cs.organizeCostPrice,
+               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_distribution_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="getCmDistributionSkuCount" parameterType="com.caimei.modules.product.entity.CmDistributionSku" resultType="String">
+        select count(1)
+        from cm_distribution_sku AS cm_distribution_sku
+        <where>
+            <if test="skuId != null  and  skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.substring(skuId.toUpperCase().indexOf('=')+1,skuId.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+        group by cm_distribution_sku.skuId
+    </select>
+
+    <select id="getCmDistributionSkuBySkuId" parameterType="String" resultMap="CmDistributionSkuResult">
+        <include refid="selectCmDistributionSkuVo"/>
+        from cm_distribution_sku AS cm_distribution_sku
+        LEFT JOIN cm_sku cs ON  cs.skuId = cm_distribution_sku.skuId
+        where  cm_distribution_sku.skuId = #{skuId}
+    </select>
+
+    <select id="getByIds" parameterType="com.caimei.modules.product.entity.CmDistributionSku" resultType="String">
+        select skuId
+        from cm_distribution_sku AS cm_distribution_sku
+        <where>
+            <if test="skuId != null  and skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.substring(skuId.toUpperCase().indexOf('=')+1,skuId.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+        group by cm_distribution_sku.skuId
+    </select>
+
+    <select id="getById" parameterType="com.caimei.modules.product.entity.CmDistributionSku" resultType="String">
+        select skuId
+        from cm_distribution_sku AS cm_distribution_sku
+        <where>
+            <if test="skuId != null  and skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toString().toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toString().toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.toString().substring(skuId.toString().toUpperCase().indexOf('=')+1,skuId.toString().length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+        group by cm_distribution_sku.skuId
+        limit 0,1
+    </select>
+
+    <insert id="addCmDistributionSku" parameterType="com.caimei.modules.product.entity.CmDistributionSku" useGeneratedKeys="true" keyProperty="skuId">
+        insert into cm_distribution_sku
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="skuId != null and skuId != ''">skuId,</if>
+            <if test="productId != null">productId,</if>
+            <if test="price != null">price,</if>
+            <if test="shopPercent != null">shopPercent,</if>
+            <if test="organizePercent != null">organizePercent,</if>
+            <if test="cmPercent != null">cmPercent,</if>
+            <if test="costCheckFlag != null and costCheckFlag != ''">costCheckFlag,</if>
+            <if test="costPrice != null">costPrice,</if>
+            <if test="cmCostPrice != null">cmCostPrice,</if>
+            <if test="organizeCostPrice != null">organizeCostPrice,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="skuId != null and skuId != ''">#{skuId},</if>
+            <if test="productId != null">#{productId},</if>
+            <if test="price != null">#{price},</if>
+            <if test="shopPercent != null">#{shopPercent},</if>
+            <if test="organizePercent != null">#{organizePercent},</if>
+            <if test="cmPercent != null">#{cmPercent},</if>
+            <if test="costCheckFlag != null and costCheckFlag != ''">#{costCheckFlag},</if>
+            <if test="costPrice != null">#{costPrice},</if>
+            <if test="cmCostPrice != null">#{cmCostPrice},</if>
+            <if test="organizeCostPrice != null">#{organizeCostPrice},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmDistributionSku" parameterType="com.caimei.modules.product.entity.CmDistributionSku">
+        update cm_distribution_sku
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="productId != null">productId = #{productId},</if>
+            <if test="price != null">price = #{price},</if>
+            <if test="shopPercent != null">shopPercent = #{shopPercent},</if>
+            <if test="organizePercent != null">organizePercent = #{organizePercent},</if>
+            <if test="cmPercent != null">cmPercent = #{cmPercent},</if>
+            <if test="costCheckFlag != null and costCheckFlag != ''">costCheckFlag = #{costCheckFlag},</if>
+            <if test="costPrice != null">costPrice = #{costPrice},</if>
+            <if test="cmCostPrice != null">cmCostPrice = #{cmCostPrice},</if>
+            <if test="organizeCostPrice != null">organizeCostPrice = #{organizeCostPrice},</if>
+        </trim>
+        where skuId = #{skuId}
+    </update>
+
+
+
+    <delete id="delCmDistributionSkuBySkuId" parameterType="String">
+        delete
+        from cm_distribution_sku where skuId = #{skuId}
+    </delete>
+
+    <delete id="delCmDistributionSku" parameterType="com.caimei.modules.product.entity.CmDistributionSku">
+        delete
+        from cm_distribution_sku AS cm_distribution_sku
+        <where>
+            <if test="skuId != null  and skuId != ''">
+                and cm_distribution_sku.skuId
+                <if test="skuId.toUpperCase().indexOf('=')==-1">
+                    = #{skuId}
+                </if>
+                <if test="skuId.toUpperCase().indexOf('=')!=-1">
+                    <if test="skuId.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="skuId.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="skuIdIn" collection="skuId.substring(skuId.toUpperCase().indexOf('=')+1,skuId.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{skuIdIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="productId != null "> and cm_distribution_sku.productId = #{productId}</if>
+            <if test="price != null "> and cm_distribution_sku.price = #{price}</if>
+            <if test="shopPercent != null "> and cm_distribution_sku.shopPercent = #{shopPercent}</if>
+            <if test="organizePercent != null "> and cm_distribution_sku.organizePercent = #{organizePercent}</if>
+            <if test="cmPercent != null "> and cm_distribution_sku.cmPercent = #{cmPercent}</if>
+            <if test="costCheckFlag != null  and costCheckFlag != ''"> and cm_distribution_sku.costCheckFlag = #{costCheckFlag}</if>
+        </where>
+    </delete>
+
+    <delete id="delCmDistributionSkuBySkuIds" parameterType="String">
+        delete from cm_distribution_sku where skuId in
+        <foreach item="skuId" collection="skuIds" open="(" separator="," close=")">
+            #{skuId}
+        </foreach>
+    </delete>
+
+</mapper>

+ 455 - 0
src/main/resources/mappings/modules/user/CmDistributionMapper.xml

@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.user.dao.CmDistributionMapper">
+
+	<resultMap type="com.caimei.modules.user.entity.CmDistribution" id="CmDistributionResult">
+		<result property="id"    column="id"    />
+		<result property="userId"    column="userId"    />
+		<result property="name"    column="name"    />
+		<result property="linkMan"    column="linkMan"    />
+		<result property="mobile"    column="mobile"    />
+		<result property="password"    column="password"    />
+		<result property="corporateName"    column="corporateName"    />
+		<result property="splitCode"    column="splitCode"    />
+		<result property="bankName"    column="bankName"    />
+		<result property="bankAccount"    column="bankAccount"    />
+		<result property="status"    column="status"    />
+		<result property="qrCode"    column="qrCode"    />
+		<result property="parentId"    column="parentId"    />
+		<result property="parentIds"    column="parentIds"    />
+		<result property="updateTime"    column="updateTime"    />
+		<result property="addTime"    column="addTime"    />
+		<result property="delFlag"    column="delFlag"    />
+	</resultMap>
+
+	<sql id="selectCmDistributionVo">
+		select
+			cm_distribution.id,
+			cm_distribution.userId,
+			cm_distribution.name,
+			cm_distribution.linkMan,
+			cm_distribution.mobile,
+			cm_distribution.password,
+			cm_distribution.corporateName,
+			cm_distribution.splitCode,
+			cm_distribution.bankName,
+			cm_distribution.bankAccount,
+			cm_distribution.status,
+			cm_distribution.qrCode,
+			cm_distribution.parentId,
+			cm_distribution.parentIds,
+			cm_distribution.updateTime,
+			cm_distribution.addTime,
+			cm_distribution.delFlag
+	</sql>
+
+
+
+
+	<select id="getByCmDistribution" parameterType="com.caimei.modules.user.entity.CmDistribution" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+		group by cm_distribution.id
+		order by cm_distribution.addTime desc
+		limit 0,1
+	</select>
+
+	<select id="getCmDistributionList" parameterType="com.caimei.modules.user.entity.CmDistribution" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds like concat('%', #{parentIds}, '%')</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+		group by cm_distribution.id
+		order by cm_distribution.addTime desc
+	</select>
+
+	<select id="findList" parameterType="com.caimei.modules.user.entity.CmDistribution" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+			<if test="settleStatus != null ">
+				<if test="settleStatus == 1 ">
+					and (SELECT ifnull(sum(IFNULL(cop.organizeCostPrice,cop.price*cop.organizePercent)),0)
+					from cm_reporting_club a
+					left join cm_distribution  cd on cd.id = a.distributionId
+					left join cm_order  co on co.orderID = a.orderID
+					left join cm_shop_order cso on cso.orderID = a.orderID
+					left join cm_order_product  cop on cop.orderID = a.orderID
+					LEFT JOIN cm_receipt_order_relation crr ON crr.orderId = a.orderID  AND crr.delFlag = '0'
+					LEFT JOIN cm_discern_receipt cdr ON crr.receiptId = cdr.id
+					WHERE a.splitSettleStatus!=3 and(cd.parentId=cm_distribution.id or cd.id=cm_distribution.id)
+					)=0
+				</if>
+				<if test="settleStatus == 0 ">
+					and (SELECT ifnull(sum(IFNULL(cop.organizeCostPrice,cop.price*cop.organizePercent)),0)
+					from cm_reporting_club a
+					left join cm_distribution  cd on cd.id = a.distributionId
+					left join cm_order  co on co.orderID = a.orderID
+					left join cm_shop_order cso on cso.orderID = a.orderID
+					left join cm_order_product  cop on cop.orderID = a.orderID
+					LEFT JOIN cm_receipt_order_relation crr ON crr.orderId = a.orderID  AND crr.delFlag = '0'
+					LEFT JOIN cm_discern_receipt cdr ON crr.receiptId = cdr.id
+					WHERE a.splitSettleStatus!=3 and(cd.parentId=cm_distribution.id or cd.id=cm_distribution.id)
+					)>0
+				</if>
+			 </if>
+		</where>
+		group by cm_distribution.id
+		order by cm_distribution.addTime desc
+	</select>
+
+	<select id="getCmDistributionCount" parameterType="com.caimei.modules.user.entity.CmDistribution" resultType="String">
+		select count(1)
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and  id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+		group by cm_distribution.id
+	</select>
+
+	<select id="getCmDistributionById" parameterType="String" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		where  cm_distribution.delFlag = 0 and cm_distribution.id = #{id}
+	</select>
+
+	<select id="get" parameterType="String" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		where  cm_distribution.delFlag = 0 and cm_distribution.id = #{id}
+	</select>
+
+	<select id="findDistributionIsMobile" parameterType="String" resultMap="CmDistributionResult">
+		<include refid="selectCmDistributionVo"/>
+		from cm_distribution AS cm_distribution
+		WHERE cm_distribution.delFlag = 0 and cm_distribution.mobile=#{mobile}
+		<if test="oldMobile !=null and oldMobile !=''">
+			and cm_distribution.mobile!=#{oldMobile}
+		</if>
+		limit 0,1
+	</select>
+
+	<select id="getByCommissions"  resultType="bigDecimal">
+		SELECT ifnull(sum(IFNULL(cop.organizeCostPrice,cop.price*cop.organizePercent)),0)
+		from cm_reporting_club a
+				 left join cm_distribution  cd on cd.id = a.distributionId
+				 left join cm_order  co on co.orderID = a.orderID
+				 left join cm_shop_order cso on cso.orderID = a.orderID
+				 left join cm_order_product  cop on cop.orderID = a.orderID
+				 LEFT JOIN cm_receipt_order_relation crr ON crr.orderId = a.orderID  AND crr.delFlag = '0'
+				 LEFT JOIN cm_discern_receipt cdr ON crr.receiptId = cdr.id
+		WHERE a.splitSettleStatus!=3 and(cd.parentId=#{id} or cd.id=#{id}) and cdr.payWay=#{payWay}
+	</select>
+
+	<select id="getByIds" parameterType="com.caimei.modules.user.entity.CmDistribution" resultType="String">
+		select id
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+		group by cm_distribution.id
+	</select>
+
+	<select id="getById" parameterType="com.caimei.modules.user.entity.CmDistribution" resultType="String">
+		select id
+		from cm_distribution AS cm_distribution
+		<where>  cm_distribution.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toString().toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toString().toUpperCase().indexOf('=')!=-1">
+					<if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+		group by cm_distribution.id
+		limit 0,1
+	</select>
+
+	<insert id="addCmDistribution" parameterType="com.caimei.modules.user.entity.CmDistribution" useGeneratedKeys="true" keyProperty="id">
+		insert into cm_distribution
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">id,</if>
+			<if test="userId != null">userId,</if>
+			<if test="name != null and name != ''">name,</if>
+			<if test="linkMan != null and linkMan != ''">linkMan,</if>
+			<if test="mobile != null and mobile != ''">mobile,</if>
+			<if test="password != null and password != ''">password,</if>
+			<if test="corporateName != null and corporateName != ''">corporateName,</if>
+			<if test="splitCode != null and splitCode != ''">splitCode,</if>
+			<if test="bankName != null and bankName != ''">bankName,</if>
+			<if test="bankAccount != null and bankAccount != ''">bankAccount,</if>
+			<if test="status != null">status,</if>
+			<if test="qrCode != null and qrCode != ''">qrCode,</if>
+			<if test="parentId != null">parentId,</if>
+			<if test="parentIds != null and parentIds != ''">parentIds,</if>
+			<if test="updateTime != null">updateTime,</if>
+			<if test="addTime != null">addTime,</if>
+			<if test="delFlag != null">delFlag,</if>
+		</trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">#{id},</if>
+			<if test="userId != null">#{userId},</if>
+			<if test="name != null and name != ''">#{name},</if>
+			<if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+			<if test="mobile != null and mobile != ''">#{mobile},</if>
+			<if test="password != null and password != ''">#{password},</if>
+			<if test="corporateName != null and corporateName != ''">#{corporateName},</if>
+			<if test="splitCode != null and splitCode != ''">#{splitCode},</if>
+			<if test="bankName != null and bankName != ''">#{bankName},</if>
+			<if test="bankAccount != null and bankAccount != ''">#{bankAccount},</if>
+			<if test="status != null">#{status},</if>
+			<if test="qrCode != null and qrCode != ''">#{qrCode},</if>
+			<if test="parentId != null">#{parentId},</if>
+			<if test="parentIds != null and parentIds != ''">#{parentIds},</if>
+			<if test="updateTime != null">#{updateTime},</if>
+			<if test="addTime != null">#{addTime},</if>
+			<if test="delFlag != null">#{delFlag},</if>
+		</trim>
+	</insert>
+
+	<update id="updateCmDistribution" parameterType="com.caimei.modules.user.entity.CmDistribution">
+		update cm_distribution
+		<trim prefix="SET" suffixOverrides=",">
+			<if test="userId != null">userId = #{userId},</if>
+			<if test="name != null and name != ''">name = #{name},</if>
+			<if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+			<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+			<if test="password != null and password != ''">password = #{password},</if>
+			<if test="corporateName != null and corporateName != ''">corporateName = #{corporateName},</if>
+			<if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
+			<if test="bankName != null and bankName != ''">bankName = #{bankName},</if>
+			<if test="bankAccount != null and bankAccount != ''">bankAccount = #{bankAccount},</if>
+			<if test="status != null">status = #{status},</if>
+			<if test="qrCode != null and qrCode != ''">qrCode = #{qrCode},</if>
+			<if test="parentId != null">parentId = #{parentId},</if>
+			<if test="parentIds != null and parentIds != ''">parentIds = #{parentIds},</if>
+			<if test="updateTime != null">updateTime = #{updateTime},</if>
+			<if test="addTime != null">addTime = #{addTime},</if>
+			<if test="delFlag != null">delFlag = #{delFlag},</if>
+		</trim>
+		<where>
+			<if test="id != null  and id != ''"> and cm_distribution.id = #{id}</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+		</where>
+
+	</update>
+
+	<update id="updateDelCmDistributionByIds" parameterType="String">
+		update cm_distribution set delFlag=#{delFlag} where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</update>
+
+	<delete id="delCmDistributionById" parameterType="String">
+		delete
+		from cm_distribution where id = #{id}
+	</delete>
+
+	<delete id="delCmDistribution" parameterType="com.caimei.modules.user.entity.CmDistribution">
+		delete
+		from cm_distribution AS cm_distribution
+		<where>
+			<if test="id != null  and id != ''">
+				and cm_distribution.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+			<if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+			<if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+			<if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+			<if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+			<if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+			<if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+			<if test="status != null "> and cm_distribution.status = #{status}</if>
+			<if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+			<if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+			<if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+			<if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+			<if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+		</where>
+	</delete>
+
+	<delete id="delCmDistributionByIds" parameterType="String">
+		delete from cm_distribution where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 320 - 0
src/main/resources/mappings/modules/user/CmRelatedImageMapper.xml

@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.user.dao.CmRelatedImageMapper">
+
+	<resultMap type="com.caimei.modules.user.entity.CmRelatedImage" id="CmRelatedImageResult">
+		<result property="id"    column="id"    />
+		<result property="type"    column="type"    />
+		<result property="authorId"    column="authorId"    />
+		<result property="image"    column="image"    />
+		<result property="delFlag"    column="delFlag"    />
+		<result property="updateTime"    column="updateTime"    />
+		<result property="createTime"    column="createTime"    />
+	</resultMap>
+
+	<sql id="selectCmRelatedImageVo">
+		select
+			cm_related_image.id,
+			cm_related_image.type,
+			cm_related_image.authorId,
+			cm_related_image.image,
+			cm_related_image.delFlag,
+			cm_related_image.updateTime,
+			cm_related_image.createTime
+	</sql>
+
+	<select id="getByCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultMap="CmRelatedImageResult">
+		<include refid="selectCmRelatedImageVo"/>
+		from cm_related_image AS cm_related_image
+		<where>  cm_related_image.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_related_image.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+		group by cm_related_image.id
+		order by cm_related_image.createTime desc
+		limit 0,1
+	</select>
+
+	<select id="getCmRelatedImageList" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultMap="CmRelatedImageResult">
+		<include refid="selectCmRelatedImageVo"/>
+		from cm_related_image AS cm_related_image
+		<where>  cm_related_image.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_related_image.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+		group by cm_related_image.id
+		order by cm_related_image.createTime desc
+	</select>
+
+	<select id="getCmRelatedImageCount" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
+		select count(1)
+		from cm_related_image AS cm_related_image
+		<where>  cm_related_image.delFlag = 0
+			<if test="id != null  and  id != ''">
+				and cm_related_image.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+		group by cm_related_image.id
+	</select>
+
+	<select id="getCmRelatedImageById" parameterType="String" resultMap="CmRelatedImageResult">
+		<include refid="selectCmRelatedImageVo"/>
+		from cm_related_image AS cm_related_image
+		where  cm_related_image.delFlag = 0 and cm_related_image.id = #{id}
+	</select>
+
+	<select id="getByIds" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
+		select id
+		from cm_related_image AS cm_related_image
+		<where>  cm_related_image.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_related_image.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+		group by cm_related_image.id
+	</select>
+
+	<select id="getById" parameterType="com.caimei.modules.user.entity.CmRelatedImage" resultType="String">
+		select id
+		from cm_related_image AS cm_related_image
+		<where>  cm_related_image.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_related_image.id
+				<if test="id.toString().toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toString().toUpperCase().indexOf('=')!=-1">
+					<if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+		group by cm_related_image.id
+		limit 0,1
+	</select>
+
+	<insert id="addCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage" useGeneratedKeys="true" keyProperty="id">
+		insert into cm_related_image
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">id,</if>
+			<if test="type != null and type != ''">type,</if>
+			<if test="authorId != null and authorId != ''">authorId,</if>
+			<if test="image != null and image != ''">image,</if>
+			<if test="delFlag != null">delFlag,</if>
+			<if test="updateTime != null">updateTime,</if>
+			<if test="createTime != null">createTime,</if>
+		</trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">#{id},</if>
+			<if test="type != null and type != ''">#{type},</if>
+			<if test="authorId != null and authorId != ''">#{authorId},</if>
+			<if test="image != null and image != ''">#{image},</if>
+			<if test="delFlag != null">#{delFlag},</if>
+			<if test="updateTime != null">#{updateTime},</if>
+			<if test="createTime != null">#{createTime},</if>
+		</trim>
+	</insert>
+
+	<update id="updateCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage">
+		update cm_related_image
+		<trim prefix="SET" suffixOverrides=",">
+			<if test="type != null and type != ''">type = #{type},</if>
+			<if test="authorId != null and authorId != ''">authorId = #{authorId},</if>
+			<if test="image != null and image != ''">image = #{image},</if>
+			<if test="delFlag != null">delFlag = #{delFlag},</if>
+			<if test="updateTime != null">updateTime = #{updateTime},</if>
+			<if test="createTime != null">createTime = #{createTime},</if>
+		</trim>
+		where id = #{id}
+	</update>
+
+	<update id="updateDelCmRelatedImageByIds" parameterType="String">
+		update cm_related_image set delFlag=#{delFlag} where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</update>
+
+	<delete id="delCmRelatedImageById" parameterType="String">
+		delete
+		from cm_related_image where id = #{id}
+	</delete>
+
+	<delete id="delCmRelatedImage" parameterType="com.caimei.modules.user.entity.CmRelatedImage">
+		delete
+		from cm_related_image AS cm_related_image
+		<where>
+			<if test="id != null  and id != ''">
+				and cm_related_image.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="type != null  and type != ''">
+				and cm_related_image.type
+				<if test="type.toUpperCase().indexOf('=')==-1">
+					= #{type}
+				</if>
+				<if test="type.toUpperCase().indexOf('=')!=-1">
+					<if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+						#{typeIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+			<if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+			<if test="delFlag != null "> and cm_related_image.delFlag = #{delFlag}</if>
+			<if test="updateTime != null "> and cm_related_image.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_related_image.createTime = #{createTime}</if>
+		</where>
+	</delete>
+
+	<delete id="delCmRelatedImageByIds" parameterType="String">
+		delete from cm_related_image where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 441 - 0
src/main/resources/mappings/modules/user/CmReportingClubMapper.xml

@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.user.dao.CmReportingClubMapper">
+
+	<resultMap type="com.caimei.modules.user.entity.CmReportingClub" id="CmReportingClubResult">
+		<result property="id"    column="id"    />
+		<result property="clubName"    column="clubName"    />
+		<result property="linkMan"    column="linkMan"    />
+		<result property="mobile"    column="mobile"    />
+		<result property="productId"    column="productId"    />
+		<result property="orderStatus"    column="orderStatus"    />
+		<result property="lockStatus"    column="lockStatus"    />
+		<result property="lockTime"    column="lockTime"    />
+		<result property="distributionId"    column="distributionId"    />
+		<result property="delFlag"    column="delFlag"    />
+		<result property="updateTime"    column="updateTime"    />
+		<result property="createTime"    column="createTime"    />
+		<result property="distributionName"    column="distributionName"    />
+		<result property="distributionMobile"    column="distributionMobile"    />
+		<result property="productName"    column="productName"    />
+		<result property="productImage"    column="productImage"    />
+		<result property="commission"    column="commission"    />
+		<result property="settleStatus"    column="settleStatus"    />
+		<result property="orderId"    column="orderId"    />
+	</resultMap>
+
+	<sql id="selectCmReportingClubVo">
+		select
+			cm_reporting_club.id,
+			cm_reporting_club.clubName,
+			cm_reporting_club.linkMan,
+			cm_reporting_club.mobile,
+			cm_reporting_club.productId,
+			cm_reporting_club.orderId,
+			cm_reporting_club.orderStatus,
+			cm_reporting_club.lockStatus,
+			cm_reporting_club.lockTime,
+			cm_reporting_club.distributionId,
+			cm_reporting_club.delFlag,
+			cm_reporting_club.updateTime,
+			cm_reporting_club.createTime,
+			ifnull(cm_reporting_club.commission,0) AS commission,
+			ifnull(cm_reporting_club.paidCommission,0) AS paidCommission,
+			cm_reporting_club.settleStatus,
+			cm_reporting_club.splitSettleStatus,
+			cm_reporting_club.splitSettleTime,
+			cm_distribution.name AS distributionName,
+			cm_distribution.mobile AS distributionMobile,
+			p.name AS productName,
+			p.mainImage AS productImage
+	</sql>
+
+	<select id="getByCmReportingClub" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultType="com.caimei.modules.user.entity.CmReportingClub">
+		<include refid="selectCmReportingClubVo"/>,
+		cdr.payWay,cso.settleStatus as splitSettleStatus,cso.orderTime,IFNULL(cop.organizeCostPrice,cop.price*cop.organizePercent) as organizeCostPrice
+		from cm_reporting_club AS cm_reporting_club
+		LEFT JOIN cm_distribution_product AS cm_distribution_product  on cm_reporting_club.productId=cm_distribution_product.productId
+		LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+		LEFT JOIN cm_distribution AS cm_distribution ON  cm_reporting_club.distributionId = cm_distribution.id
+		left join cm_order  co on co.orderID = cm_reporting_club.orderID
+		left join cm_shop_order cso on cso.orderID =cm_reporting_club.orderID
+		left join cm_order_product  cop on cop.orderID =cm_reporting_club.orderID
+		LEFT JOIN cm_receipt_order_relation crr ON crr.orderId = cm_reporting_club.orderID  AND crr.delFlag = '0'
+		LEFT JOIN cm_discern_receipt cdr ON crr.receiptId = cdr.id
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+			<if test="productName != null and productName!='' "> and p.name  like concat('%', #{productName}, '%')</if>
+			<if test="distributionName != null and distributionName!='' "> and cm_distribution.name  like concat('%', #{distributionName}, '%')</if>
+			<if test="distributionMobile != null and distributionMobile!='' "> and cm_distribution.mobile  like concat('%', #{distributionMobile}, '%')</if>
+			<if test="payWay != null "> and cdr.payWay  =#{payWay} </if>
+			<if test="splitSettleStatus != null "> and cso.settleStatus   =#{splitSettleStatus} </if>
+		</where>
+		group by cm_reporting_club.id
+		order by cm_reporting_club.createTime desc
+		limit 0,1
+	</select>
+
+	<select id="findList" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultMap="CmReportingClubResult">
+		<include refid="selectCmReportingClubVo"/>
+		from cm_reporting_club AS cm_reporting_club
+		LEFT JOIN cm_distribution_product AS cm_distribution_product  on cm_reporting_club.productId=cm_distribution_product.productId
+		LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+		LEFT JOIN cm_distribution AS cm_distribution ON  cm_reporting_club.distributionId = cm_distribution.id
+		LEFT JOIN cm_reporting_member AS cm_reporting_member ON  cm_reporting_club.id = cm_reporting_member.clubReportingId
+
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+			<if test="distributionCount != null ">
+				<if test="distributionCount == 0 ">
+				 and
+				 (select count(1)
+				 from cm_reporting_member
+				 where delFlag = 0 and auditStatus !=2 and clubReportingId=cm_reporting_club.id
+				 ) = 0
+				 </if>
+				<if test="distributionCount == 1 ">
+					and
+					(select count(1)
+					from cm_reporting_member
+					where delFlag = 0 and auditStatus !=2 and clubReportingId=cm_reporting_club.id
+					) > 0
+				</if>
+			 </if>
+			<if test="productName != null and productName!='' "> and p.name  like concat('%', #{productName}, '%')</if>
+
+		</where>
+		group by cm_reporting_club.id
+		order by cm_reporting_club.createTime desc
+	</select>
+	<select id="getCmReportingClubList" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultType="com.caimei.modules.user.entity.CmReportingClub">
+		<include refid="selectCmReportingClubVo"/>,
+		cdr.payWay,cso.orderTime,IFNULL(cop.organizeCostPrice,cop.price*cop.organizePercent) as organizeCostPrice
+		from cm_reporting_club AS cm_reporting_club
+		LEFT JOIN cm_distribution_product AS cm_distribution_product  on cm_reporting_club.productId=cm_distribution_product.productId
+		LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+		LEFT JOIN cm_distribution AS cm_distribution ON  cm_reporting_club.distributionId = cm_distribution.id
+		left join cm_order  co on co.orderID = cm_reporting_club.orderID
+		left join cm_shop_order cso on cso.orderID =cm_reporting_club.orderID
+		left join cm_order_product  cop on cop.orderID =cm_reporting_club.orderID
+		LEFT JOIN cm_receipt_order_relation crr ON crr.orderId = cm_reporting_club.orderID  AND crr.delFlag = '0'
+		LEFT JOIN cm_discern_receipt cdr ON crr.receiptId = cdr.id
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+			<if test="productName != null and productName!='' "> and p.name  like concat('%', #{productName}, '%')</if>
+			<if test="distributionName != null and distributionName!='' "> and cm_distribution.name  like concat('%', #{distributionName}, '%')</if>
+			<if test="distributionMobile != null and distributionMobile!='' "> and cm_distribution.mobile  like concat('%', #{distributionMobile}, '%')</if>
+			<if test="payWay != null "> and cdr.payWay  =#{payWay} </if>
+			<if test="splitSettleStatus != null "> and cm_reporting_club.splitSettleStatus = #{splitSettleStatus} </if>
+			<if test="parentIds != null and parentIds != ''"> and (cm_distribution.id = #{parentIds} or cm_distribution.parentId = #{parentIds}) </if>
+		</where>
+		group by cm_reporting_club.id
+		order by cm_reporting_club.createTime desc
+	</select>
+
+	<select id="getCmReportingClubCount" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultType="String">
+		select count(1)
+		from cm_reporting_club AS cm_reporting_club
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and  id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+		</where>
+		group by cm_reporting_club.id
+	</select>
+
+	<select id="get" parameterType="String" resultMap="CmReportingClubResult">
+		<include refid="selectCmReportingClubVo"/>
+		from cm_reporting_club AS cm_reporting_club
+		LEFT JOIN cm_distribution_product AS cm_distribution_product  on cm_reporting_club.productId=cm_distribution_product.productId
+		LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+		LEFT JOIN cm_distribution AS cm_distribution ON  cm_reporting_club.distributionId = cm_distribution.id
+
+		where  cm_reporting_club.delFlag = 0 and cm_reporting_club.id = #{id}
+	</select>
+	<select id="getCmReportingClubById" parameterType="String" resultMap="CmReportingClubResult">
+		<include refid="selectCmReportingClubVo"/>
+		from cm_reporting_club AS cm_reporting_club
+		LEFT JOIN cm_distribution_product AS cm_distribution_product  on cm_reporting_club.productId=cm_distribution_product.productId
+		LEFT JOIN product p ON  cm_distribution_product.productId = p.productID
+		LEFT JOIN cm_distribution AS cm_distribution ON  cm_reporting_club.distributionId = cm_distribution.id
+		where  cm_reporting_club.delFlag = 0 and cm_reporting_club.id = #{id}
+	</select>
+
+	<select id="getByIds" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultType="String">
+		select id
+		from cm_reporting_club AS cm_reporting_club
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+		</where>
+		group by cm_reporting_club.id
+	</select>
+
+	<select id="getById" parameterType="com.caimei.modules.user.entity.CmReportingClub" resultType="String">
+		select id
+		from cm_reporting_club AS cm_reporting_club
+		<where>  cm_reporting_club.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toString().toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toString().toUpperCase().indexOf('=')!=-1">
+					<if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+		</where>
+		group by cm_reporting_club.id
+		limit 0,1
+	</select>
+
+	<insert id="addCmReportingClub" parameterType="com.caimei.modules.user.entity.CmReportingClub" useGeneratedKeys="true" keyProperty="id">
+		insert into cm_reporting_club
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">id,</if>
+			<if test="clubName != null and clubName != ''">clubName,</if>
+			<if test="linkMan != null and linkMan != ''">linkMan,</if>
+			<if test="mobile != null and mobile != ''">mobile,</if>
+			<if test="productId != null">productId,</if>
+			<if test="orderStatus != null">orderStatus,</if>
+			<if test="lockStatus != null">lockStatus,</if>
+			<if test="lockTime != null">lockTime,</if>
+			<if test="distributionId != null">distributionId,</if>
+			<if test="delFlag != null">delFlag,</if>
+			<if test="updateTime != null">updateTime,</if>
+			<if test="createTime != null">createTime,</if>
+			<if test="commission != null">commission,</if>
+			<if test="settleStatus != null">settleStatus,</if>
+		</trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">#{id},</if>
+			<if test="clubName != null and clubName != ''">#{clubName},</if>
+			<if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+			<if test="mobile != null and mobile != ''">#{mobile},</if>
+			<if test="productId != null">#{productId},</if>
+			<if test="orderStatus != null">#{orderStatus},</if>
+			<if test="lockStatus != null">#{lockStatus},</if>
+			<if test="lockTime != null">#{lockTime},</if>
+			<if test="distributionId != null">#{distributionId},</if>
+			<if test="delFlag != null">#{delFlag},</if>
+			<if test="updateTime != null">#{updateTime},</if>
+			<if test="createTime != null">#{createTime},</if>
+			<if test="commission != null">#{commission},</if>
+			<if test="settleStatus != null">#{settleStatus},</if>
+		</trim>
+	</insert>
+
+	<update id="updateCmReportingClub" parameterType="com.caimei.modules.user.entity.CmReportingClub">
+		update cm_reporting_club
+		<trim prefix="SET" suffixOverrides=",">
+			<if test="clubName != null and clubName != ''">clubName = #{clubName},</if>
+			<if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+			<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+			<if test="productId != null">productId = #{productId},</if>
+			<if test="orderId != null">orderId = #{orderId},</if>
+			<if test="orderStatus != null">orderStatus = #{orderStatus},</if>
+			<if test="lockStatus != null">lockStatus = #{lockStatus},</if>
+			<if test="lockTime != null">lockTime = #{lockTime},</if>
+			<if test="distributionId != null">distributionId = #{distributionId},</if>
+			<if test="delFlag != null">delFlag = #{delFlag},</if>
+			<if test="updateTime != null">updateTime = #{updateTime},</if>
+			<if test="createTime != null">createTime = #{createTime},</if>
+			<if test="commission != null">commission = #{commission},</if>
+			<if test="settleStatus != null">settleStatus = #{settleStatus},</if>
+			<if test="settleTime != null">settleTime = #{settleTime},</if>
+			<if test="paidCommission != null">paidCommission = #{paidCommission},</if>
+			<if test="splitSettleStatus != null">splitSettleStatus = #{splitSettleStatus},</if>
+			<if test="splitSettleTime != null">splitSettleTime = #{splitSettleTime},</if>
+			<if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
+		</trim>
+		where id = #{id}
+	</update>
+
+	<update id="updateDelCmReportingClubByIds" parameterType="String">
+		update cm_reporting_club set delFlag=#{delFlag} where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</update>
+
+	<delete id="delCmReportingClubById" parameterType="String">
+		delete
+		from cm_reporting_club where id = #{id}
+	</delete>
+
+	<delete id="delCmReportingClub" parameterType="com.caimei.modules.user.entity.CmReportingClub">
+		delete
+		from cm_reporting_club AS cm_reporting_club
+		<where>
+			<if test="id != null  and id != ''">
+				and cm_reporting_club.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="clubName != null  and clubName != ''"> and cm_reporting_club.clubName like concat('%', #{clubName}, '%')</if>
+			<if test="linkMan != null  and linkMan != ''"> and cm_reporting_club.linkMan = #{linkMan}</if>
+			<if test="mobile != null  and mobile != ''"> and cm_reporting_club.mobile = #{mobile}</if>
+			<if test="productId != null "> and cm_reporting_club.productId = #{productId}</if>
+			<if test="orderId != null "> and cm_reporting_club.orderId = #{orderId}</if>
+			<if test="orderStatus != null "> and cm_reporting_club.orderStatus = #{orderStatus}</if>
+			<if test="lockStatus != null "> and cm_reporting_club.lockStatus = #{lockStatus}</if>
+			<if test="distributionId != null "> and cm_reporting_club.distributionId = #{distributionId}</if>
+			<if test="delFlag != null "> and cm_reporting_club.delFlag = #{delFlag}</if>
+			<if test="updateTime != null "> and cm_reporting_club.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_club.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_club.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_club.settleStatus = #{settleStatus}</if>
+		</where>
+	</delete>
+
+	<delete id="delCmReportingClubByIds" parameterType="String">
+		delete from cm_reporting_club where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 394 - 0
src/main/resources/mappings/modules/user/CmReportingMemberMapper.xml

@@ -0,0 +1,394 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+		PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+		"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei.modules.user.dao.CmReportingMemberMapper">
+
+	<resultMap type="com.caimei.modules.user.entity.CmReportingMember" id="CmReportingMemberResult">
+		<result property="id"    column="id"    />
+		<result property="distributionId"    column="distributionId"    />
+		<result property="clubReportingId"    column="clubReportingId"    />
+		<result property="auditStatus"    column="auditStatus"    />
+		<result property="auditText"    column="auditText"    />
+		<result property="auditTime"    column="auditTime"    />
+		<result property="delFlag"    column="delFlag"    />
+		<result property="updateTime"    column="updateTime"    />
+		<result property="createTime"    column="createTime"    />
+		<result property="remarks"    column="remarks"    />
+		<result property="auditBy"    column="auditBy"    />
+		<result property="commission"    column="commission"    />
+		<result property="settleStatus"    column="settleStatus"    />
+		<result property="settleTime"    column="settleTime"    />
+	</resultMap>
+
+	<sql id="selectCmReportingMemberVo">
+		select
+			cm_reporting_member.id,
+			cm_reporting_member.distributionId,
+			cm_reporting_member.clubReportingId,
+			cm_reporting_member.auditStatus,
+			cm_reporting_member.auditText,
+			cm_reporting_member.auditTime,
+			cm_reporting_member.remarks,
+			cm_reporting_member.auditBy,
+			cm_reporting_member.delFlag,
+			cm_reporting_member.updateTime,
+			cm_reporting_member.createTime,
+			ifnull(cm_reporting_member.commission,0) AS commission,
+			cm_reporting_member.settleStatus,
+			cm_reporting_member.settleTime
+	</sql>
+
+	<select id="getByCmReportingMember" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultMap="CmReportingMemberResult">
+		<include refid="selectCmReportingMemberVo"/>
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+		group by cm_reporting_member.id
+		order by cm_reporting_member.createTime desc
+		limit 0,1
+	</select>
+
+	<select id="getCmReportingMemberList" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultMap="CmReportingMemberResult">
+		<include refid="selectCmReportingMemberVo"/>
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+		group by cm_reporting_member.id
+		order by cm_reporting_member.createTime desc
+	</select>
+
+	<select id="findList" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultMap="CmReportingMemberResult">
+		<include refid="selectCmReportingMemberVo"/>
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+			<if test="cmDistribution != null ">
+				<if test="cmDistribution.name != null  and cmDistribution.name != ''">
+					and cm_reporting_member.distributionId in (select
+					id from cm_distribution where name like concat('%', #{cmDistribution.name}, '%'))
+				</if>
+				<if test="cmDistribution.mobile != null  and cmDistribution.mobile != ''">
+					and cm_reporting_member.distributionId in (select
+					id from cm_distribution where mobile like concat('%', #{cmDistribution.mobile}, '%'))
+				</if>
+				<if test="cmDistribution.corporateName != null  and cmDistribution.corporateName != ''">
+					and cm_reporting_member.distributionId in (select
+					id from cm_distribution where corporateName like concat('%', #{cmDistribution.corporateName}, '%'))
+				</if>
+				<if test="cmDistribution.parentId != null  ">
+					and cm_reporting_member.distributionId in (select
+					id from cm_distribution where
+					<if test="cmDistribution.parentId == 0"> parentId=0</if>
+					<if test="cmDistribution.parentId != 0"> parentId!=0</if>
+					)
+				</if>
+			</if>
+
+		</where>
+		group by cm_reporting_member.id
+		order by cm_reporting_member.createTime desc
+	</select>
+
+	<select id="getCmReportingMemberCount" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultType="Integer">
+		select ifnull(count(1),0)
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and  id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != ''">
+				and cm_reporting_member.auditStatus
+				<if test="auditStatus.toUpperCase().indexOf('=')==-1">
+					= #{auditStatus}
+				</if>
+				<if test="auditStatus.toUpperCase().indexOf('=')!=-1">
+					<if test="auditStatus.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="auditStatus.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="auditStatus.substring(auditStatus.toUpperCase().indexOf('=')+1,auditStatus.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+-- 		group by cm_reporting_member.id
+	</select>
+	<select id="getCmReportingMembercCommissions" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultType="Double">
+		select sum(cm_reporting_member.commission)
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			and cm_reporting_member.clubReportingId = #{clubReportingId}
+			and cm_reporting_member.settleStatus !=2
+		</where>
+-- 		group by cm_reporting_member.id
+	</select>
+
+	<select id="get" parameterType="String" resultMap="CmReportingMemberResult">
+		<include refid="selectCmReportingMemberVo"/>
+		from cm_reporting_member AS cm_reporting_member
+		where  cm_reporting_member.delFlag = 0 and cm_reporting_member.id = #{id}
+	</select>
+
+	<select id="getCmReportingMemberById" parameterType="String" resultMap="CmReportingMemberResult">
+		<include refid="selectCmReportingMemberVo"/>
+		from cm_reporting_member AS cm_reporting_member
+		where  cm_reporting_member.delFlag = 0 and cm_reporting_member.id = #{id}
+	</select>
+
+	<select id="getByIds" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultType="String">
+		select id
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+		group by cm_reporting_member.id
+	</select>
+
+	<select id="getById" parameterType="com.caimei.modules.user.entity.CmReportingMember" resultType="String">
+		select id
+		from cm_reporting_member AS cm_reporting_member
+		<where>  cm_reporting_member.delFlag = 0
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toString().toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toString().toUpperCase().indexOf('=')!=-1">
+					<if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+		group by cm_reporting_member.id
+		limit 0,1
+	</select>
+
+	<insert id="addCmReportingMember" parameterType="com.caimei.modules.user.entity.CmReportingMember" useGeneratedKeys="true" keyProperty="id">
+		insert into cm_reporting_member
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">id,</if>
+			<if test="distributionId != null">distributionId,</if>
+			<if test="clubReportingId != null">clubReportingId,</if>
+			<if test="auditStatus != null">auditStatus,</if>
+			<if test="auditText != null and auditText != ''">auditText,</if>
+			<if test="auditBy != null">auditBy,</if>
+			<if test="auditTime != null">auditTime,</if>
+			<if test="delFlag != null">delFlag,</if>
+			<if test="updateTime != null">updateTime,</if>
+			<if test="createTime != null">createTime,</if>
+			<if test="remarks != null and remarks != ''">remarks,</if>
+			<if test="commission != null">commission,</if>
+			<if test="settleStatus != null">settleStatus,</if>
+			<if test="settleTime != null">settleTime,</if>
+		</trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="id != null and id != ''">#{id},</if>
+			<if test="distributionId != null">#{distributionId},</if>
+			<if test="clubReportingId != null">#{clubReportingId},</if>
+			<if test="auditStatus != null">#{auditStatus},</if>
+			<if test="auditText != null and auditText != ''">#{auditText},</if>
+			<if test="auditBy != null">#{auditBy},</if>
+			<if test="auditTime != null">#{auditTime},</if>
+			<if test="delFlag != null">#{delFlag},</if>
+			<if test="updateTime != null">#{updateTime},</if>
+			<if test="createTime != null">#{createTime},</if>
+			<if test="remarks != null and remarks != ''">#{remarks},</if>
+			<if test="commission != null">#{commission},</if>
+			<if test="settleStatus != null">#{settleStatus},</if>
+			<if test="settleTime != null">#{settleTime},</if>
+		</trim>
+	</insert>
+
+	<update id="updateCmReportingMember" parameterType="com.caimei.modules.user.entity.CmReportingMember">
+		update cm_reporting_member
+		<trim prefix="SET" suffixOverrides=",">
+			<if test="distributionId != null">distributionId = #{distributionId},</if>
+			<if test="clubReportingId != null">clubReportingId = #{clubReportingId},</if>
+			<if test="auditStatus != null">auditStatus = #{auditStatus},</if>
+			<if test="auditText != null and auditText != ''">auditText = #{auditText},</if>
+			<if test="auditBy != null">auditBy = #{auditBy},</if>
+			<if test="auditTime != null">auditTime = #{auditTime},</if>
+			<if test="delFlag != null">delFlag = #{delFlag},</if>
+			<if test="updateTime != null">updateTime = #{updateTime},</if>
+			<if test="createTime != null">createTime = #{createTime},</if>
+			<if test="remarks != null and remarks != ''">remarks = #{remarks},</if>
+			<if test="commission != null">commission = #{commission},</if>
+			<if test="settleStatus != null">settleStatus = #{settleStatus},</if>
+			<if test="settleTime != null">settleTime = #{settleTime},</if>
+		</trim>
+		where id = #{id}
+	</update>
+
+	<update id="updateDelCmReportingMemberByIds" parameterType="String">
+		update cm_reporting_member set delFlag=#{delFlag} where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</update>
+
+	<delete id="delCmReportingMemberById" parameterType="String">
+		delete
+		from cm_reporting_member where id = #{id}
+	</delete>
+
+	<delete id="delCmReportingMember" parameterType="com.caimei.modules.user.entity.CmReportingMember">
+		delete
+		from cm_reporting_member AS cm_reporting_member
+		<where>
+			<if test="id != null  and id != ''">
+				and cm_reporting_member.id
+				<if test="id.toUpperCase().indexOf('=')==-1">
+					= #{id}
+				</if>
+				<if test="id.toUpperCase().indexOf('=')!=-1">
+					<if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+					<if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+					<foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+						#{idIn}
+					</foreach>
+				</if>
+			</if>
+			<if test="distributionId != null "> and cm_reporting_member.distributionId = #{distributionId}</if>
+			<if test="clubReportingId != null "> and cm_reporting_member.clubReportingId = #{clubReportingId}</if>
+			<if test="auditStatus != null  and  auditStatus != '' "> and cm_reporting_member.auditStatus = #{auditStatus}</if>
+			<if test="auditText != null  and auditText != ''"> and cm_reporting_member.auditText = #{auditText}</if>
+			<if test="auditTime != null "> and cm_reporting_member.auditTime = #{auditTime}</if>
+			<if test="delFlag != null "> and cm_reporting_member.delFlag = #{delFlag}</if>
+			<if test="updateTime != null "> and cm_reporting_member.updateTime = #{updateTime}</if>
+			<if test="createTime != null "> and cm_reporting_member.createTime = #{createTime}</if>
+			<if test="commission != null "> and cm_reporting_member.commission = #{commission}</if>
+			<if test="settleStatus != null "> and cm_reporting_member.settleStatus = #{settleStatus}</if>
+			<if test="settleTime != null "> and cm_reporting_member.settleTime = #{settleTime}</if>
+		</where>
+	</delete>
+
+	<delete id="delCmReportingMemberByIds" parameterType="String">
+		delete from cm_reporting_member where id in
+		<foreach item="id" collection="ids" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 8 - 1
src/main/resources/mappings/modules/user/CmUserMapper.xml

@@ -461,7 +461,14 @@
         SELECT
         <include refid="cmUserColumns"/>
         FROM user a
-        WHERE a.mobile=#{mobile}
+        WHERE a.bindMobile=#{mobile}
+        <if test="oldUserId !=null and oldUserId !=''">
+            and a.userId!=#{oldUserId}
+        </if>
+        <if test="userIdentity !=null">
+            and a.userIdentity=#{userIdentity}
+        </if>
+        limit 0,1
     </select>
 
     <select id="getUserPayOrder" resultType="com.caimei.po.neworder.CmShopOrder">

+ 75 - 2
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -104,7 +104,7 @@
         LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1)
         covs ON a.userID = covs.userID
         <where>
-            (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+            (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 AND u.userIdentity != 8
             <if test="clubID != null and clubID != ''">
                 AND a.clubID = #{clubID}
             </if>
@@ -548,7 +548,9 @@
             medicalPracticeLicenseImg=#{medicalPracticeLicenseImg},
         </if>
         userID = #{userID}
-        WHERE clubID = #{clubID}
+        WHERE (clubID = #{clubID}
+        <if test="clubID == null or clubID == ''">or userID = #{userID}</if>
+            )
     </update>
 
     <delete id="delete">
@@ -557,6 +559,77 @@
         WHERE clubID = #{clubID}
     </delete>
 
+    <select id="findDistributionCLubList" resultType="com.caimei.modules.user.entity.NewCmClub">
+        SELECT
+        <include refid="newCmClubColumns"/>,
+        u.registerTime,
+        u.userName,
+        u.bindMobile
+        FROM club a
+        LEFT JOIN user u ON u.userID = a.userID
+        <where>
+            (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 and  a.status != 92
+            <if test="clubID != null and clubID != ''">
+                AND a.clubID = #{clubID}
+            </if>
+            <if test="userID != null and userID != ''">
+                AND a.userID = #{userID}
+            </if>
+            <if test="account != null and account != ''">
+                AND u.account = #{account}
+            </if>
+            <if test="name != null and name != ''">
+                AND u.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="userName != null and userName != ''">
+                AND u.userName LIKE concat('%',#{userName},'%')
+            </if>
+            <if test="status != null and status != ''">
+                AND a.status = #{status}
+            </if>
+            <if test="bindMobile != null and bindMobile != ''">
+                AND u.bindMobile LIKE concat('%',#{bindMobile},'%')
+            </if>
+            <if test="email != null and email != ''">
+                AND u.email LIKE concat('%',#{email},'%')
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                AND a.linkMan LIKE concat('%',#{linkMan},'%')
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND (u.registerTime &gt; #{startTime} OR u.registerTime = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
+            </if>
+            <if test="startLoginTime != null and startLoginTime != ''">
+                AND (u.loginTime &gt; #{startLoginTime} OR u.loginTime = #{startLoginTime})
+            </if>
+            <if test="endLoginTime != null and endLoginTime != ''">
+                AND (u.loginTime &lt; #{endLoginTime} OR u.loginTime = #{endLoginTime})
+            </if>
+
+            <if test="userIdentity != null and userIdentity != ''">
+                AND u.userIdentity = #{userIdentity}
+            </if>
+            <if test="newDeal != null">
+                AND a.newDeal =#{newDeal}
+            </if>
+            <if test="spID != null and spID != ''">
+                AND a.spID = #{spID}
+            </if>
+        </where>
+        group by a.clubId
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                ORDER BY case when a.status = 91 then 0 else 1 end desc,  u.registerTime DESC
+            </otherwise>
+        </choose>
+    </select>
+
     <select id="findClubById" resultType="com.caimei.modules.user.entity.NewCmClub">
         SELECT
         <include refid="newCmClubColumns"/>

+ 6 - 6
src/main/webapp/WEB-INF/views/modules/info/infoTypeForm.jsp

@@ -115,7 +115,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:1920 * 510 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:524 * 382 / PX</p>
 				</div>
 			</span>
 				<span style="float: left">
@@ -130,7 +130,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:750 * 366 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:550 * 400 / PX</p>
 				</div>
 			</span>
 			</div>
@@ -172,7 +172,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:300 * 200 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:360 * 187 / PX</p>
 				</div>
 			</span>
 				<span style="float: left">
@@ -187,7 +187,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:300 * 200 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:378 * 192 / PX</p>
 				</div>
 			</span>
 			</div>
@@ -229,7 +229,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:300 * 200 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:360 * 187 / PX</p>
 				</div>
 			</span>
 				<span style="float: left">
@@ -244,7 +244,7 @@
 								  maxHeight="100"/>
 				</div>
 				<div class="controls" style="padding-top: 20px;">
-					<p style="color:#D0D0D0 ;">建议尺寸:300 * 200 / PX</p>
+					<p style="color:#D0D0D0 ;">建议尺寸:378 * 192 / PX</p>
 				</div>
 			</span>
 			</div>

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp

@@ -325,6 +325,8 @@
 <body>
 <ul class="nav nav-tabs">
     <li class="active"><a href="${ctx}/product/new/list?searchProductCategory=1">商品列表</a></li>
+    <li><a href="${ctx}/product/cmDistributionProduct/list">分销商品</a></li>
+
 </ul>
 <form:form id="searchForm" modelAttribute="product" action="${ctx}/product/new/list" method="post"
            class="breadcrumb form-search">

+ 144 - 0
src/main/webapp/WEB-INF/views/modules/product/cmDistributionAddProduct.jsp

@@ -0,0 +1,144 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>选择商品</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table td i {
+            margin: 0 2px;
+        }
+    </style>
+
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#searchForm").validate({
+                submitHandler: function (form) {
+                    var isSubMitFlag = true;
+                    var productID = $("#productID").val();
+                    if (isNaN(productID) || productID.indexOf('0') == 0) {
+                        alertx("请输入正确的商品ID");
+                        isSubMitFlag = false;
+                        return false;
+                    }
+                    if (isSubMitFlag) {
+                        form.submit();
+                    }
+                }
+            })
+        });
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product" action="${ctx}${url}" method="post"
+           class="breadcrumb form-search">
+    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <input id="distributionId" name="distributionId" type="hidden" value="${distributionId}"/>
+    <div class="ul-form">
+        <label>商品ID:</label>
+        <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
+                    onkeyup="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
+        <label>供应商名称:</label>
+        <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
+        &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table class="table table-striped table-bordered table-condensed table-hover">
+    <tr>
+        <th style="width:20px;"></th>
+        <th>商品ID</th>
+        <th>商品图片</th>
+        <th>商品名称</th>
+        <th>供应商名称</th>
+    </tr>
+    <tbody>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="item" varStatus="index">
+            <tr id="${item.productID}" class="itemtr">
+                <th>
+                    <input class="check-item" type="radio" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
+                <td class="name">${item.name}</td>
+                <td id="shopName">${item.shopName}</td>
+                <input type="hidden" value="${item.price}" id="price">
+                <input type="hidden" value="${index.index}" id="index">
+                <input type="hidden" value="${item.includedTax}" id="includedTax">
+                <input type="hidden" value="${item.invoiceType}" id="invoiceType">
+                <input type="hidden" value="${item.taxPoint}" id="clubTaxPoint">
+                <input type="hidden" value="${item.supplierTaxPoint}" id="shopTaxPoint">
+                <input type="hidden" value="${item.costCheckFlag}" id="costType">
+                <input type="hidden" value="${item.costPrice}" id="costPrice">
+                <input type="hidden" value="${item.shopPercent}" id="shopPercent">
+            </tr>
+        </c:forEach>
+    </c:if>
+    </tbody>
+</table>
+<c:if test="${empty  page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+<script type="text/javascript">
+    $(document).ready(function () {
+        //弹出框去滚动条
+        top.$('#jbox-content').css("overflow-y", "hidden");
+        show_title(30);
+    });
+
+    function page(n, s) {
+        $("#pageNo").val(n);
+        $("#pageSize").val(s);
+        $("#searchForm").submit();
+        return false;
+    }
+
+    function getCheckedItems() {
+        var items = new Array();
+        var $items = $('.check-item:checked');
+        $items.each(function () {
+            var c={};
+            c= ${productList};
+            var index= $(this).parents(".itemtr").find("#index").val();
+            var s=c[index].skuList;
+            items.push({
+                productId: $(this).val(),
+                skuList: s,
+                mainImage: $(this).parents(".itemtr").find(".mainImage").attr("src"),
+                name: $(this).parents(".itemtr").find(".name").text(),
+                shopName: $(this).parents(".itemtr").find("#shopName").text(),
+                price: $(this).parents(".itemtr").find("#price").val(),
+                includedTax: $(this).parents(".itemtr").find("#includedTax").val(),
+                invoiceType: $(this).parents(".itemtr").find("#invoiceType").val(),
+                clubTaxPoint: $(this).parents(".itemtr").find("#clubTaxPoint").val(),
+                shopTaxPoint: $(this).parents(".itemtr").find("#shopTaxPoint").val(),
+                costType: $(this).parents(".itemtr").find("#costType").val(),
+                costPrice: $(this).parents(".itemtr").find("#costPrice").val(),
+                shopPercent: $(this).parents(".itemtr").find("#shopPercent").val()
+            })
+        });
+        return items;
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>
+

+ 561 - 0
src/main/webapp/WEB-INF/views/modules/product/cmDistributionProductForm.jsp

@@ -0,0 +1,561 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>分销商品管理</title>
+    <meta name="decorator" content="default"/>
+    <style>
+        body {
+            font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
+            font-size: 14px;
+            line-height: 1.42857143;
+            color: #666;
+            margin: 0;
+        }
+
+        .hidden {
+            display: none !important;
+        }
+
+        .selectPickerWrapper * {
+            box-sizing: border-box;
+        }
+
+        .selectPickerWrapper {
+            position: relative;
+            /* margin: 50px; */
+            display: inline-block;
+        }
+
+        .select-picker-search {
+            width: 200px;
+            height: 32px;
+            line-height: 32px;
+            color: #666;
+            border-radius: 3px;
+            border: 1px solid #ddd;
+            padding: 0 10px;
+            font-size: 14px;
+            cursor: pointer;
+        }
+
+        .select-picker-search-checked {
+            position: relative;
+            width: 180px;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+            overflow: hidden;
+            padding-right: 5px;
+        }
+
+        .select-picker-search-checked:after {
+            border: 5px solid transparent;
+            content: ' ';
+            height: 0;
+            position: absolute;
+            width: 0;
+            top: 12.2px;
+            border-top: 8px solid #666;
+            right: 0;
+        }
+
+        .select-picker-options-wrp {
+            display: none;
+            width: 200px;
+            border-radius: 2px;
+            box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
+            background-color: #fff;
+            position: absolute;
+            top: 36px;
+            left: 0;
+            z-index: 999;
+        }
+
+        .select-picker-options-serch input {
+            width: 160px;
+            height: 32px;
+            line-height: 32px;
+            border: 1px solid #ddd;
+            border-radius: 3px;
+            margin: 12px 0 0 10px;
+            padding-left: 8px;
+        }
+
+        .select-picker-options-serch input:focus {
+            border-color: #2fa4e7;
+            outline: 0;
+            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
+            box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
+        }
+
+        .select-picker-options-list {
+            width: 100%;
+            padding: 8px 0;
+        }
+
+        .select-picker-options-list-item {
+            width: 100%;
+            line-height: 36px;
+            cursor: pointer;
+            padding: 0 12px;
+        }
+
+        .select-picker-options-list-item:hover {
+            background: #ebf1f5;
+        }
+
+        .duihao {
+            display: inline-block;
+            width: 18px;
+            height: 18px;
+            border-radius: 3px;
+            transform: translateY(4px);
+            margin-right: 6px;
+        }
+
+        .duihao-checked {
+            background: #2fa4e7;
+            position: relative;
+        }
+
+        .duihao-checked:before,
+        .duihao-checked::after {
+            content: '';
+            height: 10px;
+            width: 2px;
+            border-radius: 10px;
+            display: block;
+            background: white;
+            position: absolute;
+            top: 4px;
+            left: 10px;
+            transform: rotate(45deg);
+            -ms-transform: rotate(45deg);
+        }
+
+        .duihao-checked::before {
+            height: 6px;
+            transform: rotate(-45deg);
+            -ms-transform: rotate(-45deg);
+            position: absolute;
+            top: 7px;
+            left: 5px;
+        }
+
+        .duihao-nocheck {
+            border: 1px solid #ddd;
+        }
+
+        .control-group > div::after {
+            content: "";
+            display: block;
+            clear: both;
+        }
+
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var productId = $('#productId').val();
+                    if (productId.length == 0) {
+                        alertx("请选择商品");
+                        return false;
+                    }
+                    var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
+                    var skus = $("#skuPrice .sku")
+                    var flag = true
+                    if (skus.length > 0) {
+                        skus.each(function () {
+                            var cost = $(this)
+                            if (costCheckFlag * 1 === 1) {
+                                var costPrice = cost.find(".costPrice").val()
+                                var organizeCostPrice = cost.find(".organizeCostPrice").val()
+                                var cmCostPrice = cost.find(".cmCostPrice").val()
+                                var price = cost.find(".price").val() * 1
+                                console.log(costPrice)
+                                const num = costPrice * 1 + organizeCostPrice * 1 + cmCostPrice * 1
+                                if (num > price) {
+                                    alertx("采美固定成本之和不能大于机构价")
+                                    flag = false;
+                                }
+                            } else {
+                                var shopPercent = cost.find(".shopPercent").val()
+                                var organizePercent = cost.find(".organizePercent").val()
+                                var cmPercent = cost.find(".cmPercent").val()
+                                const num = shopPercent * 1 + organizePercent * 1 + cmPercent * 1
+                                if (num != 100) {
+                                    alertx("采美佣金比例之和不能大于或小于100")
+                                    flag = false;
+                                }
+                            }
+                        })
+                        if (!flag) {
+                            return flag;
+                        }
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/product/cmDistributionProduct/">商品列表</a></li>
+    <li class="active"><a
+            href="${ctx}/product/cmDistributionProduct/form?id=${cmDistributionProduct.id}">${not empty cmDistributionProduct.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmDistributionProduct" action="${ctx}/product/cmDistributionProduct/save"
+           method="post"
+           class="form-horizontal">
+<form:hidden path="id"/>
+<form:hidden path="productId" id="productId"/>
+<form:hidden path="isNewRecord" id="isNewRecord"/>
+<sys:message content="${message}"/>
+<div class="control-group">
+    <label class="control-label"><font color="red">*</font>商品:</label>
+    <div class="controls" id="addProduct">
+        <a href="JavaScript:;" onclick="showSelect()">请选择分销商品</a>
+    </div>
+    <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
+        <thead>
+        <tr>
+            <th style="text-align:right">图片</th>
+            <th>商品名称</th>
+            <th>供应商</th>
+            <th>操作</th>
+        </tr>
+        </thead>
+        <tbody>
+        <tr>
+            <td style="text-align:right"><img id="mainImage" src="${cmDistributionProduct.mainImage}" width="50px"
+                                              height="50px"></td>
+            <td style="text-align: center" id="name">${cmDistributionProduct.name}</td>
+            <td id="shopName">${cmDistributionProduct.shopName}</td>
+            <td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+<div id="productInfo" hidden="hidden">
+    <c:if test="${empty cmDistributionProduct.skus}">
+    <div class="control-group" hidden id="skuPrice">
+        </c:if>
+        <c:if test="${not empty cmDistributionProduct.skus}">
+        <div class="control-group" id="skuPrice">
+            </c:if>
+
+            <label style="margin-left: 80px"><font color="red">*</font>成本类型:</label>
+            <input type="radio" name="costCheckFlag"
+                       value="1" ${cmDistributionProduct.skus[0].costCheckFlag==1?'checked="checked"':''}
+                       onclick="showCostCheckFlag()"/>固定成本
+             <input type="radio" name="costCheckFlag"
+                        value="2"${cmDistributionProduct.skus[0].costCheckFlag==2?'checked="checked"':''}
+                        onclick="showCostCheckFlag()"/>比例成本
+            <p></p>
+            <c:forEach items="${cmDistributionProduct.skus}" var="sku" varStatus="index">
+                <form:hidden path="skus[${index.index}].productId" id="skus[${index.index}].productId"/>
+                <form:hidden path="skus[${index.index}].costCheckFlag" id="skus[${index.index}].costCheckFlag"/>
+                <div class="sku"><input type="number" style="display:none" value="${sku.skuId}"
+                                        name="skus[${index.index}].skuId">
+                    <label class="control-label" style="text-align:right"><font color="red">*</font>规格:${sku.unit}
+                    </label>
+                    <div class="controls">
+                        <font color="red">*</font>售价:
+                        <input type="number" style="width:100px;" min="0" class="price"
+                               name="skus[${index.index}].price"
+                               value="${sku.price}" required onblur="checkPrice(this)">
+                            <%--                        <label><font color="red">*</font>成本类型:</label>--%>
+                            <%--                        <form:radiobutton id="costCheckFlag1" path="skus[${index.index}].costCheckFlag" value="1"--%>
+                            <%--                                          label="固定成本"--%>
+                            <%--                                          onchange="checkCostCheckFlag('1${index.index}','2${index.index}')"/>--%>
+                            <%--                        <form:radiobutton id="costCheckFlag0" path="skus[${index.index}].costCheckFlag" value="2"--%>
+                            <%--                                          label="比例成本"--%>
+                            <%--                                          onchange="checkCostCheckFlag('2${index.index}','1${index.index}')"/>--%>
+                        <span class="costCheckFlag1"
+                              style="display: ${sku.costCheckFlag==2?'none':'inline-block'}">
+                                 <label><font color="red">*</font>
+                                固定成本:供应商成本<input type="number" style="width:100px;" min="0" class="costPrice"
+                                                 name="skus[${index.index}].costPrice" value="${sku.costPrice}"
+                                                 required>
+                                采美服务费<input type="number" style="width:100px;" min="0" class="cmCostPrice"
+                                            name="skus[${index.index}].cmCostPrice" value="${sku.cmCostPrice}" required>
+                                分销团队佣金<input type="number" style="width:100px;" min="0" class="organizeCostPrice"
+                                             name="skus[${index.index}].organizeCostPrice"
+                                             value="${sku.organizeCostPrice}" required></label>
+                            </span>
+                        <span class="costCheckFlag2"
+                              style="display: ${sku.costCheckFlag==1?'none':'inline-block'}">
+                                <label><font color="red">*</font>
+                                比例成本:供应商成本<input type="number" style="width:100px;" min="0" class="shopPercent"
+                                                 name="skus[${index.index}].shopPercent" value="${sku.shopPercent}"
+                                                 required>%
+                                采美服务费<input type="number" style="width:100px;" min="0" class="cmPercent"
+                                            name="skus[${index.index}].cmPercent" value="${sku.cmPercent}" required>%
+                                分销团队佣金<input type="number" style="width:100px;" min="0" class="organizePercent"
+                                             name="skus[${index.index}].organizePercent" value="${sku.organizePercent}"
+                                             required>%</label>
+                            </span>
+                    </div>
+                </div>
+            </c:forEach>
+        </div>
+        <div class="control-group">
+
+            <label class="control-label"><font color="red">*</font>是否含税:</label>
+            <div class="controls">
+                <form:radiobutton id="includedTax1" path="includedTax" value="1" label="含税"
+                                  onclick="chageIncludedTax()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <form:radiobutton id="includedTax0" path="includedTax" value="0" label="不含税"
+                                  onclick="chageIncludedTax()"/>
+            </div>
+            <br>
+            <div class="controls">
+                <form:radiobutton id="invoiceType1" path="invoiceType" value="1" label="增值税专用发票"
+                                  onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <form:radiobutton id="invoiceType2" path="invoiceType" value="2" label="增值税普通发票"
+                                  onclick="showTaxPoint()"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                <span id="invoiceTypeShow"><form:radiobutton id="invoiceType3" path="invoiceType" value="3" label="不能开票"
+                                                             onclick="showTaxPoint()"/></span>
+            </div>
+        </div>
+        <div class="control-group taxPointShow">
+            <label class="control-label"><font color="red">*</font>机构税率:</label>
+            <div class="controls">
+                <input type="number" style="width:100px;" id="clubTaxPoint" name="clubTaxPoint"
+                       value="${cmDistributionProduct.clubTaxPoint}" required>%
+            </div>
+        </div>
+        <div class="control-group taxPointShow">
+            <label class="control-label"><font color="red">*</font>供应商税率:</label>
+            <div class="controls">
+                <input type="number" style="width:100px;" id="shopTaxPoint" name="shopTaxPoint"
+                       value="${cmDistributionProduct.shopTaxPoint}" required>%
+            </div>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><font color="red">*</font>报备佣金:</label>
+        <div class="controls">
+            <form:input path="commission" label="报备佣金"/>
+        </div>
+        <br>
+        <label class="control-label"><font color="red">*</font>商品状态:</label>
+        <div class="controls">
+            <form:select path="validFlag" class="input-small required">
+                <form:option value="1" label="已上架"/>
+                <form:option value="2" label="已下架"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+    </form:form>
+    <script>
+        $(function () {
+            //初始化商品信息
+            if (${not empty cmDistributionProduct.id}) {
+                $('#contentTable').show();
+                $('#productInfo').show();
+                $('#addProduct').hide();
+                chageIncludedTax();
+                showTaxPoint();
+                showCostCheckFlag();
+            }
+        });
+
+
+        //选择添加商品
+        function showSelect() {
+            var url = '';
+            var title = '';
+            url = "${ctx}/product/cmDistributionProduct/findProductPage";
+            title = "选择商品";
+            top.$.jBox("iframe:" + url, {
+                iframeScrolling: 'yes',
+                width: $(top.document).width() - 600,
+                height: $(top.document).height() - 160,
+                persistent: true,
+                title: title,
+                buttons: {"确定": '1', "关闭": '-1'},
+                submit: function (v, h, f) {
+                    //确定
+                    var $jboxFrame = top.$('#jbox-iframe');
+                    var $mainFrame = top.$('#mainFrame');
+                    if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                        var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+                        if (items.length > 0) {
+                            console.log(items);
+                            var skus = {};
+                            skus = items[0].skuList;
+                            var html = '';
+                            html += '<label style="margin-left: 80px"><font color="red">*</font>成本类型:</label>'
+                            html += '<input type="radio" name="costCheckFlag" value="1"  ' + (skus[0].costCheckFlag == 1 ? 'checked="checked"' : '') + ' onclick="showCostCheckFlag()"/>固定成本'
+                            html += ' <input type="radio" name="costCheckFlag"  value="2"  ' + (skus[0].costCheckFlag == 2 ? 'checked="checked"' : '') + ' onclick="showCostCheckFlag()"/>比例成本'
+                            html += '<p></p>'
+                            for (let i = 0; i < skus.length; i++) {
+                                html += '   <input type="hidden" name="skus[' + i + '].productId" value="' + skus[i].productId + '"/>'
+                                html += '   <input type="hidden" name="skus[' + i + '].costCheckFlag" value="' + skus[i].costCheckFlag + '"/>'
+                                html += '<div class="sku"><input type="number" style="display:none" value="' + skus[i].skuId + '" name="skus[' + i + '].skuId">'
+                                html += '     <label class="control-label" style="text-align:right"><font color="red">*</font>规格:' + skus[i].unit + ' </label>'
+                                html += '  <div class="controls">'
+                                html += '  <font color="red">*</font>售价:'
+                                html += '  <input type="number" style="width:100px;" min="0" class="price" name="skus[' + i + '].price" value="' + skus[i].price + '" required onblur="checkPrice(this)">'
+                                // html += '  <label><font color="red">*</font>成本类型:</label>'
+                                // html += '<input type="radio" id="costCheckFlag1" name="skus[' +i + '].costCheckFlag" value="1"  ' + (skus[i].costCheckFlag==1?'checked="checked"':'') + ' onchange="checkCostCheckFlag(1' +i + ',2' +i + ')"/>固定成本'
+                                // html += '<input type="radio" id="costCheckFlag0" name="skus[' +i + '].costCheckFlag" value="2" ' + (skus[i].costCheckFlag==2?'checked="checked"':'') + ' onchange="checkCostCheckFlag(2' +i + ',1' +i + ')"/>比例成本'
+                                html += '  <span class="costCheckFlag1" style="display: ' + (skus[i].costCheckFlag == 2 ? 'none' : 'inline-block') + '">'
+                                html += '   <label><font color="red">*</font>'
+                                html += '  固定成本:供应商成本<input type="number" style="width:100px;" min="0" class="costPrice" name="skus[' + i + '].costPrice" value="' + skus[i].costPrice + '" required>'
+                                html += '   采美服务费<input type="number" style="width:100px;" min="0" class="cmCostPrice" name="skus[' + i + '].cmCostPrice" value="' + skus[i].cmCostPrice + '" required>'
+                                html += '   分销团队佣金<input type="number" style="width:100px;" min="0" class="organizeCostPrice" name="skus[' + i + '].organizeCostPrice" value="' + skus[i].organizeCostPrice + '" required></label>'
+                                html += ' </span>'
+                                html += '  <span class="costCheckFlag2"style="display: ' + (skus[i].costCheckFlag == 1 ? 'none' : 'inline-block') + '">'
+                                html += '  <label><font color="red">*</font>'
+                                html += '比例成本:供应商成本<input type="number" style="width:100px;" min="0" class="shopPercent" name="skus[' + i + '].shopPercent" value="' + skus[i].shopPercent + '" required >% '
+                                html += '采美服务费<input type="number" style="width:100px;" min="0" class="cmPercent" name="skus[' + i + '].cmPercent" value="' + skus[i].cmPercent + '" required>%'
+                                html += '分销团队佣金<input type="number" style="width:100px;" min="0" class="organizePercent" name="skus[' + i + '].organizePercent"value="' + skus[i].organizePercent + '" required>%</label>'
+                                html += ' </span>'
+                                html += ' </div>'
+                                html += ' </div>'
+
+                            }
+                            $("#skuPrice").html(html);
+                            $("#skuPrice").show();
+
+                            $('#contentTable').show();
+                            $('#productInfo').show();
+                            $('#addProduct').hide();
+                            var productId = items[0].productId;
+                            var mainImage = items[0].mainImage;
+                            var name = items[0].name;
+                            var shopName = items[0].shopName;
+                            var price = items[0].price;
+                            var includedTax = items[0].includedTax;
+                            var invoiceType = items[0].invoiceType;
+                            var clubTaxPoint = items[0].clubTaxPoint;
+                            var shopTaxPoint = items[0].shopTaxPoint;
+                            var costType = items[0].costType;
+                            var costPrice = items[0].costPrice;
+                            var shopPercent = items[0].shopPercent;
+                            $("#mainImage").attr("src", mainImage);
+                            $("#shopName").text(shopName);
+                            $("#productId").val(productId);
+                            $("#name").text(name);
+                            $("#price").val(price);
+                            if (includedTax == 1) {
+                                $('#includedTax1').attr('checked', true);
+                            } else {
+                                $('#includedTax0').attr('checked', true);
+                            }
+                            if (invoiceType == 1) {
+                                $('#invoiceType1').attr('checked', true);
+                            } else if (invoiceType == 2) {
+                                $('#invoiceType2').attr('checked', true);
+                            } else {
+                                $('#invoiceType3').attr('checked', true);
+                            }
+                            $("#clubTaxPoint").val(clubTaxPoint);
+                            $("#shopTaxPoint").val(shopTaxPoint);
+                            // if (costType == 1) {
+                            //     $('#costType').text('固定成本');
+                            // } else {
+                            //     $('#costType').text('比例成本');
+                            // }
+                            $("#costPrice").text(costPrice);
+                            $("#shopPercent").text(shopPercent + '%');
+                            chageIncludedTax();
+                        } else {
+                            top.$.jBox.tip("请先勾选商品...");
+                            return false;
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+
+        //是否含税显示
+        function chageIncludedTax() {
+            var includedTax = $("input[name='includedTax']:checked").val();
+            if (includedTax == 1) {
+                $('#invoiceTypeShow').hide();
+                var invoiceType = $("input[name='invoiceType']:checked").val();
+                if (invoiceType == 3) {
+                    $('#invoiceType1').attr('checked', true);
+                    showTaxPoint();
+                }
+            } else {
+                $('#invoiceTypeShow').show();
+            }
+        }
+
+        //税率显示
+        function showTaxPoint() {
+            var invoiceType = $("input[name='invoiceType']:checked").val();
+            if (invoiceType == 3) {
+                $('.taxPointShow').hide();
+            } else {
+                $('.taxPointShow').show();
+            }
+        }
+
+        //成本比例显示
+        function showCostCheckFlag() {
+            var costCheckFlag = $("input[name='costCheckFlag']:checked").val();
+            if (costCheckFlag == 1) {
+                $('.costCheckFlag1').show();
+                $('.costCheckFlag2').hide();
+            } else {
+                $('.costCheckFlag1').hide();
+                $('.costCheckFlag2').show();
+            }
+            $("input[type='hidden'][name$='costCheckFlag']").val(costCheckFlag)
+        }
+
+        //删除商品
+        function deleteProduct() {
+            $('#contentTable').hide();
+            $('#productInfo').hide();
+            $('#addProduct').show();
+            $('#productId').val('');
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+
+        /**
+         * @param obj
+         * jquery检验售价
+         */
+        function checkPrice(obj) {
+            if (obj.value == '0') {
+                obj.value = '';
+            }
+        }
+
+    </script>
+</body>
+</html>

+ 167 - 0
src/main/webapp/WEB-INF/views/modules/product/cmDistributionProductList.jsp

@@ -0,0 +1,167 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销商品管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+
+		//状态修改
+		function updateEnabledStatus(status, ids) {
+			update(status, ids)
+		}
+
+		function update(status, ids) {
+			var msg = '确定上架该商品吗?';
+			if ('91' == status) {
+				msg = '确定下架该商品吗?下架后,相关联分销员商品也将一并下架。';
+			}
+			top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+				if (v == 'ok') {
+					$.post("${ctx}/product/cmDistributionProduct/updateEnabledStatus", {
+						'validFlag': status,
+						'id': ids
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						history.go(0)
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+				}
+				return;
+			}, {buttonsFocus: 1, persistent: true});
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/product/new/list?searchProductCategory=1">商品列表</a></li>
+		<li class="active"><a href="${ctx}/product/cmDistributionProduct/list">分销商品</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmDistributionProduct" action="${ctx}/product/cmDistributionProduct" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<div class="ul-form">
+			<label>商品ID:</label>
+				<form:input type="number" path="productId" htmlEscape="false" class="input-medium"/>
+			<label>商品名称:</label>
+				<form:input path="name" htmlEscape="false" class="input-medium"/>
+			<label>供应商名称:</label>
+				<form:input path="shopName" htmlEscape="false" class="input-medium"/>
+			 <label>商品状态:</label>
+				<form:select path="validFlag" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="已上架"/>
+					<form:option value="2" label="已下架"/>
+				</form:select>
+			 <label>是否含税:</label>
+				<form:select path="includedTax" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="0" label="不含税"/>
+					<form:option value="1" label="含税"/>
+				</form:select>
+			 <label>发票:</label>
+				<form:select path="invoiceType" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="增值税专用发票"/>
+					<form:option value="2" label="增值税普通发票"/>
+					<form:option value="3" label="不能开票"/>
+				</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="window.location='${ctx}/product/cmDistributionProduct/form'" value="上线商品"/>
+			<div class="clearfix"></div>
+		</div>
+		<div style="margin-top: 10px">
+			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>商品ID</th>
+				<th>商品图片</th>
+				<th>商品名称</th>
+				<th>供应商名称</th>
+				<th>售价</th>
+				<th>报备佣金</th>
+				<th>是否含税</th>
+				<th>商品状态</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmDistributionProduct" varStatus="varIndex">
+			<tr>
+				<td>
+						${cmDistributionProduct.productId}
+				</td>
+				<td>
+					<img src="${cmDistributionProduct.mainImage}" width="50px" height="50px">
+				</td>
+				<td>
+						${cmDistributionProduct.name}
+				</td>
+				<td>
+						${cmDistributionProduct.shopName}
+				</td>
+				<td>
+						${cmDistributionProduct.price}
+				</td>
+				<td>
+						${cmDistributionProduct.commission}
+				</td>
+				<td>
+					${cmDistributionProduct.includedTax eq 0 ? "不含税" : "含税"}-
+					${cmDistributionProduct.invoiceType eq 1 ? "增值税专用发票" : cmDistributionProduct.invoiceType eq 2 ? "增值税普通发票" : "不能开票"}
+				</td>
+				<td>
+					<c:if test="${cmDistributionProduct.validFlag eq 1}">
+						<font color="green"><b>已上架</b></font>
+					</c:if>
+					<c:if test="${cmDistributionProduct.validFlag eq 2}">
+						<font color="red"><b>已下架</b></font>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmDistributionProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+    				<a href="${ctx}/product/cmDistributionProduct/form?id=${cmDistributionProduct.id}">编辑</a>
+					<a href="#"
+					   onclick="updateEnabledStatus('${cmDistributionProduct.validFlag==1?2:1}','${cmDistributionProduct.id}')">${cmDistributionProduct.validFlag==1?'下架':'上架'}</a>
+<%--					<a href="${ctx}/product/cmDistributionProduct/del?productId=${cmDistributionProduct.productId}" onclick="return confirmx('确定删除该商品吗?删除后,相关联分销员商品也将一并删除。', this.href)">删除</a>--%>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+<script>
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 189 - 0
src/main/webapp/WEB-INF/views/modules/product/cmDistributionTeamProductList.jsp

@@ -0,0 +1,189 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队商品管理</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th{text-align: center;}
+		.table td{text-align: center;}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function() {
+
+		});
+		function page(n,s){
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+        	return false;
+        }
+
+		//状态修改
+		function updateEnabledStatus(status,productId,  distributionId) {
+			update(status, productId,distributionId)
+		}
+
+		function update(status, productId,distributionId) {
+			var msg = '确定上架该商品吗?';
+			if ('2' == status) {
+				msg = '确定下架该商品吗?';
+			}
+			top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+				if (v == 'ok') {
+					$.post("${ctx}/product/cmDistributionProduct/updateTeamEnabledStatus", {
+						'validFlag': status,
+						'distributionId': distributionId,
+						'productId': productId
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						history.go(0)
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+				}
+				return;
+			}, {buttonsFocus: 1, persistent: true});
+		}
+		//选择添加商品
+		function showSelect(distributionId) {
+			var url = '';
+			var title = '';
+			url = "${ctx}/product/cmDistributionProduct/findTeamProductPage?distributionId="+distributionId;
+			title = "选择商品";
+			top.$.jBox("iframe:" + url, {
+				iframeScrolling: 'yes',
+				width: $(top.document).width() - 600,
+				height: $(top.document).height() - 160,
+				persistent: true,
+				title: title,
+				buttons: {"确定": '1', "关闭": '-1'},
+				submit: function (v, h, f) {
+					//确定
+					var $jboxFrame = top.$('#jbox-iframe');
+					var $mainFrame = top.$('#mainFrame');
+					if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+						var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
+						if (items.length > 0) {
+							console.log(items);
+							var productId = items[0].productId;
+							$.post("${ctx}/product/cmDistributionProduct/TeamSave", {'distributionId': distributionId, 'productId': productId}, function (data) {
+								if (true == data.success) {
+									$.jBox.tip(data.msg, 'info');
+									window.location.reload();
+								} else {
+									$.jBox.tip(data.msg, 'error');
+								}
+							}, "JSON");//这里返回的类型有:json,html,xml,text
+						} else {
+							top.$.jBox.tip("请先勾选商品...");
+							return false;
+						}
+					}
+					return true;
+				}
+			});
+		}
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+		<li class="active"><a href="${ctx}/product/cmDistributionProduct/TeamList">商品列表</a></li>
+	</ul>
+	<form:form id="searchForm" modelAttribute="cmDistributionProduct" action="${ctx}/product/cmDistributionProduct/TeamList" method="post" class="breadcrumb form-search">
+		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+		<form:hidden path="distributionId" />
+		<div class="ul-form">
+			<label>商品ID:</label>
+				<form:input  type="number" path="productId" htmlEscape="false" class="input-medium"/>
+			<label>商品名称:</label>
+				<form:input path="name" htmlEscape="false" class="input-medium"/>
+			<label>供应商名称:</label>
+				<form:input path="shopName" htmlEscape="false" class="input-medium"/>
+			 <label>商品状态:</label>
+				<form:select path="validFlag" class="input-small">
+					<form:option value="" label="请选择"/>
+					<form:option value="1" label="已上架"/>
+					<form:option value="2" label="已下架"/>
+				</form:select>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			&nbsp;&nbsp;<input class="btn btn-primary" style="width: 80px" onclick="showSelect('${cmDistributionProduct.distributionId}')" value="上线商品"/>
+			<div class="clearfix"></div>
+		</div>
+		<div style="margin-top: 10px">
+			<label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+		</div>
+	</form:form>
+	<sys:message content="${message}"/>
+	<table id="contentTable" class="table table-striped table-bordered table-condensed">
+		<thead>
+			<tr>
+				<th>商品ID</th>
+				<th>商品图片</th>
+				<th>商品名称</th>
+				<th>供应商名称</th>
+				<th>售价</th>
+				<th>商品状态</th>
+				<th>添加时间</th>
+				<th>操作</th>
+			</tr>
+		</thead>
+		<tbody>
+		<c:forEach items="${page.list}" var="cmDistributionProduct" varStatus="varIndex">
+			<tr>
+<%--				<td>--%>
+<%--						${varIndex.index+1}--%>
+<%--				</td>--%>
+				<td>
+						${cmDistributionProduct.productId}
+				</td>
+				<td>
+					<img src="${cmDistributionProduct.mainImage}" width="50px" height="50px">
+				</td>
+				<td>
+						${cmDistributionProduct.name}
+				</td>
+				<td>
+						${cmDistributionProduct.shopName}
+				</td>
+				<td>
+						${cmDistributionProduct.price}
+				</td>
+				<td>
+					<c:if test="${cmDistributionProduct.validFlag eq 1}">
+						<font color="green"><b>已上架</b></font>
+					</c:if>
+					<c:if test="${cmDistributionProduct.validFlag eq 2}">
+						<font color="red"><b>已下架</b></font>
+					</c:if>
+				</td>
+				<td>
+					<fmt:formatDate value="${cmDistributionProduct.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+				</td>
+				<td>
+					<a href="#"
+					   onclick="updateEnabledStatus('${cmDistributionProduct.validFlag==1?2:1}','${cmDistributionProduct.productId }','${cmDistributionProduct.distributionId}')">${cmDistributionProduct.validFlag==1?'下架':'上架'}</a>
+					<a href="${ctx}/product/cmDistributionProduct/TeamDel?productId=${cmDistributionProduct.productId}&distributionId=${cmDistributionProduct.distributionId}" onclick="return confirmx('确定删除该商品吗?删除后,相关联分销员商品也将一并删除。', this.href)">删除</a>
+				</td>
+			</tr>
+		</c:forEach>
+		</tbody>
+	</table>
+	<div class="pagination">${page}</div>
+
+<script>
+
+	/**
+	 * @param obj
+	 * jquery控制input只能输入数字
+	 */
+	function onlynum(obj) {
+		obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+	}
+</script>
+</body>
+</html>

+ 65 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionClubFrom.jsp

@@ -0,0 +1,65 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队管理</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function() {
+			$("#inputForm").validate({
+				ignore:"",
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/new/user/agency/">机构基本资料列表</a></li>
+	<li><a href="${ctx}/new/user/agency/statisticsList">机构分析统计列表</a></li>
+	<li><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
+	<li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
+	<li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
+	<li ><a href="${ctx}/new/user/agency/distributionCLubList">分销系统机构列表</a></li>
+	<li class="active"><a href="${ctx}/new/user/agency/distributionCLubFrom?clubID=${newCmClub.clubID}">查看详情</a></li>
+</ul><br/>
+<form:form id="inputForm" modelAttribute="newCmClub" action="${ctx}" method="post" class="form-horizontal">
+	<form:hidden path="clubID"/>
+	<sys:message content="${message}"/>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 机构名称:</label>
+		<div class="controls">
+				${newCmClub.name}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 联系人:</label>
+		<div class="controls">
+				${newCmClub.userName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 手机号:</label>
+		<div class="controls">
+				${newCmClub.bindMobile}
+		</div>
+	</div>
+	<div class="form-actions">
+<%--		<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;--%>
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+</body>
+</html>

+ 169 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionClubList.jsp

@@ -0,0 +1,169 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销系统机构列表</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					// loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#inputForm").submit();
+			return false;
+		}
+
+		//状态修改
+		function updateEnabledStatus(status, userId) {
+			update(status, userId)
+		}
+
+		function update(status, userId) {
+			var msg = '确定上线该机构吗?';
+			if ('91' == status) {
+				msg = '确定下线该机构吗?下线后机构将不能登录小程序。';
+			}
+			top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+				if (v == 'ok') {
+					$.post("${ctx}/new/user/agency/updateEnabledStatus", {
+						'status': status,
+						'userID': userId
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						history.go(0)
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+				}
+				return;
+			}, {buttonsFocus: 1, persistent: true});
+		}
+
+		// 修改密码
+		function updatePwd(id) {
+			var regPwd = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/;
+			var html = "<div style='padding:20px;'><font color='red'>*</font> 新密码 :" +
+					"<input type='password' id='newPwd' name='newPwd' rows='1' cols='12'/>" +
+					"</br><font color='red'>*</font>确认密码:" +
+					"<input type='password' id='surePwd' name='surePwd' rows='1' cols='12'/></div>";
+			var submit = function (v, h, f) {
+				// 密码
+				if (!regPwd.test(f.newPwd)) {
+					$.jBox.tip("密码需8-16位字母数字组合", 'error', {focusId: "newPwd"});
+					return false;
+				}
+				if (f.newPwd !== f.surePwd) {
+					$.jBox.tip("确认密码与登录密码不一致", 'error', {focusId: "surePwd"});
+					return false;
+				}
+				$.post("${ctx}/new/user/agency/updatePwd", {'password': f.newPwd, 'id': id}, function (data) {
+					if (true == data.success) {
+						$.jBox.tip(data.msg, 'info');
+						$("#searchForm").submit();
+					} else {
+						$.jBox.tip(data.msg, 'error');
+					}
+				}, "JSON");//这里返回的类型有:json,html,xml,text
+			};
+			$.jBox(html, {title: "确定修改密码?", submit: submit});
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/new/user/agency/">机构基本资料列表</a></li>
+	<li><a href="${ctx}/new/user/agency/statisticsList">机构分析统计列表</a></li>
+	<li><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
+	<li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
+	<li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
+	<li class="active"><a href="${ctx}/new/user/agency/distributionCLubList">分销系统机构列表</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="newCmClub" action="${ctx}/new/user/agency/distributionCLubList" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<div class="ul-form">
+		<label>机构名称:</label>
+		<form:input path="name" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>联系人:</label>
+		<form:input path="userName" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="bindMobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>状态:</label>
+		<form:select path="status" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="90" label="已上线"/>
+			<form:option value="91" label="已下线"/>
+		</form:select>
+			<label>注册时间:</label>
+			<form:input path="searchStartTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
+						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+			-
+			<form:input path="searchEndTime" type="text" maxlength="20" class="input-mini Wdate" value="${endTime}"
+						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>机构名称</th>
+		<th>联系人</th>
+		<th>手机号</th>
+		<th>状态</th>
+		<th>注册时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="newCmClubList" varStatus="status">
+		<tr>
+			<td>${newCmClubList.name}</td>
+			<td>${newCmClubList.userName}</td>
+			<td>${newCmClubList.bindMobile}</td>
+			<td style="color:${newCmClubList.status==90?'green':'red'} ">${newCmClubList.status==90?'已上线':'已下线'}</td>
+			<td> <fmt:formatDate value="${newCmClubList.registerTime}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
+			<td>
+				<a href="#"
+				   onclick="updateEnabledStatus('${newCmClubList.status==90?91:90}','${newCmClubList.userID}')">${newCmClubList.status==90?'下线':'上线'}</a>
+				<a href="${ctx}/new/user/agency/distributionCLubFrom?clubID=${newCmClubList.clubID}">查看详情</a>
+				<a href="javascript:void(0);" onclick="updatePwd(${newCmClubList.userID})">重置密码</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 105 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionFrom.jsp

@@ -0,0 +1,105 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销系统机构列表详情</title>
+	<meta name="decorator" content="default"/>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					$.post("${ctx}/new/user/agency/findUserIsMobile", {
+						'mobile': $("#mobile").val(),
+						'oldUserId': $("#userId").val(),
+						'userIdentity': 7
+					}, function (data) {
+						console.log(data)
+						if (false == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							loading('正在提交,请稍等...');
+							form.submit();
+						}
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+	<li class="active"><a
+			href="${ctx}/user/distribution/form?id=${cmDistribution.id}">${not empty cmDistribution.id?'编辑':'添加'}</a>
+	</li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmDistribution" action="${ctx}/user/distribution/save" method="post"
+		   class="form-horizontal">
+	<form:hidden path="id"/>
+	<form:hidden path="parentId" value="0"/>
+	<form:hidden path="userId"/>
+	<sys:message content="${message}"/>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 姓名:</label>
+		<div class="controls">
+			<form:input path="name" htmlEscape="false" maxlength="15" class="input-xlarge required"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 手机号:</label>
+		<div class="controls">
+			<form:input path="mobile" htmlEscape="false" maxlength="11" onkeyup="this.value=value.replace(/[^\d]/g,'')" class="input-xlarge required"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 公司名称:</label>
+		<div class="controls">
+			<form:input path="corporateName" htmlEscape="false" maxlength="30" class="input-xlarge required"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 线上分账号:</label>
+		<div class="controls">
+			<form:input path="splitCode" htmlEscape="false" maxlength="15" class="input-xlarge required" onkeyup="this.value=value.replace(/[^A-Za-z0-9]/g,'')"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 所属银行:</label>
+		<div class="controls">
+			<form:input path="bankName" htmlEscape="false" maxlength="30" class="input-xlarge required"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label"><font color="red">*</font> 银行卡号:</label>
+		<div class="controls">
+			<form:input path="bankAccount" htmlEscape="false" maxlength="20" class="input-xlarge required" onkeyup="this.value=value.replace(/[^\d]/g,'')"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label">状态:</label>
+		<div class="controls">
+			<form:select path="status" class="input-mini">
+				<form:option value="90" label="已上线"/>
+				<form:option value="91" label="已下线"/>
+			</form:select>
+		</div>
+	</div>
+	<div class="form-actions">
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+</body>
+</html>

+ 150 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionList.jsp

@@ -0,0 +1,150 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					// loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+
+		//状态修改
+		function updateEnabledStatus(status, userId) {
+			update(status, userId)
+		}
+
+		function update(status, userId) {
+			var msg = '确定上线该分销团队吗?';
+			if ('91' == status) {
+				msg = '确定下线该分销团队吗?';
+			}
+			top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+				if (v == 'ok') {
+					$.post("${ctx}/user/distribution/updateEnabledStatus", {
+						'status': status,
+						'userId': userId
+					}, function (data) {
+						if (true == data.success) {
+							$.jBox.tip(data.msg, 'info');
+						} else {
+							$.jBox.tip(data.msg, 'error');
+						}
+						history.go(0)
+					}, "JSON");//这里返回的类型有:json,html,xml,text
+				}
+				return;
+			}, {buttonsFocus: 1, persistent: true});
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<c:if test="${cmDistribution.parentId==0}">
+		<li class="active"><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+		<li><a href="${ctx}/user/reporting">意向订单报备池</a></li>
+	</c:if>
+	<c:if test="${cmDistribution.parentId!=0}">
+		<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+		<li class="active"><a href="${ctx}/user/distribution?parentId=${cmDistribution.parentId}">分销成员</a></li>
+	</c:if>
+</ul>
+<form:form id="inputForm" modelAttribute="cmDistribution" action="${ctx}/user/distribution" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<form:hidden path="parentId" value="${cmDistribution.parentId}"/>
+	<div class="ul-form">
+		<label>姓名:</label>
+		<form:input path="name" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>公司名称:</label>
+		<form:input path="corporateName" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>状态:</label>
+		<form:select path="status" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="90" label="已上线"/>
+			<form:option value="91" label="已下线"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<c:if test="${cmDistribution.parentId==0}">
+		<input id="btnSubmit" class="btn btn-primary" type="button" onclick="return location.href='${ctx}/user/distribution/form'" value="添加分销团队"/>
+		</c:if>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>ID</th>
+		<th>姓名</th>
+		<th>手机号</th>
+		<th>团队身份</th>
+		<th>公司名称</th>
+		<th>状态</th>
+		<th>添加时间</th>
+		<c:if test="${cmDistribution.parentId==0}">
+			<th>操作</th>
+		</c:if>
+
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmDistribution" varStatus="status">
+		<tr>
+			<td>${cmDistribution.id}</td>
+			<td>${cmDistribution.name}</td>
+			<td>${cmDistribution.mobile}</td>
+			<td>${cmDistribution.parentId==0?'管理员':'成员'}</td>
+			<td>${cmDistribution.corporateName}</td>
+			<td style="color:${cmDistribution.status==90?'green':'red'} ">${cmDistribution.status==90?'已上线':'已下线'}</td>
+			<td><fmt:formatDate value="${cmDistribution.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+			<c:if test="${cmDistribution.parentId==0}">
+			<td>
+				<a href="#"
+				   onclick="updateEnabledStatus('${cmDistribution.status==90?91:90}','${cmDistribution.userId}')">${cmDistribution.status==90?'下线':'上线'}</a>
+				<a href="${ctx}/user/distribution/form?id=${cmDistribution.id}&parentId=0">编辑</a>
+				<a href="${ctx}/product/cmDistributionProduct/TeamList?distributionId=${cmDistribution.id}">商品列表</a>
+				<a href="${ctx}/user/distribution?parentId=${cmDistribution.id}">团队成员</a>
+			</td>
+			</c:if>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 99 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionMemberSettleFrom.jsp

@@ -0,0 +1,99 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/user/distribution/settleList?parentId=0">分销报备佣金</a></li>
+	<li ><a href="${ctx}/user/reporting/settleClubList?parentId=${cmDistribution.parentId}">佣金明细</a></li>
+	<li class="active"><a href="${ctx}/user/reporting/settleClubFrom?id=${cmReportingClub.id}">查看详情</a></li>
+</ul><br/>
+
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="#"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<sys:message content="${message}"/>
+	<div class="control-group">
+		<label class="control-label keyClass">成员:</label>
+		<div class="controls">
+				${cmReportingClub.distributionName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmReportingClub.distributionMobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">订单编号(ID):</label>
+		<div class="controls">
+				${cmReportingClub.orderId}
+		</div>
+	</div>
+
+	<div class="control-group">
+		<label class="control-label keyClass">佣金:</label>
+		<div class="controls">
+				${cmReportingClub.organizeCostPrice}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">结算状态:</label>
+		<div class="controls">
+				${cmReportingClub.splitSettleStatus==1?'待手动分账':cmReportingClub.splitSettleStatus==2?'待手动结算':'已结算'}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">下单时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingClub.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">确认时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingClub.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+
+	<div class="form-actions">
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+
+</script>
+</body>
+</html>

+ 150 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionMemberSettleList.jsp

@@ -0,0 +1,150 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+		.livelyProportion {
+			/*background: #f5f5f5;*/
+			height: 50px;
+			width: 300px;
+			display: flex;
+			list-style: none;
+
+		}
+
+		.livelyProportion > li {
+			flex: 1;
+			text-align: center;
+			margin: auto 0;
+			font-size: 18px;
+			font-weight: bold;
+		}
+
+		.livelyLi{
+			color: red;
+			border-bottom: red 3px solid;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$(".livelyProportion > li").click(function (){
+				$("#payWay").val($(this).index()+1)
+				$("#inputForm").submit()
+			})
+
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li ><a href="${ctx}/user/distribution/settleList?parentId=0">分销订单佣金</a></li>
+		<li class="active"><a href="${ctx}/user/reporting/settleClubList?parentId=${cmReportingClub.parentIds}&payWay=${cmReportingClub.payWay}">佣金明细</a></li>
+</ul>
+<ul class="livelyProportion">
+	<li>
+		<span class="${cmReportingClub.payWay==1?"livelyLi":""}" >
+			线上支付订单
+		</span>
+	</li>
+	<li>
+		<span class="${cmReportingClub.payWay==2?"livelyLi":""}" >
+			线下支付订单
+		</span>
+	</li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="${ctx}/user/reporting/settleClubList" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<input id="payWay" name="payWay" type="hidden" value="${cmReportingClub.payWay}"/>
+	<input id="parentIds" name="parentIds" type="hidden" value="${cmReportingClub.parentIds}"/>
+	<div class="ul-form">
+		<label>成员:</label>
+		<form:input path="distributionName" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="distributionMobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>订单编号(ID):</label>
+		<form:input path="orderId" type="numbder" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>结算状态:</label>
+		<form:select path="splitSettleStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="待确认"/>
+			<form:option value="1" label="待手动分账"/>
+			<form:option value="2" label="待手动结算"/>
+			<form:option value="3" label="已结算"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>成员</th>
+		<th>手机号</th>
+		<th>订单编号(ID)</th>
+		<th>佣金</th>
+		<th>结算状态</th>
+		<th>下单时间</th>
+		<th>结算时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmReportingClub" varStatus="status">
+		<tr>
+			<td>${cmReportingClub.distributionName}</td>
+			<td>${cmReportingClub.distributionMobile}</td>
+			<td>${cmReportingClub.orderId}</td>
+			<td>${cmReportingClub.organizeCostPrice}</td>
+			<td>${cmReportingClub.splitSettleStatus eq null?'----':cmReportingClub.splitSettleStatus==0?'待确认':cmReportingClub.splitSettleStatus==1?'待手动分账':cmReportingClub.splitSettleStatus==2?'待手动结算':'已结算'}</td>
+			<td><fmt:formatDate value="${cmReportingClub.orderTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+			<td>${cmReportingClub.splitSettleTime eq null?'----':''}<c:if test="${cmReportingClub.splitSettleTime ne null}"><fmt:formatDate value="${cmReportingClub.splitSettleTime}" pattern="yyyy-MM-dd HH:mm:ss"/></c:if></td>
+			<td>
+				<c:if test="${cmReportingClub.payWay==2&&cmReportingClub.splitSettleStatus==2}">
+				<a href="${ctx}/user/reporting/splitSettleStatus?id=${cmReportingClub.id}&parentId=${cmDistribution.parentId}&payWay=${cmReportingClub.payWay}">结算</a>
+				</c:if>
+				<a href="${ctx}/user/reporting/settleClubFrom?id=${cmReportingClub.id}">查看详情</a>
+				<a href="${ctx}/order/detail?id=${cmReportingClub.orderId}">查看订单</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 92 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionSettleFrom.jsp

@@ -0,0 +1,92 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/user/distribution/settleList?parentId=0">分销报备佣金</a></li>
+	<li class="active"><a href="${ctx}/user/distribution/settleFrom?id=${cmDistribution.id}">查看详情</a></li>
+</ul><br/>
+
+<form:form id="inputForm" modelAttribute="cmDistribution" action="#"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<sys:message content="${message}"/>
+	<div class="control-group">
+		<label class="control-label keyClass">团队管理员:</label>
+		<div class="controls">
+				${cmDistribution.name}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmDistribution.mobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">公司名称:</label>
+		<div class="controls">
+				${cmDistribution.corporateName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">(线上订单)待返佣金:</label>
+		<div class="controls">
+				${cmDistribution.onLineCommission}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">(线下订单)待返佣金:</label>
+		<div class="controls">
+				${cmDistribution.offlineCommission }
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">结算状态:</label>
+		<div class="controls">
+				${cmDistribution.settleStatus eq 1?'已完结':'未完结'}
+		</div>
+	</div>
+
+
+	<div class="form-actions">
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+
+</script>
+</body>
+</html>

+ 102 - 0
src/main/webapp/WEB-INF/views/modules/user/cmDistributionSettleList.jsp

@@ -0,0 +1,102 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					// loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/user/distribution/settleList?parentId=0">分销订单佣金</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmDistribution" action="${ctx}/user/distribution/settleList" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<form:hidden path="parentId" value="${cmDistribution.parentId}"/>
+	<div class="ul-form">
+		<label>团队管理员:</label>
+		<form:input path="name" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>公司名称:</label>
+		<form:input path="corporateName" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>结算状态:</label>
+		<form:select path="settleStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="已完结"/>
+			<form:option value="0" label="未完结"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>团队管理员</th>
+		<th>手机号</th>
+		<th>公司名称</th>
+		<th>(线上订单)待返佣金</th>
+		<th>(线下订单)待返佣金</th>
+		<th>结算状态</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmDistribution" varStatus="status">
+		<tr>
+			<td>${cmDistribution.name}</td>
+			<td>${cmDistribution.mobile}</td>
+			<td>${cmDistribution.corporateName}</td>
+			<td>${cmDistribution.onLineCommission}</td>
+			<td>${cmDistribution.offlineCommission}</td>
+			<td>${cmDistribution.settleStatus==1?'已完结':'未完结'}</td>
+			<td>
+				<a href="${ctx}/user/distribution/settleFrom?id=${cmDistribution.id}">查看详情</a>
+				<a href="${ctx}/user/reporting/settleClubList?parentIds=${cmDistribution.id}&payWay=1">佣金明细</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 118 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingClubFrom.jsp

@@ -0,0 +1,118 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+	<li ><a href="${ctx}/user/reporting">意向订单报备池</a></li>
+	<li class="active"><a href="${ctx}/user/reporting/form?id=${cmReportingClub.id}">查看详情</a></li>
+</ul><br/>
+
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="#"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<sys:message content="${message}"/>
+<%--	<div class="control-group" style="margin-left: 20px">--%>
+<%--		<label class="control-label keyClass" >机构名称:${cmReportingClub.clubName}</label>--%>
+<%--		<label class="control-label keyClass">联系人:${cmReportingClub.linkMan}</label>--%>
+<%--		<label class="control-label keyClass">手机号:${cmReportingClub.mobile}</label>--%>
+<%--	</div>--%>
+	<div class="control-group">
+		<label class="control-label keyClass">机构名称:</label>
+		<div class="controls">
+				${cmReportingClub.clubName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">联系人:</label>
+		<div class="controls">
+				${cmReportingClub.linkMan}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmReportingClub.mobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">待审核:</label>
+		<div class="controls">
+				${cmReportingClub.distributionCount}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">订单状态:</label>
+		<div class="controls">
+				${cmReportingClub.orderStatus eq 1?'已成交':'未成交'}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">是否锁定:</label>
+		<div class="controls">
+				${cmReportingClub.lockStatus eq 1?'是':'否'}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">锁定人:</label>
+		<div class="controls">
+				${cmReportingClub.distributionId}
+		</div>
+	</div>
+<%--	<div class="control-group" >--%>
+<%--		<label class="control-label keyClass">待审核:${cmReportingClub.distributionCount }</label>--%>
+<%--		<label class="control-label keyClass">订单状态:${cmReportingClub.orderStatus eq 1?'已成交':'未成交'}</label>--%>
+<%--	</div>--%>
+<%--	<div class="control-group" >--%>
+<%--		<label class="control-label keyClass">是否锁定:${cmReportingClub.lockStatus eq 1?'是':'否'}</label>--%>
+<%--		<label class="control-label keyClass">锁定人:${cmReportingClub.distributionId}</label>--%>
+<%--		<label class="control-label "style="width: 200px">锁定时间:<fmt:formatDate value="${cmReportingClub.lockTime}" pattern="yyyy-MM-dd HH:mm:ss"/></label>--%>
+<%--	</div>--%>
+	<table id="contentTable" class="table-condensed">
+		<tr>
+			<th ><img src="${cmReportingClub.productImage}" width="50px" height="50px" style="margin-left: 80px"></th>
+			<th ><span style="margin-left: 50px">${cmReportingClub.productName}</span></th>
+		</tr>
+	</table>
+
+	<div class="form-actions">
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+
+</script>
+</body>
+</html>

+ 126 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingClubList.jsp

@@ -0,0 +1,126 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+		<li class="active"><a href="${ctx}/user/reporting">意向订单报备池</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="${ctx}/user/reporting" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<div class="ul-form">
+		<label>机构名称:</label>
+		<form:input path="clubName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>联系人:</label>
+		<form:input path="linkMan" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>商品名称:</label>
+		<form:input path="productName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>待审核:</label>
+		<form:select path="distributionCount" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="有"/>
+			<form:option value="0" label="无"/>
+		</form:select>
+		<label>是否锁定:</label>
+		<form:select path="lockStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="是"/>
+			<form:option value="0" label="否"/>
+		</form:select>
+		<label>订单状态:</label>
+		<form:select path="orderStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="已成交"/>
+			<form:option value="0" label="未成交"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>ID</th>
+		<th>机构名称</th>
+		<th>联系人</th>
+		<th>手机号</th>
+		<th>商品图片</th>
+		<th>商品名称</th>
+		<th>待审核</th>
+		<th>是否锁定</th>
+		<th>锁定人</th>
+		<th>订单状态</th>
+		<th>锁定时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmReportingClub" varStatus="status">
+		<tr>
+			<td>${cmReportingClub.id}</td>
+			<td>${cmReportingClub.clubName}</td>
+			<td>${cmReportingClub.linkMan}</td>
+			<td>${cmReportingClub.mobile}</td>
+			<td><img src="${cmReportingClub.productImage}" width="50px" height="50px"></td>
+			<td>${cmReportingClub.productName}</td>
+			<td>${cmReportingClub.distributionCount}</td>
+			<td style="color: ${cmReportingClub.lockStatus==1?'#0bbbee':''} ">${cmReportingClub.lockStatus==1?'是':'否'}</td>
+			<td>${cmReportingClub.distributionName eq null?'----':cmReportingClub.distributionName}</td>
+			<td style="color: ${cmReportingClub.orderStatus==1?'#0bbbee':''} ">${cmReportingClub.orderStatus eq null?'----':cmReportingClub.orderStatus==1?'已成交':'未成交'}</td>
+			<td>${cmReportingClub.lockTime eq null?'----':''}<c:if test="${cmReportingClub.lockTime ne null}"><fmt:formatDate value="${cmReportingClub.lockTime}" pattern="yyyy-MM-dd HH:mm:ss"/></c:if></td>
+			<td>
+				<a href="${ctx}/user/reporting/form?id=${cmReportingClub.id}">查看详情</a>
+				<a href="${ctx}/user/reporting/memberlist?clubReportingId=${cmReportingClub.id}">报备人员</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 98 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingClubSettleFrom.jsp

@@ -0,0 +1,98 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/user/reporting/settleList">分销报备佣金</a></li>
+	<li class="active"><a href="${ctx}/user/reporting/settleForm?id=${cmReportingClub.id}">查看详情</a></li>
+</ul><br/>
+
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="#"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<sys:message content="${message}"/>
+	<div class="control-group">
+		<label class="control-label keyClass">订单编号:</label>
+		<div class="controls">
+				${cmReportingClub.orderId}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">机构名称:</label>
+		<div class="controls">
+				${cmReportingClub.clubName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">联系人:</label>
+		<div class="controls">
+				${cmReportingClub.linkMan}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmReportingClub.mobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">待返佣金:</label>
+		<div class="controls">
+				${cmReportingClub.commission}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">结算状态:</label>
+		<div class="controls">
+				${cmReportingClub.settleStatus eq 1?'已完结':'未完结'}
+		</div>
+	</div>
+
+	<table id="contentTable" class="table-condensed">
+		<tr>
+			<th ><img src="${cmReportingClub.productImage}" width="50px" height="50px" style="margin-left: 80px"></th>
+			<th ><span style="margin-left: 50px">${cmReportingClub.productName}</span></th>
+		</tr>
+	</table>
+
+	<div class="form-actions">
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+
+</script>
+</body>
+</html>

+ 107 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingClubSettleList.jsp

@@ -0,0 +1,107 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					// loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/user/reporting/settleList">分销报备佣金</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmReportingClub" action="${ctx}/user/reporting/settleList" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<div class="ul-form">
+		<label>订单编号(ID):</label>
+		<form:input path="orderId" type="numbder" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>机构名称:</label>
+		<form:input path="clubName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>联系人:</label>
+		<form:input path="linkMan" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>商品名称:</label>
+		<form:input path="productName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>结算状态:</label>
+		<form:select path="settleStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="已完结"/>
+			<form:option value="0" label="未完结"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>订单编号(ID)</th>
+		<th>机构名称</th>
+		<th>联系人</th>
+		<th>手机号</th>
+		<th>商品报备佣金</th>
+		<th>待返佣金</th>
+		<th>结算状态</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmReportingClub" varStatus="status">
+		<tr>
+			<td>${cmReportingClub.orderId}</td>
+			<td>${cmReportingClub.clubName}</td>
+			<td>${cmReportingClub.linkMan}</td>
+			<td>${cmReportingClub.mobile}</td>
+			<td>${cmReportingClub.commission}</td>
+			<td>${cmReportingClub.commission-cmReportingClub.paidCommission}</td>
+			<td>${cmReportingClub.settleStatus==1?'已完结':'未完结'}</td>
+			<td>
+				<a href="${ctx}/user/reporting/settleForm?id=${cmReportingClub.id}">查看详情</a>
+				<a href="${ctx}/user/reporting/memberSettleList?clubReportingId=${cmReportingClub.id}">佣金明细</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 167 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberFrom.jsp

@@ -0,0 +1,167 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+	<li ><a href="${ctx}/user/reporting">意向订单报备池</a></li>
+	<li ><a href="${ctx}/user/reporting/memberlist?clubReportingId=${cmReportingMember.clubReportingId}">报备人员</a></li>
+	<li class="active"><a href="${ctx}/user/reporting/memberForm?id=${cmReportingMember.id}">查看详情</a></li>
+</ul><br/>
+
+<form:form id="inputForm" modelAttribute="cmReportingMember" action="${ctx}/user/reporting/memberAudit"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<form:hidden path="auditBy" value="${fns:getUser().id}"/>
+	<form:hidden path="clubReportingId"/>
+	<sys:message content="${message}"/>
+<%--	<div class="control-group">--%>
+<%--		<label class="control-label keyClass">  报备人:${cmReportingMember.cmDistribution.name}</label>--%>
+<%--		<label class="control-label keyClass">手机号:${cmReportingMember.cmDistribution.mobile}</label>--%>
+<%--		<label class="control-label keyClass">所属公司:${cmReportingMember.cmDistribution.corporateName}</label>--%>
+<%--		<label class="control-label keyClass">团队管理员:${cmReportingMember.cmDistribution.parentId==0?'管理员':'分销人员'}</label>--%>
+<%--	</div>--%>
+	<div class="control-group">
+		<label class="control-label keyClass">报备人:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.name}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.mobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">所属公司:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.corporateName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">团队管理员:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.parentId==0?'管理员':'分销人员'}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">报备说明:</label>
+		<div class="controls">
+				${cmReportingMember.remarks}
+		</div>
+	</div>
+	<c:if test="${cmReportingMember.cmRelatedImageList ne null  }">
+	<div class="control-group">
+		<label class="control-label keyClass">上传凭证:</label>
+		<div class="controls">
+
+				<div>
+					<c:forEach items="${cmReportingMember.cmRelatedImageList}" var="items" varStatus="index">
+						<c:if test="${items.image ne null  }">
+							<a href="${items.image}" target="_blank">
+								<img class="supplier-img" src="${items.image}" style="width: 120px;height: 120px"/>
+							</a>
+						</c:if>
+					</c:forEach>
+				</div>
+		</div>
+	</div>
+	</c:if>
+
+	<%--	<div class="control-group" >--%>
+<%--		<label class="control-label keyClass">审核状态:${cmReportingMember.auditStatus eq 1?'待审核':info.auditStatus eq 2?'审核通过':'审核失败'}</label>--%>
+<%--		<label class="control-label keyClass">审核人:${fns:getUserById(cmReportingMember.auditBy).name}</label>--%>
+<%--		<label class="control-label "style="width: 200px">审核时间:<fmt:formatDate value="${cmReportingMember.auditTime}" pattern="yyyy-MM-dd HH:mm:ss"/></label>--%>
+<%--	</div>--%>
+	<div class="control-group">
+		<label class="control-label keyClass">审核状态:</label>
+		<div class="controls">
+				${cmReportingMember.auditStatus==1?'待审核':cmReportingMember.auditStatus==2?'审核通过':'审核失败'}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">审核人:</label>
+		<div class="controls">
+				${fns:getUserById(cmReportingMember.auditBy).name}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">审核时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingMember.auditTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">报备时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingMember.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+	<c:if test="${auditType ne null}">
+		<div class="control-group">
+			<label class="control-label keyClass">审核:</label>
+			<div class="controls">
+				<input type="radio" name="auditStatus" value="2" onclick="updateAuditStatus(2)" ${ cmReportingMember.auditStatus!= 3 ?'checked=checked':''}> 审核通过
+				<input type="radio" name="auditStatus" value="3" onclick="updateAuditStatus(3)" ${cmReportingMember.auditStatus == 3?'checked=checked':''}> 审核失败
+			</div>
+		</div>
+		<div class="control-group" id="failReasonDiv" style="${ cmReportingMember.auditStatus != 3 ?'display: none':''}">
+			<label class="control-label"><font color="red">*</font>失败原因</label>
+			<div class="controls">
+				<textarea type="text" id="auditText" name="auditText" required style="width: 400px;height: 90px">${cmReportingMember.auditText}</textarea>
+			</div>
+		</div>
+	</c:if>
+
+	<div class="form-actions">
+		<c:if test="${auditType ne null}">
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
+		</c:if>
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+	function updateAuditStatus(auditStatus) {
+		var elementById = document.getElementById("failReasonDiv");
+		if (auditStatus === 2) {
+			elementById.style.cssText = "display:none";
+		} else {
+			elementById.style.cssText = "";
+		}
+	}
+</script>
+</body>
+</html>

+ 117 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberList.jsp

@@ -0,0 +1,117 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li><a href="${ctx}/user/distribution?parentId=0">分销团队</a></li>
+		<li><a href="${ctx}/user/reporting">意向订单报备池</a></li>
+		<li class="active"><a href="${ctx}/user/reporting/memberlist?clubReportingId=${cmReportingMember.clubReportingId}">报备人员</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmReportingMember" action="${ctx}/user/reporting/memberlist" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<form:hidden path="clubReportingId"></form:hidden>
+	<div class="ul-form">
+		<label>报备人:</label>
+		<form:input path="cmDistribution.name" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="cmDistribution.mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>所属公司:</label>
+		<form:input path="cmDistribution.corporateName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>团队管理员:</label>
+		<form:select path="cmDistribution.parentId" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="0" label="是"/>
+			<form:option value="-1" label="否"/>
+		</form:select>
+		<label>审核状态:</label>
+		<form:select path="auditStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="待审核"/>
+			<form:option value="2" label="审核通过"/>
+			<form:option value="3" label="审核失败"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>报备人</th>
+		<th>手机号</th>
+		<th>所属公司</th>
+		<th>团队管理员</th>
+		<th>审核状态</th>
+		<th>审核人</th>
+		<th>审核时间</th>
+		<th>报备时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmReportingMember" varStatus="status">
+		<tr>
+			<td>${cmReportingMember.cmDistribution.name}</td>
+			<td>${cmReportingMember.cmDistribution.mobile}</td>
+			<td>${cmReportingMember.cmDistribution.corporateName}</td>
+			<td>${cmReportingMember.cmDistribution.parentId==0?'是':'否'}</td>
+			<td>${cmReportingMember.auditStatus==1?'待审核':cmReportingMember.auditStatus==2?'审核通过':'审核失败'}</td>
+			<td>${cmReportingMember.auditBy eq null?'----':fns:getUserById(cmReportingMember.auditBy).name}</td>
+			<td>${cmReportingMember.auditTime eq null?'----':''}<c:if test="${cmReportingMember.auditTime ne null}"><fmt:formatDate value="${cmReportingMember.auditTime}" pattern="yyyy-MM-dd HH:mm:ss"/></c:if></td>
+			<td><fmt:formatDate value="${cmReportingMember.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+			<td>
+				<a href="${ctx}/user/reporting/memberForm?id=${cmReportingMember.id}">查看详情</a>
+				<c:if test="${cmReportingMember.auditStatus!=2}">
+				<a href="${ctx}/user/reporting/memberForm?id=${cmReportingMember.id}&auditStatus=1">审核</a>
+				</c:if>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 110 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberSettleFrom.jsp

@@ -0,0 +1,110 @@
+<%@ page import="com.thinkgem.jeesite.common.config.Global" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style>
+
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+	<li ><a href="${ctx}/user/reporting/settleList">分销报备佣金</a></li>
+	<li><a href="${ctx}/user/reporting/memberSettleList?clubReportingId=${cmReportingMember.clubReportingId}">佣金明细</a></li>
+	<li class="active"><a href="${ctx}/user/reporting/memberSettleForm?id=${cmReportingMember.id}">查看详情</a></li>
+</ul><br/>
+<form:form id="inputForm" modelAttribute="cmReportingMember" action="${ctx}/user/reporting/memberAudit"  method="post" class="form-horizontal">
+	<form:hidden path="id"/>
+	<form:hidden path="auditBy" value="${fns:getUser().id}"/>
+	<form:hidden path="clubReportingId"/>
+	<sys:message content="${message}"/>
+
+	<div class="control-group">
+		<label class="control-label keyClass">报备人:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.name}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">手机号:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.mobile}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">所属公司:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.corporateName}
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">团队管理员:</label>
+		<div class="controls">
+				${cmReportingMember.cmDistribution.parentId==0?'管理员':'分销人员'}
+		</div>
+	</div>
+
+	<div class="control-group">
+		<label class="control-label keyClass">结算状态:</label>
+		<div class="controls">
+				${cmReportingMember.settleStatus eq 1?'待确认':info.auditStatus eq 2?'待结算':'已结算'}
+		</div>
+	</div>
+
+	<div class="control-group">
+		<label class="control-label keyClass">报备时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingMember.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+	<div class="control-group">
+		<label class="control-label keyClass">结算时间:</label>
+		<div class="controls">
+			<fmt:formatDate value="${cmReportingMember.settleTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
+		</div>
+	</div>
+
+
+	<div class="form-actions">
+		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+	</div>
+</form:form>
+
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
+<script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
+<script type="text/javascript" src="${ctxStatic}/sensitiveWords/mint-filter.umd.js"></script>
+<script type="text/javascript" src="${ctxStatic}/auto-input.js"></script>
+<script type="text/javascript" src="${ctxStatic}/content-edit.js"></script>
+<script>
+	function updateAuditStatus(auditStatus) {
+		var elementById = document.getElementById("failReasonDiv");
+		if (auditStatus === 2) {
+			elementById.style.cssText = "display:none";
+		} else {
+			elementById.style.cssText = "";
+		}
+	}
+</script>
+</body>
+</html>

+ 116 - 0
src/main/webapp/WEB-INF/views/modules/user/cmReportingMemberSettleList.jsp

@@ -0,0 +1,116 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+	<title>分销团队</title>
+	<meta name="decorator" content="default"/>
+	<style type="text/css">
+		.table th {
+			text-align: center;
+		}
+
+		.table td {
+			text-align: center;
+		}
+	</style>
+	<script type="text/javascript">
+		$(document).ready(function () {
+			$("#inputForm").validate({
+				ignore: "",
+				submitHandler: function (form) {
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function (error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+		});
+
+		function page(n, s) {
+			$("#pageNo").val(n);
+			$("#pageSize").val(s);
+			$("#searchForm").submit();
+			return false;
+		}
+	</script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+		<li><a href="${ctx}/user/reporting/settleList">分销报备佣金</a></li>
+		<li class="active"><a href="${ctx}/user/reporting/memberSettleList?clubReportingId=${cmReportingMember.clubReportingId}">佣金明细</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="cmReportingMember" action="${ctx}/user/reporting/memberSettleList" method="post"
+		   class="breadcrumb form-search">
+	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
+	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+	<form:hidden path="clubReportingId"></form:hidden>
+	<div class="ul-form">
+		<label>报备人:</label>
+		<form:input path="cmDistribution.name" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>手机号:</label>
+		<form:input path="cmDistribution.mobile" htmlEscape="false" maxlength="11" class="input-medium"/>
+		<label>所属公司:</label>
+		<form:input path="cmDistribution.corporateName" htmlEscape="false" maxlength="30" class="input-medium"/>
+		<label>团队管理员:</label>
+		<form:select path="cmDistribution.parentId" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="0" label="是"/>
+			<form:option value="-1" label="否"/>
+		</form:select>
+		<label>结算状态:</label>
+		<form:select path="settleStatus" class="input-mini">
+			<form:option value="" label="请选择"/>
+			<form:option value="1" label="待确认"/>
+			<form:option value="2" label="待结算"/>
+			<form:option value="3" label="已结算"/>
+		</form:select>
+		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+		<div class="clearfix"></div>
+	</div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+	<thead>
+	<tr>
+		<th>报备人</th>
+		<th>手机号</th>
+		<th>所属公司</th>
+		<th>团队管理员</th>
+		<th>佣金</th>
+		<th>结算状态</th>
+		<th>结算时间</th>
+		<th>报备时间</th>
+		<th>操作</th>
+	</tr>
+	</thead>
+	<tbody>
+	<c:forEach items="${page.list}" var="cmReportingMember" varStatus="status">
+		<tr>
+			<td>${cmReportingMember.cmDistribution.name}</td>
+			<td>${cmReportingMember.cmDistribution.mobile}</td>
+			<td>${cmReportingMember.cmDistribution.corporateName}</td>
+			<td>${cmReportingMember.cmDistribution.parentId==0?'是':'否'}</td>
+			<td>${cmReportingMember.commission}</td>
+			<td>${cmReportingMember.settleStatus==1?'待确认':cmReportingMember.settleStatus==2?'待结算':'已结算'}</td>
+			<td>${cmReportingMember.settleTime eq null?'----':''}<c:if test="${cmReportingMember.settleTime ne null}"><fmt:formatDate value="${cmReportingMember.settleTime}" pattern="yyyy-MM-dd HH:mm:ss"/></c:if></td>
+			<td><fmt:formatDate value="${cmReportingMember.createTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+			<td>
+				<c:if test="${cmReportingMember.settleStatus==2}">
+				<a href="${ctx}/user/reporting/settleStatus?id=${cmReportingMember.id}&settleStatus=1&clubReportingId=${cmReportingMember.clubReportingId}">结算</a>
+				</c:if>
+				<a href="${ctx}/user/reporting/memberSettleForm?id=${cmReportingMember.id}">查看详情</a>
+			</td>
+		</tr>
+	</c:forEach>
+	</tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

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

@@ -55,6 +55,7 @@
     <li><a href="${ctx}/new/user/agency/cmSpClubTrackList">新分配机构跟踪管理</a></li>
     <li><a href="${ctx}/user/clubTemporary/">未确认机构</a></li>
     <li><a href="${ctx}/user/cmOperational/">操作日志</a></li>
+    <li><a href="${ctx}/new/user/agency/distributionCLubList">分销系统机构列表</a></li>
 </ul>
 <form:form id="searchForm" modelAttribute="newCmClub" action="${ctx}/new/user/agency/" method="post"
            class="breadcrumb form-search">