Ver código fonte

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

# Conflicts:
#	src/main/resources/mappings/modules/user/CmSpMapper.xml
zhijiezhao 2 meses atrás
pai
commit
92aa652144
45 arquivos alterados com 3627 adições e 510 exclusões
  1. 13 0
      src/main/java/com/caimei/modules/newhome/dao/NewPageQualitySupplierDao.java
  2. 20 0
      src/main/java/com/caimei/modules/newhome/dao/NewPageRecommendProductDao.java
  3. 44 0
      src/main/java/com/caimei/modules/newhome/dao/NewPageZoneDao.java
  4. 19 0
      src/main/java/com/caimei/modules/newhome/entity/NewPageQualitySupplier.java
  5. 16 0
      src/main/java/com/caimei/modules/newhome/entity/NewPageZone.java
  6. 19 0
      src/main/java/com/caimei/modules/newhome/entity/NewPageZoneImage.java
  7. 84 60
      src/main/java/com/caimei/modules/newhome/service/NewPageQualitySupplierService.java
  8. 38 0
      src/main/java/com/caimei/modules/newhome/service/NewPageRecommendProductService.java
  9. 139 0
      src/main/java/com/caimei/modules/newhome/service/NewPageZoneService.java
  10. 273 173
      src/main/java/com/caimei/modules/newhome/web/NewPageQualitySupplierController.java
  11. 135 0
      src/main/java/com/caimei/modules/newhome/web/NewPageRecommendProductController.java
  12. 366 0
      src/main/java/com/caimei/modules/newhome/web/NewPageZoneController.java
  13. 4 0
      src/main/java/com/caimei/modules/order/dao/NewOrderDao.java
  14. 2 0
      src/main/java/com/caimei/modules/order/entity/CmSettleVo.java
  15. 68 0
      src/main/java/com/caimei/modules/order/entity/CmSplitParams.java
  16. 13 32
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  17. 86 2
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  18. 6 0
      src/main/java/com/caimei/modules/order/web/CmPayShopController.java
  19. 3 0
      src/main/java/com/caimei/modules/product/entity/Product.java
  20. 2 0
      src/main/java/com/caimei/modules/user/dao/CmSpDao.java
  21. 9 0
      src/main/java/com/caimei/modules/user/entity/CmProvider.java
  22. 1 0
      src/main/java/com/caimei/modules/user/entity/NewCmSp.java
  23. 2 0
      src/main/java/com/caimei/modules/user/web/newUser/SpController.java
  24. 2 2
      src/main/resources/config/prod/caimei.properties
  25. 2 1
      src/main/resources/mappings/modules/coupon/CmCouponMapper.xml
  26. 202 141
      src/main/resources/mappings/modules/newhome/NewPageQualitySupplierMapper.xml
  27. 71 0
      src/main/resources/mappings/modules/newhome/NewPageRecommendProductMapper.xml
  28. 271 0
      src/main/resources/mappings/modules/newhome/NewPageZoneMapper.xml
  29. 23 2
      src/main/resources/mappings/modules/order/OrderMapper.xml
  30. 3 1
      src/main/webapp/WEB-INF/views/modules/coupon/toAddShop.jsp
  31. 1 1
      src/main/webapp/WEB-INF/views/modules/newhome/newPageHomeimageForm.jsp
  32. 185 0
      src/main/webapp/WEB-INF/views/modules/newhome/newPageProductList.jsp
  33. 140 82
      src/main/webapp/WEB-INF/views/modules/newhome/newPageQualitySupplierForm.jsp
  34. 1 0
      src/main/webapp/WEB-INF/views/modules/newhome/newPageQualitySupplierList.jsp
  35. 76 0
      src/main/webapp/WEB-INF/views/modules/newhome/newPageZoneForm.jsp
  36. 191 0
      src/main/webapp/WEB-INF/views/modules/newhome/newPageZoneList.jsp
  37. 162 0
      src/main/webapp/WEB-INF/views/modules/newhome/recommendProductList.jsp
  38. 127 0
      src/main/webapp/WEB-INF/views/modules/newhome/toSelectProduct.jsp
  39. 126 0
      src/main/webapp/WEB-INF/views/modules/newhome/toSelectRecommendProduct.jsp
  40. 123 0
      src/main/webapp/WEB-INF/views/modules/newhome/toSelectZoneProduct.jsp
  41. 124 0
      src/main/webapp/WEB-INF/views/modules/newhome/zoneImageForm.jsp
  42. 203 0
      src/main/webapp/WEB-INF/views/modules/newhome/zoneImageList.jsp
  43. 171 0
      src/main/webapp/WEB-INF/views/modules/newhome/zoneProductList.jsp
  44. 39 11
      src/main/webapp/WEB-INF/views/modules/order/cmSplitAccountList.jsp
  45. 22 2
      src/main/webapp/WEB-INF/views/modules/userNew/cmSpEdit.jsp

+ 13 - 0
src/main/java/com/caimei/modules/newhome/dao/NewPageQualitySupplierDao.java

@@ -1,9 +1,13 @@
 package com.caimei.modules.newhome.dao;
 
 import com.caimei.modules.newhome.entity.NewPageQualitySupplierImage;
+import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.newhome.entity.NewPageQualitySupplier;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 优质供应商DAO接口
@@ -16,4 +20,13 @@ public interface NewPageQualitySupplierDao extends CrudDao<NewPageQualitySupplie
     int updateImage(NewPageQualitySupplierImage newPageQualitySupplierImage);
     NewPageQualitySupplierImage getImage();
     int saveSort(NewPageQualitySupplier newPageQualitySupplier);
+
+    List<Product> findSupplierProducts(NewPageQualitySupplier newPageQualitySupplier);
+
+    void delProduct(@Param("id")Integer id,@Param("productId") Integer productId);
+
+    List<Product> findProductList(Product product);
+    void addProducts(@Param("id")Integer id,@Param("split") String[] split);
+
+    void updateSort(@Param("sort")String sort, @Param("id")String id);
 }

+ 20 - 0
src/main/java/com/caimei/modules/newhome/dao/NewPageRecommendProductDao.java

@@ -0,0 +1,20 @@
+package com.caimei.modules.newhome.dao;
+
+import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@MyBatisDao
+public interface NewPageRecommendProductDao {
+    List<Product> findRecommendList(Product product);
+
+    void updateSorts(@Param("sort") String sort, @Param("id") String id);
+
+    List<Product> findProductList(Product product);
+
+    void addProducts(@Param("split") String[] split);
+
+    void delProduct(Integer productId);
+}

+ 44 - 0
src/main/java/com/caimei/modules/newhome/dao/NewPageZoneDao.java

@@ -0,0 +1,44 @@
+package com.caimei.modules.newhome.dao;
+
+import com.caimei.modules.newhome.entity.NewPageZone;
+import com.caimei.modules.newhome.entity.NewPageZoneImage;
+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;
+
+import java.util.List;
+
+@MyBatisDao
+public interface NewPageZoneDao extends CrudDao<NewPageZone> {
+
+    void saveSort(@Param("sort") String sort, @Param("id") String id, @Param("zoneId") Integer zoneId);
+
+    List<Product> findZoneProductList(Product product);
+
+    List<Product> findProducts(Product product);
+
+    void addProducts(@Param("split") String[] split, @Param("zoneId") Integer zoneId);
+
+    void delProduct(@Param("productId") Integer productId, @Param("zoneId") Integer zoneId);
+
+    void delProducts(NewPageZone newPageZone);
+
+    void delImages(NewPageZone newPageZone);
+
+    List<NewPageZoneImage> findImageList(NewPageZoneImage image);
+
+    NewPageZoneImage getImage(NewPageZoneImage image);
+
+    void saveImage(NewPageZoneImage image);
+
+    void updateImage(NewPageZoneImage image);
+
+    void deleteImage(NewPageZoneImage image);
+
+    void updateImageCrmEnabledStatusByIds(@Param("crmEnabledStatus") String crmEnabledStatus, @Param("ids") String[] ids);
+
+    void updateImageEnabledStatusByIds(@Param("enabledStatus") String enabledStatus, @Param("ids") String[] ids);
+
+    void updateImageSort(@Param("id") String id, @Param("sort") String sort);
+}

+ 19 - 0
src/main/java/com/caimei/modules/newhome/entity/NewPageQualitySupplier.java

@@ -12,6 +12,9 @@ import com.thinkgem.jeesite.common.persistence.DataEntity;
 public class NewPageQualitySupplier extends DataEntity<NewPageQualitySupplier> {
 	
 	private static final long serialVersionUID = 1L;
+
+	private Integer productId;
+	private Integer shopId;
 	private String supplierName;		// 供应商名称
 	private String image;		// 供应商图片
 	private String link;		// 链接
@@ -27,6 +30,22 @@ public class NewPageQualitySupplier extends DataEntity<NewPageQualitySupplier> {
 		super(id);
 	}
 
+	public Integer getProductId() {
+		return productId;
+	}
+
+	public void setProductId(Integer productId) {
+		this.productId = productId;
+	}
+
+	public Integer getShopId() {
+		return shopId;
+	}
+
+	public void setShopId(Integer shopId) {
+		this.shopId = shopId;
+	}
+
 	@Length(min=0, max=20, message="供应商名称长度必须介于 0 和 20 之间")
 	public String getSupplierName() {
 		return supplierName;

+ 16 - 0
src/main/java/com/caimei/modules/newhome/entity/NewPageZone.java

@@ -0,0 +1,16 @@
+package com.caimei.modules.newhome.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
+
+@Data
+public class NewPageZone extends DataEntity<NewPageZone> {
+    private static final long serialVersionUID = 1L;
+    private String floorTitle;
+    private String floorDetail;
+    private String sort;
+    // Pc端状态 0停用 1启用
+    private String wwwEnabledStatus;
+    // CRM端状态 0停用 1启用
+    private String crmEnabledStatus;
+}

+ 19 - 0
src/main/java/com/caimei/modules/newhome/entity/NewPageZoneImage.java

@@ -0,0 +1,19 @@
+package com.caimei.modules.newhome.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
+
+@Data
+public class NewPageZoneImage extends DataEntity<NewPageZoneImage> {
+    private Integer imageId;
+    private Integer zoneId;
+    private String image;
+    private String crmImage;
+    private String title;
+    private String crmTitle;
+    private String link;
+    private String crmLink;
+    private Integer wwwEnabledStatus;
+    private Integer crmEnabledStatus;
+    private Integer sort;
+}

+ 84 - 60
src/main/java/com/caimei/modules/newhome/service/NewPageQualitySupplierService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.caimei.modules.hehe.util.UploadPicUtils;
 import com.caimei.modules.newhome.entity.NewPageQualitySupplierImage;
+import com.caimei.modules.product.entity.Product;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -18,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
 
 /**
  * 优质供应商Service
+ *
  * @author ye.qiin
  * @version 2019-03-18
  */
@@ -25,64 +27,86 @@ import javax.servlet.http.HttpServletRequest;
 @Transactional(readOnly = true)
 public class NewPageQualitySupplierService extends CrudService<NewPageQualitySupplierDao, NewPageQualitySupplier> {
 
-	@Resource
-	private NewPageQualitySupplierDao newPageQualitySupplierDao;
-
-
-	public NewPageQualitySupplier get(String id) {
-		return super.get(id);
-	}
-
-	public NewPageQualitySupplierImage getImage() {
-		return newPageQualitySupplierDao.getImage();
-	}
-
-	public List<NewPageQualitySupplier> findList(NewPageQualitySupplier newPageQualitySupplier) {
-		return super.findList(newPageQualitySupplier);
-	}
-	
-	public Page<NewPageQualitySupplier> findPage(Page<NewPageQualitySupplier> page, NewPageQualitySupplier newPageQualitySupplier) {
-		page.setOrderBy("sort");
-		return super.findPage(page, newPageQualitySupplier);
-	}
-	
-	@Transactional(readOnly = false)
-	public void save(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request) {
-		if(null != newPageQualitySupplier.getImage() && !"".equals(newPageQualitySupplier.getImage())){
-			String img = UploadPicUtils.saveImageToServer(newPageQualitySupplier.getImage());
-			newPageQualitySupplier.setImage(img);
-		}
-		super.save(newPageQualitySupplier);
-	}
-
-	@Transactional(readOnly = false)
-	public void saveSort(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request) {
-		newPageQualitySupplierDao.saveSort(newPageQualitySupplier);
-	}
-
-
-	@Transactional(readOnly = false)
-	public void saveImage(NewPageQualitySupplierImage newPageQualitySupplierImage, HttpServletRequest request) {
-		if(null != newPageQualitySupplierImage.getCrmImage() && !"".equals(newPageQualitySupplierImage.getCrmImage())){
-			String img = UploadPicUtils.saveImageToServer(newPageQualitySupplierImage.getCrmImage());
-			newPageQualitySupplierImage.setCrmImage(img);
-		}
-		if(null != newPageQualitySupplierImage.getWwwImage() && !"".equals(newPageQualitySupplierImage.getWwwImage())){
-			String img = UploadPicUtils.saveImageToServer(newPageQualitySupplierImage.getWwwImage());
-			newPageQualitySupplierImage.setWwwImage(img);
-		}
-		String id = newPageQualitySupplierImage.getId();
-		if(StringUtils.isNotEmpty(id)){
-			newPageQualitySupplierDao.updateImage(newPageQualitySupplierImage);
-		}else{
-			newPageQualitySupplierDao.saveImage(newPageQualitySupplierImage);
-		}
-
-	}
-	
-	@Transactional(readOnly = false)
-	public void delete(NewPageQualitySupplier newPageQualitySupplier) {
-		super.delete(newPageQualitySupplier);
-	}
-	
+    @Resource
+    private NewPageQualitySupplierDao newPageQualitySupplierDao;
+
+
+    public NewPageQualitySupplier get(String id) {
+        return super.get(id);
+    }
+
+    public NewPageQualitySupplierImage getImage() {
+        return newPageQualitySupplierDao.getImage();
+    }
+
+    public List<NewPageQualitySupplier> findList(NewPageQualitySupplier newPageQualitySupplier) {
+        return super.findList(newPageQualitySupplier);
+    }
+
+    public Page<NewPageQualitySupplier> findPage(Page<NewPageQualitySupplier> page, NewPageQualitySupplier newPageQualitySupplier) {
+        page.setOrderBy("sort");
+        return super.findPage(page, newPageQualitySupplier);
+    }
+
+    @Transactional(readOnly = false)
+    public void save(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request) {
+        if (null != newPageQualitySupplier.getImage() && !"".equals(newPageQualitySupplier.getImage())) {
+            String img = UploadPicUtils.saveImageToServer(newPageQualitySupplier.getImage());
+            newPageQualitySupplier.setImage(img);
+        }
+        super.save(newPageQualitySupplier);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveSort(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request) {
+        newPageQualitySupplierDao.saveSort(newPageQualitySupplier);
+    }
+
+
+    @Transactional(readOnly = false)
+    public void saveImage(NewPageQualitySupplierImage newPageQualitySupplierImage, HttpServletRequest request) {
+        if (null != newPageQualitySupplierImage.getCrmImage() && !"".equals(newPageQualitySupplierImage.getCrmImage())) {
+            String img = UploadPicUtils.saveImageToServer(newPageQualitySupplierImage.getCrmImage());
+            newPageQualitySupplierImage.setCrmImage(img);
+        }
+        if (null != newPageQualitySupplierImage.getWwwImage() && !"".equals(newPageQualitySupplierImage.getWwwImage())) {
+            String img = UploadPicUtils.saveImageToServer(newPageQualitySupplierImage.getWwwImage());
+            newPageQualitySupplierImage.setWwwImage(img);
+        }
+        String id = newPageQualitySupplierImage.getId();
+        if (StringUtils.isNotEmpty(id)) {
+            newPageQualitySupplierDao.updateImage(newPageQualitySupplierImage);
+        } else {
+            newPageQualitySupplierDao.saveImage(newPageQualitySupplierImage);
+        }
+
+    }
+
+    @Transactional(readOnly = false)
+    public void delete(NewPageQualitySupplier newPageQualitySupplier) {
+        super.delete(newPageQualitySupplier);
+    }
+
+    public List<Product> findSupplierProducts(NewPageQualitySupplier newPageQualitySupplier) {
+        return newPageQualitySupplierDao.findSupplierProducts(newPageQualitySupplier);
+    }
+
+    @Transactional(readOnly = false)
+    public void productDel(Integer id, Integer productId) {
+        newPageQualitySupplierDao.delProduct(id, productId);
+    }
+
+    public List<Product> findProductList(Product product) {
+        return newPageQualitySupplierDao.findProductList(product);
+    }
+
+    @Transactional(readOnly = false)
+    public void addProducts(Integer id, String[] split) {
+        newPageQualitySupplierDao.addProducts(id, split);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveBatchSort(String sort, String id) {
+        newPageQualitySupplierDao.updateSort(sort, id);
+    }
 }

+ 38 - 0
src/main/java/com/caimei/modules/newhome/service/NewPageRecommendProductService.java

@@ -0,0 +1,38 @@
+package com.caimei.modules.newhome.service;
+
+import com.caimei.modules.newhome.dao.NewPageRecommendProductDao;
+import com.caimei.modules.product.entity.Product;
+import com.thinkgem.jeesite.common.persistence.Page;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+public class NewPageRecommendProductService {
+
+    @Resource
+    private NewPageRecommendProductDao newPageRecommendProductDao;
+
+    public List<Product> findRecommendList(Page page) {
+        Product product = new Product();
+        product.setPage(page);
+        return newPageRecommendProductDao.findRecommendList(product);
+    }
+
+    public void saveBatchSort(String sort, String id) {
+        newPageRecommendProductDao.updateSorts(sort, id);
+    }
+
+    public List<Product> findProductList(Product product) {
+        return newPageRecommendProductDao.findProductList(product);
+    }
+
+    public void addProducts(String[] split) {
+        newPageRecommendProductDao.addProducts(split);
+    }
+
+    public void productDel(Integer productId) {
+        newPageRecommendProductDao.delProduct(productId);
+    }
+}

+ 139 - 0
src/main/java/com/caimei/modules/newhome/service/NewPageZoneService.java

@@ -0,0 +1,139 @@
+package com.caimei.modules.newhome.service;
+
+import com.caimei.dfs.image.beens.ImageUploadInfo;
+import com.caimei.modules.common.utils.UploadUtils;
+import com.caimei.modules.newhome.dao.NewPageZoneDao;
+import com.caimei.modules.newhome.entity.NewPageZone;
+import com.caimei.modules.newhome.entity.NewPageZoneImage;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.sys.utils.UploadImageUtils;
+import com.thinkgem.jeesite.common.config.Global;
+import com.thinkgem.jeesite.common.persistence.Page;
+import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.utils.Encodes;
+import com.thinkgem.jeesite.common.utils.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Service
+public class NewPageZoneService extends CrudService<NewPageZoneDao, NewPageZone> {
+
+    @Resource
+    private NewPageZoneDao pageZoneDao;
+
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id, Integer zoneId) {
+        pageZoneDao.saveSort(sort, id, zoneId);
+    }
+
+    public List<Product> findZoneProductList(Integer zoneId, Page<Product> page) {
+        Product product = new Product();
+        product.setZoneId(zoneId);
+        product.setPage(page);
+        return pageZoneDao.findZoneProductList(product);
+    }
+
+    public List<Product> findProductList(Product product) {
+        return pageZoneDao.findProducts(product);
+    }
+
+    @Transactional(readOnly = false)
+    public void addProducts(String[] split, Integer zoneId) {
+        pageZoneDao.addProducts(split, zoneId);
+    }
+
+    @Transactional(readOnly = false)
+    public void productDel(Integer productId, Integer zoneId) {
+        pageZoneDao.delProduct(productId, zoneId);
+    }
+
+    @Transactional(readOnly = false)
+    public void deleteZone(NewPageZone newPageZone) {
+        pageZoneDao.delete(newPageZone);
+        pageZoneDao.delProducts(newPageZone);
+        pageZoneDao.delImages(newPageZone);
+    }
+
+    public Page<NewPageZoneImage> findImagePage(Page<NewPageZoneImage> newPageZonePage, NewPageZoneImage image) {
+        image.setPage(newPageZonePage);
+        newPageZonePage.setList(pageZoneDao.findImageList(image));
+        return newPageZonePage;
+    }
+
+    public NewPageZoneImage getImage(NewPageZoneImage image) {
+        return pageZoneDao.getImage(image);
+    }
+
+    @Transactional(readOnly = false)
+    public void saveImage(NewPageZoneImage image, HttpServletRequest request) {
+        if (null != image.getImage() && !"".equals(image.getImage())) {
+            String img = saveImageToServer(image.getImage(), request);
+            image.setImage(img);
+        }
+        if (null != image.getCrmImage() && !"".equals(image.getCrmImage())) {
+            String img = saveImageToServer(image.getCrmImage(), request);
+            image.setCrmImage(img);
+        }
+        if (null != image.getImageId()) {
+            pageZoneDao.updateImage(image);
+        } else {
+            pageZoneDao.saveImage(image);
+        }
+    }
+
+    @Transactional(readOnly = false)
+    public void imageDelete(NewPageZoneImage image) {
+        pageZoneDao.deleteImage(image);
+    }
+
+    public String saveImageToServer(String imagesHead, HttpServletRequest request) {
+        //获取文件服务器地址
+        String photoServer = Global.getConfig("photoServer");
+        String res = "";
+        ImageUploadInfo saveImageSerivce = new ImageUploadInfo();
+        if (StringUtils.isNotBlank(imagesHead) && !imagesHead.startsWith("http:") && !imagesHead.startsWith("https:")) {
+            imagesHead = Encodes.urlDecode(imagesHead);
+            String realPath = UploadImageUtils.getAbsolutePath(imagesHead);
+            int pointerIndex = realPath.lastIndexOf(".");
+            try {
+                saveImageSerivce = UploadUtils.saveImageSerivce(realPath, pointerIndex, realPath);
+                res = photoServer + saveImageSerivce.getSource();
+            } catch (Exception e) {
+                logger.error("图片上传错误:" + e.toString(), e);
+            }
+        } else {
+            res = imagesHead;
+        }
+        return res;
+    }
+
+    @Transactional(readOnly = false)
+    public void updateImageCrmEnabledStatusByIds(String crmEnabledStatus, String[] ids) {
+        pageZoneDao.updateImageCrmEnabledStatusByIds(crmEnabledStatus, ids);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateImageEnabledStatusByIds(String enabledStatus, String[] ids) {
+        pageZoneDao.updateImageEnabledStatusByIds(enabledStatus, ids);
+    }
+
+    @Transactional(readOnly = false)
+    public void updateImageSorts(String sortNums) {
+        if (sortNums.contains(",")) {
+            String[] sortNum = sortNums.split(",");
+            for (String s : sortNum) {
+                String[] s1 = s.split("_");
+                if (2 == s1.length) {
+                    String id = s1[0];
+                    String sort = s1[1];
+                    pageZoneDao.updateImageSort(id, sort);
+                }
+            }
+        }
+
+    }
+}

+ 273 - 173
src/main/java/com/caimei/modules/newhome/web/NewPageQualitySupplierController.java

@@ -8,7 +8,10 @@ import com.caimei.constants.common.RedisKeyUtil;
 import com.caimei.modules.newhome.entity.NewPageQualitySupplierImage;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.product.entity.CmBigtype;
+import com.caimei.modules.product.entity.CmProductCombination;
+import com.caimei.modules.product.entity.Product;
 import com.caimei.redis.RedisService;
+import com.caimei.utils.AppUtils;
 import com.google.common.collect.Maps;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -33,6 +36,7 @@ import java.util.regex.Pattern;
 
 /**
  * 优质供应商Controller
+ *
  * @author ye.qiin
  * @version 2019-03-18
  */
@@ -40,181 +44,277 @@ import java.util.regex.Pattern;
 @RequestMapping(value = "${adminPath}/newhome/newPageQualitySupplier")
 public class NewPageQualitySupplierController extends BaseController {
 
-	@Resource
-	private NewPageQualitySupplierService newPageQualitySupplierService;
-	@Resource
-	private RedisService redisService;
+    @Resource
+    private NewPageQualitySupplierService newPageQualitySupplierService;
+    @Resource
+    private RedisService redisService;
     @Resource
     private GenerateUtils generateUtils;
-	
-	
-	
-	@ModelAttribute
-	public NewPageQualitySupplier get(@RequestParam(required=false) String id) {
-		NewPageQualitySupplier entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = newPageQualitySupplierService.get(id);
-		}
-		if (entity == null){
-			entity = new NewPageQualitySupplier();
-		}
-		return entity;
-	}
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request, HttpServletResponse response, Model model) {
-		Page<NewPageQualitySupplier> page = newPageQualitySupplierService.findPage(new Page<NewPageQualitySupplier>(request, response), newPageQualitySupplier);
-		model.addAttribute("page", page);
-		return "modules/newhome/newPageQualitySupplierList";
-	}
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:view")
-	@RequestMapping(value = "form")
-	public String form(NewPageQualitySupplier newPageQualitySupplier, Model model) {
-		model.addAttribute("newPageQualitySupplier", newPageQualitySupplier);
-		return "modules/newhome/newPageQualitySupplierForm";
-	}
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:view")
-	@RequestMapping(value = "formImage")
-	public String formImage(NewPageQualitySupplierImage newPageQualitySupplierImage, Model model) {
-		NewPageQualitySupplierImage image = newPageQualitySupplierService.getImage();
-		model.addAttribute("NewPageQualitySupplierImage", image);
-		return "modules/newhome/newPageQualitySupplierImage";
-	}
-
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:edit")
-	@RequestMapping(value = "saveImage")
-	public String saveImage(NewPageQualitySupplierImage newPageQualitySupplierImage,HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, newPageQualitySupplierImage)){
-			return formImage(newPageQualitySupplierImage, model);
-		}
-		if (checkValidator(model, newPageQualitySupplierImage)){
-			return formImage(newPageQualitySupplierImage, model);
-		}
-		newPageQualitySupplierService.saveImage(newPageQualitySupplierImage,request);
-		cleanRedisCache();
-		addMessage(redirectAttributes, "保存供应商广告图成功");
-		return "redirect:"+Global.getAdminPath()+"/newhome/newPageQualitySupplier/";
-	}
-
-	private boolean checkValidator(Model model, NewPageQualitySupplierImage image) {
-		if (!beanValidator(model, image)){
-			return true;
-		}
-		if (StringUtils.isEmpty(image.getWwwImage())) {
-			model.addAttribute("errorMsg", "请上传网站端图!");
-			return true;
-		}
-		if (StringUtils.isEmpty(image.getCrmImage())) {
-			model.addAttribute("errorMsg", "请上传小程序端图!");
-			return true;
-		}
-		return false;
-	}
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:edit")
-	@RequestMapping(value = "batchSaveSort")
-	@ResponseBody
-	public  Map<String, Object>  batchSaveSort(String newPageList, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
-		Map<String, Object> map = Maps.newLinkedHashMap();
-		try {
-			String[]  newPageLists = newPageList.split(",");
-			for(String list:newPageLists){
-				String[] split = list.split("-");
-				String s = split[1];//判断是否是数字,或者为空
-				if(StringUtils.isNotEmpty(s)){
-			 		if( isInteger(s)){
-						NewPageQualitySupplier newPageQualitySupplier = new NewPageQualitySupplier();
-						newPageQualitySupplier.setId(split[0]);
-						newPageQualitySupplier.setSort(split[1]);
-						newPageQualitySupplierService.saveSort(newPageQualitySupplier,request);
-					}else{
-						map.put("success",false);
-						map.put("msg", "排序值只能为数字");
-						return map;
-					}
-				}else{
-					map.put("success",false);
-					map.put("msg", "排序不能为空");
-					return map;
-				}
-			}
-			cleanRedisCache();
-			map.put("success",true);
-			map.put("msg", "保存排序成功");
-			return map;
-		} catch (Exception e) {
-			map.put("success",false);
-			map.put("msg", "更新排序失败,排序不能为空");
-			return map;
-		}
-	}
-
-
-	public static boolean isInteger(String str) {
-		Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
-		return pattern.matcher(str).matches();
-	}
-
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:edit")
-	@RequestMapping(value = "save")
-	public String save(NewPageQualitySupplier newPageQualitySupplier,HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, newPageQualitySupplier)){
-			return form(newPageQualitySupplier, model);
-		}
-		newPageQualitySupplierService.save(newPageQualitySupplier,request);
-		cleanRedisCache();
-		addMessage(redirectAttributes, "保存优质供应商成功");
-		return "redirect:"+Global.getAdminPath()+"/newhome/newPageQualitySupplier/?repage";
-	}
-
-	@RequiresPermissions("newhome:newPageQualitySupplier:delete")
-	@RequestMapping(value = "delete")
-	public String delete(NewPageQualitySupplier newPageQualitySupplier, RedirectAttributes redirectAttributes) {
-		newPageQualitySupplierService.delete(newPageQualitySupplier);
-		cleanRedisCache();
-		addMessage(redirectAttributes, "删除优质供应商成功");
-		return "redirect:"+Global.getAdminPath()+"/newhome/newPageQualitySupplier/?repage";
-	}
-	@RequiresPermissions("newhome:newPageHomeimage:edit")
-	@ResponseBody
-	@RequestMapping(value="updateEnabledStatus")
-	public Map<String, Object> updateEnabledStatus(String enabledStatus, String[] ids, String [] supplierIDs, HttpServletRequest request, HttpServletResponse response){
-		Map<String, Object> map = Maps.newLinkedHashMap();
-		try {
-			newPageQualitySupplierService.updateEnabledStatusByIds(enabledStatus,ids);
-			cleanRedisCache();
-			map.put("success",true);
-			map.put("msg", "修改成功");
-		} catch (Exception e) {
-			logger.debug(e.toString(),e);
-			map.put("success",false);
-			map.put("msg", "修改失败");
-		}
-		return map;
-	}
-
-	@RequiresPermissions("newhome:newPageHomeimage:edit")
-	@ResponseBody
-	@RequestMapping(value="updateCrmEnabledStatusByIds")
-	public Map<String, Object> updateCrmEnabledStatusByIds(String crmEnabledStatus, String[] ids, String [] supplierIDs, HttpServletRequest request, HttpServletResponse response){
-		Map<String, Object> map = Maps.newLinkedHashMap();
-		try {
-			newPageQualitySupplierService.updateCrmEnabledStatusByIds(crmEnabledStatus,ids);
-			cleanRedisCache();
-			map.put("success",true);
-			map.put("msg", "修改成功");
-		} catch (Exception e) {
-			logger.debug(e.toString(),e);
-			map.put("success",false);
-			map.put("msg", "修改失败");
-		}
-		return map;
-	}
+
+
+    @ModelAttribute
+    public NewPageQualitySupplier get(@RequestParam(required = false) String id) {
+        NewPageQualitySupplier entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = newPageQualitySupplierService.get(id);
+        }
+        if (entity == null) {
+            entity = new NewPageQualitySupplier();
+        }
+        return entity;
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:view")
+    @RequestMapping(value = {"list", ""})
+    public String list(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<NewPageQualitySupplier> page = newPageQualitySupplierService.findPage(new Page<NewPageQualitySupplier>(request, response), newPageQualitySupplier);
+        model.addAttribute("page", page);
+        return "modules/newhome/newPageQualitySupplierList";
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:view")
+    @RequestMapping(value = "form")
+    public String form(NewPageQualitySupplier newPageQualitySupplier, Model model) {
+        model.addAttribute("newPageQualitySupplier", newPageQualitySupplier);
+        return "modules/newhome/newPageQualitySupplierForm";
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:view")
+    @RequestMapping(value = "product")
+    public String productList(NewPageQualitySupplier newPageQualitySupplier, Model model) {
+        List<Product> productList = newPageQualitySupplierService.findSupplierProducts(newPageQualitySupplier);
+        model.addAttribute("productList", productList);
+        model.addAttribute("newPageQualitySupplier", newPageQualitySupplier);
+        return "modules/newhome/newPageProductList";
+    }
+
+    @RequestMapping(value = "batchSaveSorts")
+    @ResponseBody
+    public Map<String, Object> batchSaveSorts(String newProducSorttList, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[]  newPageLists = newProducSorttList.split(",");
+            for(String list:newPageLists){
+                String[] split = list.split("-");
+                if(split.length == 1 || split.length < 1){
+                    map.put("success",false);
+                    map.put("msg", "排序值不能为空!");
+                    return map;
+                }
+                String s = split[1];
+                //判断是否是数字,或者为空
+                if(StringUtils.isNotEmpty(s)){
+                    if( isInteger(s)){
+                        String id = split[0];
+                        String sort = split[1];
+                        //保存数据,
+                        newPageQualitySupplierService.saveBatchSort(sort,id);
+                    }else{
+                        map.put("success",false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }else{
+                    map.put("success",false);
+                    map.put("msg", "排序值不能为空!");
+                    return map;
+                }
+            }
+            map.put("success",true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success",false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:view")
+    @RequestMapping(value = "productDel")
+    public String productDel(NewPageQualitySupplier newPageQualitySupplier, RedirectAttributes redirectAttributes) {
+        newPageQualitySupplierService.productDel(Integer.valueOf(newPageQualitySupplier.getId()),newPageQualitySupplier.getProductId());
+        addMessage(redirectAttributes, "删除成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageQualitySupplier/product?id=" + newPageQualitySupplier.getId();
+    }
+
+    @RequestMapping(value = "toAddProduct")
+    public String toAddProduct(Product product, Page page, Model model) {
+        //获取采美所有商品
+        if (0 == page.getPageSize() || -1 == page.getPageSize()) page.setPageSize(30);
+        if (0 == page.getPageNo()) page.setPageNo(1);
+        product.setPage(page);
+        List<Product> productList = newPageQualitySupplierService.findProductList(product);
+        if (CollectionUtils.isNotEmpty(productList)) {
+            for (Product p : productList) {
+                p.setMainImage(AppUtils.getProductImageURL(p.getMainImage(), 0, Global.getConfig("wwwServer")));
+            }
+        }
+        page.setList(productList);
+        model.addAttribute("page", page);
+        model.addAttribute("Product", product);
+        return "modules/newhome/toSelectProduct";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "saveAddProduct")
+    public Map<String, Object> saveAddProduct(String productIds,Integer id) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] split = productIds.split(",");
+            //保存商品添加的组合
+            newPageQualitySupplierService.addProducts(id,split);
+            map.put("success", true);
+            map.put("msg", "添加成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "添加失败");
+        }
+        return map;
+    }
+
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:view")
+    @RequestMapping(value = "formImage")
+    public String formImage(NewPageQualitySupplierImage newPageQualitySupplierImage, Model model) {
+        NewPageQualitySupplierImage image = newPageQualitySupplierService.getImage();
+        model.addAttribute("NewPageQualitySupplierImage", image);
+        return "modules/newhome/newPageQualitySupplierImage";
+    }
+
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:edit")
+    @RequestMapping(value = "saveImage")
+    public String saveImage(NewPageQualitySupplierImage newPageQualitySupplierImage, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, newPageQualitySupplierImage)) {
+            return formImage(newPageQualitySupplierImage, model);
+        }
+        if (checkValidator(model, newPageQualitySupplierImage)) {
+            return formImage(newPageQualitySupplierImage, model);
+        }
+        newPageQualitySupplierService.saveImage(newPageQualitySupplierImage, request);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "保存供应商广告图成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageQualitySupplier/";
+    }
+
+    private boolean checkValidator(Model model, NewPageQualitySupplierImage image) {
+        if (!beanValidator(model, image)) {
+            return true;
+        }
+        if (StringUtils.isEmpty(image.getWwwImage())) {
+            model.addAttribute("errorMsg", "请上传网站端图!");
+            return true;
+        }
+        if (StringUtils.isEmpty(image.getCrmImage())) {
+            model.addAttribute("errorMsg", "请上传小程序端图!");
+            return true;
+        }
+        return false;
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:edit")
+    @RequestMapping(value = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSort(String newPageList, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = newPageList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                String s = split[1];//判断是否是数字,或者为空
+                if (StringUtils.isNotEmpty(s)) {
+                    if (isInteger(s)) {
+                        NewPageQualitySupplier newPageQualitySupplier = new NewPageQualitySupplier();
+                        newPageQualitySupplier.setId(split[0]);
+                        newPageQualitySupplier.setSort(split[1]);
+                        newPageQualitySupplierService.saveSort(newPageQualitySupplier, request);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                } else {
+                    map.put("success", false);
+                    map.put("msg", "排序不能为空");
+                    return map;
+                }
+            }
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "保存排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败,排序不能为空");
+            return map;
+        }
+    }
+
+
+    public static boolean isInteger(String str) {
+        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
+        return pattern.matcher(str).matches();
+    }
+
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:edit")
+    @RequestMapping(value = "save")
+    public String save(NewPageQualitySupplier newPageQualitySupplier, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, newPageQualitySupplier)) {
+            return form(newPageQualitySupplier, model);
+        }
+        newPageQualitySupplierService.save(newPageQualitySupplier, request);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "保存优质供应商成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageQualitySupplier/?repage";
+    }
+
+    @RequiresPermissions("newhome:newPageQualitySupplier:delete")
+    @RequestMapping(value = "delete")
+    public String delete(NewPageQualitySupplier newPageQualitySupplier, RedirectAttributes redirectAttributes) {
+        newPageQualitySupplierService.delete(newPageQualitySupplier);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "删除优质供应商成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageQualitySupplier/?repage";
+    }
+
+    @RequiresPermissions("newhome:newPageHomeimage:edit")
+    @ResponseBody
+    @RequestMapping(value = "updateEnabledStatus")
+    public Map<String, Object> updateEnabledStatus(String enabledStatus, String[] ids, String[] supplierIDs, HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageQualitySupplierService.updateEnabledStatusByIds(enabledStatus, ids);
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
+
+    @RequiresPermissions("newhome:newPageHomeimage:edit")
+    @ResponseBody
+    @RequestMapping(value = "updateCrmEnabledStatusByIds")
+    public Map<String, Object> updateCrmEnabledStatusByIds(String crmEnabledStatus, String[] ids, String[] supplierIDs, HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageQualitySupplierService.updateCrmEnabledStatusByIds(crmEnabledStatus, ids);
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "修改成功");
+        } catch (Exception e) {
+            logger.debug(e.toString(), e);
+            map.put("success", false);
+            map.put("msg", "修改失败");
+        }
+        return map;
+    }
 
     /**
      * 有数据变动时需要清除缓存

+ 135 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageRecommendProductController.java

@@ -0,0 +1,135 @@
+package com.caimei.modules.newhome.web;
+
+import com.caimei.modules.newhome.service.NewPageRecommendProductService;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.utils.AppUtils;
+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 org.apache.commons.collections.CollectionUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+@Controller
+@RequestMapping(value = "${adminPath}/newhome/recommendProduct")
+public class NewPageRecommendProductController {
+
+    @Resource
+    private NewPageRecommendProductService newPageRecommendProductService;
+
+    @RequestMapping(value = {"list", ""})
+    public String recommendProductList(HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<Product> page = new Page<Product>(request, response);
+        if (0 == page.getPageSize() || -1 == page.getPageSize()) page.setPageSize(20);
+        if (0 == page.getPageNo()) page.setPageNo(1);
+        //获取组合列表
+        List<Product> list = newPageRecommendProductService.findRecommendList(page);
+        page.setList(list);
+        model.addAttribute("page", page);
+        return "modules/newhome/recommendProductList";
+    }
+
+    @RequestMapping(value = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSorts(String newProducSorttList, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = newProducSorttList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    map.put("success", false);
+                    map.put("msg", "排序值不能为空!");
+                    return map;
+                }
+                String s = split[1];
+                //判断是否是数字,或者为空
+                if (StringUtils.isNotEmpty(s)) {
+                    if (isInteger(s)) {
+                        String id = split[0];
+                        String sort = split[1];
+                        //保存数据,
+                        newPageRecommendProductService.saveBatchSort(sort, id);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                } else {
+                    map.put("success", false);
+                    map.put("msg", "排序值不能为空!");
+                    return map;
+                }
+            }
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+    @RequestMapping(value = "toAddProduct")
+    public String toAddProduct(Product product, Page page, Model model) {
+        //获取采美所有商品
+        if (0 == page.getPageSize() || -1 == page.getPageSize()) page.setPageSize(30);
+        if (0 == page.getPageNo()) page.setPageNo(1);
+        product.setPage(page);
+        List<Product> productList = newPageRecommendProductService.findProductList(product);
+        if (CollectionUtils.isNotEmpty(productList)) {
+            for (Product p : productList) {
+                p.setMainImage(AppUtils.getProductImageURL(p.getMainImage(), 0, Global.getConfig("wwwServer")));
+            }
+        }
+        page.setList(productList);
+        model.addAttribute("page", page);
+        model.addAttribute("Product", product);
+        return "modules/newhome/toSelectProduct";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "saveAddProduct")
+    public Map<String, Object> saveAddProduct(String productIds, Integer id) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] split = productIds.split(",");
+            //保存商品添加的组合
+            newPageRecommendProductService.addProducts(split);
+            map.put("success", true);
+            map.put("msg", "添加成功");
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "添加失败");
+        }
+        return map;
+    }
+
+    @RequestMapping(value = "deleteProduct")
+    public String productDel(Integer productId, RedirectAttributes redirectAttributes) {
+        newPageRecommendProductService.productDel(productId);
+        addMessage(redirectAttributes, "删除成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/recommendProduct/list";
+    }
+
+    protected void addMessage(RedirectAttributes redirectAttributes, String... messages) {
+        StringBuilder sb = new StringBuilder();
+        for (String message : messages) {
+            sb.append(message).append(messages.length > 1 ? "<br/>" : "");
+        }
+        redirectAttributes.addFlashAttribute("message", sb.toString());
+    }
+}

+ 366 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageZoneController.java

@@ -0,0 +1,366 @@
+package com.caimei.modules.newhome.web;
+
+import com.caimei.constants.common.RedisKeyUtil;
+import com.caimei.modules.newhome.entity.NewPageZone;
+import com.caimei.modules.newhome.entity.NewPageZoneImage;
+import com.caimei.modules.newhome.service.NewPageZoneService;
+import com.caimei.modules.opensearch.GenerateUtils;
+import com.caimei.modules.product.entity.Product;
+import com.caimei.modules.product.service.ProductService;
+import com.caimei.redis.RedisService;
+import com.caimei.utils.AppUtils;
+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.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+import static com.caimei.modules.newhome.web.NewPageQualitySupplierController.isInteger;
+
+
+@Controller
+@RequestMapping(value = "${adminPath}/newhome/newPageZone")
+public class NewPageZoneController extends BaseController {
+
+    @Resource
+    private NewPageZoneService newPageZoneService;
+    @Resource
+    private ProductService productService;
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private GenerateUtils generateUtils;
+
+
+    @ModelAttribute
+    public NewPageZone get(@RequestParam(required = false) String id) {
+        NewPageZone entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = newPageZoneService.get(id);
+        }
+        if (entity == null) {
+            entity = new NewPageZone();
+        }
+        return entity;
+    }
+
+    @RequiresPermissions("newhome:newPageZone:view")
+    @RequestMapping(value = {"list", ""})
+    public String list(NewPageZone newPageZone, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<NewPageZone> page = newPageZoneService.findPage(new Page<NewPageZone>(request, response), newPageZone);
+        model.addAttribute("page", page);
+        return "modules/newhome/newPageZoneList";
+    }
+
+    @RequestMapping(value = "imageList")
+    public String imageList(NewPageZoneImage image, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<NewPageZoneImage> page = newPageZoneService.findImagePage(new Page<NewPageZoneImage>(request, response), image);
+        model.addAttribute("zoneImage", image);
+        model.addAttribute("page", page);
+        return "modules/newhome/zoneImageList";
+    }
+
+    @RequestMapping(value = "imageForm")
+    public String form(NewPageZoneImage image, Model model) {
+        if (null != image.getImageId()) {
+            image = newPageZoneService.getImage(image);
+        }
+        if (image == null) {
+            image = new NewPageZoneImage();
+        }
+        model.addAttribute("zoneImage", image);
+        return "modules/newhome/zoneImageForm";
+    }
+
+    @RequestMapping(value = "imageSave")
+    public String save(NewPageZoneImage image, RedirectAttributes redirectAttributes, HttpServletRequest request) {
+        newPageZoneService.saveImage(image, request);
+        cleanRedisCache(null);
+        //清除首页轮播图缓存
+        redisService.remove("getHomeBanners::www");
+        addMessage(redirectAttributes, "保存新首页轮播图成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone/imageList?zoneId=" + image.getZoneId();
+    }
+
+    @RequestMapping(value = "imageDelete")
+    public String imageDelete(NewPageZoneImage image, RedirectAttributes redirectAttributes) {
+        newPageZoneService.imageDelete(image);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "删除楼层管理成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone/imageList/?zoneId=" + image.getZoneId();
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "updateImageCrmEnabledStatusByIds")
+    public Map<String, Object> updateImageCrmEnabledStatusByIds(String crmEnabledStatus, String[] ids) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageZoneService.updateImageCrmEnabledStatusByIds(crmEnabledStatus, ids);
+            cleanRedisCache();
+            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 = "updateImageEnabledStatus")
+    public Map<String, Object> updateImageEnabledStatus(String enabledStatus, String[] ids) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageZoneService.updateImageEnabledStatusByIds(enabledStatus, ids);
+            cleanRedisCache();
+            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 = "updateImageSort")
+    @ResponseBody
+    public Map<String, Object> updateImageSort(String sortNums) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageZoneService.updateImageSorts(sortNums);
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+    @RequestMapping(value = "productList")
+    public String productList(Integer zoneId, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Page<Product> page = new Page<Product>(request, response);
+        if (0 == page.getPageSize() || -1 == page.getPageSize()) page.setPageSize(20);
+        if (0 == page.getPageNo()) page.setPageNo(1);
+        //获取组合列表
+        List<Product> list = newPageZoneService.findZoneProductList(zoneId, page);
+        page.setList(list);
+        model.addAttribute("zoneId", zoneId);
+        model.addAttribute("page", page);
+        return "modules/newhome/zoneProductList";
+    }
+
+    @RequestMapping(value = "toAddProduct")
+    public String toAddProduct(Product product, Page page, Model model) {
+        //获取采美所有商品
+        if (0 == page.getPageSize() || -1 == page.getPageSize()) page.setPageSize(30);
+        if (0 == page.getPageNo()) page.setPageNo(1);
+        product.setPage(page);
+        List<Product> productList = newPageZoneService.findProductList(product);
+        if (CollectionUtils.isNotEmpty(productList)) {
+            for (Product p : productList) {
+                p.setMainImage(AppUtils.getProductImageURL(p.getMainImage(), 0, Global.getConfig("wwwServer")));
+            }
+        }
+        page.setList(productList);
+        model.addAttribute("page", page);
+        model.addAttribute("Product", product);
+        return "modules/newhome/toSelectProduct";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "saveAddProduct")
+    public Map<String, Object> saveAddProduct(Product product) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] split = product.getProductIds().split(",");
+            //保存商品添加的组合
+            newPageZoneService.addProducts(split, product.getZoneId());
+            map.put("success", true);
+            map.put("msg", "添加成功");
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "添加失败");
+        }
+        return map;
+    }
+
+
+    @RequiresPermissions("newhome:newPageZone:view")
+    @RequestMapping(value = "form")
+    public String form(NewPageZone newPageZone, Model model) {
+        model.addAttribute("newPageZone", newPageZone);
+        return "modules/newhome/newPageZoneForm";
+    }
+
+    @RequestMapping(value = "save")
+    public String save(Integer floor, NewPageZone newPageZone, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, newPageZone)) {
+            return form(newPageZone, model);
+        }
+        newPageZoneService.save(newPageZone);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "保存楼层管理成功");
+        if (floor != null) {
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone/lists";
+        } else {
+            return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone";
+        }
+
+    }
+
+    @RequestMapping(value = "delete")
+    public String delete(NewPageZone newPageZone, RedirectAttributes redirectAttributes) {
+        newPageZoneService.deleteZone(newPageZone);
+        cleanRedisCache();
+        addMessage(redirectAttributes, "删除楼层管理成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone/?repage";
+    }
+
+    @ResponseBody
+    @RequestMapping(value = "updateEnabledStatus")
+    public Map<String, Object> updateEnabledStatus(String enabledStatus, String[] ids) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageZoneService.updateEnabledStatusByIds(enabledStatus, ids);
+            cleanRedisCache();
+            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 = "updateCrmEnabledStatusByIds")
+    public Map<String, Object> updateCrmEnabledStatusByIds(String crmEnabledStatus, String[] ids) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            newPageZoneService.updateCrmEnabledStatusByIds(crmEnabledStatus, ids);
+            cleanRedisCache();
+            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 = "batchSaveSort")
+    @ResponseBody
+    public Map<String, Object> batchSaveSort(String sortList, Integer zoneId) {
+        Map<String, Object> map = Maps.newLinkedHashMap();
+        try {
+            String[] newPageLists = sortList.split(",");
+            for (String list : newPageLists) {
+                String[] split = list.split("-");
+                if (split.length == 1 || split.length < 1) {
+                    String id = split[0];
+                    String sort = null;
+                    newPageZoneService.saveSort(sort, id, zoneId);
+                } else {
+                    String id = split[0];
+                    String sort = split[1];
+                    if (isInteger(sort)) {
+                        newPageZoneService.saveSort(sort, id, zoneId);
+                    } else {
+                        map.put("success", false);
+                        map.put("msg", "排序值只能为数字");
+                        return map;
+                    }
+                }
+            }
+            cleanRedisCache();
+            map.put("success", true);
+            map.put("msg", "更新排序成功");
+            return map;
+        } catch (Exception e) {
+            map.put("success", false);
+            map.put("msg", "更新排序失败");
+            return map;
+        }
+    }
+
+    /**
+     * 添加商品
+     */
+    @RequestMapping("/addProductImage")
+    public String addProductImage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        product.setValidFlag("2");
+        Page<Product> page = productService.findProductImage(new Page<Product>(request, response), product);
+        model.addAttribute("page", page);
+        model.addAttribute("productCategory", product.getProductCategory());
+        model.addAttribute("productIds", product.getProductIds());
+        return "modules/newhome/addProductImage";
+    }
+
+    @RequestMapping(value = "deleteProduct")
+    public String productDel(Integer productId, Integer zoneId, RedirectAttributes redirectAttributes) {
+        newPageZoneService.productDel(productId, zoneId);
+        addMessage(redirectAttributes, "删除成功");
+        return "redirect:" + Global.getAdminPath() + "/newhome/newPageZone/productList?zoneId=" + zoneId;
+    }
+
+    /**
+     * 有数据变动时需要清除缓存
+     */
+    public void cleanRedisCache() {
+        //清除活动专题缓存
+        redisService.removePattern("getPageFloorData*");
+        //清除活动专题缓存
+        redisService.removePattern("activityData*");
+        //清除产品仪器缓存
+        redisService.removePattern("instrumentData*");
+        redisService.removePattern("insCommodityData*");
+        //首页缓存
+        String homeData = "getHomeData*";
+        redisService.removePattern(homeData);
+        redisService.removePattern("getHomeCommodityData*");
+        // 重新生成静态首页
+        generateUtils.generateHome();
+
+    }
+
+    public void cleanRedisCache(String caller) {
+        if (null == caller) {
+            String www = RedisKeyUtil.getNewPageHomeImageKey("WWW");
+            if (redisService.exists(www)) {
+                redisService.remove(www);
+            }
+            String crm = RedisKeyUtil.getNewPageHomeImageKey("CRM");
+            if (redisService.exists(crm)) {
+                redisService.remove(crm);
+            }
+            // 重新生成静态首页
+            generateUtils.generateHome();
+        }
+    }
+
+}

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

@@ -375,4 +375,8 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     Integer findOrderId(Integer shopOrderId);
 
     List<CmSettleVo> findSplitAccounts(String shopOrderId);
+
+    void updateOrderPayStatus(Integer orderId);
+
+    CmSplitParams findSplitParams(String shopOrderId);
 }

+ 2 - 0
src/main/java/com/caimei/modules/order/entity/CmSettleVo.java

@@ -11,4 +11,6 @@ public class CmSettleVo extends DataEntity<CmSettleVo> {
     private Double splitAccount;
     private Integer productType;
 
+    private Integer orderId;
+
 }

+ 68 - 0
src/main/java/com/caimei/modules/order/entity/CmSplitParams.java

@@ -0,0 +1,68 @@
+package com.caimei.modules.order.entity;
+
+import lombok.Data;
+
+@Data
+public class CmSplitParams {
+    private Integer shopOrderId;
+    private Integer clubId;
+    /**
+     * 服务商id
+     */
+    private Integer providerId;
+    /**
+     * 供应商分帐号
+     */
+    private String shopSplitCode;
+
+    private String cmSplitCode = Constant.CUSTOMERNUM2;
+    /**
+     * 服务商分帐号
+     */
+    private String providerSplitCode;
+    private String clubName;
+    /**
+     * 协销名称
+     */
+    private String spName;
+    /**
+     * 服务商名称
+     */
+    private String cpName;
+    /**
+     * 订单应收
+     */
+    private Double needPayAmount;
+
+
+    /****** 非数据库字段 ********/
+
+
+    /** 分账参数类型
+     *  1.服务商
+     *  2.非服务商
+     */
+    private Integer splitType;
+    /**
+     * 供应商收款手续费
+     */
+    private Double shopCommission;
+    /**
+     * 供应商分账手续费
+     */
+    private Double shopSplitCommission;
+    /**
+     * 供应商分账金额
+     */
+    private Double shopSplitAccount;
+    /**
+     * 采美分账金额
+     */
+    private Double cmSplitAccount;
+    /**
+     * 服务商分账金额
+     */
+    private Double providerSplitAccount;
+
+
+}

+ 13 - 32
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -1504,15 +1504,18 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
 
         for (CmSettleVo settleVo : settleVos) {
             if (1 == settleVo.getProductType()) {
-                settleOrder("JSCB" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, 1);
+                settleOrder("JSCB" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, settleVo.getProductType());
             }
             if (3 == settleVo.getProductType()) {
-                settleOrder("JSYJ" + shopOrderId + substring, settleVo.getSplitAccount(), Constant.CUSTOMERNUM2, shopOrderId, 2);
+                settleOrder("JSYJ" + shopOrderId + substring, settleVo.getSplitAccount(), Constant.CUSTOMERNUM2, shopOrderId, settleVo.getProductType());
             }
             if (5 == settleVo.getProductType()) {
-                settleOrder("JSZZ" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, 3);
+                settleOrder("JSFWS" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, settleVo.getProductType());
             }
         }
+        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
+        newOrderDao.updateOrderPayStatus(settleVos.get(0).getOrderId());
+        //todo 结算三方短信
     }
 
     @Transactional(readOnly = false, rollbackFor = Exception.class)
@@ -1545,35 +1548,13 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
             } else {
                 SettleRecord settleRecord = new SettleRecord();
                 //存结算表,改子订单结算状态
-                if (1 == settleFlag) {
-                    //成本结算
-                    settleRecord.setSettleType(settleFlag);
-                    settleRecord.setSettleAmount(settleAmount);
-                    settleRecord.setSplitCode(P3_customerNumber);
-                    settleRecord.setShopOrderId(shopOrderId);
-                    newOrderDao.insertSettleRecord(settleRecord);
-                    // 修改cm_split_account settlestatus
-                    newOrderDao.updateSettleStatus(shopOrderId, 1);
-//                    //计算供应商成本,结算金额,修改结算状态
-//                    Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
-//                    Double settleSum = newOrderDao.findSettleSum(shopOrderId);
-//                    if (shouldPayShopAmount > settleSum) {
-//                        //成本>结算金额,部分结算
-//                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
-//                    } else {
-                    //成本=结算金额 全部结算
-                    newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
-//                    }
-                } else {
-                    //佣金结算
-                    settleRecord.setSettleType(settleFlag);
-                    settleRecord.setSettleAmount(settleAmount);
-                    settleRecord.setSplitCode(P3_customerNumber);
-                    settleRecord.setShopOrderId(shopOrderId);
-                    newOrderDao.insertSettleRecord(settleRecord);
-                    // 修改cm_split_account settlestatus
-                    newOrderDao.updateSettleStatus(shopOrderId, 3);
-                }
+                settleRecord.setSettleType(settleFlag);
+                settleRecord.setSettleAmount(settleAmount);
+                settleRecord.setSplitCode(P3_customerNumber);
+                settleRecord.setShopOrderId(shopOrderId);
+                newOrderDao.insertSettleRecord(settleRecord);
+                // 修改cm_split_account settlestatus
+                newOrderDao.updateSettleStatus(shopOrderId, settleFlag);
             }
         }
     }

+ 86 - 2
src/main/java/com/caimei/modules/order/service/SplitAccountService.java

@@ -46,8 +46,8 @@ public class SplitAccountService extends BaseService {
     private CmReportingClubMapper cmReportingClubMapper;
 
     /**
-     *  !!!!注意:分帐时合利宝收费规则为谁分收谁0.1%手续费,这里是供应商承担的,如果要采美,服务商承担各自的费用,要提前计算好!!!
-     *
+     * !!!!注意:分帐时合利宝收费规则为谁分收谁0.1%手续费,这里是供应商承担的,如果要采美,服务商承担各自的费用,要提前计算好!!!
+     * <p>
      * 当前版本分帐逻辑变更,前台传入分帐帐号及金额,直接分帐
      * splits : "E123456,10;E123456,20;E123456,30"
      *
@@ -616,4 +616,88 @@ public class SplitAccountService extends BaseService {
         }
     }
 
+    /**
+     * 根据订单情况给予分账信息提示,返回分帐号;对应分账金额
+     * 1.非服务商模式(供应商+采美分账 /徳玛莉)
+     * 2.服务商模式(供应商+采美+服务商分账 /锦波)
+     *
+     * @param shopOrderId
+     */
+    public CmSplitParams getSplitParams(String shopOrderId) {
+        CmSplitParams params = newOrderDao.findSplitParams(shopOrderId);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(new Date());
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String currentTime = format.format(calendar.getTime());
+        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime, shopOrderId);
+        if (null != params.getProviderId()) {
+            // 服务商
+            params.setSplitType(1);
+        } else {
+            // 非服务商
+            params.setSplitType(2);
+        }
+        getProcedureFee(params, orderRelations);
+        return params;
+    }
+
+    private void getProcedureFee(CmSplitParams params, List<OrderReceiptRelationPo> orderRelations) {
+        /** 总收款手续费
+         *  如存在多次收款,则存在多次手续费,当前业务一般不会出现
+         */
+        AtomicReference<Double> totalReceiveCommission = new AtomicReference<>(0d);
+        orderRelations.forEach(o -> {
+            double splitAmount = o.getAssociateAmount();
+            // 收款手续费
+            double receiveCommission;
+            if (12 == o.getPayType()) {
+                receiveCommission = 10.00;
+            } else if (17 == o.getPayType()) {
+                //b2c 0.2%
+                receiveCommission = MathUtil.mul(splitAmount, 0.002, 2).doubleValue();
+                //b2c最低手续费0.1
+                if (receiveCommission < 0.1) {
+                    receiveCommission = 0.1;
+                }
+            } else if (13 == o.getPayType() || 15 == o.getPayType()) {
+                //微信0.65%
+                receiveCommission = MathUtil.mul(splitAmount, 0.0065, 2).doubleValue();
+            } else if (29 == o.getPayType()) {
+                receiveCommission = MathUtil.mul(splitAmount, 0.003, 2).doubleValue();
+                if (receiveCommission < 0.1) {
+                    receiveCommission = 0.1;
+                }
+            } else if (30 == o.getPayType()) {
+                receiveCommission = MathUtil.mul(splitAmount, 0.006, 2).doubleValue();
+                if (receiveCommission < 0.1) {
+                    receiveCommission = 0.1;
+                }
+            } else {
+                //手续费 支付宝0.25%
+                receiveCommission = MathUtil.mul(splitAmount, 0.0025, 2).doubleValue();
+            }
+            if (MathUtil.compare(receiveCommission, 0.01) <= 0) {
+                receiveCommission = 0.01;
+            }
+            // 收款手续费
+            totalReceiveCommission.set(MathUtil.add(receiveCommission,totalReceiveCommission.get()).doubleValue());
+        });
+        /** todo 当前服务商模式默认 91%供应商,1%采美,8%服务商,后续应该后台加入分配比例,取值自动计算,或者使用商品编辑中的比例分账,在分账页手选服务商分帐号
+         *  todo 当前形式仅支持单商品子订单,未考虑子订单多商品
+         *  这里用订单实付 - 手续费 - 分账金额 * 0.1% - 采美佣金 - 服务商佣金= 供应商结算
+         */
+        Double cmSplitAccount = MathUtil.mul(params.getNeedPayAmount(), 0.01, 2).doubleValue();
+        Double providerSplitAccount = MathUtil.mul(params.getNeedPayAmount(), 0.08, 2).doubleValue();
+        /** 分账手续费 shopSplitCommission **/
+        Double shopSplitCommission = MathUtil.mul(MathUtil.add(cmSplitAccount, providerSplitAccount), 0.001, 2).doubleValue();
+        BigDecimal totalSplit = MathUtil.add(cmSplitAccount, providerSplitAccount);
+        BigDecimal totalCommission = MathUtil.add(totalReceiveCommission.get(), shopSplitCommission);
+        Double shopSplitAccount = MathUtil.sub(params.getNeedPayAmount(), MathUtil.add(totalSplit, totalCommission)).doubleValue();
+
+        params.setCmSplitAccount(cmSplitAccount);
+        params.setProviderSplitAccount(providerSplitAccount);
+        params.setShopSplitAccount(shopSplitAccount);
+        params.setShopCommission(totalReceiveCommission.get());
+        params.setShopSplitCommission(shopSplitCommission);
+    }
 }

+ 6 - 0
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -783,6 +783,12 @@ public class CmPayShopController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList";
     }
 
+    @RequestMapping("new/splitParams")
+    @ResponseBody
+    public CmSplitParams splitParams(String shopOrderId) {
+        CmSplitParams splitParams = splitAccountService.getSplitParams(shopOrderId);
+        return splitParams;
+    }
     @RequestMapping("new/splitEdit")
     @ResponseBody
     public Map<String, Object> splitEdit(String shopOrderId, String splits) {

+ 3 - 0
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -14,6 +14,9 @@ import java.util.List;
 
 @Data
 public class Product extends DataEntity<Product> {
+
+    private Integer zoneId;
+    private Integer supId;
     private String name;
     private String shopName;//供应商名称
     private String validFlag; //0暂存中 1待审核 2已上架 3已下架 8 审核不通过 9已冻结

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

@@ -1,5 +1,6 @@
 package com.caimei.modules.user.dao;
 
+import com.caimei.modules.user.entity.CmProvider;
 import com.caimei.modules.user.entity.CmSaleMan;
 import com.caimei.modules.user.entity.NewCmSp;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
@@ -17,6 +18,7 @@ import java.util.Map;
 @MyBatisDao
 public interface CmSpDao extends CrudDao<NewCmSp> {
 
+    List<CmProvider> findProviders();
     List<NewCmSp> findSpManager();
 
     List<NewCmSp> findSelectList(NewCmSp newCmSp);

+ 9 - 0
src/main/java/com/caimei/modules/user/entity/CmProvider.java

@@ -0,0 +1,9 @@
+package com.caimei.modules.user.entity;
+
+import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
+
+@Data
+public class CmProvider extends DataEntity<CmProvider> {
+    private String name;
+}

+ 1 - 0
src/main/java/com/caimei/modules/user/entity/NewCmSp.java

@@ -10,6 +10,7 @@ public class NewCmSp extends DataEntity<NewCmSp> {
 
 	private static final long serialVersionUID = 1L;
 
+	private Integer providerId;//服务商Id
 	private Integer insiderFlag;//内外部协销标记 0内部协销,1外部协销
 	private Integer serviceProviderID;
 	private Integer userID;		// 对应的userId

+ 2 - 0
src/main/java/com/caimei/modules/user/web/newUser/SpController.java

@@ -581,6 +581,8 @@ public class SpController extends BaseController {
                 newCmSp.setPosition("2");
             }
         }
+        List<CmProvider> providers = cmSpDao.findProviders();
+        model.addAttribute("providers", providers);
         model.addAttribute("newCmSp", newCmSp);
         return "modules/userNew/cmSpEdit";
     }

+ 2 - 2
src/main/resources/config/prod/caimei.properties

@@ -179,8 +179,8 @@ caimei.core=https://core.caimei365.com
 caimei.manager=https://manager.caimei365.com
 
 #\u963F\u91CC\u4E91oss\u5B58\u50A8
-aliyun.accessKeyId=LTAI5tRM3C1pNDuhcSve3MTf
-aliyun.accessKeySecret=soXAFV0elA4InXvarOUO8ZMB2DhZlP
+aliyun.accessKeyId=LTAI5tKMgBnvy7sjmBmtFjit
+aliyun.accessKeySecret=VPFtZvwkfC5OxUDJzCMrq1qx3Zhjj8
 aliyun.bucketName=caimei-oss
 aliyun.endpoint=https://oss-cn-shenzhen.aliyuncs.com
 

+ 2 - 1
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -374,7 +374,8 @@
 		  IFNULL(s.name, u.name) AS name,
 		  IFNULL(s.sname, u.realName) AS sname,
 		  IFNULL(s.contractMobile, u.bindMobile) AS contractMobile,
-		  IFNULL(s.linkMan, u.userName) AS linkMan
+		  IFNULL(s.linkMan, u.userName) AS linkMan,
+		  s.logo
 		FROM
 		  shop s
 		  LEFT JOIN USER u ON u.`shopID` = s.`shopID`

+ 202 - 141
src/main/resources/mappings/modules/newhome/NewPageQualitySupplierMapper.xml

@@ -1,9 +1,9 @@
 <?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.newhome.dao.NewPageQualitySupplierDao">
-    
-	<sql id="newPageQualitySupplierColumns">
-		a.id AS "id",
+
+    <sql id="newPageQualitySupplierColumns">
+        a.id AS "id",
 		a.supplierName AS "supplierName",
 		a.image AS "image",
 		a.link AS "link",
@@ -14,154 +14,215 @@
 		a.createDate AS "createDate",
 		a.updateBy AS "updateBy.id",
 		a.updateDate AS "updateDate",
-		a.delFlag AS "delFlag"
-	</sql>
-
-	<select id="getImage" resultType="NewPageQualitySupplierImage">
-		SELECT *
-		FROM new_page_quality_supplier_image a
-		WHERE a.id = 1
-	</select>
-
-	<select id="get" resultType="NewPageQualitySupplier">
-		SELECT 
-			<include refid="newPageQualitySupplierColumns"/>
-		FROM new_page_quality_supplier a
-		WHERE a.id = #{id}
-	</select>
-	
-	<select id="findList" resultType="NewPageQualitySupplier">
-		SELECT 
-			<include refid="newPageQualitySupplierColumns"/>
-		FROM new_page_quality_supplier a
-		<where>
-			and a.delFlag = 0
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<select id="findAllList" resultType="NewPageQualitySupplier">
-		SELECT 
-			<include refid="newPageQualitySupplierColumns"/>
-		FROM new_page_quality_supplier a
-		<where>
-			
-		</where>		
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-		</choose>
-	</select>
-	
-	<insert id="insert" parameterType="NewPageQualitySupplier"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO new_page_quality_supplier(
-			supplierName,
-			image,
-			link,
-		<if test="sort != null and sort != ''" >
-			sort,
-		</if>
-			wwwEnabledStatus,
-			crmEnabledStatus,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-			#{supplierName},
-			#{image},
-			#{link},
-		<if test="sort != null and sort != ''" >
-			#{sort},
-		</if>
-			#{wwwEnabledStatus},
-			#{crmEnabledStatus},
-			#{createBy.id},
-			#{createDate},
-			#{updateBy.id},
-			#{updateDate},
-			#{delFlag}
-		)
-	</insert>
-
-
-	<insert id="saveImage" parameterType="NewPageQualitySupplierImage"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO new_page_quality_supplier_image(
-		crmImage,
-		wwwImage,
-		crmLink,
-		wwwLink
-		) VALUES (
-		#{crmImage},
-		#{imwwwImageage},
-		#{crmLink},
-		#{wwwLink}
-		)
-	</insert>
-
-
-	<update id="updateImage">
-		UPDATE new_page_quality_supplier_image SET
-		crmImage = #{crmImage},
-		wwwImage = #{wwwImage},
-		crmLink = #{crmLink},
-		wwwLink = #{wwwLink}
-		WHERE id = #{id}
-	</update>
-
-	
-	<update id="update">
-		UPDATE new_page_quality_supplier SET 	
-			supplierName = #{supplierName},
-			image = #{image},
-			link = #{link},
-			sort = #{sort},
-			wwwEnabledStatus = #{wwwEnabledStatus},
-			crmEnabledStatus = #{crmEnabledStatus},
-			createBy = #{createBy.id},
-			createDate = #{createDate},
-			updateBy = #{updateBy.id},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag}
-		WHERE id = #{id}
-	</update>
-
-	<update id="saveSort">
-		UPDATE new_page_quality_supplier SET
-		sort = #{sort}
-		WHERE id = #{id}
-	</update>
-
-
-
-	<delete id="delete">
-		update new_page_quality_supplier set delFlag = 1
-		WHERE id = #{id}
-	</delete>
+		a.delFlag AS "delFlag",
+		a.shopId AS "shopId"
+    </sql>
+
+    <select id="getImage" resultType="NewPageQualitySupplierImage">
+        SELECT *
+        FROM new_page_quality_supplier_image a
+        WHERE a.id = 1
+    </select>
+
+    <select id="get" resultType="NewPageQualitySupplier">
+        SELECT
+        <include refid="newPageQualitySupplierColumns"/>
+        FROM new_page_quality_supplier a
+        WHERE a.id = #{id}
+    </select>
+
+    <select id="findList" resultType="NewPageQualitySupplier">
+        SELECT
+        <include refid="newPageQualitySupplierColumns"/>
+        FROM new_page_quality_supplier a
+        <where>
+            and a.delFlag = 0
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="NewPageQualitySupplier">
+        SELECT
+        <include refid="newPageQualitySupplierColumns"/>
+        FROM new_page_quality_supplier a
+        <where>
+
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findSupplierProducts" resultType="com.caimei.modules.product.entity.Product">
+        SELECT nsp.sort as sortIndex,a.*, s.name as "shopName",nsp.supplierId as supId
+        FROM new_page_quality_supplier_product nsp
+        left join product a on a.productId = nsp.productId
+        left join shop s on a.shopId = s.shopID
+        where nsp.supplierId = #{id}
+          and a.productCategory = 1
+        group by a.productID
+        ORDER BY nsp.sort asc
+    </select>
+    <select id="findProductList" 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 a.shopId = s.shopID
+        left join new_page_quality_supplier_product nsp ON a.productId = nsp.productId
+        <where>
+            nsp.productId is null
+            and
+            copi.validFlag in (2,3,9)
+            <if test="productID !=null and productID !=''">
+                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>
+            and a.productCategory = 1
+        </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 desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <insert id="insert" parameterType="NewPageQualitySupplier" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO new_page_quality_supplier(
+        supplierName,
+        image,
+        link,
+        <if test="sort != null and sort != ''">
+            sort,
+        </if>
+        wwwEnabledStatus,
+        crmEnabledStatus,
+        createBy,
+        createDate,
+        updateBy,
+        updateDate,
+        delFlag,
+        shopId
+        ) VALUES (
+        #{supplierName},
+        #{image},
+        #{link},
+        <if test="sort != null and sort != ''">
+            #{sort},
+        </if>
+        #{wwwEnabledStatus},
+        #{crmEnabledStatus},
+        #{createBy.id},
+        #{createDate},
+        #{updateBy.id},
+        #{updateDate},
+        #{delFlag},
+        #{shopId}
+        )
+    </insert>
+
+
+    <insert id="saveImage" parameterType="NewPageQualitySupplierImage" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO new_page_quality_supplier_image(crmImage,
+                                                    wwwImage,
+                                                    crmLink,
+                                                    wwwLink)
+        VALUES (#{crmImage},
+                #{imwwwImageage},
+                #{crmLink},
+                #{wwwLink})
+    </insert>
+
+    <insert id="addProducts">
+        insert into new_page_quality_supplier_product(productId,supplierId,shopId)
+            values
+        <foreach collection="split" item="item" index="index" separator=",">
+            (#{item},#{id},(select shopId from product where productId = #{item}))
+        </foreach>
+    </insert>
+
+
+    <update id="updateImage">
+        UPDATE new_page_quality_supplier_image
+        SET crmImage = #{crmImage},
+            wwwImage = #{wwwImage},
+            crmLink  = #{crmLink},
+            wwwLink  = #{wwwLink}
+        WHERE id = #{id}
+    </update>
+
+
+    <update id="update">
+        UPDATE new_page_quality_supplier
+        SET supplierName     = #{supplierName},
+            image            = #{image},
+            link             = #{link},
+            sort             = #{sort},
+            wwwEnabledStatus = #{wwwEnabledStatus},
+            crmEnabledStatus = #{crmEnabledStatus},
+            createBy         = #{createBy.id},
+            createDate       = #{createDate},
+            updateBy         = #{updateBy.id},
+            updateDate       = #{updateDate},
+            delFlag          = #{delFlag},
+            shopId           = #{shopId}
+        WHERE id = #{id}
+    </update>
+
+    <update id="saveSort">
+        UPDATE new_page_quality_supplier
+        SET sort = #{sort}
+        WHERE id = #{id}
+    </update>
+
+    <delete id="delete">
+        update new_page_quality_supplier
+        set delFlag = 1
+        WHERE id = #{id}
+    </delete>
+
+    <delete id="delProduct">
+        DELETE
+        FROM new_page_quality_supplier_product
+        WHERE supplierId = #{id}
+          and productId = #{productId}
+    </delete>
 
     <update id="updateEnabledStatusByIds">
         UPDATE new_page_quality_supplier a SET a.wwwEnabledStatus = #{param1}
-        WHERE  a.id IN
-        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
+        WHERE a.id IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
             #{id}
         </foreach>
     </update>
 
     <update id="updateCrmEnabledStatusByIds">
         UPDATE new_page_quality_supplier a SET a.crmEnabledStatus = #{param1}
-        WHERE  a.id IN
-        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
+        WHERE a.id IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
             #{id}
         </foreach>
     </update>
+    <update id="updateSort">
+        update new_page_quality_supplier_product
+        set sort = #{sort}
+        where productId = #{id}
+    </update>
 </mapper>

+ 71 - 0
src/main/resources/mappings/modules/newhome/NewPageRecommendProductMapper.xml

@@ -0,0 +1,71 @@
+<?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.newhome.dao.NewPageRecommendProductDao">
+
+    <insert id="addProducts">
+        insert into cm_page_recommend_product (productId)
+        values
+        <foreach collection="split" item="item" index="index" separator=",">
+            (#{item})
+        </foreach>
+    </insert>
+
+    <update id="updateSorts">
+        update cm_page_recommend_product
+        set sort = #{sort}
+        where productId = #{id}
+    </update>
+
+    <delete id="delProduct">
+        delete from cm_page_recommend_product
+        where productId = #{productId}
+    </delete>
+
+    <select id="findRecommendList" resultType="com.caimei.modules.product.entity.Product">
+        select cpp.sort as sortIndex, p.mainImage, p.name, p.productID, s.name as shopName
+        from cm_page_recommend_product cpp
+        left join product p on cpp.productId = p.productID
+        left join shop s on p.shopId = s.shopId
+        where p.productCategory = 1
+        group by p.productID
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy},cpp.sort asc
+            </when>
+            <otherwise>
+                order by cpp.sort asc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findProductList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT a.mainImage, a.name, a.productID,s.name as "shopName"
+        FROM product a
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        left join shop s on a.shopId = s.shopID
+        left join cm_page_recommend_product nsp ON a.productId = nsp.productId
+        <where>
+            nsp.productId is null
+            and
+            copi.validFlag in (2,3,9)
+            <if test="productID !=null and productID !=''">
+                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>
+            and a.productCategory = 1
+        </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 desc
+            </otherwise>
+        </choose>
+    </select>
+</mapper>

+ 271 - 0
src/main/resources/mappings/modules/newhome/NewPageZoneMapper.xml

@@ -0,0 +1,271 @@
+<?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.newhome.dao.NewPageZoneDao">
+
+    <sql id="NewPageZoneColumns">
+        a.id AS "id",
+		a.floorTitle AS "floorTitle",
+		a.floorDetail AS "floorDetail",
+		a.sort AS "sort",
+		a.wwwEnabledStatus AS "wwwEnabledStatus",
+		a.crmEnabledStatus AS "crmEnabledStatus",
+		a.createBy AS "createBy.id",
+		a.createDate AS "createDate",
+		a.updateBy AS "updateBy.id",
+		a.updateDate AS "updateDate",
+		a.delFlag AS "delFlag"
+    </sql>
+
+    <select id="get" resultType="NewPageZone">
+        SELECT
+        <include refid="NewPageZoneColumns"/>
+        FROM new_page_zone a
+        WHERE a.id = #{id}
+    </select>
+
+    <select id="findList" resultType="NewPageZone">
+        SELECT
+        <include refid="NewPageZoneColumns"/>
+        FROM new_page_zone a
+        <where>
+            delFlag = 0
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findZoneProductList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT npz.sort AS sortIndex, p.mainImage, p.name, p.productID, s.name AS shopName
+        FROM new_page_zone_product npz
+                 LEFT JOIN product p ON npz.productId = p.productID
+                 LEFT JOIN shop s ON p.shopId = s.shopId
+        WHERE p.productCategory = 1
+          AND npz.zoneId = #{zoneId}
+        GROUP BY p.productID
+        ORDER BY npz.sort ASC
+    </select>
+
+    <select id="findProducts" resultType="com.caimei.modules.product.entity.Product">
+        SELECT a.mainImage, a.name, a.productID,s.name as "shopName"
+        FROM product a
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        left join shop s on a.shopId = s.shopID
+        left join new_page_zone_product npz ON a.productId = npz.productId
+        <where>
+            npz.productId is null
+            and
+            copi.validFlag in (2,3,9)
+            <if test="productID !=null and productID !=''">
+                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>
+            and a.productCategory = 1
+        </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 desc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findImageList" resultType="com.caimei.modules.newhome.entity.NewPageZoneImage">
+        select id as imageId,
+               zoneId,
+               image,
+               crmImage,
+               title,
+               crmTitle,
+               link,
+               crmLink,
+               wwwEnabledStatus,
+               crmEnabledStatus,
+               sort
+        from new_page_zone_image
+        where zoneId = #{zoneId}
+    </select>
+
+    <select id="getImage" resultType="com.caimei.modules.newhome.entity.NewPageZoneImage">
+        select id as imageId,
+               zoneId,
+               image,
+               crmImage,
+               title,
+               crmTitle,
+               link,
+               crmLink,
+               wwwEnabledStatus,
+               crmEnabledStatus,
+               sort
+        from new_page_zone_image
+        where id = #{imageId}
+    </select>
+
+
+    <insert id="insert" parameterType="NewPageZone" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO new_page_zone(
+        floorTitle,
+        floorDetail,
+        <if test="sort != null and sort != ''">
+            sort,
+        </if>
+        wwwEnabledStatus,
+        crmEnabledStatus,
+        createBy,
+        createDate,
+        updateBy,
+        updateDate,
+        delFlag
+        ) VALUES (
+        #{floorTitle},
+        #{floorDetail},
+        <if test="sort != null and sort != ''">
+            #{sort},
+        </if>
+        #{wwwEnabledStatus},
+        #{crmEnabledStatus},
+        #{createBy.id},
+        #{createDate},
+        #{updateBy.id},
+        #{updateDate},
+        #{delFlag}
+        )
+    </insert>
+
+    <insert id="addProducts">
+        insert into new_page_zone_product (zoneId,productId)
+        values
+        <foreach collection="split" item="item" index="index" separator=",">
+            (#{zoneId},#{item})
+        </foreach>
+    </insert>
+
+    <insert id="saveImage">
+        insert into new_page_zone_image(id, zoneId, image, crmImage, title, crmTitle, link, crmLink, wwwEnabledStatus,
+                                        crmEnabledStatus, sort)
+        values (#{imageId}, #{zoneId}, #{image}, #{crmImage}, #{title},
+                #{crmTitle},
+                #{link},
+                #{crmLink},
+                #{wwwEnabledStatus},
+                #{crmEnabledStatus},
+                #{sort})
+    </insert>
+
+    <update id="update">
+        UPDATE new_page_zone
+        SET floorTitle       = #{floorTitle},
+            floorDetail      = #{floorDetail},
+            sort             = #{sort},
+            wwwEnabledStatus = #{wwwEnabledStatus},
+            crmEnabledStatus = #{crmEnabledStatus},
+            createBy         = #{createBy.id},
+            createDate       = #{createDate},
+            updateBy         = #{updateBy.id},
+            updateDate       = #{updateDate},
+            delFlag          = #{delFlag}
+        WHERE id = #{id}
+    </update>
+
+    <delete id="delete">
+        UPDATE new_page_zone
+        SET delFlag = 1
+        WHERE id = #{id}
+    </delete>
+
+    <delete id="delProduct">
+        delete
+        from new_page_zone_product
+        where productId = #{productId}
+          and zoneId = #{zoneId}
+    </delete>
+
+    <delete id="delProducts">
+        delete
+        from new_page_zone_product
+        where zoneId = #{id}
+    </delete>
+    <delete id="delImages">
+        delete
+        from new_page_zone_image
+        where zoneId = #{id}
+    </delete>
+
+    <delete id="deleteImage">
+        delete
+        from new_page_zone_image
+        where id = #{imageId}
+    </delete>
+
+    <update id="updateEnabledStatusByIds">
+        UPDATE new_page_zone a SET a.wwwEnabledStatus = #{param1}
+        WHERE a.id IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <update id="updateCrmEnabledStatusByIds">
+        UPDATE new_page_zone a SET a.crmEnabledStatus = #{param1}
+        WHERE a.id IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <update id="saveSort">
+        UPDATE new_page_zone_product
+        SET sort = #{sort}
+        WHERE zoneId = #{zoneId}
+          and productId = #{id}
+    </update>
+
+    <update id="updateImage">
+        update new_page_zone_image
+        set image           = #{image},
+            crmImage=#{crmImage},
+            title=#{title},
+            crmTitle=#{crmTitle},
+            link=#{link},
+            crmLink=#{crmLink},
+            wwwEnabledStatus=#{wwwEnabledStatus},
+            crmEnabledStatus=#{crmEnabledStatus},
+            sort=#{sort}
+        where id = #{imageId}
+    </update>
+
+    <update id="updateImageCrmEnabledStatusByIds">
+        UPDATE new_page_zone_image a SET a.crmEnabledStatus = #{crmEnabledStatus}
+        WHERE a.id IN
+        <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <update id="updateImageEnabledStatusByIds">
+        UPDATE new_page_zone_image a SET a.wwwEnabledStatus = #{enabledStatus}
+        WHERE a.id IN
+        <foreach collection="ids" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <update id="updateImageSort">
+        UPDATE new_page_zone_image
+        set sort = #{sort}
+        where id = #{id}
+    </update>
+
+</mapper>

+ 23 - 2
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -1038,7 +1038,8 @@
 
     <update id="updateShopOrderSettleStatus">
         update cm_shop_order
-        set settleStatus = #{settleStatus}
+        set settleStatus = #{settleStatus},
+            payStatus = 3
         where shopOrderId = #{shopOrderId}
     </update>
 
@@ -2101,12 +2102,28 @@
         limit 0,1
     </select>
     <select id="findSplitAccounts" resultType="com.caimei.modules.order.entity.CmSettleVo">
-        SELECT productType,subUserNo,splitAccount
+        SELECT productType,subUserNo,splitAccount,orderId
         FROM cm_split_account
         where shopOrderId = #{shopOrderId}
         and payStatus = 1
         and settleStatus = 0
     </select>
+    <select id="findSplitParams" resultType="com.caimei.modules.order.entity.CmSplitParams">
+        SELECT cso.shopOrderId,
+               cso.splitCode AS shopSplitCode,
+               cso.clubId,
+               sp.providerId,
+               cp.splitCode AS providerSplitCode,
+               c.name AS clubName,
+               sp.name AS spName,
+               cp.name AS cpName,
+               cso.needPayAmount
+        FROM cm_shop_order cso
+        LEFT JOIN club c ON cso.clubId = c.clubId
+        LEFT JOIN serviceprovider sp ON c.spId = sp.serviceProviderId
+        LEFT JOIN cm_providers cp ON sp.providerId = cp.id
+        WHERE cso.shopOrderId = #{shopOrderId}
+    </select>
 
     <insert id="addCmOrder" parameterType="com.caimei.modules.order.entity.NewOrder" useGeneratedKeys="true" keyProperty="orderID">
         insert into cm_order
@@ -2326,6 +2343,10 @@
             #{orderID}
         </foreach>
     </update>
+    <update id="updateOrderPayStatus">
+        update cm_order set payStatus = 3
+        where orderId = #{orderId}
+    </update>
 
     <delete id="delCmOrderByOrderID" parameterType="String">
         delete

+ 3 - 1
src/main/webapp/WEB-INF/views/modules/coupon/toAddShop.jsp

@@ -28,7 +28,8 @@
                 "name": shop.name,
                 "sname": shop.sname,
                 "linkMan": shop.linkMan,
-                "contractMobile": shop.contractMobile
+                "contractMobile": shop.contractMobile,
+                "logo":shop.logo
             };
             return items;
         }
@@ -94,6 +95,7 @@
                 <td>${item.sname}</td>
                 <td>${item.linkMan}</td>
                 <td>${item.contractMobile}</td>
+                <td hidden>${item.logo}</td>
             </tr>
         </c:forEach>
     </c:if>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/newhome/newPageHomeimageForm.jsp

@@ -59,7 +59,7 @@
 				<sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
 			</div>
 			<div class="controls" style="padding-top: 20px;">
-				<p style="color:#D0D0D0 ;">建议尺寸:1920 * 510 / PX</p>
+				<p style="color:#D0D0D0 ;">建议尺寸:500*469 / PX</p>
 			</div>
 		</div>
 		<div class="control-group">

+ 185 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newPageProductList.jsp

@@ -0,0 +1,185 @@
+<%@ 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;
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+
+        //选择添加商品
+        function showSelect() {
+            //获取选中的组合
+            var id = $(".supId").val();
+            top.$.jBox("iframe:${ctx}/newhome/newPageQualitySupplier/toAddProduct?supId=" + id, {
+                iframeScrolling: 'yes',
+                width: $(top.document).width() - 400,
+                height: $(top.document).height() - 160,
+                persistent: true,
+                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();//获取到的数据格式:(含有参数序号拼接,使用数组传入)1o,2e,3t,4y,5u,6p
+                        if (items.length > 0) {
+                            //添加数据
+                            $.post("${ctx}/newhome/newPageQualitySupplier/saveAddProduct",
+                                {"productIds": items, "id": id},
+                                function (data) {
+                                    if (true == data.success) {
+                                        window.location.href = "${ctx}/newhome/newPageQualitySupplier/product?id=" + id;
+                                        $.jBox.tip(data.msg, 'info');
+                                    } else {
+                                        $.jBox.tip(data.msg, 'error');
+                                    }
+                                }, "JSON");//这里返回的类型有:json,html,xml,text
+                            return true;
+                        } else {
+                            top.$.jBox.tip("请先勾选商品...");
+                            return false;
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+
+        //批量保存排序
+        function batchSaveSort() {
+            var items = new Array();
+            var $items = $('.check-item');
+            $items.each(function () {
+                items.push($(this).val());
+            });
+            //保存批量排序
+            $.post("${ctx}/newhome/newPageQualitySupplier/batchSaveSorts?newProducSorttList=" + items, function (data) {
+                if (true == data.success) {
+                    $.jBox.tip(data.msg, 'info');
+                    setInterval(g, 1000);
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        function g() {
+            window.location.href = "${ctx}/newhome/newPageQualitySupplier/product?id=${newPageQualitySupplier.id}";//刷新页面
+        }
+
+        //修改排序值
+        function changeSort(id,sortThis) {
+            var value = sortThis.value;
+            $("#sort"+id).val(id+"-"+value);
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/newhome/newPageQualitySupplier/">优质供应商列表</a></li>
+    <li class="active"><a
+            href="${ctx}/newhome/newPageQualitySupplier/product?id=${newPageQualitySupplier.id}">优质供应商商品列表</a></li>
+</ul>
+<div class="ul-form">
+    <input type="button" class="btn btn-primary" value="添加商品" onclick="showSelect()"/>&nbsp&nbsp&nbsp
+    <c:if test="${not empty productList}">
+        <input type="button" class="btn btn-primary" value="保存排序" onclick="batchSaveSort()"/>
+    </c:if>
+    <br><font color="#a9a9a9">&nbsp;&nbsp;&nbsp;排序规则:按照排序数值升序排列,数值越小排序越靠前,排序值允许重复。</font>
+    <div class="clearfix"></div>
+</div>
+<input type="hidden" class="supId" value="${newPageQualitySupplier.id}">
+<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>
+    </tr>
+    </thead>
+    <c:if test="${not empty productList}">
+        <c:forEach items="${productList}" var="product">
+            <tbody>
+            <tr>
+                <input class="check-item" type="hidden" id="sort${product.productID}"
+                       value='${product.productID}-${product.sortIndex}'/>
+                <td>
+                        ${product.productID}
+                </td>
+                <td><img src="${product.mainImage}" width="50px" height="50px"></td>
+                <td>
+                    <a href="https://www.caimei365.com/product-${product.productID}.html"
+                       target="_blank">${product.name}</a>
+                    <font color="red">
+                        <c:if test="${product.validFlag eq 9}">
+                            (已隐身)
+                        </c:if>
+                        <c:if test="${product.validFlag eq 3}">
+                            (已下架)
+                        </c:if>
+                        <c:if test="${product.validFlag eq 0}">
+                            (已删除)
+                        </c:if>
+                        <c:if test="${product.validFlag eq 1}">
+                            (待审核)
+                        </c:if>
+                        <c:if test="${product.validFlag eq 8}">
+                            (审核未通过)
+                        </c:if>
+                    </font>
+                </td>
+                <td>
+                        ${product.shopName}
+                </td>
+                <td>
+                    <input id="sort" name="sort" style="width:50px;" value="${product.sortIndex}"
+                           onkeyup="onlynum(this)"  onchange="changeSort(${product.productID},this)">
+                </td>
+                <td>
+                    <a href="${ctx}/newhome/newPageQualitySupplier/productDel?id=${newPageQualitySupplier.id}&productId=${product.productID}"
+                       onclick="return confirmx('确认删除吗?', this.href)">删除</a>
+                </td>
+            </tr>
+            </tbody>
+        </c:forEach>
+    </c:if>
+</table>
+<c:if test="${empty productList}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 140 - 82
src/main/webapp/WEB-INF/views/modules/newhome/newPageQualitySupplierForm.jsp

@@ -1,93 +1,151 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>优质供应商管理</title>
-	<meta name="decorator" content="default"/>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			//$("#name").focus();
-			$("#inputForm").validate({
-				submitHandler: function(form){
+    <title>优质供应商管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var shopId = $("#shopId").val();
+                    if (shopId != undefined && shopId.trim() != "" && shopId != 0) {
+                        console.log(shopId);
+                    } else {
+                        alertx("请选择供应商!");
+                        return;
+                    }
                     var image = $("#image").val();
-                    if(image != undefined && image.trim() != ""){
+                    if (image != undefined && image.trim() != "") {
                         loading('正在提交,请稍等...');
                         form.submit();
-					}else{
-                     	alertx("请先选择图片!");
-					}
-				},
-				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>
+                    } else {
+                        alertx("请先选择图片!");
+                    }
+                },
+                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 showSelect() {
+            var url = "${ctx}/coupon/cmCoupon/toAddShop";
+            var title = '';
+            title = "选择供应商";
+            top.$.jBox("iframe:" + url, {
+                iframeScrolling: 'yes',
+                width: $(top.document).width() - 400,
+                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();
+                        console.log(items);
+                        appendShopOrderHead(items);
+                    }
+                    return true;
+                }
+            });
+        }
+
+        function appendShopOrderHead(data) {
+            $("#shopId").val(data.shopId);
+            $("#supplierName").val(data.name);
+            $("#image").val(data.logo);
+            var link = "https://www.caimei365.com/supplier-" + data.shopId + ".html";
+            $("#link").val(link);
+        }
+    </script>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/newhome/newPageQualitySupplier/">优质供应商列表</a></li>
-		<li class="active"><a href="${ctx}/newhome/newPageQualitySupplier/form?id=${newPageQualitySupplier.id}">优质供应商<shiro:hasPermission name="newhome:newPageQualitySupplier:edit">${not empty newPageQualitySupplier.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission name="newhome:newPageQualitySupplier:edit">查看</shiro:lacksPermission></a></li>
-		<shiro:hasPermission name="newhome:newPageQualitySupplier:edit"><li><a href="${ctx}/newhome/newPageQualitySupplier/formImage?id=1">供应商广告图添加</a></li></shiro:hasPermission>
-	</ul><br/>
-	<form:form id="inputForm" modelAttribute="newPageQualitySupplier" action="${ctx}/newhome/newPageQualitySupplier/save" method="post" class="form-horizontal">
-		<form:hidden path="id"/>
-		<sys:message content="${message}"/>
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>供应商名称:</label>
-			<div class="controls">
-				<form:input path="supplierName" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>供应商图片:</label>
-			<div class="controls">
-				<form:hidden  id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
-				<sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-			</div>
-			<div class="controls" style="padding-top: 20px;">
-                <p style="color:#D0D0D0 ;">建议尺寸:134px*134px</p>
-			</div>
-		</div>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/newhome/newPageQualitySupplier/">优质供应商列表</a></li>
+    <li class="active"><a
+            href="${ctx}/newhome/newPageQualitySupplier/form?id=${newPageQualitySupplier.id}">优质供应商<shiro:hasPermission
+            name="newhome:newPageQualitySupplier:edit">${not empty newPageQualitySupplier.id?'编辑':'添加'}</shiro:hasPermission><shiro:lacksPermission
+            name="newhome:newPageQualitySupplier:edit">查看</shiro:lacksPermission></a></li>
+    <shiro:hasPermission name="newhome:newPageQualitySupplier:edit">
+        <li><a href="${ctx}/newhome/newPageQualitySupplier/formImage?id=1">供应商广告图添加</a></li>
+    </shiro:hasPermission>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="newPageQualitySupplier" action="${ctx}/newhome/newPageQualitySupplier/save"
+           method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="shopId"/>
+    <sys:message content="${message}"/>
+    <%--关联供应商--%>
+    <div class="control-group">
+        <label class="control-label"><a href="JavaScript:;" onclick="showSelect()">请选择供应商</a></label>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>供应商名称:</label>
+        <div class="controls">
+            <form:input path="supplierName" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>供应商图片:</label>
+        <div class="controls">
+            <form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+            <sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
+                          maxHeight="100"/>
+        </div>
+        <div class="controls" style="padding-top: 20px;">
+            <p style="color:#D0D0D0 ;">建议尺寸:134px*134px</p>
+        </div>
+    </div>
 
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>链接:</label>
-			<div class="controls">
-				<form:input path="link" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
-			<div class="controls">
-				<form:input path="sort" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
-			</div>
-		</div>
-		<div class="control-group crmstatus" style="" >
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>小程序端状态:</label>
-			<div class="controls">
-				<form:select path="crmEnabledStatus" class="input-xlarge ">
-					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" />
-				</form:select>
-			</div>
-		</div>
-		<div class="control-group crmstatus" style="" >
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>PC端状态:</label>
-			<div class="controls">
-				<form:select path="wwwEnabledStatus" class="input-xlarge ">
-					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" />
-				</form:select>
-			</div>
-		</div>
-		<div class="form-actions">
-			<shiro:hasPermission name="newhome:newPageQualitySupplier:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
-			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
-		</div>
-	</form:form>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>链接:</label>
+        <div class="controls">
+            <form:input path="link" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
+        <div class="controls">
+            <form:input path="sort" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group crmstatus" style="">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>小程序端状态:</label>
+        <div class="controls">
+            <form:select path="crmEnabledStatus" class="input-xlarge ">
+                <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+                              htmlEscape="false"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="control-group crmstatus" style="">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>PC端状态:</label>
+        <div class="controls">
+            <form:select path="wwwEnabledStatus" class="input-xlarge ">
+                <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+                              htmlEscape="false"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="form-actions">
+        <shiro:hasPermission name="newhome:newPageQualitySupplier:edit"><input id="btnSubmit" class="btn btn-primary"
+                                                                               type="submit"
+                                                                               value="保 存"/>&nbsp;</shiro:hasPermission>
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
 </body>
 </html>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newPageQualitySupplierList.jsp

@@ -154,6 +154,7 @@
 
 				<shiro:hasPermission name="newhome:newPageQualitySupplier:edit"><td>
     				<a href="${ctx}/newhome/newPageQualitySupplier/form?id=${newPageQualitySupplier.id}">编辑</a>
+    				<a href="${ctx}/newhome/newPageQualitySupplier/product?id=${newPageQualitySupplier.id}">商品编辑</a>
     				<shiro:hasPermission name="newhome:newPageQualitySupplier:delete">
 					<a href="${ctx}/newhome/newPageQualitySupplier/delete?id=${newPageQualitySupplier.id}" onclick="return confirmx('确定删除吗?删除后不可恢复!', this.href)">删除</a>
 					</shiro:hasPermission>

+ 76 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newPageZoneForm.jsp

@@ -0,0 +1,76 @@
+<%@ 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() {
+			//$("#name").focus();
+			$("#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}/newhome/newPageZone/">专区管理列表</a></li>
+		<li class="active"><a href="${ctx}/newhome/newPageZone/form?id=${newPageZone.id}">专区管理${not empty newPageZone.id?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="newPageZone" action="${ctx}/newhome/newPageZone/save" method="post" class="form-horizontal">
+		<form:hidden path="id"/>
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>专区标题:</label>
+			<div class="controls">
+				<form:input path="floorTitle" htmlEscape="false" maxlength="10" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>专区描述:</label>
+			<div class="controls">
+				<form:input path="floorDetail" htmlEscape="false" maxlength="30" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
+			<div class="controls">
+				<form:input path="sort" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
+			</div>
+		</div>
+		<div class="control-group crmstatus" style="" >
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>网站状态:</label>
+			<div class="controls">
+				<form:select path="wwwEnabledStatus" class="input-xlarge required">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"  />
+				</form:select>
+			</div>
+		</div>
+		<div class="control-group crmstatus" style="" >
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>小程序状态:</label>
+			<div class="controls">
+				<form:select path="crmEnabledStatus" class="input-xlarge required">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"  />
+				</form:select>
+			</div>
+		</div>
+		<div class="form-actions">
+			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
+			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+		</div>
+	</form:form>
+</body>
+</html>

+ 191 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newPageZoneList.jsp

@@ -0,0 +1,191 @@
+<%@ 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;
+        }
+
+        //PC端状态修改
+        function updateEnabledStatus(status, ids) {
+            var msg = '确定启用该专区吗?';
+            if ('0' == status) {
+                msg = '确定停用该专区吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/newhome/newPageZone/updateEnabledStatus", {
+                        'enabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        window.location = "${ctx}/newhome/newPageZone/";
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+
+        //CRM端状态修改
+        function updateCrmEnabledStatusByIds(status, ids) {
+            var msg = '确定启用该专区吗?';
+            if ('0' == status) {
+                msg = '确定停用该专区吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/newhome/newPageZone/updateCrmEnabledStatusByIds", {
+                        'crmEnabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        window.location = "${ctx}/newhome/newPageZone/";
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        //批量保存排序
+        function batchSaveSort() {
+            var items = new Array();
+            var $items = $('.check-item');
+            $items.each(function () {
+                items.push($(this).val());
+            });
+            //保存批量排序
+            $.post("${ctx}/newhome/newPageZone/batchSaveSort?sortList=" + items, function (data) {
+                if (true == data.success) {
+                    $.jBox.tip(data.msg, 'info');
+                    window.location.href = "${ctx}/newhome/newPageZone";
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        //修改排序值
+        function changeSort(id, sortThis) {
+            var value = sortThis.value;
+            $("#preferredProductSort" + id).val(id + "-" + value);
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/newhome/newPageZone/">专区管理列表</a></li>
+</ul>
+<form:form action="" class="breadcrumb form-search">
+    <input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
+    <input class="btn btn-primary" style="width: 70px" onclick="window.location='${ctx}/newhome/newPageZone/form'"
+           value="添加专区"/>
+    <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="newPageZone">
+        <tr>
+            <input class="check-item" type="hidden" id="preferredProductSort${newPageZone.id}"
+                   value='${newPageZone.id}-${newPageZone.sort}'/>
+            <td>${newPageZone.id}</td>
+            <td>${newPageZone.floorTitle}</td>
+            <td>${newPageZone.floorDetail}</td>
+            <td>
+                <c:if test="${newPageZone.wwwEnabledStatus eq 1 }">
+                    <font color="green">已启用</font>
+                    <a href="javascript:void(0);" onclick="updateEnabledStatus('0','${newPageZone.id}');">
+                        停用
+                    </a>
+                </c:if>
+                <c:if test="${newPageZone.wwwEnabledStatus ne 1 }">
+                    <font color="red">已停用</font>
+                    <a href="javascript:void(0)" onclick="updateEnabledStatus('1','${newPageZone.id}');">
+                        启用
+                    </a>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${newPageZone.crmEnabledStatus eq 1 }">
+                    <font color="green">已启用</font>
+                    <a href="javascript:void(0);" onclick="updateCrmEnabledStatusByIds('0','${newPageZone.id}');">
+                        停用
+                    </a>
+                </c:if>
+                <c:if test="${newPageZone.crmEnabledStatus ne 1 }">
+                    <font color="red">已停用</font>
+                    <a href="javascript:void(0)" onclick="updateCrmEnabledStatusByIds('1','${newPageZone.id}');">
+                        启用
+                    </a>
+                </c:if>
+            </td>
+            <td>
+                <input type="text" id="sort" name="sort" style="width:50px;" value="${newPageZone.sort}"
+                       onkeyup="onlynum(this)" onchange="changeSort(${newPageZone.id},this)">
+            </td>
+            <td><fmt:formatDate value="${newPageZone.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+            <td>
+                <a href="${ctx}/newhome/newPageZone/form?id=${newPageZone.id}">编辑</a>
+                <a href="${ctx}/newhome/newPageZone/productList?zoneId=${newPageZone.id}">专区商品</a>
+                <a href="${ctx}/newhome/newPageZone/imageList?zoneId=${newPageZone.id}">专区轮播图</a>
+
+                <a href="${ctx}/newhome/newPageZone/delete?id=${newPageZone.id}"
+                   onclick="return confirmx('确定删除该专区吗?', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 162 - 0
src/main/webapp/WEB-INF/views/modules/newhome/recommendProductList.jsp

@@ -0,0 +1,162 @@
+<%@ 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;
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+
+        //选择添加商品
+        function showSelect(){
+        //获取选中的组合
+        var id=$("#id option:selected").val();
+            top.$.jBox("iframe:${ctx}/newhome/recommendProduct/toAddProduct", {
+                iframeScrolling:'yes',
+                width: $(top.document).width()-400,
+                height: $(top.document).height()-160,
+                persistent: true,
+                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();//获取到的数据格式:(含有参数序号拼接,使用数组传入)1o,2e,3t,4y,5u,6p
+                        if(items.length>0){
+                            //添加数据
+                            $.post("${ctx}/newhome/recommendProduct/saveAddProduct",{
+                                "productIds":items,"id":id}, function(data) {
+                                if(true==data.success){
+                                    window.location.href = "${ctx}/newhome/recommendProduct/list";
+                                    $.jBox.tip(data.msg, 'info');
+                                } else {
+                                    $.jBox.tip(data.msg,'error');
+                                }
+                            },"JSON");//这里返回的类型有:json,html,xml,text
+                            return true;
+                        }else{
+                            top.$.jBox.tip("请先勾选商品...");
+                            return false;
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+
+        //批量保存排序
+        function batchSaveSort() {
+            var items = new Array();
+            var $items = $('.check-item');
+            $items.each(function(){
+                items.push($(this).val());
+            });
+            //保存批量排序
+            $.post("${ctx}/newhome/recommendProduct/batchSaveSort?newProducSorttList="+items, function(data) {
+                if(true==data.success){
+                    $.jBox.tip(data.msg, 'info');
+                    setInterval(g,1000);
+                } else {
+                    $.jBox.tip(data.msg,'error');
+                }
+            },"JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        function g()
+        {
+            window.location.href="${ctx}/newhome/recommendProduct/list";//刷新页面
+        }
+
+        //修改排序值
+        function changeSort(id,sortThis) {
+            var value = sortThis.value;
+            $("#sort"+id).val(id+"-"+value);
+        }
+
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li class="active"><a href="${ctx}/newhome/recommendProduct/list">推荐商品列表</a></li>
+	</ul>
+	<form:form id="searchForm" action="${ctx}/newhome/recommendProduct/list" 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">
+			  <input type="button" class="btn btn-primary" value="添加商品" onclick="showSelect()"/>&nbsp&nbsp&nbsp
+              <c:if test="${not empty page.list}">
+                    <input type="button" class="btn btn-primary" value="批量排序" onclick="batchSaveSort()"/>
+              </c:if>
+              <br><font color="#a9a9a9">&nbsp;&nbsp;&nbsp;排序规则:按照排序数值升序排列,数值越小排序越靠前,排序值允许重复。</font>
+			<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>
+			</tr>
+		</thead>
+		<c:if test="${not empty page.list}">
+            <c:forEach items="${page.list}" var="product">
+            <tbody>
+                <tr>
+                	<input class="check-item" type="hidden" id="sort${product.productID}"
+                       value='${product.productID}-${product.sortIndex}'/>
+                    <td>
+                        ${product.productID}
+                    </td>
+                    <td><img src="${product.mainImage}" width="50px" height="50px"></td>
+                    <td>
+                        <a href="https://www.caimei365.com/product-${product.productID}.html" target="_blank">${product.name}</a>
+                    </td>
+                    <td>
+                        ${product.shopName}
+                    </td>
+                    <td>
+                        <input id="sort" name="sort" style="width:50px;" value="${product.sortIndex}"
+                           onkeyup="onlynum(this)" onchange="changeSort(${product.productID},this)">
+                    </td>
+                    <td>
+                        <a href="${ctx}/newhome/recommendProduct/deleteProduct?productId=${product.productID}" onclick="return confirmx('确认删除吗?', this.href)">删除</a>
+                    </td>
+                </tr>
+			</tbody>
+		</c:forEach>
+        </c:if>
+	</table>
+	<c:if test="${empty page.list}">
+            <p style="text-align: center;"><font  color="#1e90ff">暂无数据……</font></p>
+    </c:if>
+	<div class="pagination">${page}</div>
+</body>
+</html>

+ 127 - 0
src/main/webapp/WEB-INF/views/modules/newhome/toSelectProduct.jsp

@@ -0,0 +1,127 @@
+<%@ 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 () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            show_title(30);
+
+//			反选
+            $('body').on('click', 'input[name="info"]', function () {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle = $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if (allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems() {
+            var items = "";
+            var $items = $('.check-item:checked');
+            $items.each(function () {
+                //通过拿到的商品ID串(逗号隔开)
+                var productID = $(this).val();
+                items = items + productID + ","
+            });
+            items = items.substring(0, items.length - 1);
+            return items;
+        }
+
+        function allCkbfun(ckb) {
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product"
+           action="${ctx}/newhome/newPageQualitySupplier/toAddProduct?supId=${product.supId}" method="post"
+           class="breadcrumb form-search">
+    <input id="supId" name="supId" type="hidden" value="${product.supId}"/>
+    <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="productID" htmlEscape="false" maxlength="10" class="input-mini" onchange="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="productName" 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;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></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">
+            <tr id="${item.productID}" class="itemtr">
+                    <%--已过滤添加过的商品和未上架的商品--%>
+                <th>
+                    <input class="check-item" type="checkbox" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+            </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>
+</body>
+</html>

+ 126 - 0
src/main/webapp/WEB-INF/views/modules/newhome/toSelectRecommendProduct.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 td i {
+            margin: 0 2px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            show_title(30);
+
+//			反选
+            $('body').on('click', 'input[name="info"]', function () {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle = $('.check-all');
+//			    判断选中长度和总长度,如果相等就是全选否则取消全选
+                if (allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems() {
+            var items = "";
+            var $items = $('.check-item:checked');
+            $items.each(function () {
+                //通过拿到的商品ID串(逗号隔开)
+                var productID = $(this).val();
+                items = items + productID + ","
+            });
+            items = items.substring(0, items.length - 1);
+            return items;
+        }
+
+        function allCkbfun(ckb) {
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product"
+           action="${ctx}/newhome/recommendProduct/toAddProduct" 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="productID" htmlEscape="false" maxlength="10" class="input-mini" onchange="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="productName" 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;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></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">
+            <tr id="${item.productID}" class="itemtr">
+                    <%--已过滤添加过的商品和未上架的商品--%>
+                <th>
+                    <input class="check-item" type="checkbox" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+            </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>
+</body>
+</html>

+ 123 - 0
src/main/webapp/WEB-INF/views/modules/newhome/toSelectZoneProduct.jsp

@@ -0,0 +1,123 @@
+<%@ 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 () {
+            //弹出框去滚动条
+            top.$('#jbox-content').css("overflow-y", "hidden");
+            $('body').on('click', 'input[name="info"]', function () {
+                var allInputLength = $('input[name="info"]').length - $('input[name="info"]:disabled').length,
+                    allInputCheckedLength = $('input[name="info"]:checked').length,
+                    checkAllEle = $('.check-all');
+                if (allInputLength === allInputCheckedLength) {
+                    checkAllEle.attr('checked', true);
+                } else {
+                    checkAllEle.attr('checked', false);
+                }
+            })
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        function getCheckedItems() {
+            var items = "";
+            var $items = $('.check-item:checked');
+            $items.each(function () {
+                //通过拿到的商品ID串(逗号隔开)
+                var productID = $(this).val();
+                items = items + productID + ","
+            });
+            items = items.substring(0, items.length - 1);
+            return items;
+        }
+
+        function allCkbfun(ckb) {
+            var isChecked = ckb.checked;
+            $(".check-item").attr('checked', isChecked);
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字和两位小数(金额)
+         */
+        function num(obj) {
+            obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+            obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+            obj.value = obj.value.replace(/\.{2,}/g, "."); //只保留第一个, 清除多余的
+            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+            obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        }
+
+    </script>
+</head>
+<body>
+<form:form id="searchForm" modelAttribute="product"
+           action="${ctx}/newhome/newPageQualitySupplier/toAddProduct?zoneId=${product.zoneId}" method="post"
+           class="breadcrumb form-search">
+    <input id="zoneId" name="zoneId" type="hidden" value="${product.zoneId}"/>
+    <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="productID" htmlEscape="false" maxlength="10" class="input-mini" onchange="onlynum(this)"/>
+        <label>商品名称:</label>
+        <form:input path="productName" 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;"><input class="check-all" type="checkbox" onclick="allCkbfun(this);"/></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">
+            <tr id="${item.productID}" class="itemtr">
+                    <%--已过滤添加过的商品和未上架的商品--%>
+                <th>
+                    <input class="check-item" type="checkbox" name="info" value='${item.productID}'/>
+                </th>
+                <td>${item.productID}</td>
+                <td><img src="${item.mainImage}" width="50px" height="50px"></td>
+                <td>${item.name}</td>
+                <td>${item.shopName}</td>
+            </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>
+</body>
+</html>

+ 124 - 0
src/main/webapp/WEB-INF/views/modules/newhome/zoneImageForm.jsp

@@ -0,0 +1,124 @@
+<%@ 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() {
+			//$("#name").focus();
+			$("#inputForm").validate({
+				submitHandler: function(form){
+                    var image = $("#image").val();
+                    if(image != undefined && image.trim() != ""){
+                        loading('正在提交,请稍等...');
+                        form.submit();
+                    }else {
+                        alertx("请先选择PC端图!");
+                    }
+				},
+				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 clearChar(obj) {
+            obj.value = obj.value.replace(",", "");
+            obj.value = obj.value.replace(",", "");
+        };
+	</script>
+</head>
+<body>
+	<ul class="nav nav-tabs">
+		<li><a href="${ctx}/newhome/newPageZone/imageList?imageId=${zoneImage.zoneId}">专区轮播图列表</a></li>
+		<li class="active"><a href="${ctx}/newhome/newPageZone/imageForm?zoneId=${zoneImage.zoneId}">专区轮播图${not empty zoneImage.zoneId?'编辑':'添加'}</a></li>
+	</ul><br/>
+	<form:form id="inputForm" modelAttribute="zoneImage" action="${ctx}/newhome/newPageZone/imageSave" method="post" class="form-horizontal">
+		<form:hidden path="imageId"/>
+		<form:hidden path="zoneId"/>
+		<sys:message content="${message}"/>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>标题:</label>
+			<div class="controls">
+				<form:input path="title" htmlEscape="false" maxlength="40" class="input-xlarge required" onkeyup="clearChar(this)" />
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="required"><font color="red">*</font> </span>PC端图:</label>
+			<div class="controls">
+				<form:hidden id="image" path="image" htmlEscape="false" value="${image}" maxlength="255" class="input-xlarge required"/>
+				<sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+			</div>
+			<div class="controls" style="padding-top: 20px;">
+				<p style="color:#D0D0D0 ;">建议尺寸:1920 * 510 / PX</p>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="required"><font color="red">*</font> </span>PC端链接:</label>
+			<div class="controls">
+				<form:input path="link" htmlEscape="false" maxlength="255" class="input-xlarge required url"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">小程序端图:</label>
+			<div class="controls">
+				<form:hidden id="crmImage" path="crmImage" htmlEscape="false"  value="${crmImage}" maxlength="255" class="input-xlarge"/>
+				<sys:ckfinder input="crmImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
+			</div>
+			<div class="controls" style="padding-top: 20px;">
+				<p style="color:#D0D0D0 ;">建议尺寸:702 * 280 / PX</p>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">小程序端链接:</label>
+			<div class="controls">
+				<form:input path="crmLink" htmlEscape="false" maxlength="255" class="input-xlarge url"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label">小程序页面title:</label>
+			<div class="controls">
+				<form:input path="crmTitle" placeholder="最多输入15个汉字" htmlEscape="false" maxlength="15" class="input-xlarge"/>
+			</div>
+		</div>
+		<div class="control-group">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
+			<div class="controls">
+                <c:if test="${empty zoneImage.imageId}">
+				    <form:input path="sort" htmlEscape="false" maxlength="9" class="input-xlarge required digits" value="${empty sort?0:sort+1}"/>
+                </c:if>
+                <c:if test="${not empty zoneImage.imageId}">
+                    <form:input path="sort" htmlEscape="false" maxlength="9" class="input-xlarge required digits" value="${empty zoneImage.sort?0:(zoneImage.sort) }"/>
+                </c:if>
+			</div>
+		</div>
+		<div class="control-group crmstatus" style="" >
+			<label class="control-label">小程序状态:</label>
+			<div class="controls">
+				<form:select path="crmEnabledStatus" class="input-xlarge ">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" />
+				</form:select>
+			</div>
+		</div>
+		<div class="control-group crmstatus" style="" >
+			<label class="control-label">PC端状态:</label>
+			<div class="controls">
+				<form:select path="wwwEnabledStatus" class="input-xlarge ">
+					<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" />
+				</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>

+ 203 - 0
src/main/webapp/WEB-INF/views/modules/newhome/zoneImageList.jsp

@@ -0,0 +1,203 @@
+<%@ 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 () {
+
+        });
+
+        var changeSortNumber = [];
+
+        function changeSort(id) {
+            changeSortNumber.push(id);
+            console.log("changeSortNumber------------>" + changeSortNumber);
+        }
+
+        var changeSorts = "";
+
+        //批量保存排序
+        function updateSortIndex() {
+            for (let i = 0; i < changeSortNumber.length; i++) {
+                var id = changeSortNumber[i];
+                var sortNum = $("#sortNum" + id).val();
+                changeSorts += id + '_' + sortNum + ',';
+            }
+            $.post("${ctx}/newhome/newPageZone/updateImageSort", {'sortNums': changeSorts}, function (result) {
+                $.jBox.tip(result.data, 'info');
+                setTimeout(function () {
+                    $("#searchForm").submit();
+                }, 500);
+            })
+            changeSortNumber = null;
+            changeSorts = null;
+        }
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        //PC端状态修改
+        function updateEnabledStatus(status, ids) {
+            var msg = '确定开启?';
+            if ('0' == status) {
+                msg = '确定停用?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/newhome/newPageZone/updateImageEnabledStatus", {
+                        'enabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        $("#searchForm").submit();
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        //CRM端状态修改
+        function updateCrmEnabledStatusByIds(status, ids) {
+            var msg = '确定开启?';
+            if ('0' == status) {
+                msg = '确定停用?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/newhome/newPageZone/updateImageCrmEnabledStatusByIds", {
+                        'crmEnabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        $("#searchForm").submit();
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/newhome/newPageZone/imageList?zoneId=${zoneImage.zoneId}">专区轮播图列表</a></li>
+    <li><a href="${ctx}/newhome/newPageZone/imageForm?zoneId=${zoneImage.zoneId}">专区轮播图添加</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="zoneImage" action="${ctx}/newhome/newPageZone/imageList" 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="imageId" htmlEscape="false" maxlength="11" class="input-mini"/>
+        <label>标题:</label>
+        <form:input path="title" htmlEscape="false" maxlength="40" class="input-small"/>
+        <label>小程序端状态:</label>
+        <form:select path="crmEnabledStatus" class="input-small">
+            <form:option value="" label=" "/>
+            <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+                          htmlEscape="false"/>
+        </form:select>
+        <label>PC端状态:</label>
+        <form:select path="wwwEnabledStatus" class="input-small">
+            <form:option value="" label=" "/>
+            <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value"
+                          htmlEscape="false"/>
+        </form:select>
+        &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+        <input class="btn btn-primary" type="button" value="一键排序" onclick="updateSortIndex()"
+               style="margin-left: 15px"/>
+        <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>PC端状态</th>
+        <th>创建时间</th>
+        <th>操作</th>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="zoneImage">
+        <tr>
+            <td>${zoneImage.imageId}</td>
+            <td>${zoneImage.title}</td>
+            <td><img style="width:120px;height: 80px;" src="${zoneImage.image}"/></td>
+            <td><a href="${zoneImage.link}" target="_blank">${zoneImage.link}</a></td>
+
+            <td>
+                <input id="sortNum${zoneImage.id}" type="text" name="sort" style="width:50px;"
+                       value="${zoneImage.sort}" onkeyup="onlynum(this)"
+                       onchange="changeSort(${zoneImage.id})"/>
+            </td>
+            <td>
+                <c:if test="${zoneImage.crmEnabledStatus eq 1 }">
+                    <a href="javascript:void(0);" onclick="updateCrmEnabledStatusByIds('0','${zoneImage.imageId}');">
+                        <img alt="启用" src="/static/images/yes.gif" width="15px" border="none" title="启用">
+                    </a>
+                </c:if>
+                <c:if test="${zoneImage.crmEnabledStatus ne 1 }">
+                    <a href="javascript:void(0)" onclick="updateCrmEnabledStatusByIds('1','${zoneImage.imageId}');">
+                        <img alt="停用" src="/static/images/no.gif" width="15px" border="none" title="停用">
+                    </a>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${zoneImage.wwwEnabledStatus eq 1 }">
+                    <a href="javascript:void(0);" onclick="updateEnabledStatus('0','${zoneImage.imageId}');">
+                        <img alt="启用" src="/static/images/yes.gif" width="15px" border="none" title="启用">
+                    </a>
+                </c:if>
+                <c:if test="${zoneImage.wwwEnabledStatus ne 1 }">
+                    <a href="javascript:void(0)" onclick="updateEnabledStatus('1','${zoneImage.imageId}');">
+                        <img alt="停用" src="/static/images/no.gif" width="15px" border="none" title="停用">
+                    </a>
+                </c:if>
+            </td>
+            <td><fmt:formatDate value="${zoneImage.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+            <td>
+                <a href="${ctx}/newhome/newPageZone/imageForm?imageId=${zoneImage.imageId}">编辑</a>
+                <a href="${ctx}/newhome/newPageZone/imageDelete?imageId=${zoneImage.imageId}&zoneId=${zoneImage.zoneId}"
+                   onclick="return confirmx('确认要删除该新首页轮播图吗?', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 171 - 0
src/main/webapp/WEB-INF/views/modules/newhome/zoneProductList.jsp

@@ -0,0 +1,171 @@
+<%@ 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;
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+
+        //选择添加商品
+        function showSelect(zoneId) {
+            top.$.jBox("iframe:${ctx}/newhome/newPageZone/toAddProduct?zoneId=" + zoneId, {
+                iframeScrolling: 'yes',
+                width: $(top.document).width() - 400,
+                height: $(top.document).height() - 160,
+                persistent: true,
+                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();//获取到的数据格式:(含有参数序号拼接,使用数组传入)1o,2e,3t,4y,5u,6p
+                        if (items.length > 0) {
+                            //添加数据
+                            $.post("${ctx}/newhome/newPageZone/saveAddProduct", {
+                                "productIds": items, "zoneId": zoneId
+                            }, function (data) {
+                                if (true == data.success) {
+                                    window.location.href = "${ctx}/newhome/newPageZone/productList?zoneId=" + zoneId;
+                                    $.jBox.tip(data.msg, 'info');
+                                } else {
+                                    $.jBox.tip(data.msg, 'error');
+                                }
+                            }, "JSON");//这里返回的类型有:json,html,xml,text
+                            return true;
+                        } else {
+                            top.$.jBox.tip("请先勾选商品...");
+                            return false;
+                        }
+                    }
+                    return true;
+                }
+            });
+        }
+
+        //批量保存排序
+        function batchSaveSort() {
+            var items = new Array();
+            var $items = $('.check-item');
+            $items.each(function () {
+                items.push($(this).val());
+            });
+            var zoneId = $('#zoneId').val();
+            //保存批量排序
+            $.post("${ctx}/newhome/newPageZone/batchSaveSort?sortList=" + items + "&zoneId=" + zoneId, function (data) {
+                if (true == data.success) {
+                    $.jBox.tip(data.msg, 'info');
+                    setInterval(g(zoneId), 1000);
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        function g(zoneId) {
+            window.location.href = "${ctx}/newhome/newPageZone/productList?zoneId="+zoneId;//刷新页面
+        }
+
+        //修改排序值
+        function changeSort(id, sortThis) {
+            var value = sortThis.value;
+            $("#sort" + id).val(id + "-" + value);
+        }
+
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/newhome/newPageZone/">专区管理列表</a></li>
+    <li class="active"><a href="${ctx}/newhome/newPageZone/productList">专区商品列表</a></li>
+</ul>
+<form:form id="searchForm" action="${ctx}/newhome/newPageZone/productList" 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="zoneId" name="zoneId" type="hidden" value="${zoneId}"/>
+    <div class="ul-form">
+        <input type="button" class="btn btn-primary" value="添加商品" onclick="showSelect(${zoneId})"/>&nbsp&nbsp&nbsp
+        <c:if test="${not empty page.list}">
+            <input type="button" class="btn btn-primary" value="保存排序" onclick="batchSaveSort()"/>
+        </c:if>
+        <br><font color="#a9a9a9">&nbsp;&nbsp;&nbsp;排序规则:按照排序数值升序排列,数值越小排序越靠前,排序值允许重复。</font>
+        <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>
+    </tr>
+    </thead>
+    <c:if test="${not empty page.list}">
+        <c:forEach items="${page.list}" var="product">
+            <tbody>
+            <tr>
+                <input class="check-item" type="hidden" id="sort${product.productID}"
+                       value='${product.productID}-${product.sortIndex}'/>
+                <td>
+                        ${product.productID}
+                </td>
+                <td><img src="${product.mainImage}" width="50px" height="50px"></td>
+                <td>
+                    <a href="https://www.caimei365.com/product-${product.productID}.html"
+                       target="_blank">${product.name}</a>
+                </td>
+                <td>
+                        ${product.shopName}
+                </td>
+                <td>
+                    <input id="sort" name="sort" style="width:50px;" value="${product.sortIndex}"
+                           onkeyup="onlynum(this)" onchange="changeSort(${product.productID},this)">
+                </td>
+                <td>
+                    <a href="${ctx}/newhome/newPageZone/deleteProduct?productId=${product.productID}&zoneId=${zoneId}"
+                       onclick="return confirmx('确认删除吗?', this.href)">删除</a>
+                </td>
+            </tr>
+            </tbody>
+        </c:forEach>
+    </c:if>
+</table>
+<c:if test="${empty page.list}">
+    <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
+</c:if>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 39 - 11
src/main/webapp/WEB-INF/views/modules/order/cmSplitAccountList.jsp

@@ -549,7 +549,8 @@
 <%--子订单分账弹窗--%>
 <div class="mask revise-popup" id="sub-revise-popup">
     <div class="revise-popup-content" style="width: 540px;">
-        <h4>分账提示</h4>
+        <h3>分账提示</h3>
+        <h6 style="color: red">提供默认值仅供参考,核对后确认</h6>
         <div class="tab-content">
             <%--            <div>--%>
             <%--                <div style="display: inline-block">--%>
@@ -588,7 +589,7 @@
                 </div>
 
             </div>
-            <div>
+            <div id="serviceSplit">
                 <div style="display: inline-block">
                     <p>
                         <span>服务商分账号:<input type="text" id="div-service-accounts"></span>
@@ -906,6 +907,7 @@
             }
         });
 
+        var local = 0;
         $('#apply').on('click', function () {
             var checked = $('.pay-wrapper input[type=checkbox]:checked'), params = '?';
             for (var i = 0; i < checked.length; i++) {
@@ -922,6 +924,27 @@
                 alertx('请至少选择一个订单');
                 return false;
             }
+            $.ajax({
+                url: "${ctx}/order/cmPayShop/new/splitParams",
+                data: {'shopOrderId': shoporderId},
+                type: "POST",
+                success: function (data) {
+                    // console.log("--------->" + JSON.stringify(data, null, 2));
+                    $('#div-caimei-accounts').val(data.cmSplitCode);
+                    $('#div-shop-accounts').val(data.shopSplitCode);
+                    local = data.splitType;
+                    // 服务商
+                    if (data.splitType == 1) {
+                        $('#div-service-accounts').val(data.providerSplitCode);
+                        $('#div-shop-money').val(data.shopSplitAccount);
+                        $('#div-caimei-money').val(data.cmSplitAccount);
+                        $('#div-service-money').val(data.providerSplitAccount);
+                    } else {
+                        // 非服务商
+                        $("#serviceSplit").hide();
+                    }
+                }
+            });
             $('#sub-revise-popup').show();
             btnToGrey1();
             <%--window.location.href = '${ctx}/order/cmPayShop/new/splitEdit' + params;--%>
@@ -937,6 +960,9 @@
             var serviceCode = $('#div-service-accounts').val();
             var serviceMoney = $('#div-service-money').val();
             var splits = shopCode + ',' + shopMoney + ';' + cmCode + ',' + cmMoney + ';' + serviceCode + ',' + serviceMoney;
+            if(local == 2){
+                splits = shopCode + ',' + shopMoney + ';' + cmCode + ',' + cmMoney;
+            }
             console.log("splits--------------->" + splits);
             console.log("shoporderId--------------->" + shoporderId);
             top.$.jBox.confirm('确定对该子订单申请分账吗?', '系统提示', function (v, h, f) {
@@ -1140,15 +1166,17 @@
                 btnToGrey1();
                 return false;
             }
-            if (!serviceCode) {
-                showTips2('服务商分账号不能为空');
-                btnToGrey1();
-                return false;
-            }
-            if (!serviceMoney) {
-                showTips2('请输入服务商分账金额');
-                btnToGrey1();
-                return false;
+            if(local == 1){
+                if (!serviceCode) {
+                    showTips2('服务商分账号不能为空');
+                    btnToGrey1();
+                    return false;
+                }
+                if (!serviceMoney) {
+                    showTips2('请输入服务商分账金额');
+                    btnToGrey1();
+                    return false;
+                }
             }
         }
 

+ 22 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmSpEdit.jsp

@@ -13,6 +13,9 @@
 	<meta name="decorator" content="default"/>
 	<script type="text/javascript">
 		$(document).ready(function() {
+			if(${newCmSp.position eq 0}){
+				$('#positionShow').hide();
+			}
 			//$("#name").focus();
 			$("#inputForm").validate({
 				submitHandler: function(form){
@@ -30,12 +33,19 @@
 				}
 			});
 		});
+		function checkPosition(pos){
+			if(0 == pos){
+				$('#positionShow').hide();
+			}else{
+				$('#positionShow').show();
+			}
+		}
 	</script>
 </head>
 <body>
 	<ul class="nav nav-tabs">
 		<li><a href="${ctx}/user/cmSp/">协销人员管理列表</a></li>
-        <li class="active"><a href="${ctx}/new/user/cmSp/cmSpForm?id=${cmSp.id}">协销人员管理</a></li>
+        <li class="active"><a href="${ctx}/new/user/cmSp/cmSpEdit?id=${newCmSp.id}">协销人员管理</a></li>
 	</ul><br/>
 	<form:form id="inputForm" modelAttribute="newCmSp" action="${ctx}/new/user/cmSp/cmSpSave" method="post" class="form-horizontal">
 		<form:hidden path="id"/>
@@ -55,12 +65,22 @@
 		<div class="control-group">
 			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>身份:</label>
 			<div class="controls">
-				<form:select path="position" itemLabel="key" itemValue="value" htmlEscape="false">
+				<form:select path="position" itemLabel="key" itemValue="value" htmlEscape="false" onchange="checkPosition(this.value)">
 				  	    <form:option value="0" label="内部协销"/>
 				  	    <form:option value="2" label="外部协销"/>
                 </form:select>
             </div>
 		</div>
+		<div class="control-group" id="positionShow">
+			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>服务商</label>
+			<div class="controls">
+				<form:select path="providerId" class="input-medium required">
+					<form:option value="" label="请选择"/>
+					<form:options items="${providers}" itemLabel="name" itemValue="id"
+								  htmlEscape="false"/>
+				</form:select>
+			</div>
+		</div>
 		<div class="form-actions">
 			<shiro:hasPermission name="user:newCmClub:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
 			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>