Sfoglia il codice sorgente

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

Aslee 4 anni fa
parent
commit
29f8fc33cc

+ 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);
+	}
 }

+ 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>

+ 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();