Kaynağa Gözat

Merge remote-tracking branch 'remotes/origin/developer' into developerB

plf 4 yıl önce
ebeveyn
işleme
3c2b473a75
26 değiştirilmiş dosya ile 673 ekleme ve 129 silme
  1. 3 3
      src/main/java/com/caimei/modules/cmpage/web/CmPageCentreController.java
  2. 1 1
      src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java
  3. 17 26
      src/main/java/com/caimei/modules/opensearch/SearchUitls.java
  4. 21 5
      src/main/java/com/caimei/modules/product/web/CmPromotionController.java
  5. 1 0
      src/main/java/com/caimei/modules/product/web/CmSmalltypeController.java
  6. 1 0
      src/main/java/com/caimei/modules/product/web/CmTinytypeController.java
  7. 3 2
      src/main/java/com/caimei/modules/product/web/ProductNewController.java
  8. 43 0
      src/main/java/com/caimei/modules/zplm/dao/CmBrandAuthDao.java
  9. 27 0
      src/main/java/com/caimei/modules/zplm/entity/CmBrandAuth.java
  10. 86 0
      src/main/java/com/caimei/modules/zplm/entity/CmBrandAuthFile.java
  11. 111 14
      src/main/java/com/caimei/modules/zplm/service/CmBrandAuthService.java
  12. 21 0
      src/main/java/com/caimei/modules/zplm/web/CmBrandAuthController.java
  13. 4 3
      src/main/resources/config/beta/caimei.properties
  14. 2 2
      src/main/resources/config/beta/dfs_client.conf
  15. 2 2
      src/main/resources/config/beta/log4j.properties
  16. 1 1
      src/main/resources/config/dev/caimei.properties
  17. 1 0
      src/main/resources/config/product/caimei.properties
  18. 75 2
      src/main/resources/mappings/modules/zplm/CmBrandAuthMapper.xml
  19. 1 0
      src/main/webapp/WEB-INF/views/modules/basesetting/helpPageEdit.jsp
  20. 3 2
      src/main/webapp/WEB-INF/views/modules/cmpage/cmPageList.jsp
  21. 1 0
      src/main/webapp/WEB-INF/views/modules/info/infoForm.jsp
  22. 3 2
      src/main/webapp/WEB-INF/views/modules/info/infoList.jsp
  23. 1 0
      src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp
  24. 3 2
      src/main/webapp/WEB-INF/views/modules/product-new/productList.jsp
  25. 2 1
      src/main/webapp/WEB-INF/views/modules/product-new/secondHand.jsp
  26. 239 61
      src/main/webapp/WEB-INF/views/modules/zplm/cmBrandAuthForm.jsp

+ 3 - 3
src/main/java/com/caimei/modules/cmpage/web/CmPageCentreController.java

@@ -109,7 +109,7 @@ public class CmPageCentreController extends BaseController {
         addMessage(redirectAttributes, "保存成功");
         if ("5".equals(cmPageCentre.getType())) {
             //清除产品仪器缓存
-            redisService.removePattern("instrumentData*");
+            redisService.removePattern("instrumentData*");redisService.removePattern("insCommodityData*");
         } else if ("6".equals(cmPageCentre.getType())) {
             //清除活动专题缓存
             redisService.removePattern("activityData*");
@@ -206,7 +206,7 @@ public class CmPageCentreController extends BaseController {
                 }
             }
             //清除产品仪器缓存
-            redisService.removePattern("instrumentData*");
+            redisService.removePattern("instrumentData*");redisService.removePattern("insCommodityData*");
             //清除活动专题缓存
             redisService.removePattern("activityData*");
             map.put("success", true);
@@ -230,4 +230,4 @@ public class CmPageCentreController extends BaseController {
         }
         return "modules/newhome/newPageFloorContentForm";
     }
-}
+}

+ 1 - 1
src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java

@@ -306,7 +306,7 @@ public class NewPageFloorController extends BaseController {
             return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + floorContent.getPageId() + "&type=6";
         } else {
             //清除产品仪器缓存
-            redisService.removePattern("instrumentData*");
+            redisService.removePattern("instrumentData*");redisService.removePattern("insCommodityData*");
             return "redirect:" + Global.getAdminPath() + "/cmpage/cmPageCentre/?pageId=" + floorContent.getPageId() + "&type=5";
         }
     }

+ 17 - 26
src/main/java/com/caimei/modules/opensearch/SearchUitls.java

@@ -1,6 +1,8 @@
 package com.caimei.modules.opensearch;
 
 import com.thinkgem.jeesite.common.config.Global;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
@@ -14,57 +16,46 @@ import org.springframework.web.client.RestTemplate;
  */
 @Component
 public class SearchUitls {
-
+	Logger logger = LoggerFactory.getLogger(getClass());
     public void updateProductIndex(Integer productId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("pid", productId);
-        updatePost("/update/product", paramMap);
+        updatePost("/update/product?productId=" + productId);
     }
 
     public void deleteProductIndex(Integer productId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("pid", productId);
-        updatePost("/delete/product", paramMap);
+        updatePost("/delete/product?productId=" + productId);
     }
 
     public void updateArticleIndex(Integer articleId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("aid", articleId);
-        updatePost("/update/article", paramMap);
+        updatePost("/update/article?articleId=" + articleId);
     }
 
     public void deleteArticleIndex(Integer articleId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("aid", articleId);
-        updatePost("/delete/article", paramMap);
+        updatePost("/delete/article?articleId=" + articleId);
     }
 
     public void updateAllArticleIndex(){
-        updatePost("/update/article",null);
+        updatePost("/article/all");
     }
 
     public void updateShopIndex(Integer shopId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("sid", shopId);
-        updatePost("/update/supplier", paramMap);
+        updatePost("/update/shop?shopId=" + shopId);
     }
 
     public void updateEquipmentIndex(Integer equipmentId){
-        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
-        paramMap.add("eid", equipmentId);
-        updatePost("/update/equipment", paramMap);
+        updatePost("/update/equipment?equipmentId=" + equipmentId);
     }
 
-    private void updatePost(String path, MultiValueMap<String, Integer> paramMap){
-        // 获取spi服务器地址
-        String spiServer = Global.getConfig("caimei.spi");
+    private void updatePost(String path){
+        // 获取core服务器地址
+        String coreServer = Global.getConfig("caimei.core");
         RestTemplate restTemplate = new RestTemplate();
-        String uri = spiServer + "/search/manage" + path;
+        String uri = coreServer + "/commodity/search/index" + path;
         // 打印参数
-        System.out.println("更新索引uri:" + uri +",参数:"+ paramMap.toString());
+        logger.info("更新索引uri:" + uri);
         // 发起Post请求
+        MultiValueMap<String, Integer> paramMap = new LinkedMultiValueMap<>();
         String result = restTemplate.postForObject(uri, paramMap, String.class);
-        System.out.println("更新索引result:" + result);
+        logger.info("更新索引result:" + result);
     }
 
 

+ 21 - 5
src/main/java/com/caimei/modules/product/web/CmPromotionController.java

@@ -1,13 +1,13 @@
 package com.caimei.modules.product.web;
 
-import com.caimei.modules.brand.service.ShopModelService;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.cibe.entity.Shop;
-import com.caimei.modules.product.entity.CmActivity;
+import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.product.entity.CmPromotion;
 import com.caimei.modules.product.entity.Product;
 import com.caimei.modules.product.service.CmPromotionService;
 import com.caimei.modules.product.service.ProductService;
+import com.caimei.redis.RedisService;
 import com.caimei.utils.AppUtils;
 import com.foxinmy.weixin4j.util.StringUtil;
 import com.thinkgem.jeesite.common.config.Global;
@@ -22,6 +22,7 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.*;
 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.*;
@@ -40,9 +41,10 @@ public class CmPromotionController extends BaseController {
     private CmPromotionService cmPromotionService;
     @Autowired
     private ProductService productService;
-
-
-
+    @Autowired
+    private RedisService redisService;
+    @Resource
+    private GenerateUtils generateUtils;
     @ModelAttribute
     public CmPromotion get(@RequestParam(required = false) String id) {
         CmPromotion entity = null;
@@ -353,6 +355,7 @@ public class CmPromotionController extends BaseController {
             map.put("success", false);
             map.put("msg", "促销活动id不能为空");
         }
+        cleanRedisCache();
         return map;
     }
 
@@ -422,6 +425,7 @@ public class CmPromotionController extends BaseController {
         }
         cmPromotionService.save(cmPromotion);
         addMessage(redirectAttributes, "保存促销列表成功");
+        cleanRedisCache();
         return "redirect:" + Global.getAdminPath() + "/product/cmPromotions/?type="+cmPromotion.getType();
     }
 
@@ -434,4 +438,16 @@ public class CmPromotionController extends BaseController {
     public List<PurchaseProduct> getGifts(String id) {
         return cmPromotionService.findGiftPurchaseProduct(id);
     }
+
+
+    /**
+     * 有数据变动时需要清除缓存
+     */
+    public void cleanRedisCache() {
+        redisService.removePattern("getHomeData*");
+        redisService.removePattern("getHomeCommodityData*");
+        redisService.removePattern("insCommodityData*");
+        // 重新生成静态首页
+        generateUtils.generateHome();
+    }
 }

+ 1 - 0
src/main/java/com/caimei/modules/product/web/CmSmalltypeController.java

@@ -199,6 +199,7 @@ public class CmSmalltypeController extends BaseController {
 		//分类缓存
 		String productClassify = "getClassify*";
 		redisService.removePattern(productClassify);
+		redisService.removePattern("getCommodityClassify*");
 	}
 	/**
 	 * 获取二级分类

+ 1 - 0
src/main/java/com/caimei/modules/product/web/CmTinytypeController.java

@@ -324,6 +324,7 @@ public class CmTinytypeController extends BaseController {
         //分类缓存
         String productClassify = "getClassify*";
         redisService.removePattern(productClassify);
+        redisService.removePattern("getCommodityClassify*");
 	}
 
 	/**

+ 3 - 2
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -327,8 +327,6 @@ public class ProductNewController extends BaseController {
             }
         }
         addMessage(redirectAttributes, "保存商品成功");
-        // 更新索引
-        searchUitls.updateProductIndex(product.getProductID());
         String editFlag = product.getEditFlag();
         if (StringUtils.equals("1", editFlag)) {
             redirectAttributes.addAttribute("id", product.getId());
@@ -348,6 +346,8 @@ public class ProductNewController extends BaseController {
         }
         // 有数据变动时需要清除缓存
         cleanRedisCache();
+        // 更新索引
+        searchUitls.updateProductIndex(product.getProductID());
         return "redirect:" + Global.getAdminPath() + "/product/new/list/";
     }
 
@@ -880,6 +880,7 @@ public class ProductNewController extends BaseController {
         String homeData = "getHomeData*";
         redisService.removePattern(homeData);
         redisService.removePattern("getHomeCommodityData*");
+        redisService.removePattern("insCommodityData*");
         // 重新生成静态首页
         generateUtils.generateHome();
     }

+ 43 - 0
src/main/java/com/caimei/modules/zplm/dao/CmBrandAuthDao.java

@@ -3,6 +3,7 @@ package com.caimei.modules.zplm.dao;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.common.entity.Country;
 import com.caimei.modules.zplm.entity.CmBrandAuth;
+import com.caimei.modules.zplm.entity.CmBrandAuthFile;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import org.apache.ibatis.annotations.Param;
@@ -56,4 +57,46 @@ public interface CmBrandAuthDao extends CrudDao<CmBrandAuth> {
      * @param cmBrandAuth
      */
     CmBrandAuth findSameAuth(CmBrandAuth cmBrandAuth);
+
+    CmBrandAuthFile findMd5Hex(String md5Hex);
+
+    /**
+     * 保存代理声明文件
+     * @param statementFile
+     */
+    void insertStatementFile(CmBrandAuthFile statementFile);
+
+    /**
+     * 更新代理声明文件
+     * @param cmBrandAuthFile
+     */
+    void updateStatementFile(CmBrandAuthFile cmBrandAuthFile);
+
+    /**
+     * 根据授权Id查找代理声明文件
+     * @param cmBrandAuthId
+     * @return
+     */
+    CmBrandAuthFile findStatementFileByAuthId(String cmBrandAuthId);
+
+    /**
+     * 根据MD5标识查找代理声明文件
+     * @param md5Hex
+     * @return
+     */
+    Integer findStatementFileByMd5Hex(String md5Hex);
+
+    /**
+     * 删除代理声明文件
+     * @param id
+     */
+    void deleteStatementFile(Integer id);
+
+    /**
+     * 查找代理声明文件
+     * @param brandAuthId
+     * @param md5Hex
+     * @return
+     */
+    CmBrandAuthFile findStatementFile(CmBrandAuthFile cmBrandAuthFile);
 }

+ 27 - 0
src/main/java/com/caimei/modules/zplm/entity/CmBrandAuth.java

@@ -22,12 +22,15 @@ public class CmBrandAuth extends DataEntity<CmBrandAuth> {
 	private Integer statementType;		// 代理声明类型:1弹窗,2链接
 	private String statementContent;		// 声明弹窗内容
 	private String statementLink;		// 声明链接
+	private String statementImage;		// 声明图片
 	private String authParty;		// 被授权方名称
 	private Date createTime;		// 创建时间
 
 	private String brandName;		//品牌名
 	private String authLogo;	// 品牌授权logo
 	private String createUserName;	//创建人用户名
+	private CmBrandAuthFile statementFile; 	//代理声明文件
+	private Integer statementFileId;	//代理声明文件Id
 
 	public CmBrandAuth() {
 		super();
@@ -146,4 +149,28 @@ public class CmBrandAuth extends DataEntity<CmBrandAuth> {
 	public void setAuthLogo(String authLogo) {
 		this.authLogo = authLogo;
 	}
+
+	public String getStatementImage() {
+		return statementImage;
+	}
+
+	public void setStatementImage(String statementImage) {
+		this.statementImage = statementImage;
+	}
+
+	public CmBrandAuthFile getStatementFile() {
+		return statementFile;
+	}
+
+	public void setStatementFile(CmBrandAuthFile statementFile) {
+		this.statementFile = statementFile;
+	}
+
+	public Integer getStatementFileId() {
+		return statementFileId;
+	}
+
+	public void setStatementFileId(Integer statementFileId) {
+		this.statementFileId = statementFileId;
+	}
 }

+ 86 - 0
src/main/java/com/caimei/modules/zplm/entity/CmBrandAuthFile.java

@@ -0,0 +1,86 @@
+package com.caimei.modules.zplm.entity;
+
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Aslee
+ * @date : 2021/04/28
+ */
+public class CmBrandAuthFile {
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+    /**
+     * 对应cm_brand_auth表id
+     */
+    private Integer brandAuthId;
+
+    /**
+     * 声明文件名称
+     */
+    private String name;
+
+    /**
+     * oss存储名
+     */
+    private String ossName;
+
+    /**
+     * 文件唯一标识
+     */
+    private String md5Hex;
+
+    /**
+     * 上传时间
+     */
+    private Date uploadTime;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getBrandAuthId() {
+        return brandAuthId;
+    }
+
+    public void setBrandAuthId(Integer brandAuthId) {
+        this.brandAuthId = brandAuthId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getOssName() {
+        return ossName;
+    }
+
+    public void setOssName(String ossName) {
+        this.ossName = ossName;
+    }
+
+    public String getMd5Hex() {
+        return md5Hex;
+    }
+
+    public void setMd5Hex(String md5Hex) {
+        this.md5Hex = md5Hex;
+    }
+
+    public Date getUploadTime() {
+        return uploadTime;
+    }
+
+    public void setUploadTime(Date uploadTime) {
+        this.uploadTime = uploadTime;
+    }
+}

+ 111 - 14
src/main/java/com/caimei/modules/zplm/service/CmBrandAuthService.java

@@ -1,22 +1,29 @@
 package com.caimei.modules.zplm.service;
 
-import java.util.Date;
-import java.util.List;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.*;
 
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.brand.utils.ImagePathUtils;
+import com.caimei.modules.miniprogram.utils.UploadPicUtils;
+import com.caimei.modules.oss.entity.CmOssArchivePdf;
+import com.caimei.modules.oss.utils.OSSUtils;
 import com.caimei.modules.sys.utils.UploadImageUtils;
 import com.caimei.modules.zplm.entity.CmBrandAuth;
+import com.caimei.modules.zplm.entity.CmBrandAuthFile;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.utils.Encodes;
 import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.caimei.modules.zplm.dao.CmBrandAuthDao;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 
@@ -45,20 +52,19 @@ public class CmBrandAuthService extends CrudService<CmBrandAuthDao, CmBrandAuth>
 	
 	@Transactional(readOnly = false)
 	public void save(CmBrandAuth cmBrandAuth) {
+		//新增授权时,若授权有代理商且选择了文件代理声明,需要更新文件的授权Id
+		Boolean updateFileFlag = false;
+		if (StringUtils.isBlank(cmBrandAuth.getId())) {
+			updateFileFlag = true;
+		}
 		//保存图片
 		String logo = cmBrandAuth.getAuthLogo();
+		String statementImage = cmBrandAuth.getStatementImage();
 		if(StringUtils.isNotBlank(logo) && !logo.startsWith("http")){
-			String photoServer = Global.getConfig("photoServer");//获取文件服务器地址
-			logo= Encodes.urlDecode(logo);
-			String realPath = UploadImageUtils.getAbsolutePath(logo);
-			int pointerIndex = realPath.lastIndexOf(".");
-			ImageUploadInfo saveImageSerivce;
-			try {
-				saveImageSerivce = ImagePathUtils.saveImageSerivce(realPath, pointerIndex,realPath);
-				cmBrandAuth.setAuthLogo(photoServer+saveImageSerivce.getSource());
-			} catch (Exception e) {
-				logger.error("图片上传错误:"+e.toString(),e);
-			}
+			cmBrandAuth.setAuthLogo(UploadPicUtils.saveImageToServer(logo, null));
+		}
+		if(StringUtils.isNotBlank(statementImage) && !statementImage.startsWith("http")){
+			cmBrandAuth.setStatementImage(UploadPicUtils.saveImageToServer(statementImage, null));
 		}
 		if (cmBrandAuth.getIsNewRecord()) {
 			cmBrandAuth.setCreateBy(UserUtils.getUser());
@@ -68,6 +74,23 @@ public class CmBrandAuthService extends CrudService<CmBrandAuthDao, CmBrandAuth>
         cmBrandAuthDao.updateBrandAuthLogo(cmBrandAuth.getBrandId(), cmBrandAuth.getAuthLogo());
 		//保存品牌授权
 		super.save(cmBrandAuth);
+		//有代理商且选择了文件代理声明的情况下
+		if (cmBrandAuth.getAgentFlag() == 1 && cmBrandAuth.getStatementType() == 4) {
+			//新增授权时,更新代理声明文件
+			if (updateFileFlag) {
+				Integer statementFileId = cmBrandAuth.getStatementFileId();
+				if (statementFileId != null) {
+					CmBrandAuthFile cmBrandAuthFile = new CmBrandAuthFile();
+					cmBrandAuthFile.setId(statementFileId);
+					cmBrandAuthFile.setBrandAuthId(Integer.parseInt(cmBrandAuth.getId()));
+					cmBrandAuthDao.updateStatementFile(cmBrandAuthFile);
+				}
+			}
+			//修改授权情况下,不需要更新
+		} else {
+			// 没有选择文件代理声明的情况下,若存在原来的文件,删除代理声明文件
+			deleteFileByAuthId(cmBrandAuth.getId());
+		}
 	}
 	
 	@Transactional(readOnly = false)
@@ -76,7 +99,81 @@ public class CmBrandAuthService extends CrudService<CmBrandAuthDao, CmBrandAuth>
 		cmBrandAuthDao.deleteParamsByAuthId(cmBrandAuth.getId());
 		//删除授权商品
 		cmBrandAuthDao.deleteProductsByAuthId(cmBrandAuth.getId());
+		//删除代理声明文件
+		if (cmBrandAuth.getAgentFlag() == 1 && cmBrandAuth.getStatementType() == 4) {
+			deleteFileByAuthId(cmBrandAuth.getId());
+		}
 		super.delete(cmBrandAuth);
 	}
-	
+
+	/**
+	 * 代理声明文件上传
+	 * @param fileName
+	 * @return
+	 */
+
+	@Transactional(readOnly = false)
+    public Map<String, Object> uploadFile(String brandAuthId, MultipartFile multipartFile, String fileName) {
+		Map<String, Object> map = new HashMap<>();
+		String fileAllName = multipartFile.getOriginalFilename();
+		String fileType = fileAllName.substring(fileAllName.lastIndexOf(".") + 1);
+		String uuid = UUID.randomUUID().toString().replaceAll("-", "");
+		String filePath = uuid + "." + fileType;
+		String contentType = OSSUtils.getContentType(fileAllName);
+		try {
+			//保存本地
+			File file = OSSUtils.ossUpload(multipartFile);
+			//判断文件的唯一性,转换成16进制md5值
+			String md5Hex = DigestUtils.md5Hex(new FileInputStream(file));
+			CmBrandAuthFile searchFile = new CmBrandAuthFile();
+			searchFile.setBrandAuthId(StringUtils.isBlank(brandAuthId) ? null : Integer.parseInt(brandAuthId));
+			searchFile.setMd5Hex(md5Hex);
+			// 查找该授权下是否已存在相同文件
+			CmBrandAuthFile cmBrandAuthFile = cmBrandAuthDao.findStatementFile(searchFile);
+			String url = "";
+			if (cmBrandAuthFile == null) {
+				logger.info("默认路径>>>" + file.getAbsolutePath());
+				// 修改情况下,如果原来已经选择了文件代理声明,并且旧文件与新文件不同,需要将旧文件删除
+				deleteFileByAuthId(brandAuthId);
+				//将新文件上传oss
+				url = OSSUtils.ossUpload(filePath, file, contentType);
+				//删除本地文件
+				OSSUtils.deleteFile(file);
+				//保存关联关系
+				cmBrandAuthFile = new CmBrandAuthFile();
+				cmBrandAuthFile.setBrandAuthId(searchFile.getBrandAuthId());
+				cmBrandAuthFile.setName(fileName);
+				cmBrandAuthFile.setOssName(filePath);
+				cmBrandAuthFile.setMd5Hex(md5Hex);
+				cmBrandAuthFile.setUploadTime(new Date());
+				cmBrandAuthDao.insertStatementFile(cmBrandAuthFile);
+			} else {
+				//删除本地文件
+				OSSUtils.deleteFile(file);
+			}
+
+			map.put("success", true);
+			map.put("msg", "操作成功");
+			map.put("url", url);
+			map.put("statementFile", cmBrandAuthFile);
+		} catch (Exception e) {
+			e.printStackTrace();
+			map.put("success", false);
+			map.put("msg", "操作失败");
+			logger.info("上传异常!!!");
+		}
+		return map;
+    }
+
+	private void deleteFileByAuthId(String brandAuthId) {
+		CmBrandAuthFile oldFile = cmBrandAuthDao.findStatementFileByAuthId(brandAuthId);
+		if (oldFile != null) {
+			Integer num = cmBrandAuthDao.findStatementFileByMd5Hex(oldFile.getMd5Hex());
+			if (num == 1) {
+				//删除oss服务器上的文件
+				OSSUtils.deleteSingleFile(oldFile.getOssName());
+			}
+			cmBrandAuthDao.deleteStatementFile(oldFile.getId());
+		}
+	}
 }

+ 21 - 0
src/main/java/com/caimei/modules/zplm/web/CmBrandAuthController.java

@@ -8,12 +8,15 @@ import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.common.entity.Country;
 import com.caimei.modules.zplm.dao.CmBrandAuthDao;
 import com.caimei.modules.zplm.entity.CmBrandAuth;
+import com.caimei.modules.zplm.entity.CmBrandAuthFile;
 import org.springframework.beans.factory.annotation.Autowired;
 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.multipart.MultipartFile;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import com.thinkgem.jeesite.common.config.Global;
@@ -23,6 +26,7 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.caimei.modules.zplm.service.CmBrandAuthService;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 品牌授权Controller
@@ -66,6 +70,10 @@ public class CmBrandAuthController extends BaseController {
 		model.addAttribute("brandList", brandList);
 		model.addAttribute("countryList", countryList);
 		model.addAttribute("cmBrandAuth", cmBrandAuth);
+		if (StringUtils.isNotBlank(cmBrandAuth.getId())) {
+			CmBrandAuthFile statementFileByAuthId = cmBrandAuthDao.findStatementFileByAuthId(cmBrandAuth.getId());
+			cmBrandAuth.setStatementFile(statementFileByAuthId);
+		}
 		return "modules/zplm/cmBrandAuthForm";
 	}
 
@@ -102,4 +110,17 @@ public class CmBrandAuthController extends BaseController {
 		}
 		return false;
 	}
+
+
+	/**
+	 * 代理声明文件上传
+	 *
+	 * @param file
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping(value = "uploadFile")
+	public Map<String, Object> uploadFile(@RequestParam("brandAuthId") String brandAuthId, @RequestParam("file") MultipartFile file, @RequestParam("fileName") String fileName) {
+		return cmBrandAuthService.uploadFile(brandAuthId, file, fileName);
+	}
 }

+ 4 - 3
src/main/resources/config/beta/caimei.properties

@@ -12,9 +12,9 @@
 #mysql database setting
 jdbc.type=mysql
 jdbc.driver=com.mysql.cj.jdbc.Driver
-jdbc.url=jdbc:mysql://10.104.59.165:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+jdbc.url=jdbc:mysql://172.31.165.28:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
 jdbc.username=developer
-jdbc.password=05bZ/OxTB:X+yd%1
+jdbc.password=J5p3tgOVazNl4ydf
 
 #mssql database settings
 #jdbc.type=mssql
@@ -126,7 +126,7 @@ activiti.diagram.labelFontName=\u5B8B\u4F53
 activiti.form.server.url=
 
 #测试服务器本地存储地址
-userfiles.basedir=/mnt/newdatadrive/data/custom/tempimage
+userfiles.basedir=/mnt/newdatadrive/nfs_client/
 
 #\u5DE5\u7A0B\u8DEF\u5F84\uFF0C\u5728\u4EE3\u7801\u751F\u6210\u65F6\u83B7\u53D6\u4E0D\u5230\u5DE5\u7A0B\u8DEF\u5F84\u65F6\uFF0C\u53EF\u518D\u6B64\u6307\u5B9A\u7EDD\u5BF9\u8DEF\u5F84\u3002
 #projectPath=D\:\\workspace\\jeesite
@@ -174,6 +174,7 @@ export.template=/mnt/newdatadrive/data/custom/manager-export-template
 
 # SPI-server(CKEditor5图片上传API,搜索更新索引)
 caimei.spi=https://spi-b.caimei365.com
+caimei.core=https://core-b.caimei365.com
 
 #阿里云oss存储
 aliyun.accessKeyId=LTAI4GBL3o4YkWnbKYgf2Xia

+ 2 - 2
src/main/resources/config/beta/dfs_client.conf

@@ -7,12 +7,12 @@ connect_timeout=30
 network_timeout=60
 
 # the base path to store log files
-base_path=/home/yuqing/fastdfs
+base_path=/mnt/newdatadrive/fdfs
 
 # tracker_server can ocur more than once, and tracker_server format is
 #  "host:port", host can be hostname or ip address
 #tracker_server=10.205.44.47:22122
-tracker_server=10.104.50.235:22122
+tracker_server=172.31.165.28:22122
 
 #standard log level as syslog, case insensitive, value list:
 ### emerg for emergency

+ 2 - 2
src/main/resources/config/beta/log4j.properties

@@ -1,4 +1,4 @@
-# Output pattern : date [thread] priority category - message   FATAL 0  ERROR 3  WARN 4  INFO 6  DEBUG 7 
+# Output pattern : date [thread] priority category - message   FATAL 0  ERROR 3  WARN 4  INFO 6  DEBUG 7
 log4j.rootLogger=WARN, Console, DailyRolling
 
 #Console
@@ -9,7 +9,7 @@ log4j.appender.Console.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %l
 
 #DailyRolling
 log4j.appender.DailyRolling=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.DailyRolling.File=/custom/logs/manager/manager.log
+log4j.appender.DailyRolling.File=${catalina.base}/logs/caimei-manager.log
 log4j.appender.DailyRolling.DatePattern='.'yyyy-MM-dd
 log4j.appender.DailyRolling.layout=org.apache.log4j.PatternLayout
 log4j.appender.DailyRolling.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%-5p] %l >> %m%n

+ 1 - 1
src/main/resources/config/dev/caimei.properties

@@ -188,7 +188,7 @@ export.template=export
 
 # SPI-server(CKEditor5图片上传API,搜索更新索引)
 caimei.spi=http://localhost:8008
-
+caimei.core=https://localhost:18002
 #阿里云oss存储
 aliyun.accessKeyId=LTAI4GBL3o4YkWnbKYgf2Xia
 aliyun.accessKeySecret=dBjAXqbYiEPP6Ukuk2ZsXQeET7FVkK

+ 1 - 0
src/main/resources/config/product/caimei.properties

@@ -175,6 +175,7 @@ export.template=/mnt/newdatadrive/data/custom/manager-export-template
 
 # SPI-server(CKEditor5图片上传API,搜索更新索引)
 caimei.spi=https://spi.caimei365.com
+caimei.core=https://core.caimei365.com
 
 #阿里云oss存储
 aliyun.accessKeyId=LTAI4GBL3o4YkWnbKYgf2Xia

+ 75 - 2
src/main/resources/mappings/modules/zplm/CmBrandAuthMapper.xml

@@ -12,6 +12,7 @@
 		a.statementType AS "statementType",
 		a.statementContent AS "statementContent",
 		a.statementLink AS "statementLink",
+		a.statementImage AS "statementImage",
 		a.authParty AS "authParty",
 		a.createTime AS "createTime",
 		a.createBy AS "createBy.id",
@@ -96,8 +97,31 @@
 		</where>
 		limit 1
 	</select>
+	<select id="findMd5Hex" resultType="com.caimei.modules.zplm.entity.CmBrandAuthFile">
+		SELECT * FROM cm_brand_auth_file WHERE md5Hex = #{md5Hex} LIMIT 1
+	</select>
+    <select id="findStatementFileByAuthId" resultType="com.caimei.modules.zplm.entity.CmBrandAuthFile">
+        select *
+        from cm_brand_auth_file
+        where brandAuthId = #{cmBrandAuthId}
+        limit 1
+    </select>
+    <select id="findStatementFileByMd5Hex" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM cm_brand_auth_file WHERE md5Hex = #{md5Hex}
+    </select>
+    <select id="findStatementFile" resultType="com.caimei.modules.zplm.entity.CmBrandAuthFile">
+        select * from cm_brand_auth_file
+        <where>
+            <if test="brandAuthId != null">
+                and brandAuthId = #{brandAuthId}
+            </if>
+            <if test="md5Hex != null and md5Hex != ''">
+                and md5Hex = #{md5Hex}
+            </if>
+        </where>
+    </select>
 
-	<insert id="insert" parameterType="CmBrandAuth"  keyProperty="id" useGeneratedKeys="true">
+    <insert id="insert" parameterType="CmBrandAuth"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO cm_brand_auth(
 			brandId,
 			countryId,
@@ -107,6 +131,7 @@
 			statementType,
 			statementContent,
 			statementLink,
+			statementImage,
 			authParty,
 			createTime,
 			createBy
@@ -119,12 +144,50 @@
 			#{statementType},
 			#{statementContent},
 			#{statementLink},
+		    #{statementImage},
 			#{authParty},
 			#{createTime},
 			#{createBy.id}
 		)
 	</insert>
-	
+	<insert id="insertStatementFile" keyProperty="id" useGeneratedKeys="true">
+		INSERT INTO cm_brand_auth_file
+		<trim prefix="(" suffix=")" suffixOverrides=",">
+			<if test="brandAuthId != null">
+                brandAuthId,
+			</if>
+			<if test="name != null">
+				name,
+			</if>
+			<if test="ossName != null">
+				ossName,
+			</if>
+			<if test="md5Hex != null">
+				md5Hex,
+			</if>
+			<if test="uploadTime != null">
+				uploadTime,
+			</if>
+		</trim>
+		<trim prefix="values (" suffix=")" suffixOverrides=",">
+			<if test="brandAuthId != null">
+				#{brandAuthId},
+			</if>
+			<if test="name != null">
+				#{name},
+			</if>
+			<if test="ossName != null">
+				#{ossName},
+			</if>
+			<if test="md5Hex != null">
+				#{md5Hex},
+			</if>
+			<if test="uploadTime != null">
+				#{uploadTime},
+			</if>
+		</trim>
+	</insert>
+
 	<update id="update">
 		UPDATE cm_brand_auth SET 	
 			brandId = #{brandId},
@@ -139,6 +202,9 @@
 			<if test="statementLink != null and statementLink != ''">
 				statementLink = #{statementLink},
 			</if>
+			<if test="statementImage != null and statementImage != ''">
+				statementImage = #{statementImage},
+			</if>
 			authParty = #{authParty}
 		WHERE id = #{id}
 	</update>
@@ -147,6 +213,9 @@
         set authLogo = #{authLogo}
         where id = #{brandId}
     </update>
+    <update id="updateStatementFile">
+        update cm_brand_auth_file set brandAuthId = #{brandAuthId} where id = #{id}
+    </update>
 
     <delete id="delete">
 		DELETE FROM cm_brand_auth
@@ -163,5 +232,9 @@
 		delete from cm_brand_auth_product
 		where authId = #{authId}
 	</delete>
+    <delete id="deleteStatementFile">
+        delete from cm_brand_auth_file
+        where id = #{id}
+    </delete>
 
 </mapper>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/basesetting/helpPageEdit.jsp

@@ -88,6 +88,7 @@
 </form:form>
 <!-- 富文本编辑器 -->
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
 <script type="text/javascript">
     //富文本框编辑

+ 3 - 2
src/main/webapp/WEB-INF/views/modules/cmpage/cmPageList.jsp

@@ -2,6 +2,7 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
 <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <html>
 <head>
     <title>网页列表</title>
@@ -71,7 +72,7 @@
                 }
                 $("#searchForm").submit();
             },"JSON");//这里返回的类型有:json,html,xml,text*/
-            $.post("${caimeiSpi}/search/manage/update/equipment", {eid: id}, function(res){
+            $.post("${caimeiCore}/commodity/search/index/update/equipment", {equipmentId: id}, function(res){
                 $.jBox.tip(res.msg, 'info');
                 $("#searchForm").submit();
             });
@@ -90,7 +91,7 @@
                         $("#searchForm").submit();
                     },"JSON");//这里返回的类型有:json,html,xml,text
                     */
-                    $.post("${caimeiSpi}/search/manage/update/equipment/all", function(res){
+                    $.post("${caimeiCore}/commodity/search/index/equipment/all", function(res){
                         $.jBox.tip(res.msg, 'info');
                         $("#searchForm").submit();
                     });

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/info/infoForm.jsp

@@ -153,6 +153,7 @@
 	</form:form>
 <!-- 富文本编辑器 -->
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
 <script type="text/javascript">
 		$(document).ready(function() {

+ 3 - 2
src/main/webapp/WEB-INF/views/modules/info/infoList.jsp

@@ -16,6 +16,7 @@
 	}
 	</style>
 	<% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 	<script type="text/javascript">
 		$(document).ready(function() {
 			show_title(16);
@@ -97,14 +98,14 @@
 
 		// 更新索引
 		function updateIndex(id) {
-			$.post("${caimeiSpi}/search/manage/update/article", {aid: id}, function(res){
+			$.post("${caimeiCore}/commodity/search/index/update/article", {articleId: id}, function(res){
 				$.jBox.tip(res.msg, 'info');
 			});
 		}
 		function updateAllIndex(){
 			var submit = function (v, h, f) {
 				if (v == true){
-					$.post("${caimeiSpi}/search/manage/update/article/all", function(res){
+					$.post("${caimeiCore}/commodity/search/index/article/all", function(res){
 						$.jBox.tip(res.msg, 'info');
 					});
 				}

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -390,6 +390,7 @@
 </form:form>
 <!-- 富文本编辑器 -->
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript" src="${ctxStatic}/ckeditor5-new/ckeditor.js"></script>
 <script type="text/javascript">
     $(document).ready(function() {

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

@@ -285,6 +285,7 @@
 	</table>
 	<div class="pagination">${page}</div>
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript">
     var num = '';
     function page(n,s){
@@ -355,14 +356,14 @@
 
     // 更新索引
     function updateIndex(id) {
-		$.post("${caimeiSpi}/search/manage/update/product", {pid: id}, function(res){
+		$.post("${caimeiCore}/commodity/search/index/update/product", {productId: id}, function(res){
 			$.jBox.tip(res.msg, 'info');
 		});
     }
     function updateAllIndex(){
             var submit = function (v, h, f) {
                 if (v == true){
-                    $.post("${caimeiSpi}/search/manage/update/product/all", function(res){
+                    $.post("${caimeiCore}/commodity/search/index/product/all", function(res){
                         $.jBox.tip(res.msg, 'info');
                     });
                 }

+ 2 - 1
src/main/webapp/WEB-INF/views/modules/product-new/secondHand.jsp

@@ -298,6 +298,7 @@
 </table>
 <div class="pagination">${page}</div>
 <% request.setAttribute("caimeiSpi", Global.getConfig("caimei.spi"));%>
+<% request.setAttribute("caimeiCore", Global.getConfig("caimei.core"));%>
 <script type="text/javascript">
     var num = '';
     function page(n,s){
@@ -364,7 +365,7 @@
 
     // 更新索引
     function updateIndex(id) {
-        $.post("${caimeiSpi}/search/manage/update/product", {pid: id}, function(res){
+        $.post("${caimeiCore}/commodity/search/index/update/product", {productId: id}, function(res){
             $.jBox.tip(res.msg, 'info');
         });
     }

+ 239 - 61
src/main/webapp/WEB-INF/views/modules/zplm/cmBrandAuthForm.jsp

@@ -9,8 +9,52 @@
 			//$("#name").focus();
 			$("#inputForm").validate({
 				submitHandler: function(form){
-					loading('正在提交,请稍等...');
-					form.submit();
+					var agentFlag = $('input[name="agentFlag"]:checked').val();
+					var statementType = $('input[name="statementType"]:checked').val();
+					var files = $('#statementFile').prop('files');
+					var fileName = $('#uploadFileName').val();
+					// 当文件名不为空,但文件列表为空时,代表代理声明文件为原文件,不需要重新上传
+					var originFileFlag = (files.length == 0 && fileName != '');
+					if (agentFlag == 1 && statementType == 4 && !originFileFlag) {
+						// 有代理商且选择了文件代理声明,且不是原文件
+						if (files.length == '') {
+							alertx('请选择上传文件');
+							return;
+						}
+						var brandAuthId = $("#id").val();
+						var data = new FormData();
+						data.append('brandAuthId', brandAuthId);
+						data.append('file', files[0]);
+						data.append('fileName', fileName);
+						$('.upload-loading').show();
+						//上传文件
+						$.ajax({
+							url: "${ctx}/zplm/cmBrandAuth/uploadFile",
+							data: data,
+							type: "POST",
+							processData: false,
+							contentType: false,
+							dataType: "json",
+							success: function (res) {
+								$('.upload-loading').hide();
+								if (res.success){
+									loading('正在提交,请稍等...');
+									$("#statementFileId").val(res.statementFile.id);
+									//上传成功,保存授权
+									form.submit();
+								}else {
+									alertx("文件上传失败");
+								}
+							},
+							error: function (json) {
+								$('.upload-loading').hide();
+								alertx("文件上传失败");
+							}
+						});
+					} else {
+                        loading('正在提交,请稍等...');
+						form.submit();
+					}
 				},
 				errorContainer: "#messageBox",
 				errorPlacement: function(error, element) {
@@ -25,62 +69,138 @@
 		});
 	</script>
     <style>
-        .iconBox{
-            font-size: 0;
-        }
-        .controls .conList{
-            display: inline-block;
-            margin-right: 15px;
-        }
-        .conList .btn:nth-of-type(1){
-            margin-left: 25px;
-        }
-        .upload-content {
-            margin-top: -70px;
-        }
-        .upload-content .conList .btn:nth-of-type(1) {
-            width: 90px;
-            height: 100px;
-            border: 2px solid #eee;
-            background: #fff;
-            position: relative;
-        }
-        .upload-content .conList .btn:nth-of-type(1)>div {
-            position: absolute;
-            top: 50%;
-            left: 50%;
-            transform: translate(-50%, -50%);
-            color: #666;
-        }
-        .upload-content .conList .btn:nth-of-type(1) span {
-            font-size: 35px;
-        }
-        .upload-content .conList .btn:nth-of-type(1) h5 {
-            color: #666;
-        }
-        .cancel-upload {
-            background: transparent;
-            border: none;
-            box-shadow: none;
-            position: relative;
-            top: -38px;
-            left: -25px;
-            cursor: pointer;
-            z-index: 100;
-        }
-        .upload-content .conList ol li {
-            width: 114px;
-            min-height: 80px;
-            text-align: center;
-            background: #fff;
-            position: relative;
-            top: 120px;
-            margin-left: 2px;
-        }
-        .hide-pic {
-            display: none !important;
-        }
+		.iconBox{
+			font-size: 0;
+		}
+		.controls .conList{
+			display: inline-block;
+			margin-right: 15px;
+		}
+		.conList .btn:nth-of-type(1){
+			margin-left: 25px;
+		}
+		.select2-choice{
+			width: 100px;
+		}
+		.upload-content {
+			margin-top: -70px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) {
+			width: 90px;
+			height: 100px;
+			border: 2px solid #eee;
+			background: #fff;
+			position: relative;
+		}
+		.upload-content .conList .btn:nth-of-type(1)>div {
+			position: absolute;
+			top: 50%;
+			left: 50%;
+			transform: translate(-50%, -50%);
+			color: #666;
+		}
+		.upload-content .conList .btn:nth-of-type(1) span {
+			font-size: 35px;
+		}
+		.upload-content .conList .btn:nth-of-type(1) h5 {
+			color: #666;
+		}
+		.cancel-upload {
+			background: transparent;
+			border: none;
+			box-shadow: none;
+			position: relative;
+			top: -38px;
+			left: -25px;
+			cursor: pointer;
+			z-index: 100;
+		}
+		.upload-content .conList ol li {
+			width: 114px;
+			min-height: 80px;
+			text-align: center;
+			background: #fff;
+			position: relative;
+			top: 120px;
+			margin-left: 2px;
+		}
+		.hide-pic {
+			display: none !important;
+		}
+
+		.upload {
+			position: relative;
+			display: inline-block;
+			background: #D0EEFF;
+			border: 1px solid #99D3F5;
+			border-radius: 4px;
+			padding: 4px 12px;
+			color: #1E88C7;
+			text-decoration: none;
+			text-indent: 0;
+			line-height: 20px;
+			margin-left: 20px;
+			cursor: pointer;
+			width: 52px;
+			height: 20px;
+		}
+
+		.upload input {
+			position: absolute;
+			width: 170px;
+			font-size: 20px;
+			right: 0;
+			top: 0;
+			opacity: 0;
+			cursor: pointer;
+		}
+
+		.upload:hover {
+			background: #AADFFD;
+			border-color: #78C3F3;
+			color: #004974;
+			text-decoration: none;
+		}
+
+		#file-list-display {
+			width: 600px;
+			height: auto;
+			float: left;
+			margin-left: 20px;
+		}
+
+		#file-list-display p {
+			line-height: 30px;
+			font-size: 14px;
+			color: #333333;
+			margin: 0;
+		}
+
+		#file-list-display p .del {
+			color: #2fa4e7;
+			font-size: 12px;
+			cursor: pointer;
+			margin-left: 20px;
+		}
 
+		#addSubmit {
+			margin-left: 20px;
+		}
+		#uploadFileName{
+			float: left;
+		}
+		.upload-loading{
+			width: 32px;
+			height: 32px;
+			float: left;
+			margin-left: 10px;
+		}
+		.upload-loading img{
+			width: 16px;
+			height: 16px;
+			display: block;
+			margin: 8px auto 0;
+		}
     </style>
 </head>
 <body>
@@ -90,7 +210,8 @@
 	</ul><br/>
 	<form:form id="inputForm" modelAttribute="cmBrandAuth" action="${ctx}/zplm/cmBrandAuth/save" method="post" class="form-horizontal">
 		<form:hidden path="id"/>
-		<sys:message content="${message}"/>		
+		<form:hidden path="statementFileId"/>
+		<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">
@@ -143,9 +264,11 @@
             </div>
             <div class="control-group">
                 <label class="control-label">代理声明:</label>
-                <div class="controls">
+                <div class="controls" style="position: relative">
 					<input type="radio" name="statementType" value="1" onclick="changeStatementType()" ${cmBrandAuth.statementType eq null?"checked":cmBrandAuth.statementType eq 1?"checked":""}/>弹窗
 					<input type="radio" name="statementType" value="2" onclick="changeStatementType()" ${cmBrandAuth.statementType eq 2?"checked":""} />链接
+					<input type="radio" name="statementType" value="3" onclick="changeStatementType()" ${cmBrandAuth.statementType eq 3?"checked":""} />图片
+					<input type="radio" name="statementType" value="4" onclick="changeStatementType()" ${cmBrandAuth.statementType eq 4?"checked":""} />文件
                 </div>
             </div>
             <div class="control-group" id="statementContentDiv">
@@ -160,6 +283,30 @@
                     <form:input path="statementLink" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
                 </div>
             </div>
+            <div class="control-group iconBox" id="statementImageDiv">
+                <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>图片:</label>
+				<div class="controls upload-content" id="statementImageBox">
+					<div class="conList">
+						<form:hidden id="statementImage" path="statementImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+						<sys:ckfinder input="statementImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
+									  maxHeight="100"/>
+						<br>
+						<label style="margin-left: 150px">建议图片分辨率542px*542px</label>
+					</div>
+				</div>
+            </div>
+            <div class="control-group" id="statementFileDiv">
+                <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>文件路径:</label>
+				<div class="controls">
+					<form:input path="statementFile.name" id="uploadFileName" placeholder="支持pdf、word、ppt" disabled="true" class="input-xlarge required" />
+					<div class="upload">
+						<input type="file" name="file" id="statementFile" accept=".pdf,.doc,.ppt">选择文件
+					</div>
+					<div class="upload-loading" hidden>
+						<img alt="gif" src="/static/images/upload.gif" width="32px" border="none">
+					</div>
+				</div>
+            </div>
         </div>
 
 		<div class="control-group">
@@ -175,10 +322,19 @@
 	</form:form>
 <script type = text/javascript>
     $(function () {
+		var files = document.getElementById("statementFile");
+		// var fileListDisplay = document.getElementById('file-list-display'), sendFile;
+		files.addEventListener("change", function (event) {
+			var name = event.target.files[0].name;
+			console.log(name)
+			$('#uploadFileName').val(name);
+		});
+
         $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
         $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
         $('.upload-content .conList').find('.cancel-upload').hide();
         var observeEle = document.getElementsByClassName('upload-content')[0];
+        var observeEle1 = document.getElementsByClassName('upload-content')[1];
         var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
         var MutationObserverConfig = {
             childList: true,
@@ -201,6 +357,7 @@
             })
         });
         observer.observe(observeEle, MutationObserverConfig);
+        observer.observe(observeEle1, MutationObserverConfig);
 
 		$('body').on('click', '.cancel-upload', function () {
 			var wrapper = $(this).closest('.conList');
@@ -227,6 +384,13 @@
 						$(ele).parents(".conList").next().removeClass("hide-pic")
 					}
 				})
+				$("#statementImageBox").find("input.input-xlarge").each(function (i, ele) {
+					if ($(ele).val()) {
+						$(ele).next().find("li").css("z-index", "99");
+						$(ele).parents(".conList").find(".cancel-upload").show();
+						$(ele).parents(".conList").next().removeClass("hide-pic")
+					}
+				})
 			}, 200);
 		});
 	});
@@ -255,12 +419,26 @@
 		if (statementType == 1) {
 			$("#statementContentDiv").show();
 			$("#statementLinkDiv").hide();
-		} else {
+			$("#statementImageDiv").hide();
+			$("#statementFileDiv").hide();
+		} else if (statementType == 2) {
 			$("#statementContentDiv").hide();
 			$("#statementLinkDiv").show();
+			$("#statementImageDiv").hide();
+			$("#statementFileDiv").hide();
+		} else if (statementType == 3) {
+			$("#statementContentDiv").hide();
+			$("#statementLinkDiv").hide();
+			$("#statementImageDiv").show();
+			$("#statementFileDiv").hide();
+		} else if (statementType == 4) {
+			$("#statementContentDiv").hide();
+			$("#statementLinkDiv").hide();
+			$("#statementImageDiv").hide();
+			$("#statementFileDiv").show();
 		}
 	}
-	
+
 	//修改品牌,品牌logo跟着修改
 	function changeBrand() {
 		var brandId = $("#brandId").val();