浏览代码

活动海报修改内容

shenhao 5 年之前
父节点
当前提交
4a950cc99f
共有 24 个文件被更改,包括 1403 次插入388 次删除
  1. 1 10
      src/main/java/com/ssj/bean/sys/poster/domain/PosterActivity.java
  2. 64 0
      src/main/java/com/ssj/bean/sys/poster/domain/PosterActivityJoin.java
  3. 1 21
      src/main/java/com/ssj/bean/sys/poster/domain/PosterJoin.java
  4. 19 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterActivityJoinDao.java
  5. 10 1
      src/main/java/com/ssj/dao/sys/poster/dao/PosterQueryDao.java
  6. 2 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterTemplateDao.java
  7. 43 16
      src/main/java/com/ssj/dao/sys/poster/dao/impl/PosterQueryDaoImpl.java
  8. 22 0
      src/main/java/com/ssj/service/sys/poster/service/PosterActivityJoinService.java
  9. 9 3
      src/main/java/com/ssj/service/sys/poster/service/PosterActivityService.java
  10. 2 3
      src/main/java/com/ssj/service/sys/poster/service/PosterJoinService.java
  11. 2 1
      src/main/java/com/ssj/service/sys/poster/service/PosterTemplateService.java
  12. 44 0
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityJoinServiceImpl.java
  13. 8 4
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityServiceImpl.java
  14. 24 17
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterJoinServiceImpl.java
  15. 7 4
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterTemplateServiceImpl.java
  16. 487 262
      src/main/java/com/ssj/sys/controller/PosterController.java
  17. 107 0
      src/main/java/com/ssj/util/ZipCompressor.java
  18. 22 5
      src/main/resources/templates/sys/poster/activity_edit.html
  19. 178 0
      src/main/resources/templates/sys/poster/activity_join_add.html
  20. 160 0
      src/main/resources/templates/sys/poster/activity_join_edit.html
  21. 158 0
      src/main/resources/templates/sys/poster/activity_join_list.html
  22. 19 6
      src/main/resources/templates/sys/poster/activity_list.html
  23. 4 14
      src/main/resources/templates/sys/poster/join_edit.html
  24. 10 21
      src/main/resources/templates/sys/poster/join_list.html

+ 1 - 10
src/main/java/com/ssj/bean/sys/poster/domain/PosterActivity.java

@@ -23,14 +23,6 @@ public class PosterActivity extends BaseEntity {
     
     private Date createTime;
 
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
 	public String getTemplateId() {
 		return templateId;
 	}
@@ -62,6 +54,5 @@ public class PosterActivity extends BaseEntity {
 	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
 	}
-    
-    
+
 }

+ 64 - 0
src/main/java/com/ssj/bean/sys/poster/domain/PosterActivityJoin.java

@@ -0,0 +1,64 @@
+package com.ssj.bean.sys.poster.domain;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.util.Date;
+
+@Entity
+@Table(name = "poster_activity_join")
+public class PosterActivityJoin extends BaseEntity {
+	
+    private static final long serialVersionUID = 1L;
+
+    private String activityId;
+    
+    private String joinId;
+    
+    private Date createTime;
+
+    private String templateId;
+
+	private String posterImg;
+
+	public String getActivityId() {
+		return activityId;
+	}
+
+	public void setActivityId(String activityId) {
+		this.activityId = activityId;
+	}
+
+	public String getJoinId() {
+		return joinId;
+	}
+
+	public void setJoinId(String joinId) {
+		this.joinId = joinId;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getTemplateId() {
+		return templateId;
+	}
+
+	public void setTemplateId(String templateId) {
+		this.templateId = templateId;
+	}
+
+	public String getPosterImg() {
+		return posterImg;
+	}
+
+	public void setPosterImg(String posterImg) {
+		this.posterImg = posterImg;
+	}
+}

+ 1 - 21
src/main/java/com/ssj/bean/sys/poster/domain/PosterJoin.java

@@ -12,11 +12,7 @@ import com.ssj.bean.common.framework.core.domain.BaseEntity;
 public class PosterJoin extends BaseEntity {
 	
     private static final long serialVersionUID = 1L;
-    
-    private String id;
-    
-    private String activityId;
-    
+
     private String name;
     
     private String phone;
@@ -35,22 +31,6 @@ public class PosterJoin extends BaseEntity {
     
     private Date createTime;
 
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	public String getActivityId() {
-		return activityId;
-	}
-
-	public void setActivityId(String activityId) {
-		this.activityId = activityId;
-	}
-
 	public String getName() {
 		return name;
 	}

+ 19 - 0
src/main/java/com/ssj/dao/sys/poster/dao/PosterActivityJoinDao.java

@@ -0,0 +1,19 @@
+package com.ssj.dao.sys.poster.dao;
+
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.bean.sys.poster.domain.PosterActivityJoin;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+public interface PosterActivityJoinDao extends JpaRepository<PosterActivityJoin, String> {
+
+
+    @Query(nativeQuery = true,value = "select * from poster_activity_join where join_id=?1 and activity_id=?2 and template_id=?3 limit 1")
+    PosterActivityJoin findOneByAnyP(String id, String activityId, String templateId);
+}

+ 10 - 1
src/main/java/com/ssj/dao/sys/poster/dao/PosterQueryDao.java

@@ -1,5 +1,6 @@
 package com.ssj.dao.sys.poster.dao;
 
+import java.util.List;
 import java.util.Map;
 
 import org.springframework.data.domain.Page;
@@ -10,5 +11,13 @@ public interface PosterQueryDao {
 	Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage);
 	
 	Page<Map<String, Object>> findJoinByPage(Map<String, Object> params, Pageable initPage);
-	
+
+    Page<Map<String, Object>> findActivityJoinByPage(Map<String, Object> params, Pageable initPage);
+
+    /**
+     * 下载准备海报数据
+     * @param params
+     * @return
+     */
+    List<Map<String, Object>> exportActivityList(Map<String, Object> params);
 }

+ 2 - 0
src/main/java/com/ssj/dao/sys/poster/dao/PosterTemplateDao.java

@@ -18,4 +18,6 @@ public interface PosterTemplateDao extends JpaRepository<PosterTemplate, String>
 	@Query(nativeQuery = true,value = " SELECT * from poster_template t WHERE t.`status`=1 ORDER BY t.create_time desc ")
 	List<PosterTemplate> findPosterTemplateByList();
 
+	@Query(nativeQuery = true,value = " SELECT * from poster_template t WHERE t.`status`=1 and t.id in(?1) ORDER BY t.create_time desc ")
+	List<PosterTemplate> findPosterTemplateByIds(List<String> templateIds);
 }

+ 43 - 16
src/main/java/com/ssj/dao/sys/poster/dao/impl/PosterQueryDaoImpl.java

@@ -23,16 +23,16 @@ public class PosterQueryDaoImpl  implements PosterQueryDao {
 	public Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage) {
 		StringBuilder sb = new StringBuilder();
         sb.append("  SELECT ");
-        sb.append("  t.*,p.back_img, ");
-        sb.append("  	( SELECT count(1) from poster_join j WHERE j.activity_id=t.id AND j.`status`=1 	) as count ");
-        sb.append(" from poster_activity t  ");
-        sb.append(" LEFT JOIN poster_template p ON t.template_id=p.id ");
-        sb.append(" WHERE t.`status`=1  ");
+        sb.append("  t.*,group_concat(p.back_img) as back_img, ");
+        sb.append("  	( SELECT count(1) from poster_activity_join j WHERE j.activity_id=t.id 	) as count ");
+        sb.append(" from poster_activity t,poster_template p  ");
+        sb.append(" WHERE t.`status`=1  and FIND_IN_SET(p.id,t.template_id) ");
         List<Object> param = new ArrayList<>();
         if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
         	 sb.append(" and t.name like concat('%',?,'%')  ");
         	 param.add(params.get("name"));
         }
+        sb.append(" group by t.id ");
         sb.append(" ORDER BY t.create_time desc ");
         return dao.findPage(sb.toString(),param.toArray(),initPage);
 	}
@@ -41,15 +41,9 @@ public class PosterQueryDaoImpl  implements PosterQueryDao {
 	@Override
 	public Page<Map<String, Object>> findJoinByPage(Map<String, Object> params, Pageable initPage) {
 		StringBuilder sb = new StringBuilder();
-        sb.append("  SELECT t.*,a.`name` as aname,p.back_img from poster_join t  ");
-        sb.append("  LEFT JOIN poster_activity a ON t.activity_id=a.id ");
-        sb.append("  LEFT JOIN poster_template p ON a.template_id=p.id ");
+        sb.append("  SELECT t.* from poster_join t  ");
         sb.append("  WHERE t.`status`=1    ");
         List<Object> param = new ArrayList<>();
-        if(params.get("id")!=null && StringUtils.isNotEmpty(params.get("id").toString())) {
-       	 sb.append(" and a.id = ?  ");
-       	 param.add(params.get("id"));
-       }
         if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
         	 sb.append(" and t.name like concat('%',?,'%')  ");
         	 param.add(params.get("name"));
@@ -57,8 +51,41 @@ public class PosterQueryDaoImpl  implements PosterQueryDao {
         sb.append(" ORDER BY t.create_time desc ");
         return dao.findPage(sb.toString(),param.toArray(),initPage);
 	}
-    
-    
-	
-	
+
+    @Override
+    public Page<Map<String, Object>> findActivityJoinByPage(Map<String, Object> params, Pageable initPage) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("  SELECT a.name,t.name as join_name,b.id,b.create_time,b.poster_img,t.phone,t.logo_img,t.qrcode_img1,t.qrcode_img2 from poster_activity a  ");
+        sb.append("   left join poster_activity_join b on a.id = b.activity_id ");
+        sb.append("   left join poster_join t on b.join_id = t.id ");
+        sb.append("  WHERE t.`status`=1    ");
+        List<Object> param = new ArrayList<>();
+        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+            sb.append(" and t.name like concat('%',?,'%')  ");
+            param.add(params.get("name"));
+        }
+        if(params.get("id")!=null && StringUtils.isNotEmpty(params.get("id").toString())) {
+            sb.append(" and a.id =? ");
+            param.add(params.get("id"));
+        }
+        sb.append(" ORDER BY b.create_time desc ");
+        return dao.findPage(sb.toString(),param.toArray(),initPage);
+    }
+
+    @Override
+    public List<Map<String, Object>> exportActivityList(Map<String, Object> params) {
+	    StringBuilder sb = new StringBuilder();
+        sb.append("  SELECT a.name,t.name as join_name,b.poster_img from poster_activity a  ");
+        sb.append("   join poster_activity_join b on a.id = b.activity_id ");
+        sb.append("   join poster_join t on b.join_id = t.id ");
+        sb.append("  WHERE t.`status`=1    ");
+        List<Object> param = new ArrayList<>();
+        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+            sb.append(" and t.name like concat('%',?,'%')  ");
+            param.add(params.get("name"));
+        }
+        return dao.findMap(sb.toString(),param.toArray());
+    }
+
+
 }

+ 22 - 0
src/main/java/com/ssj/service/sys/poster/service/PosterActivityJoinService.java

@@ -0,0 +1,22 @@
+package com.ssj.service.sys.poster.service;
+
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.bean.sys.poster.domain.PosterActivityJoin;
+import com.ssj.framework.core.common.service.BaseService;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.util.Map;
+
+/**
+ * @author admin
+ * 活动以及机构关联
+ */
+public interface PosterActivityJoinService extends BaseService<PosterActivityJoin, String> {
+	
+
+	Page<Map<String, Object>> findActivityJoinByPage(Map<String, Object> params, Pageable initPage);
+	
+	
+	
+}

+ 9 - 3
src/main/java/com/ssj/service/sys/poster/service/PosterActivityService.java

@@ -1,5 +1,6 @@
 package com.ssj.service.sys.poster.service;
 
+import java.util.List;
 import java.util.Map;
 
 import org.springframework.data.domain.Page;
@@ -12,7 +13,12 @@ public interface PosterActivityService extends BaseService<PosterActivity, Strin
 	
 
 	Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage);
-	
-	
-	
+
+
+    /**
+     * 下载活动海报数据
+     * @param params
+     * @return
+     */
+    List<Map<String, Object>> exportActivityList(Map<String, Object> params);
 }

+ 2 - 3
src/main/java/com/ssj/service/sys/poster/service/PosterJoinService.java

@@ -14,7 +14,6 @@ public interface PosterJoinService extends BaseService<PosterJoin, String> {
 	Page<Map<String, Object>> findJoinByPage(Map<String, Object> params, Pageable initPage);
 	
 	
-	PosterJoin generatePosterImg(PosterJoin posterJoin);
-	
-	
+	PosterJoin generatePosterImg(PosterJoin posterJoin,String activityId,String templateId );
+
 }

+ 2 - 1
src/main/java/com/ssj/service/sys/poster/service/PosterTemplateService.java

@@ -8,5 +8,6 @@ import com.ssj.framework.core.common.service.BaseService;
 public interface PosterTemplateService extends BaseService<PosterTemplate, String> {
 	
 	List<PosterTemplate> findPosterTemplateByList();
-	
+
+	List<PosterTemplate> findPosterTemplateByIds(List<String> templateIds);
 }

+ 44 - 0
src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityJoinServiceImpl.java

@@ -0,0 +1,44 @@
+package com.ssj.service.sys.poster.service.impl;
+
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.bean.sys.poster.domain.PosterActivityJoin;
+import com.ssj.dao.sys.poster.dao.PosterActivityDao;
+import com.ssj.dao.sys.poster.dao.PosterActivityJoinDao;
+import com.ssj.dao.sys.poster.dao.PosterQueryDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.poster.service.PosterActivityJoinService;
+import com.ssj.service.sys.poster.service.PosterActivityService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Map;
+
+@Service
+@Transactional
+public class PosterActivityJoinServiceImpl extends BaseServiceImpl<PosterActivityJoin, String> implements PosterActivityJoinService {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+    @Autowired
+    private PosterActivityJoinDao dao;
+
+    @Autowired
+    private PosterQueryDao posterQueryDao;
+    
+    @Override
+	public PagingAndSortingRepository<PosterActivityJoin, String> getDao() {
+		return dao;
+	}
+
+
+	@Override
+	public Page<Map<String, Object>> findActivityJoinByPage(Map<String, Object> params, Pageable initPage) {
+		return posterQueryDao.findActivityJoinByPage(params,initPage);
+	}
+}

+ 8 - 4
src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ssj.service.sys.poster.service.impl;
 
+import java.util.List;
 import java.util.Map;
 
 import org.slf4j.Logger;
@@ -38,8 +39,11 @@ public class PosterActivityServiceImpl extends BaseServiceImpl<PosterActivity, S
 	public Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage) {
 		return posterQueryDao.findActivityByPage(params, initPage);
 	}
-    
-	
-	
- 
+
+	@Override
+	public List<Map<String, Object>> exportActivityList(Map<String, Object> params) {
+		return posterQueryDao.exportActivityList(params);
+	}
+
+
 }

+ 24 - 17
src/main/java/com/ssj/service/sys/poster/service/impl/PosterJoinServiceImpl.java

@@ -13,6 +13,8 @@ import java.util.Map;
 
 import javax.imageio.ImageIO;
 
+import com.ssj.bean.sys.poster.domain.PosterActivityJoin;
+import com.ssj.dao.sys.poster.dao.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -26,10 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
 import com.ssj.bean.sys.poster.domain.PosterActivity;
 import com.ssj.bean.sys.poster.domain.PosterJoin;
 import com.ssj.bean.sys.poster.domain.PosterTemplate;
-import com.ssj.dao.sys.poster.dao.PosterActivityDao;
-import com.ssj.dao.sys.poster.dao.PosterJoinDao;
-import com.ssj.dao.sys.poster.dao.PosterQueryDao;
-import com.ssj.dao.sys.poster.dao.PosterTemplateDao;
 import com.ssj.framework.basic.utils.DateHelper;
 import com.ssj.framework.core.common.service.BaseServiceImpl;
 import com.ssj.framework.core.util.PropertiesUtil;
@@ -52,6 +50,9 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
     
     @Autowired
     private PosterTemplateDao posterTemplateDao;
+
+    @Autowired
+    private PosterActivityJoinDao activityJoinDao;
     
     @Autowired
     private PosterQueryDao posterQueryDao;
@@ -67,9 +68,8 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
 	}
 
 	@Override
-	public PosterJoin generatePosterImg(PosterJoin posterJoin) {
-		PosterActivity posterActivity=posterActivityDao.getOne(posterJoin.getActivityId());
-		PosterTemplate posterTemplate=posterTemplateDao.getOne(posterActivity.getTemplateId());
+	public PosterJoin generatePosterImg(PosterJoin posterJoin,String activityId,String templateId ) {
+		PosterTemplate posterTemplate=posterTemplateDao.getOne(templateId);
 		
 		if(StringUtils.isEmpty(posterJoin.getLogoImg()) || StringUtils.isEmpty(posterJoin.getQrcodeImg1())) {
 			return posterJoin;
@@ -77,10 +77,18 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
 		if(StringUtils.isNotEmpty(posterTemplate.getQrcodePosition2()) && StringUtils.isEmpty(posterJoin.getQrcodeImg2())) {
 			return posterJoin;
 		}
-		String posterImg=runGeneratePosterImg(posterTemplate, posterJoin);
+		String activityName = posterActivityDao.getOne(activityId).getName();
+		String posterImg=runGeneratePosterImg(posterTemplate, posterJoin,activityName);
 		if(StringUtils.isNotEmpty(posterImg)) {
-			posterJoin.setPosterImg(posterImg);
-			this.save(posterJoin);
+			//查询是否是存在的数据,存在就更新
+			PosterActivityJoin join = activityJoinDao.findOneByAnyP(posterJoin.getId(),activityId,templateId);
+			if(join == null){join = new PosterActivityJoin();}
+			join.setJoinId(posterJoin.getId());
+			join.setCreateTime(new Date());
+			join.setTemplateId(templateId);
+			join.setActivityId(activityId);
+			join.setPosterImg(posterImg);
+			activityJoinDao.save(join);
 		}
 		return posterJoin;
 	}
@@ -99,18 +107,17 @@ public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> i
 		posterJoin.setPhone("联系人:吴老师 13265096161");
 		posterJoin.setAddress("地址:佛山市南海区桂城融和路号号中铁建水岸花园号号号铺铺铺");//33个字
 		
-		String url=runGeneratePosterImg(posterTemplate, posterJoin);
+		String url=runGeneratePosterImg(posterTemplate, posterJoin,"");
 		System.out.println(url);
 	}
 	
     
-	public static String runGeneratePosterImg(PosterTemplate posterTemplate,PosterJoin posterJoin) {
+	public static String runGeneratePosterImg(PosterTemplate posterTemplate,PosterJoin posterJoin,String activityName) {
     	try {
-    		String savePath =PropertiesUtil.getValue("file_save_path");
-    		//String savePath="C:/Users/Admin/Desktop/";
-	    	// 当前日期(按月保存)
-	    	String date = DateHelper.formatDateByFormat(new Date(), "yyyy/MM/dd");
-	    	String save_path = savePath+date+"/";
+    		String savePath =PropertiesUtil.getValue("file_save_path")+"poster/";
+    		//String savePath="C:/Users/Admin/Desktop/poster/";
+	    	// 按/poster/活动/机构/海报 保存
+	    	String save_path = savePath+activityName+"/";
 	    	String target_path =  save_path+IdWorker.generateId() + ".png";
 	    	// 创建文件夹
 	    	File f = new File(save_path);

+ 7 - 4
src/main/java/com/ssj/service/sys/poster/service/impl/PosterTemplateServiceImpl.java

@@ -36,8 +36,11 @@ public class PosterTemplateServiceImpl extends BaseServiceImpl<PosterTemplate, S
 	public List<PosterTemplate> findPosterTemplateByList() {
 		return dao.findPosterTemplateByList();
 	}
-    
-	
-	
- 
+
+	@Override
+	public List<PosterTemplate> findPosterTemplateByIds(List<String> templateIds) {
+		return dao.findPosterTemplateByIds(templateIds);
+	}
+
+
 }

+ 487 - 262
src/main/java/com/ssj/sys/controller/PosterController.java

@@ -1,262 +1,487 @@
-package com.ssj.sys.controller;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-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 com.ssj.bean.common.framework.core.domain.Response;
-import com.ssj.bean.sys.imlibuser.TbClassTeacherTemp;
-import com.ssj.bean.sys.poster.domain.PosterActivity;
-import com.ssj.bean.sys.poster.domain.PosterJoin;
-import com.ssj.bean.sys.poster.domain.PosterTemplate;
-import com.ssj.framework.basic.common.bean.SplitPage;
-import com.ssj.framework.core.common.controller.BaseController;
-import com.ssj.service.sys.poster.service.PosterActivityService;
-import com.ssj.service.sys.poster.service.PosterJoinService;
-import com.ssj.service.sys.poster.service.PosterTemplateService;
-
-@Controller
-@RequestMapping("/sys/poster")
-public class PosterController extends BaseController {
-
-    @Autowired
-    private PosterActivityService posterActivityService;
-    
-    @Autowired
-    private PosterJoinService posterJoinService;
-    
-    @Autowired
-    private PosterTemplateService posterTemplateService;
-    
-
-    //查询活动列表
-    @RequestMapping("/activity/list")
-    public String activityList(Model model,
-            @RequestParam(required = false, defaultValue = "100") int pageSize,
-            @RequestParam(required = false, defaultValue = "1") int pageNo)throws Exception {
-		
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
-        SplitPage sp = new SplitPage();
-        sp.setAction(request.getRequestURI());
-        sp.setPageNo(pageNo);
-        sp.setPageSize(pageSize);
-        sp.setParams(params);
-        Page<Map<String, Object>> page = posterActivityService.findActivityByPage(params, initPage(pageNo, pageSize));
-        sp.setRowCnt((int) page.getTotalElements());
-        model.addAttribute("list", page.getContent());
-        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
-        model.addAttribute("page", sp);
-        model.addAttribute("search", params);
-        return "sys/poster/activity_list";
-    }
-    
-    
-    //编辑活动页面
-    @RequestMapping("/activity/edit")
-    public String activityEdit(Model model,String id)throws Exception {
-    	PosterActivity posterActivity=new PosterActivity();
-    	if(StringUtils.isNotEmpty(id)) {
-    		posterActivity=posterActivityService.getById(id);
-    	}
-        List<PosterTemplate> templates=posterTemplateService.findPosterTemplateByList();
-        model.addAttribute("posterActivity",posterActivity);
-        model.addAttribute("templates",templates);
-        return "sys/poster/activity_edit";
-    }
-	
-    
-    //保存活动信息
-    @RequestMapping("/activity/save")
-	@ResponseBody
-    public Response activitySave(Model model,String id,String templateId,String name)throws Exception {
-		Response response = new  Response();
-		if(StringUtils.isEmpty(id)){
-			PosterActivity posterActivity=new PosterActivity();
-			posterActivity.setName(name);
-			posterActivity.setTemplateId(templateId);
-			posterActivity.setStatus(1);
-			posterActivity.setCreateTime(new Date());
-			posterActivityService.save(posterActivity);
-		}else{
-			PosterActivity posterActivity=posterActivityService.getById(id);
-			if(posterActivity!=null) {
-				posterActivity.setName(name);
-				posterActivityService.save(posterActivity);
-			}
-		}
-		response.success("成功");
-        return response;
-    }
-    
-    
-    
-    //删除活动信息
-    @RequestMapping("/activity/del")
-	@ResponseBody
-    public Response activityDel(Model model,String id)throws Exception {
-		Response response = new  Response();
-		if(StringUtils.isNotEmpty(id)){
-			PosterActivity posterActivity=posterActivityService.getById(id);
-			if(posterActivity!=null) {
-				posterActivity.setStatus(0);
-				posterActivityService.save(posterActivity);
-			}
-		}
-		response.success("成功");
-        return response;
-    }
-
-    
-    
-    //查询机构列表
-    @RequestMapping("/join/list")
-    public String joinList(Model model,
-            @RequestParam(required = false, defaultValue = "100") int pageSize,
-            @RequestParam(required = false, defaultValue = "1") int pageNo)throws Exception {
-		
-        Map<String, Object> params = new HashMap<String, Object>();
-        params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
-        params.put("id", request.getParameter("id")==null?"":request.getParameter("id"));
-        SplitPage sp = new SplitPage();
-        sp.setAction(request.getRequestURI());
-        sp.setPageNo(pageNo);
-        sp.setPageSize(pageSize);
-        sp.setParams(params);
-        Page<Map<String, Object>> page = posterJoinService.findJoinByPage(params, initPage(pageNo, pageSize));
-        sp.setRowCnt((int) page.getTotalElements());
-        model.addAttribute("list", page.getContent());
-        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
-        model.addAttribute("page", sp);
-        model.addAttribute("search", params);
-        return "sys/poster/join_list";
-    }
-    
-    
-    //编辑活动页面
-    @RequestMapping("/join/edit")
-    public String joinEdit(Model model,String id,String aid)throws Exception {
-    	PosterActivity posterActivity=posterActivityService.getById(aid);
-    	PosterTemplate posterTemplate=posterTemplateService.getById(posterActivity.getTemplateId());
-    	PosterJoin posterJoin=new PosterJoin();
-    	if(StringUtils.isNotEmpty(id)) {
-    		posterJoin=posterJoinService.getById(id);
-    	}
-        List<PosterTemplate> templates=posterTemplateService.findPosterTemplateByList();
-        model.addAttribute("posterTemplate",posterTemplate);
-        model.addAttribute("posterJoin",posterJoin);
-        model.addAttribute("posterActivity",posterActivity);
-        model.addAttribute("templates",templates);
-        return "sys/poster/join_edit";
-    }
-    
-    
-    
-    //保存机构信息,并生成海报。
-    @RequestMapping("/join/save")
-	@ResponseBody
-    public Response joinSave(Model model,String id,String activityId,String name,String phone,String address,String logoImg,String qrcodeImg1,String qrcodeImg2,String posterImg)throws Exception {
-		Response response = new  Response();
-		if(StringUtils.isEmpty(id)){
-			PosterJoin posterJoin=new PosterJoin();
-			posterJoin.setActivityId(activityId);
-			posterJoin.setLogoImg(logoImg);
-			posterJoin.setName(name);
-			posterJoin.setPhone(phone);
-			posterJoin.setPosterImg(posterImg);
-			posterJoin.setQrcodeImg1(qrcodeImg1);
-			posterJoin.setQrcodeImg2(qrcodeImg2);
-			posterJoin.setAddress(address);
-			posterJoin.setStatus(1);
-			posterJoin.setCreateTime(new Date());
-			posterJoinService.save(posterJoin);
-			
-			posterJoinService.generatePosterImg(posterJoin);
-			
-		}else{
-			PosterJoin posterJoin=posterJoinService.getById(id);
-			if(posterJoin!=null) {
-				posterJoin.setLogoImg(logoImg);
-				posterJoin.setName(name);
-				posterJoin.setPhone(phone);
-				posterJoin.setPosterImg(posterImg);
-				posterJoin.setQrcodeImg1(qrcodeImg1);
-				posterJoin.setQrcodeImg2(qrcodeImg2);
-				posterJoin.setAddress(address);
-				posterJoinService.save(posterJoin);
-				
-				posterJoinService.generatePosterImg(posterJoin);
-				
-			}
-		}
-		response.success("成功");
-        return response;
-    }
-    
-    
-    //删除活动信息
-    @RequestMapping("/join/del")
-	@ResponseBody
-    public Response joinDel(Model model,String id)throws Exception {
-		Response response = new  Response();
-		if(StringUtils.isNotEmpty(id)){
-			PosterJoin posterJoin=posterJoinService.getById(id);
-			if(posterJoin!=null) {
-				posterJoin.setStatus(0);
-				posterJoinService.save(posterJoin);
-			}
-		}
-		response.success("成功");
-        return response;
-    }
-
-    
-    
-    
-    //导入机构信息
-    @RequestMapping(value="/join/import")
-	@ResponseBody
-	public Response teacherImport(Model model,String id,@RequestParam("file") MultipartFile file) {
-		Response response = new  Response();
-		try {
-			List<Map<String,String>> datas=ImLibUserController.analysisExFile(file);
-			if(datas!=null && datas.size()>0){
-				List<PosterJoin> posterJoins=new ArrayList<PosterJoin>();
-				PosterJoin posterJoin=null;
-				for (Map<String,String> map : datas) {
-					posterJoin=new PosterJoin();
-					posterJoin.setName(map.get("data_0"));
-					posterJoin.setPhone(map.get("data_1"));
-					posterJoin.setActivityId(id);
-					posterJoin.setCreateTime(new Date());
-					posterJoin.setStatus(1);
-					posterJoins.add(posterJoin);
-				}
-				if(posterJoins.size()>0) {
-					posterJoinService.save(posterJoins);
-				}
-			}
-			response.success("导入成功");
-		} catch (Exception e) {
-			logger.error("导入机构异常", e);
-			response.failure("导入机构异常:"+e.getMessage());
-		}
-		return response;
-	}	
-    
-    
-	
-
-}
+package com.ssj.sys.controller;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+import com.ssj.bean.sys.poster.domain.PosterActivityJoin;
+import com.ssj.framework.basic.utils.DateHelper;
+import com.ssj.framework.core.util.SystemResourceLocator;
+import com.ssj.framework.weixin.util.BarcodeFactory;
+import com.ssj.service.sys.poster.service.PosterActivityJoinService;
+import com.ssj.util.ZipCompressor;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.ssj.bean.common.framework.core.domain.Response;
+import com.ssj.bean.sys.imlibuser.TbClassTeacherTemp;
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.bean.sys.poster.domain.PosterJoin;
+import com.ssj.bean.sys.poster.domain.PosterTemplate;
+import com.ssj.framework.basic.common.bean.SplitPage;
+import com.ssj.framework.core.common.controller.BaseController;
+import com.ssj.service.sys.poster.service.PosterActivityService;
+import com.ssj.service.sys.poster.service.PosterJoinService;
+import com.ssj.service.sys.poster.service.PosterTemplateService;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author admin
+ * @date xxx
+ * 海报管理
+ */
+@Controller
+@RequestMapping("/sys/poster")
+public class PosterController extends BaseController {
+
+    @Autowired
+    private PosterActivityService posterActivityService;
+    
+    @Autowired
+    private PosterJoinService posterJoinService;
+    
+    @Autowired
+    private PosterTemplateService posterTemplateService;
+
+    @Autowired
+    private PosterActivityJoinService activityJoinService;
+
+
+	/**
+	 * 查询活动列表
+	 * @param model
+	 * @param pageSize
+	 * @param pageNo
+	 * @return
+	 * @throws Exception
+	 */
+    @RequestMapping("/activity/list")
+    public String activityList(Model model,
+            @RequestParam(required = false, defaultValue = "100") int pageSize,
+            @RequestParam(required = false, defaultValue = "1") int pageNo)throws Exception {
+		
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<Map<String, Object>> page = posterActivityService.findActivityByPage(params, initPage(pageNo, pageSize));
+        sp.setRowCnt((int) page.getTotalElements());
+        model.addAttribute("list", page.getContent());
+        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
+        model.addAttribute("page", sp);
+        model.addAttribute("search", params);
+        return "sys/poster/activity_list";
+    }
+
+	/**
+	 * 下载海报
+	 * @param response
+	 */
+	@RequestMapping(value = "/exportDetail", method = RequestMethod.POST)
+	@ResponseBody
+	public void exportDetail(HttpServletResponse response) {
+		try {
+			String file_path = (String) SystemResourceLocator.getValue("file_save_path");
+			String dataStr = DateHelper.formatDateByFormat(new Date(), "yyyyMMddHHmmss");
+			String zip = "/poster/"+dataStr+".zip";
+			//先压缩文件
+			ZipCompressor zc = new ZipCompressor(file_path+zip);
+			//根据条件查询需要下载的文件
+			Map<String, Object> params = new HashMap<String, Object>();
+			params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
+			List<Map<String,Object>> list = posterActivityService.exportActivityList(params);
+			String[] compressorFiles = new String[list.size()];
+			int i = 0;
+			if(Objects.nonNull(list)){
+				for(Map<String,Object> m:list){
+					compressorFiles[i]= MapUtils.getString(m,"name");
+					i++;
+				}
+			}
+			zc.compress(compressorFiles);
+			exportResponseHeadSet(response,"");
+			exportFile(response,file_path+zip);
+		} catch (Exception e) {
+			logger.error("异常", e);
+		}
+	}
+
+	public void exportResponseHeadSet(HttpServletResponse response,String fileName) throws  Exception{
+		response.setContentType("application/octet-stream;charset=UTF-8");
+		fileName=new String((fileName).getBytes("gb2312"), "iso8859-1");
+		response.setHeader("Content-Disposition", "attachment;filename=" + fileName+"_.zip");
+		response.setCharacterEncoding("utf-8");
+	}
+
+	public void exportFile(HttpServletResponse response,String fileNameUrl) throws Exception{
+		//压缩完成后,下载文件
+		File file = new File(fileNameUrl);
+		FileInputStream fis = new FileInputStream(file);
+		BufferedInputStream buff = new BufferedInputStream(fis);
+		// 相当于我们的缓存
+		byte[] b = new byte[4096];
+		// 该值用于计算当前实际下载了多少字节
+		long k = 0;
+		// 从response对象中得到输出流,准备下载
+		OutputStream myout = response.getOutputStream();
+		// 开始循环下载
+		while (k < file.length()) {
+			int j = buff.read(b, 0, 1024);
+			k += j;
+			myout.write(b, 0, j);
+		}
+		buff.close();
+		fis.close();
+	}
+	/**
+	 * 编辑活动页面
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activity/edit")
+    public String activityEdit(Model model,String id)throws Exception {
+    	PosterActivity posterActivity=new PosterActivity();
+    	if(StringUtils.isNotEmpty(id)) {
+    		posterActivity=posterActivityService.getById(id);
+    	}
+        List<PosterTemplate> templates=posterTemplateService.findPosterTemplateByList();
+        model.addAttribute("posterActivity",posterActivity);
+        model.addAttribute("templates",templates);
+        return "sys/poster/activity_edit";
+    }
+
+
+	/**
+	 * 保存活动信息
+	 * @param model
+	 * @param id
+	 * @param templateId
+	 * @param name
+	 * @return
+	 * @throws Exception
+	 */
+    @RequestMapping("/activity/save")
+	@ResponseBody
+    public Response activitySave(Model model,String id,String templateId,String name)throws Exception {
+		Response response = new  Response();
+		if(StringUtils.isEmpty(id)){
+			PosterActivity posterActivity=new PosterActivity();
+			posterActivity.setName(name);
+			posterActivity.setTemplateId(templateId);
+			posterActivity.setStatus(1);
+			posterActivity.setCreateTime(new Date());
+			posterActivityService.save(posterActivity);
+		}else{
+			PosterActivity posterActivity=posterActivityService.getById(id);
+			if(posterActivity!=null) {
+				posterActivity.setName(name);
+				posterActivityService.save(posterActivity);
+			}
+		}
+		response.success("成功");
+        return response;
+    }
+
+
+	/**
+	 * 删除活动信息
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activity/del")
+	@ResponseBody
+    public Response activityDel(Model model,String id)throws Exception {
+		Response response = new  Response();
+		if(StringUtils.isNotEmpty(id)){
+			PosterActivity posterActivity=posterActivityService.getById(id);
+			if(posterActivity!=null) {
+				posterActivity.setStatus(0);
+				posterActivityService.save(posterActivity);
+			}
+		}
+		response.success("成功");
+        return response;
+    }
+
+
+	/**
+	 * 查询机构列表
+	 * @param model
+	 * @param pageSize
+	 * @param pageNo
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/join/list")
+    public String joinList(Model model,
+            @RequestParam(required = false, defaultValue = "10") int pageSize,
+            @RequestParam(required = false, defaultValue = "1") int pageNo)throws Exception {
+		
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<Map<String, Object>> page = posterJoinService.findJoinByPage(params, initPage(pageNo, pageSize));
+        sp.setRowCnt((int) page.getTotalElements());
+        model.addAttribute("list", page.getContent());
+        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
+        model.addAttribute("page", sp);
+        model.addAttribute("search", params);
+        return "sys/poster/join_list";
+    }
+    /**
+	 * 查询机构列表
+	 * @param model
+	 * @param pageSize
+	 * @param pageNo
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activityJoin/list")
+    public String activityJoinList(Model model,
+            @RequestParam(required = false, defaultValue = "10") int pageSize,
+            @RequestParam(required = false, defaultValue = "1") int pageNo)throws Exception {
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("name", request.getParameter("name")==null?"":request.getParameter("name"));
+        params.put("id", request.getParameter("id")==null?"":request.getParameter("id"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<Map<String, Object>> page = activityJoinService.findActivityJoinByPage(params, initPage(pageNo, pageSize));
+        sp.setRowCnt((int) page.getTotalElements());
+        model.addAttribute("list", page.getContent());
+        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
+        model.addAttribute("page", sp);
+        model.addAttribute("search", params);
+        return "sys/poster/activity_join_list";
+    }
+
+
+	/**
+	 * 编辑机构页面
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/join/edit")
+    public String joinEdit(Model model,String id)throws Exception {
+    	PosterJoin posterJoin=new PosterJoin();
+    	if(StringUtils.isNotEmpty(id)) {
+    		posterJoin=posterJoinService.getById(id);
+    	}
+        model.addAttribute("posterJoin",posterJoin);
+        return "sys/poster/join_edit";
+    }
+    /**
+	 * 编辑活动页面
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activityJoin/edit")
+    public String activityJoinEdit(Model model,@RequestParam(required = false, defaultValue = "0") String id)throws Exception {
+
+		PosterActivityJoin join = activityJoinService.getById(id);
+		PosterJoin posterJoin=new PosterJoin();
+		PosterActivity activity = new PosterActivity();
+		List<PosterTemplate> list  = new ArrayList<>();
+		if(Objects.nonNull(join)){
+			posterJoin = posterJoinService.getById(join.getJoinId());
+			activity = posterActivityService.getById(join.getActivityId());
+			List<String> ids = Arrays.asList(activity.getTemplateId().split(","));
+			list = posterTemplateService.findPosterTemplateByIds(ids);
+		}
+        model.addAttribute("posterJoin",posterJoin);
+        model.addAttribute("templates",list);
+        model.addAttribute("activity",activity);
+        model.addAttribute("join",join);
+        return "sys/poster/activity_join_edit";
+    }
+    /**
+	 * 活动页面新增
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activityJoin/add")
+    public String activityJoinAdd(Model model,@RequestParam(required = false, defaultValue = "0") String id)throws Exception {
+
+		List<PosterJoin> posterJoin= posterJoinService.findAll();
+		PosterActivity activity =  posterActivityService.getById(id);
+		List<String> ids = Arrays.asList(activity.getTemplateId().split(","));
+		List<PosterTemplate> list  =  posterTemplateService.findPosterTemplateByIds(ids);
+        model.addAttribute("posterJoins",posterJoin);
+        model.addAttribute("templates",list);
+        model.addAttribute("activity",activity);
+        return "sys/poster/activity_join_add";
+    }
+
+
+	/**
+	 * 保存机构信息,并生成海报
+	 * @param model
+	 * @param id
+	 * @param name
+	 * @param phone
+	 * @param address
+	 * @param logoImg
+	 * @param qrcodeImg1
+	 * @param qrcodeImg2
+	 * @param posterImg
+	 * @return
+	 * @throws Exception
+	 */
+    @RequestMapping("/join/save")
+	@ResponseBody
+    public Response joinSave(Model model,String id,String name,String phone,String address,String logoImg,String qrcodeImg1,String qrcodeImg2,String posterImg)throws Exception {
+		Response response = new  Response();
+		PosterJoin posterJoin=new PosterJoin();
+		if(StringUtils.isEmpty(id)){
+			posterJoin.setCreateTime(new Date());
+			posterJoin.setStatus(1);
+		}else{
+			posterJoin=posterJoinService.getById(id);
+			if(posterJoin==null) {
+				posterJoin = new PosterJoin();
+				//posterJoinService.generatePosterImg(posterJoin);
+			}
+		}
+		posterJoin.setLogoImg(logoImg);
+		posterJoin.setName(name);
+		posterJoin.setPhone(phone);
+		posterJoin.setPosterImg(posterImg);
+		posterJoin.setQrcodeImg1(qrcodeImg1);
+		posterJoin.setQrcodeImg2(qrcodeImg2);
+		posterJoin.setAddress(address);
+		posterJoinService.save(posterJoin);
+		response.success("成功");
+        return response;
+    }
+    @RequestMapping("/activityJoin/save")
+	@ResponseBody
+    public Response activityJoinSave(Model model,String ids,String aid,String templateId)throws Exception {
+		Response response = new  Response();
+		List<String> list = Arrays.asList(ids.split(","));
+		list.forEach(a->
+				posterJoinService.generatePosterImg(posterJoinService.getById(a),aid,templateId)
+		);
+		response.success("成功");
+        return response;
+    }
+
+	/**
+	 * 删除机构
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/join/del")
+	@ResponseBody
+    public Response joinDel(Model model,String id)throws Exception {
+		Response response = new  Response();
+		if(StringUtils.isNotEmpty(id)){
+			PosterJoin posterJoin=posterJoinService.getById(id);
+			if(posterJoin!=null) {
+				posterJoin.setStatus(0);
+				posterJoinService.save(posterJoin);
+			}
+		}
+		response.success("成功");
+        return response;
+    }
+    /**
+	 * 删除海报
+	 * @param model
+	 * @param id
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping("/activityJoin/del")
+	@ResponseBody
+    public Response activityJoinDel(Model model,String id)throws Exception {
+		Response response = new  Response();
+
+		PosterActivityJoin activityJoin = activityJoinService.getById(id);
+
+		//删除海报文件
+		String file_path = SystemResourceLocator.getValue("file_save_path")+"poster/";
+		File file = new File(file_path+activityJoin.getPosterImg());
+		file.deleteOnExit();
+
+		activityJoinService.delete(id);
+		response.success("成功");
+        return response;
+    }
+
+
+	/**
+	 * 导入机构信息
+	 * @param model
+	 * @param id
+	 * @param file
+	 * @return
+	 */
+	@RequestMapping(value="/join/import")
+	@ResponseBody
+	public Response teacherImport(Model model,String id,@RequestParam("file") MultipartFile file) {
+		Response response = new  Response();
+		try {
+			List<Map<String,String>> datas=ImLibUserController.analysisExFile(file);
+			if(datas!=null && datas.size()>0){
+				List<PosterJoin> posterJoins=new ArrayList<PosterJoin>();
+				PosterJoin posterJoin=null;
+				for (Map<String,String> map : datas) {
+					posterJoin=new PosterJoin();
+					posterJoin.setName(map.get("data_0"));
+					posterJoin.setPhone(map.get("data_1"));
+					posterJoin.setCreateTime(new Date());
+					posterJoin.setStatus(1);
+					posterJoins.add(posterJoin);
+				}
+				if(posterJoins.size()>0) {
+					posterJoinService.save(posterJoins);
+				}
+			}
+			response.success("导入成功");
+		} catch (Exception e) {
+			logger.error("导入机构异常", e);
+			response.failure("导入机构异常:"+e.getMessage());
+		}
+		return response;
+	}	
+    
+    
+	
+
+}

+ 107 - 0
src/main/java/com/ssj/util/ZipCompressor.java

@@ -0,0 +1,107 @@
+package com.ssj.util;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.zip.CRC32;
+import java.util.zip.CheckedOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * @author sh
+ * @className ZipCompressor
+ * @description zip
+ * @date 2020/11/20
+ */
+public class ZipCompressor {
+    static final int BUFFER = 8192;
+
+    private File zipFile;
+
+    public ZipCompressor(String pathName) {
+        zipFile = new File(pathName);
+    }
+    public void compress(String... pathName) {
+        ZipOutputStream out = null;
+        try {
+            FileOutputStream fileOutputStream = new FileOutputStream(zipFile);
+            CheckedOutputStream cos = new CheckedOutputStream(fileOutputStream,
+                    new CRC32());
+            out = new ZipOutputStream(cos);
+            String basedir = "";
+            for (int i=0;i<pathName.length;i++){
+                compress(new File(pathName[i]), out, basedir);
+            }
+            out.close();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    public void compress(String srcPathName) {
+        File file = new File(srcPathName);
+        if (!file.exists()){
+            throw new RuntimeException(srcPathName + "不存在!");}
+        try {
+            FileOutputStream fileOutputStream = new FileOutputStream(zipFile);
+            CheckedOutputStream cos = new CheckedOutputStream(fileOutputStream,
+                    new CRC32());
+            ZipOutputStream out = new ZipOutputStream(cos);
+            String basedir = "";
+            compress(file, out, basedir);
+            out.close();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void compress(File file, ZipOutputStream out, String basedir) {
+        /* 判断是目录还是文件 */
+        if (file.isDirectory()) {
+            //System.out.println("压缩:" + basedir + file.getName());
+            this.compressDirectory(file, out, basedir);
+        } else {
+            //System.out.println("压缩:" + basedir + file.getName());
+            this.compressFile(file, out, basedir);
+        }
+    }
+
+    /** 压缩一个目录 */
+    private void compressDirectory(File dir, ZipOutputStream out, String basedir) {
+        if (!dir.exists()){
+            return;
+        }
+
+        File[] files = dir.listFiles();
+        for (int i = 0; i < files.length; i++) {
+            /* 递归 */
+            compress(files[i], out, basedir + dir.getName() + "/");
+        }
+    }
+
+    /** 压缩一个文件 */
+    private void compressFile(File file, ZipOutputStream out, String basedir) {
+        if (!file.exists()) {
+            return;
+        }
+        try {
+            BufferedInputStream bis = new BufferedInputStream(
+                    new FileInputStream(file));
+            ZipEntry entry = new ZipEntry(basedir + file.getName());
+            out.putNextEntry(entry);
+            int count;
+            byte data[] = new byte[BUFFER];
+            while ((count = bis.read(data, 0, BUFFER)) != -1) {
+                out.write(data, 0, count);
+            }
+            bis.close();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+    public static void main(String[] args) {
+        ZipCompressor zc = new ZipCompressor("E:/resource.zip");
+        zc.compress("E:/test1","E:/test2");
+    }
+}

+ 22 - 5
src/main/resources/templates/sys/poster/activity_edit.html

@@ -111,20 +111,37 @@ dtext{
 
 $(function (){
      $('#posterimgs img').click(function() {
-    	 $('#posterimgs img').removeClass('imgred');
-    	 $('#posterimgs img').addClass('imgfff');
-    	 $(this).removeClass('imgfff');
-         $(this).addClass('imgred');
+    	 // $('#posterimgs img').removeClass('imgred');
+    	 // $('#posterimgs img').addClass('imgfff');
+		 if($(this).hasClass("imgfff")){
+			 $(this).removeClass('imgfff');
+			 $(this).addClass('imgred');
+		 }else{
+			 $(this).removeClass('imgred');
+			 $(this).addClass('imgfff');
+		 }
+
      }); 
 })
 
+function  closeWin() {
+	parent.layer.close(parent.layer.getFrameIndex(window.name));
+}
+
 function save(){
 	
 	if($("#name").val()==''){
 		parent.layer.msg("活动名称不能为空",{icon:11});
 		return
 	}
-	var templateId=$(".imgred").data("id");
+	var templateId="";
+	$('.imgred').each(function(i,n){
+		templateId=templateId+$(n).data("id")+",";
+	});
+	if(templateId.endsWith(",")){
+		templateId = templateId.substr(0,templateId.length-1);
+	}
+	console.log("templateId--->"+templateId);
 	if(templateId=='' || templateId==undefined || templateId=='undefined'){
 		parent.layer.msg("活动模板不能为空",{icon:11});
 		return

+ 178 - 0
src/main/resources/templates/sys/poster/activity_join_add.html

@@ -0,0 +1,178 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script>
+<link th:href="@{/static/js/select/fselect.css}" rel="stylesheet" type="text/css">
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/city.json.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/citySetMe_V.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/Popt.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+<script src="sys/js/select/fSelect.js" th:src="@{/static/js/select/fselect.js}"></script>
+</head>
+ <style type="text/css">
+   body{min-width:180px;}
+       .select1{
+   		    width:100%;
+		    height: 32px;
+		    line-height: 32px;
+		    border-top: solid 1px #a7b5bc;
+		    border-left: solid 1px #a7b5bc;
+		    border-right: solid 1px #ced9df;
+		    border-bottom: solid 1px #ced9df;
+		    opacity:1;
+	        margin-bottom: 10px;
+    	}
+    	.btn{
+    	  width: 100px;
+    	}
+     label.control-label-error {color: Red;}	
+     
+._citys {     background-color: whitesmoke;width: 450px; display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
+._citys span { color: #05920a; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #05920a; cursor: pointer; }
+._citys0 { width: 95%; height: 34px; line-height: 34px; display: inline-block; border-bottom: 2px solid #05920a; padding: 0px 5px; font-size:14px; font-weight:bold; margin-left:6px; }
+._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
+._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
+._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 12px; border-radius: 5px; overflow: hidden; }
+._citys1 a:hover { color: #fff; background-color: #05920a; }
+.AreaS { background-color: #05920a !important; color: #fff !important; }
+#school{
+	margin-left: 110px;
+	padding-bottom: 10px;
+}  
+#school span{
+  	min-width: 25%;
+    float: left;
+    margin-bottom: 10px;
+}
+.joinseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}
+
+.schoolseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}    
+
+dtext{
+	color: red;
+	cursor: pointer;
+}
+.forminfo li label{
+	text-align: right;
+	padding-right: 10px
+}
+#posterimgs img{
+	width: 120px;
+  
+    margin: 10px;
+}
+
+.imgred{
+  border: 1px solid red;
+}
+
+.imgfff{
+  border: 1px solid #fff;
+}
+  
+</style>
+<body>
+<div class="formbody">
+		<ul class="forminfo">
+			<li>
+				<label>活动名称:	<b>*</b></label>
+				<input type="text" id="name" class="dfinput fl" name="name" th:value="${activity.name}" />
+			</li>
+			<li>
+				<label>机构名称:	<b>*</b></label>
+				<div class="vocation " style="margin-right: 5px; width: 300px" >
+					<select class="select2 mselect" name="jname"  multiple="multiple">
+						<optgroup label="机构">
+							<option th:value="${item.id}"
+									th:each="item:${posterJoins}" th:text="${item.name}">学前</option>
+						</optgroup>
+					</select>
+
+				</div>
+			</li>
+			
+			<li style="margin-bottom:3px">
+				<label>从以下模板中选择(单选):<b></b></label>
+
+				<div id="posterimgs">
+					<img class="imgfff" th:each="item:${templates}" th:data-id="${item.id}" th:src="${imgUrl+item.backImg}">
+				</div>
+			</li>
+			
+			<li style="padding-top: 20px">
+				<label>&nbsp;</label>
+				<button type="submit" onclick="save();" class="btn">提交</button>
+				<button type="button" class="btn" onclick="closeWin();">取消</button>
+			</li>
+			
+		</ul>
+			
+</div>
+
+</body>
+<script type="text/javascript">
+
+
+$(function (){
+     $('#posterimgs img').click(function() {
+    	 $('#posterimgs img').removeClass('imgred');
+    	 $('#posterimgs img').addClass('imgfff');
+    	 $(this).removeClass('imgfff');
+         $(this).addClass('imgred');
+     });
+
+	$('.mselect').fSelect();
+})
+
+function save(){
+	
+	if($("#name").val()==''){
+		parent.layer.msg("活动名称不能为空",{icon:11});
+		return
+	}
+	var templateId=$(".imgred").data("id");
+	if(templateId=='' || templateId==undefined || templateId=='undefined'){
+		parent.layer.msg("活动模板不能为空",{icon:11});
+		return
+	}
+	var ids = "";
+	$('.selected').each(function(i,n){
+		ids=ids+$(n).data("value")+",";
+	});
+	parent.layer.confirm("确定保存活动信息?", {
+		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+	}, function(){
+		var url="[[${sysUrl}]]/sys/poster/activityJoin/save";
+		var params ={
+			'id' : ids,
+            'aid' : '[[${activity.id}]]',
+            'templateId' : templateId,
+        };
+		$.post(url,params,function(data){
+			if(data.meta.success){
+				parent.layer.msg("保存成功",{icon:1});
+				parent.location.reload();
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			}else{
+				parent.layer.msg(data.meta.message,{icon:11});
+			}
+		});
+	});
+}
+
+function closeWin(){
+	parent.location.reload();
+	parent.layer.close(parent.layer.getFrameIndex(window.name));
+}
+
+</script>
+</html>

+ 160 - 0
src/main/resources/templates/sys/poster/activity_join_edit.html

@@ -0,0 +1,160 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script> 
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/city.json.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/citySetMe_V.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/js/city/Popt.js}"></script>
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+</head>
+ <style type="text/css">
+   body{min-width:180px;}
+       .select1{
+   		    width:100%;
+		    height: 32px;
+		    line-height: 32px;
+		    border-top: solid 1px #a7b5bc;
+		    border-left: solid 1px #a7b5bc;
+		    border-right: solid 1px #ced9df;
+		    border-bottom: solid 1px #ced9df;
+		    opacity:1;
+	        margin-bottom: 10px;
+    	}
+    	.btn{
+    	  width: 100px;
+    	}
+     label.control-label-error {color: Red;}	
+     
+._citys {     background-color: whitesmoke;width: 450px; display: inline-block; border: 2px solid #eee; padding: 5px; position: relative; }
+._citys span { color: #05920a; height: 15px; width: 15px; line-height: 15px; text-align: center; border-radius: 3px; position: absolute; right: 10px; top: 10px; border: 1px solid #05920a; cursor: pointer; }
+._citys0 { width: 95%; height: 34px; line-height: 34px; display: inline-block; border-bottom: 2px solid #05920a; padding: 0px 5px; font-size:14px; font-weight:bold; margin-left:6px; }
+._citys0 li { display: inline-block; line-height: 34px; font-size: 15px; color: #888; width: 80px; text-align: center; cursor: pointer; }
+._citys1 { width: 100%; display: inline-block; padding: 10px 0; }
+._citys1 a { width: 83px; height: 35px; display: inline-block; background-color: #f5f5f5; color: #666; margin-left: 6px; margin-top: 3px; line-height: 35px; text-align: center; cursor: pointer; font-size: 12px; border-radius: 5px; overflow: hidden; }
+._citys1 a:hover { color: #fff; background-color: #05920a; }
+.AreaS { background-color: #05920a !important; color: #fff !important; }
+#school{
+	margin-left: 110px;
+	padding-bottom: 10px;
+}  
+#school span{
+  	min-width: 25%;
+    float: left;
+    margin-bottom: 10px;
+}
+.joinseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}
+
+.schoolseachform li{
+	width: 50%;
+	margin-right: 0px;
+	padding-right: 0px;
+}    
+
+dtext{
+	color: red;
+	cursor: pointer;
+}
+.forminfo li label{
+	text-align: right;
+	padding-right: 10px
+}
+#posterimgs img{
+	width: 120px;
+  
+    margin: 10px;
+}
+
+.imgred{
+  border: 1px solid red;
+}
+
+.imgfff{
+  border: 1px solid #fff;
+}
+  
+</style>
+<body>
+<div class="formbody">
+		<ul class="forminfo">
+			<input type="hidden" id="id" class="dfinput fl" name="id" th:value="${join.id}"/>
+			
+			<li>
+				<label>活动名称:	<b>*</b></label>
+				<input type="text" id="name" class="dfinput fl" name="name" th:value="${activity.name}" />
+			</li>
+			<li>
+				<label>机构名称:	<b>*</b></label>
+				<input type="text" id="name" class="dfinput fl" name="name" th:value="${posterJoin.name}" />
+			</li>
+			
+			<li style="margin-bottom:3px">
+				<label>从以下模板中选择(单选):<b></b></label>
+				<div id="posterimgs">
+					<img th:classappend="${item.id eq join.templateId} ?'imgred':'imgfff'" th:each="item:${templates}" th:data-id="${item.id}" th:src="${imgUrl+item.backImg}">
+				</div>
+			</li>
+			
+			<li style="padding-top: 20px">
+				<label>&nbsp;</label>
+				<button type="submit" onclick="save();" class="btn">提交</button>
+				<button type="button" class="btn" onclick="closeWin();">取消</button>
+			</li>
+			
+		</ul>
+			
+</div>
+
+</body>
+<script type="text/javascript">
+
+
+$(function (){
+     $('#posterimgs img').click(function() {
+    	 $('#posterimgs img').removeClass('imgred');
+    	 $('#posterimgs img').addClass('imgfff');
+    	 $(this).removeClass('imgfff');
+         $(this).addClass('imgred');
+     }); 
+})
+
+function save(){
+	
+	if($("#name").val()==''){
+		parent.layer.msg("活动名称不能为空",{icon:11});
+		return
+	}
+	var templateId=$(".imgred").data("id");
+	if(templateId=='' || templateId==undefined || templateId=='undefined'){
+		parent.layer.msg("活动模板不能为空",{icon:11});
+		return
+	}
+	parent.layer.confirm("确定保存活动信息?", {
+		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+	}, function(){
+		var url="[[${sysUrl}]]/sys/poster/activity/save";
+		var params ={
+			'id' : $("#id").val(),
+            'name' : $("#name").val(),
+            'templateId' : templateId,
+        };
+		$.post(url,params,function(data){
+			if(data.meta.success){
+				parent.layer.msg("保存成功",{icon:1});
+				parent.location.reload();
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			}else{
+				parent.layer.msg(data.meta.message,{icon:11});
+			}
+		});
+	});
+}
+
+
+
+</script>
+</html>

+ 158 - 0
src/main/resources/templates/sys/poster/activity_join_list.html

@@ -0,0 +1,158 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script> 
+<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+<meta http-equiv="Content-Disposition" content="attachment;">
+</head>
+<style>
+	.tablelink{margin-right:10px;}
+	.stylecss{
+	      color: red;
+	}
+	.select_width{
+	     width: 220px;
+	}
+	.date_width{
+	     width: 150px;
+	}
+	
+	.tablelist th,td{
+		white-space: nowrap;
+		text-overflow: ellipsis;
+		overflow: hidden;
+	}
+	.tablelist td a{
+    	text-decoration: underline;
+	}
+	
+</style>
+<body>
+<div class="place">
+	<span>位置:</span>
+	<ul class="placeul">
+		<li><a href="#">活动海报</a></li>
+		<li><a href="#">活动海报生成详情</a></li>
+	</ul>
+</div>
+<div class="rightinfo">
+	<form id="seachform" th:action="@{/sys/poster/activityJoin/list.html}" method="post" style="float: left;width: 460px;">
+	<input type="hidden" name="pageSize" id="pageSize" value="10" />
+	<ul class="seachform">
+			<li>
+			 <label>机构名称</label>
+			  <input name="id" type="hidden" id="id" class="scinput" th:value="${search.id}"  />
+			  <input name="name" type="text" class="scinput" th:value="${search.name}"  />
+		    </li>
+			<li>
+		<input type="button" class="scbtn selectbtu" value="查询" />
+	</li>
+		<li>
+			<a th:href="@{/sys/poster/activity/list.html}">
+				<input type="button" class="scbtn" value="返回" />
+			</a>
+		</li>
+
+			<li>
+				<ul class="toolbar">
+					<a href="javascript:;" onclick="edit('')">
+						<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>新增海报</li>
+					</a>
+				</ul>
+			</li>
+	</ul>
+	</form>
+
+	<table class="tablelist">
+		<thead>
+		    <tr>
+		    	<th style="width: 50px;">序号</th>
+		    	<th >活动名称 </th>
+		    	<th >机构名称 </th>
+				<th >创建时间</th>
+		    	<th >海报</th>
+		    	<th >联系方式</th>
+		    	<th >LOGO</th>
+		    	<th >二维码1</th>
+		    	<th >二维码2</th>
+		    	<th >操作</th>
+		    </tr> 
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" >
+				<td th:text="${itemStat.count+((page.pageNo-1)*page.pageSize) }"></td>
+				<td th:text="${item.name}"></td>
+				<td th:text="${item.join_name}"></td>
+				<td th:text="${item.create_time}"></td>
+				<td class="imgtd">
+					<img  th:if="${item.poster_img!=null && item.poster_img!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.poster_img}">
+				</td>
+				<td th:text="${item.phone}"></td>
+
+				<td class="imgtd">
+					<img  th:if="${item.logo_img!=null && item.logo_img!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.logo_img}">
+				</td>
+				<td class="imgtd">
+					<img th:if="${item.qrcode_img1!=null && item.qrcode_img1!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.qrcode_img1}">
+				</td>
+				<td class="imgtd">
+					<img th:if="${item.qrcode_img2!=null && item.qrcode_img2!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.qrcode_img2}">
+				</td>
+				<td >
+					<a href="javascript:;" th:onclick="'edit(\''+${item.id}+'\')'" >编辑</a>
+					<a th:href="${imgUrl+item.poster_img}"  class="tablelink">下载</a>
+					<a th:href="${'javascript:joinDel(''' + item.id + ''')'}"  class="tablelink">删除</a>
+				</td>
+			</tr>
+		</tbody>
+	</table>
+
+	<!-- 分页 -->
+	<div class="pagin">
+    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录,当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
+    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
+   	</div>
+</div>
+</body>
+
+<script type="text/javascript">
+	function edit(id){
+		var title="添加海报";
+		var content = '[[${sysUrl}]]/sys/poster/activityJoin/add.html?&id='+$("#id").val();
+		if(id!=null && id!='' && id!=undefined){
+			title="编辑海报";
+			content = '[[${sysUrl}]]/sys/poster/activityJoin/edit.html?&id='+id;
+		}
+		parent.layer.open({
+		    type: 2,
+		    title: title,
+		    closeBtn: 1, //不显示关闭按钮
+		    shift: 0.8,
+		    offset: '100px',
+		    area: ['50%', '60%'],
+		    content: content
+		});
+	}
+	
+	function joinDel(id){
+		parent.layer.confirm("您确定要删除机构?", {
+			icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+		}, function(){
+			var url="[[${sysUrl}]]/sys/poster/activityJoin/del?id="+id;
+			var params ={};
+			$.post(url,params,function(data){
+				if(data.meta.success){
+					parent.layer.msg("删除成功",{icon:1});
+					$(".selectbtu").click();
+				}else{
+					parent.layer.msg(data.meta.message,{icon:11});
+				}
+			});
+		});
+	}
+	
+	
+</script>
+
+</html>

+ 19 - 6
src/main/resources/templates/sys/poster/activity_list.html

@@ -25,7 +25,9 @@
 	.tablelist td a{
     	text-decoration: underline;
 	}
-	
+	img{
+		margin-left: 3px;
+	}
 </style>
 <body>
 <div class="place">
@@ -40,7 +42,7 @@
 	<input type="hidden" name="pageSize" id="pageSize" value="10" />
 	<ul class="seachform">
 			<li>
-			 <label>商户名称</label>
+			 <label>活动名称</label>
 			  <input name="name" type="text" class="scinput" th:value="${search.name}"  />
 		    </li>
 			<li>
@@ -48,8 +50,13 @@
 			</li>
 			<li>
 				<ul class="toolbar">
+					<a href="javascript:;" onclick="exportAll()">
+						<input type="button" class="scbtn" value="导出" />
+					</a>
+				</ul>
+				<ul class="toolbar">
 					<a href="javascript:;" onclick="edit('')">
-						<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>添加奖品</li>
+						<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>新增活动</li>
 					</a>
 				</ul>
 			</li>
@@ -73,14 +80,14 @@
 				<td th:text="${itemStat.count+((page.pageNo-1)*page.pageSize) }"></td>
 				<td th:title="${item.name}" th:text="${item.name}"></td>
 				<td>
-					<img style="height: 40px;" th:src="${imgUrl+item.back_img}">
+					<img th:each="image:${#strings.listSplit(item.back_img,',')}" style="width: 50px;height: 50px;" th:src="${imgUrl+image}">
 				</td>
 				<td th:text="${item.create_time}"></td>
 				<td th:text="${item.count}"></td>
 				<td >
 					<a style="color: red" th:href="${'javascript:activityDel(''' + item.id + ''')'}"  class="tablelink">删除活动</a>
 					&nbsp;
-					<a th:href="@{/sys/poster/join/list.html(id=${item.id})}">
+					<a th:href="@{/sys/poster/activityJoin/list.html(id=${item.id})}">
 						查看明细
 					</a>
 					
@@ -131,7 +138,13 @@
 			});
 		});
 	}
-	
+	function exportAll() {
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/poster/activity/exportDetail";
+		$("#seachform").submit();
+		window.setTimeout(function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/poster/activity/list.html";
+		},3000);
+	}
 	
 	
 	

+ 4 - 14
src/main/resources/templates/sys/poster/join_edit.html

@@ -82,18 +82,7 @@ dtext{
 <div class="formbody">
 		<ul class="forminfo">
 			<input type="hidden" id="id" class="dfinput fl" name="id" th:value="${posterJoin.id}"/>
-			<input type="hidden" id="activityId" class="dfinput fl" name="activityId" th:value="${posterActivity.id}"/>
-			
-			<li style="margin-bottom:3px">
-				<label>海报模板:<b>*</b></label>
-				<img style="width: 120px" th:src="${imgUrl+posterTemplate.backImg}">
-			</li>
-			
-			<li>
-				<label>活动名称:	<b>*</b></label>
-				<input type="text" disabled="disabled" class="dfinput fl"  th:value="${posterActivity.name}" />
-			</li>
-			
+
 			<li>
 				<label>机构名称:	<b>*</b></label>
 				<input type="text" id="name" class="dfinput fl" name="name" th:value="${posterJoin.name}" />
@@ -169,7 +158,6 @@ function save(){
 		var url="[[${sysUrl}]]/sys/poster/join/save";
 		var params ={
 			'id' : $("#id").val(),
-            'activityId' : $("#activityId").val(),
             'name' : $("#name").val(),
             'phone' : $("#phone").val(),
             'address' : $("#address").val(),
@@ -188,7 +176,9 @@ function save(){
 		});
 	});
 }
-
+function  closeWin() {
+	parent.layer.close(parent.layer.getFrameIndex(window.name));
+}
 
 
 </script>

+ 10 - 21
src/main/resources/templates/sys/poster/join_list.html

@@ -42,7 +42,6 @@
 	<ul class="seachform">
 			<li>
 			 <label>机构名称</label>
-			  <input name="id" type="hidden" class="scinput" th:value="${search.id}"  />
 			  <input name="name" type="text" class="scinput" th:value="${search.name}"  />
 		    </li>
 			<li>
@@ -60,14 +59,14 @@
 	
 	<ul class="seachform"  style="float: left;width: 500px;">
 		<li>
-		  <input type="button" id="teacherimput" style="width: 100px;height: 30px;margin-top: 4px;"  class="scbtn" value=" + 导入机构" />
+		  <input type="button" id="teacherimput" style="width: 100px;height: 30px;margin-top: 4px;"  class="scbtn" value=" + 批量导入机构" />
 		  <div style="display: none">
 		 	 <input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" id="teacherfile" />
 		  </div>
 	    </li>
 	    
 	     <li>
-		  	<a th:href="@{/static/sys/excel/join_lib.xlsx}"><input type="button" style="width: 100px;height: 30px;margin-top: 4px;"  class="scbtn" value="下载导入模板" /></a>
+		  	<a th:href="@{/static/sys/excel/join_lib.xlsx}"><input type="button" style="width: 100px;height: 30px;margin-top: 4px;"  class="scbtn" value="下载导入表格" /></a>
 	     </li>
      </ul>
 
@@ -75,12 +74,10 @@
 		<thead>
 		    <tr>
 		    	<th style="width: 50px;">序号</th>
-		    	<th >活动名称 </th>
 		    	<th >机构名称 </th>
 		    	<th >联系方式</th>
+		    	<th >地址</th>
 		    	<th >创建时间</th>
-		    	<th >海报模板</th>
-		    	<th >生成海报</th>
 		    	<th >LOGO</th>
 		    	<th >二维码1</th>
 		    	<th >二维码2</th>
@@ -90,31 +87,23 @@
 		<tbody>
 			<tr th:each="item:${list}" >
 				<td th:text="${itemStat.count+((page.pageNo-1)*page.pageSize) }"></td>
-				<td  th:text="${item.aname}"></td>
 				<td th:text="${item.name}"></td>
 				<td th:text="${item.phone}"></td>
+				<td th:text="${item.address}"></td>
 				<td th:text="${item.create_time}"></td>
-				<td >
-					<img style="height: 40px;" th:src="${imgUrl+item.back_img}">
-				</td>
-				<td >
-					<img th:if="${item.poster_img!=null && item.poster_img!=''}" style="height: 40px;" th:src="${'https://xt.sharingschool.com/upload/'+item.poster_img}">
+				<td class="imgtd">
+					<img  th:if="${item.logo_img!=null && item.logo_img!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.logo_img}">
 				</td>
-				<td>
-					<img  th:if="${item.logo_img!=null && item.logo_img!=''}" style="height: 40px;" th:src="${imgUrl+item.logo_img}">
+				<td class="imgtd">
+					<img th:if="${item.qrcode_img1!=null && item.qrcode_img1!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.qrcode_img1}">
 				</td>
-				<td >
-					<img th:if="${item.qrcode_img1!=null && item.qrcode_img1!=''}" style="height: 40px;" th:src="${imgUrl+item.qrcode_img1}">
-				</td>
-				<td >
-					<img th:if="${item.qrcode_img2!=null && item.qrcode_img2!=''}" style="height: 40px;" th:src="${imgUrl+item.qrcode_img2}">
+				<td class="imgtd">
+					<img th:if="${item.qrcode_img2!=null && item.qrcode_img2!=''}" style="width: 50px;height: 50px;" th:src="${imgUrl+item.qrcode_img2}">
 				</td>
 				<td >
 					<a style="color: red" th:href="${'javascript:joinDel(''' + item.id + ''')'}"  class="tablelink">删除机构</a>
 					&nbsp;&nbsp;
 					<a href="javascript:;" th:onclick="'edit(\''+${item.id}+'\')'" >编辑机构</a>
-					&nbsp;&nbsp;
-					<a th:if="${item.poster_img!=null && item.poster_img!=''}" th:href="${'https://xt.sharingschool.com/upload/'+item.poster_img}" target="_blank" th:download="${item.name+'_'+item.aname+'_海报.png'}" >下载海报</a>
 				</td>
 			</tr>
 		</tbody>