소스 검색

生成海报

wuwen 5 년 전
부모
커밋
f31f9d6952
23개의 변경된 파일1862개의 추가작업 그리고 4개의 파일을 삭제
  1. 67 0
      src/main/java/com/ssj/bean/sys/poster/domain/PosterActivity.java
  2. 130 0
      src/main/java/com/ssj/bean/sys/poster/domain/PosterJoin.java
  3. 107 0
      src/main/java/com/ssj/bean/sys/poster/domain/PosterTemplate.java
  4. 16 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterActivityDao.java
  5. 16 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterJoinDao.java
  6. 14 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterQueryDao.java
  7. 21 0
      src/main/java/com/ssj/dao/sys/poster/dao/PosterTemplateDao.java
  8. 64 0
      src/main/java/com/ssj/dao/sys/poster/dao/impl/PosterQueryDaoImpl.java
  9. 3 0
      src/main/java/com/ssj/framework/weixin/util/ImgBean.java
  10. 18 0
      src/main/java/com/ssj/service/sys/poster/service/PosterActivityService.java
  11. 20 0
      src/main/java/com/ssj/service/sys/poster/service/PosterJoinService.java
  12. 12 0
      src/main/java/com/ssj/service/sys/poster/service/PosterTemplateService.java
  13. 45 0
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityServiceImpl.java
  14. 190 0
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterJoinServiceImpl.java
  15. 43 0
      src/main/java/com/ssj/service/sys/poster/service/impl/PosterTemplateServiceImpl.java
  16. 4 4
      src/main/java/com/ssj/sys/controller/FxController.java
  17. 262 0
      src/main/java/com/ssj/sys/controller/PosterController.java
  18. BIN
      src/main/resources/static/sys/excel/join_lib.xlsx
  19. 117 0
      src/main/resources/templates/sys/common/imgUpload_three.html
  20. 156 0
      src/main/resources/templates/sys/poster/activity_edit.html
  21. 141 0
      src/main/resources/templates/sys/poster/activity_list.html
  22. 195 0
      src/main/resources/templates/sys/poster/join_edit.html
  23. 221 0
      src/main/resources/templates/sys/poster/join_list.html

+ 67 - 0
src/main/java/com/ssj/bean/sys/poster/domain/PosterActivity.java

@@ -0,0 +1,67 @@
+package com.ssj.bean.sys.poster.domain;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+@Entity
+@Table(name = "poster_activity")
+public class PosterActivity extends BaseEntity {
+	
+    private static final long serialVersionUID = 1L;
+    
+    private String id;
+    
+    private String templateId;
+    
+    private String name;
+    
+    private Integer status;
+    
+    private Date createTime;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getTemplateId() {
+		return templateId;
+	}
+
+	public void setTemplateId(String templateId) {
+		this.templateId = templateId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+    
+    
+}

+ 130 - 0
src/main/java/com/ssj/bean/sys/poster/domain/PosterJoin.java

@@ -0,0 +1,130 @@
+package com.ssj.bean.sys.poster.domain;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+@Entity
+@Table(name = "poster_join")
+public class PosterJoin extends BaseEntity {
+	
+    private static final long serialVersionUID = 1L;
+    
+    private String id;
+    
+    private String activityId;
+    
+    private String name;
+    
+    private String phone;
+    
+    private String logoImg;
+    
+    private String qrcodeImg1;
+    
+    private String qrcodeImg2;
+    
+    private String address;
+    
+    private String posterImg;
+    
+    private Integer status;
+    
+    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;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getPhone() {
+		return phone;
+	}
+
+	public void setPhone(String phone) {
+		this.phone = phone;
+	}
+
+	public String getLogoImg() {
+		return logoImg;
+	}
+
+	public void setLogoImg(String logoImg) {
+		this.logoImg = logoImg;
+	}
+
+	public String getQrcodeImg1() {
+		return qrcodeImg1;
+	}
+
+	public void setQrcodeImg1(String qrcodeImg1) {
+		this.qrcodeImg1 = qrcodeImg1;
+	}
+
+	public String getQrcodeImg2() {
+		return qrcodeImg2;
+	}
+
+	public void setQrcodeImg2(String qrcodeImg2) {
+		this.qrcodeImg2 = qrcodeImg2;
+	}
+
+	public String getPosterImg() {
+		return posterImg;
+	}
+
+	public void setPosterImg(String posterImg) {
+		this.posterImg = posterImg;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+
+    
+    
+    
+}

+ 107 - 0
src/main/java/com/ssj/bean/sys/poster/domain/PosterTemplate.java

@@ -0,0 +1,107 @@
+package com.ssj.bean.sys.poster.domain;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+@Entity
+@Table(name = "poster_template")
+public class PosterTemplate extends BaseEntity {
+	
+    private static final long serialVersionUID = 1L;
+    
+    private String id;
+    
+    private String backImg;
+    
+    private String logoPosition;
+    
+    private String numberPosition;
+    
+    private String addressPosition;
+    
+    private String qrcodePosition1;
+    
+    private String qrcodePosition2;
+    
+    private Integer status;
+    
+    private Date createTime;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getBackImg() {
+		return backImg;
+	}
+
+	public void setBackImg(String backImg) {
+		this.backImg = backImg;
+	}
+
+	public String getLogoPosition() {
+		return logoPosition;
+	}
+
+	public void setLogoPosition(String logoPosition) {
+		this.logoPosition = logoPosition;
+	}
+
+	public String getNumberPosition() {
+		return numberPosition;
+	}
+
+	public void setNumberPosition(String numberPosition) {
+		this.numberPosition = numberPosition;
+	}
+	
+	public String getQrcodePosition1() {
+		return qrcodePosition1;
+	}
+
+	public void setQrcodePosition1(String qrcodePosition1) {
+		this.qrcodePosition1 = qrcodePosition1;
+	}
+
+	public String getQrcodePosition2() {
+		return qrcodePosition2;
+	}
+
+	public void setQrcodePosition2(String qrcodePosition2) {
+		this.qrcodePosition2 = qrcodePosition2;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getAddressPosition() {
+		return addressPosition;
+	}
+
+	public void setAddressPosition(String addressPosition) {
+		this.addressPosition = addressPosition;
+	}
+   
+    
+}

+ 16 - 0
src/main/java/com/ssj/dao/sys/poster/dao/PosterActivityDao.java

@@ -0,0 +1,16 @@
+package com.ssj.dao.sys.poster.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+public interface PosterActivityDao extends JpaRepository<PosterActivity, String> {
+
+
+}

+ 16 - 0
src/main/java/com/ssj/dao/sys/poster/dao/PosterJoinDao.java

@@ -0,0 +1,16 @@
+package com.ssj.dao.sys.poster.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.poster.domain.PosterJoin;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+public interface PosterJoinDao extends JpaRepository<PosterJoin, String> {
+
+
+}

+ 14 - 0
src/main/java/com/ssj/dao/sys/poster/dao/PosterQueryDao.java

@@ -0,0 +1,14 @@
+package com.ssj.dao.sys.poster.dao;
+
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+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);
+	
+}

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

@@ -0,0 +1,21 @@
+package com.ssj.dao.sys.poster.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.poster.domain.PosterTemplate;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+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();
+
+}

+ 64 - 0
src/main/java/com/ssj/dao/sys/poster/dao/impl/PosterQueryDaoImpl.java

@@ -0,0 +1,64 @@
+package com.ssj.dao.sys.poster.dao.impl;
+
+import java.util.ArrayList;
+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.data.domain.Pageable;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.dao.sys.poster.dao.PosterQueryDao;
+import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
+
+@Repository
+public class PosterQueryDaoImpl  implements PosterQueryDao {
+
+    @Autowired
+    private PagingHibernateJdbcDao dao;
+
+	@Override
+	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  ");
+        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(" ORDER BY t.create_time desc ");
+        return dao.findPage(sb.toString(),param.toArray(),initPage);
+	}
+	
+	
+	@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("  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"));
+        }
+        sb.append(" ORDER BY t.create_time desc ");
+        return dao.findPage(sb.toString(),param.toArray(),initPage);
+	}
+    
+    
+	
+	
+}

+ 3 - 0
src/main/java/com/ssj/framework/weixin/util/ImgBean.java

@@ -83,9 +83,12 @@ public class ImgBean {
     		int y,Color color,Font font) {  
     	try {  
     		Graphics2D  g = img.createGraphics();  
+    		g.setStroke(new BasicStroke(0));
     		g.setBackground(color);  
     		g.setColor(color);//设置字体颜色 
     		g.setFont(font);
+    		g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+    		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     		if (content != null) {  
     			g.drawString(content.toString(), x, y);  
     		}  

+ 18 - 0
src/main/java/com/ssj/service/sys/poster/service/PosterActivityService.java

@@ -0,0 +1,18 @@
+package com.ssj.service.sys.poster.service;
+
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface PosterActivityService extends BaseService<PosterActivity, String> {
+	
+
+	Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage);
+	
+	
+	
+}

+ 20 - 0
src/main/java/com/ssj/service/sys/poster/service/PosterJoinService.java

@@ -0,0 +1,20 @@
+package com.ssj.service.sys.poster.service;
+
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.ssj.bean.sys.poster.domain.PosterJoin;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface PosterJoinService extends BaseService<PosterJoin, String> {
+	
+	
+	Page<Map<String, Object>> findJoinByPage(Map<String, Object> params, Pageable initPage);
+	
+	
+	PosterJoin generatePosterImg(PosterJoin posterJoin);
+	
+	
+}

+ 12 - 0
src/main/java/com/ssj/service/sys/poster/service/PosterTemplateService.java

@@ -0,0 +1,12 @@
+package com.ssj.service.sys.poster.service;
+
+import java.util.List;
+
+import com.ssj.bean.sys.poster.domain.PosterTemplate;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface PosterTemplateService extends BaseService<PosterTemplate, String> {
+	
+	List<PosterTemplate> findPosterTemplateByList();
+	
+}

+ 45 - 0
src/main/java/com/ssj/service/sys/poster/service/impl/PosterActivityServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ssj.service.sys.poster.service.impl;
+
+import java.util.Map;
+
+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 com.ssj.bean.sys.poster.domain.PosterActivity;
+import com.ssj.dao.sys.poster.dao.PosterActivityDao;
+import com.ssj.dao.sys.poster.dao.PosterQueryDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.poster.service.PosterActivityService;
+
+@Service
+@Transactional
+public class PosterActivityServiceImpl extends BaseServiceImpl<PosterActivity, String> implements PosterActivityService {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+    @Autowired
+    private PosterActivityDao dao;
+
+    @Autowired
+    private PosterQueryDao posterQueryDao;
+    
+    @Override
+	public PagingAndSortingRepository<PosterActivity, String> getDao() {
+		return dao;
+	}
+
+	@Override
+	public Page<Map<String, Object>> findActivityByPage(Map<String, Object> params, Pageable initPage) {
+		return posterQueryDao.findActivityByPage(params, initPage);
+	}
+    
+	
+	
+ 
+}

+ 190 - 0
src/main/java/com/ssj/service/sys/poster/service/impl/PosterJoinServiceImpl.java

@@ -0,0 +1,190 @@
+package com.ssj.service.sys.poster.service.impl;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.util.Date;
+import java.util.Map;
+
+import javax.imageio.ImageIO;
+
+import org.apache.commons.lang3.StringUtils;
+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 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;
+import com.ssj.framework.idworker.IdWorker;
+import com.ssj.framework.weixin.util.ImageUtil;
+import com.ssj.framework.weixin.util.ImgBean;
+import com.ssj.service.sys.poster.service.PosterJoinService;
+
+@Service
+@Transactional
+public class PosterJoinServiceImpl extends BaseServiceImpl<PosterJoin, String> implements PosterJoinService {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+    @Autowired
+    private PosterJoinDao dao;
+    
+    @Autowired
+    private PosterActivityDao posterActivityDao;
+    
+    @Autowired
+    private PosterTemplateDao posterTemplateDao;
+    
+    @Autowired
+    private PosterQueryDao posterQueryDao;
+    
+    @Override
+	public PagingAndSortingRepository<PosterJoin, String> getDao() {
+		return dao;
+	}
+
+	@Override
+	public Page<Map<String, Object>> findJoinByPage(Map<String, Object> params, Pageable initPage) {
+		return posterQueryDao.findJoinByPage(params, initPage);
+	}
+
+	@Override
+	public PosterJoin generatePosterImg(PosterJoin posterJoin) {
+		PosterActivity posterActivity=posterActivityDao.getOne(posterJoin.getActivityId());
+		PosterTemplate posterTemplate=posterTemplateDao.getOne(posterActivity.getTemplateId());
+		
+		if(StringUtils.isEmpty(posterJoin.getLogoImg()) || StringUtils.isEmpty(posterJoin.getQrcodeImg1())) {
+			return posterJoin;
+		}
+		if(StringUtils.isNotEmpty(posterTemplate.getQrcodePosition2()) && StringUtils.isEmpty(posterJoin.getQrcodeImg2())) {
+			return posterJoin;
+		}
+		String posterImg=runGeneratePosterImg(posterTemplate, posterJoin);
+		if(StringUtils.isNotEmpty(posterImg)) {
+			posterJoin.setPosterImg(posterImg);
+			this.save(posterJoin);
+		}
+		return posterJoin;
+	}
+	
+	
+	public static void main(String[] args) {
+		
+		PosterTemplate posterTemplate=new PosterTemplate();
+		posterTemplate.setBackImg("1.png");
+		
+		PosterJoin posterJoin=new PosterJoin();
+		posterJoin.setLogoImg("2.png");
+		posterJoin.setQrcodeImg1("3.png");
+		posterJoin.setQrcodeImg2("3.png");
+		posterJoin.setName("活动");
+		posterJoin.setPhone("联系人:吴老师 13265096161");
+		posterJoin.setAddress("地址:佛山市南海区桂城融和路号号中铁建水岸花园号号号铺铺铺");//33个字
+		
+		String url=runGeneratePosterImg(posterTemplate, posterJoin);
+		System.out.println(url);
+	}
+	
+    
+	public static String runGeneratePosterImg(PosterTemplate posterTemplate,PosterJoin posterJoin) {
+    	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 target_path =  save_path+IdWorker.generateId() + ".png";
+	    	// 创建文件夹
+	    	File f = new File(save_path);
+	    	if (!f.exists()) {f.mkdirs();}
+	    	 
+	    	//读取模板
+	    	BufferedImage source_template = ImgBean.loadImageLocal(savePath+posterTemplate.getBackImg());
+	    	
+	    	//合成logo
+	    	String[] logoPositions=posterTemplate.getLogoPosition().split(";");
+	    	BufferedImage logoImage = ImageIO.read(new File(savePath+posterJoin.getLogoImg()));
+	    	BufferedImage target_template=ImgBean.modifyImagetogeter(logoImage, source_template,Integer.parseInt(logoPositions[0]),Integer.parseInt(logoPositions[1]));
+	    	
+	    	//合成二维码1
+	    	String[] qrcodePositions=posterTemplate.getQrcodePosition1().split(";");
+	       	String code=save_path+IdWorker.generateId()+ ".png";
+	     	ImageUtil.resizeImg(savePath+posterJoin.getQrcodeImg1(), code, Integer.parseInt(qrcodePositions[0]),  Integer.parseInt(qrcodePositions[1]), 1.0f);
+	     	BufferedImage codeImage = ImageIO.read(new File(code));
+	     	int w1 = codeImage.getWidth();
+	        int h1 = codeImage.getHeight();
+	        BufferedImage codeOutput = new BufferedImage(w1, h1,BufferedImage.TYPE_INT_ARGB);
+	        Graphics2D g3 = codeOutput.createGraphics();
+	        g3.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+	        g3.setColor(Color.WHITE);
+	        g3.fill(new RoundRectangle2D.Float(0, 0, w1, h1, 0,0));
+	        g3.setComposite(AlphaComposite.SrcAtop);
+	        g3.drawImage(codeImage, 0, 0, null);
+	        g3.dispose();
+	    	ImgBean.modifyImagetogeter(codeOutput, target_template,Integer.parseInt(qrcodePositions[2]),Integer.parseInt(qrcodePositions[3]));
+	    	
+	    	//合成二维码2
+	    	if(StringUtils.isNotEmpty(posterTemplate.getQrcodePosition2())) {
+		    	qrcodePositions=posterTemplate.getQrcodePosition2().split(";");
+		       	code=save_path+IdWorker.generateId()+ ".png";
+		     	ImageUtil.resizeImg(savePath+posterJoin.getQrcodeImg1(), code, Integer.parseInt(qrcodePositions[0]),  Integer.parseInt(qrcodePositions[1]), 1.0f);
+		     	codeImage = ImageIO.read(new File(code));
+		     	w1 = codeImage.getWidth();
+		        h1 = codeImage.getHeight();
+		        codeOutput = new BufferedImage(w1, h1,BufferedImage.TYPE_INT_ARGB);
+		        g3 = codeOutput.createGraphics();
+		        g3.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+		        g3.setColor(Color.WHITE);
+		        g3.fill(new RoundRectangle2D.Float(0, 0, w1, h1, 0,0));
+		        g3.setComposite(AlphaComposite.SrcAtop);
+		        g3.drawImage(codeImage, 0, 0, null);
+		        g3.dispose();
+		    	ImgBean.modifyImagetogeter(codeOutput, target_template,Integer.parseInt(qrcodePositions[2]),Integer.parseInt(qrcodePositions[3]));
+	    	}
+	    	
+	    	//合成联系人
+	    	String[] numberPositions=posterTemplate.getNumberPosition().split(";");
+	    	ImgBean.modifyImage(target_template,"联系人:"+posterJoin.getPhone(),115,Integer.parseInt(numberPositions[0]),new Color(240,240,240),new Font("黑体", Font.PLAIN, 19));
+	    	
+	    	//合成地址
+	    	//长500的,最多33个字,500/33=15px  (33-Address.le)/2=?
+	    	String[] addressPositions=posterTemplate.getAddressPosition().split(";");
+	    	int left=0;
+	    	if(posterJoin.getAddress().length()<33) {
+	    		left=(33-posterJoin.getAddress().length())/2*15;
+	    	}
+	    	ImgBean.modifyImage(target_template,"地址:"+posterJoin.getAddress(),left,Integer.parseInt(addressPositions[0]),new Color(220,220,220),new Font("黑体", Font.PLAIN, 15));
+	    	
+	    	//生成海报
+	    	ImgBean.writeImageLocal(target_path,  source_template);
+	    	
+	    	return target_path.replaceAll(savePath, "");
+	    	
+    	} catch (Exception e) {
+    		e.printStackTrace();
+		}
+    	return null;
+    }
+	
+	
+	
+ 
+}

+ 43 - 0
src/main/java/com/ssj/service/sys/poster/service/impl/PosterTemplateServiceImpl.java

@@ -0,0 +1,43 @@
+package com.ssj.service.sys.poster.service.impl;
+
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.ssj.bean.sys.poster.domain.PosterTemplate;
+import com.ssj.dao.sys.poster.dao.PosterQueryDao;
+import com.ssj.dao.sys.poster.dao.PosterTemplateDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.poster.service.PosterTemplateService;
+
+@Service
+@Transactional
+public class PosterTemplateServiceImpl extends BaseServiceImpl<PosterTemplate, String> implements PosterTemplateService {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+    @Autowired
+    private PosterTemplateDao dao;
+
+    @Autowired
+    private PosterQueryDao posterQueryDao;
+    
+    @Override
+	public PagingAndSortingRepository<PosterTemplate, String> getDao() {
+		return dao;
+	}
+
+	@Override
+	public List<PosterTemplate> findPosterTemplateByList() {
+		return dao.findPosterTemplateByList();
+	}
+    
+	
+	
+ 
+}

+ 4 - 4
src/main/java/com/ssj/sys/controller/FxController.java

@@ -489,7 +489,7 @@ public class FxController  extends BaseController {
         model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
         model.addAttribute("page", sp);
         model.addAttribute("search", params);
-        List<Merchant> list=merchantService.findMerchantByPage();
+        List<Merchant> list=merchantService.findMerchantByPage();	
 		model.addAttribute("poslist", list);
         return "sys/fx/merchantSignList";
     }
@@ -1024,9 +1024,9 @@ public class FxController  extends BaseController {
 					device.setStatus(status);
 					
 					if(device.getStatus()==1 && status==2){
-//						Merchant merchant=merchantService.getById(device.getMerchantId());
+//						PosterTemplate merchant=merchantService.getById(device.getMerchantId());
 //						if(merchant!=null && StringUtils.isNotEmpty(merchant.getParentPosCode())){
-//							Merchant pmerchant=merchantService.getMerchantByPosCode(merchant.getParentPosCode());
+//							PosterTemplate pmerchant=merchantService.getMerchantByPosCode(merchant.getParentPosCode());
 //							DeviceAct deviceAct=new DeviceAct();
 //							deviceAct.setFromMerchantId(pmerchant.getId());
 //							deviceAct.setToMerchantId(device.getMerchantId());
@@ -3287,7 +3287,7 @@ public class FxController  extends BaseController {
 			Admin admin =(Admin) session.getAttribute("admin");
 			Merchant merchant=merchantService.getMerchantByPosCode(admin.getLoginName());
 
-			//List<Merchant> posList=merchantService.findMerchantByPage();
+			//List<PosterTemplate> posList=merchantService.findMerchantByPage();
 			if(StringUtils.isEmpty(merchantId)){
 				if(!"SSJ-FX".equals(merchant.getOrgCode())){
 					merchantId=merchant.getId();

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

@@ -0,0 +1,262 @@
+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;
+	}	
+    
+    
+	
+
+}

BIN
src/main/resources/static/sys/excel/join_lib.xlsx


+ 117 - 0
src/main/resources/templates/sys/common/imgUpload_three.html

@@ -0,0 +1,117 @@
+
+<!-- 
+	data-bindelem:
+		绑定元素
+		
+	data-filepaths:
+		回显数据图片路径	
+		
+	data-type:
+		1:图片上传
+		2:文件上传
+		
+	data-maxnum:
+		可最大上传的数量	
+		
+		
+
+ -->
+
+
+<div id="pluguploaddiv1_three" style="display: none">
+	<span class="layui-upload" >
+	  <button type="button" class="layui-btn " id="pluguploadbutton1_three"><i class="layui-icon">&#xe60d;</i>上传图片 <i style="margin-left: 10px;display: none" class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i></button>
+	  </span>
+	 <span class="layui-upload-list" id="pluguploadimg1_three"></span>
+</div>
+
+
+<script>
+var sysUrl_three="[[${sysUrl}]]";
+var imgUrl_three="[[${imgUrl}]]";
+var type_three=$("#pluguploadid_three").data("type");
+var width_three=$("#pluguploadid_three_three").data("imgwidth");
+var height_three=$("#pluguploadid_three").data("imgheight");
+var maxnum_three=$("#pluguploadid_three").data("maxnum");
+var bindelem_three=$("#pluguploadid_three").data("bindelem");
+var filePaths_three=$("#pluguploadid_three").data("filepaths");
+
+if(type_three==undefined || type_three=='undefined' || type_three==null || type_three==''){
+	type_three=1;
+}
+if(maxnum_three==undefined || maxnum_three=='undefined' || maxnum_three==null || maxnum_three==''){
+	maxnum_three=10;
+}
+if(bindelem_three==undefined || bindelem_three=='undefined' || bindelem_three==null || bindelem_three==''){
+	bindelem_three=null;
+}
+if(filePaths_three==undefined || filePaths_three=='undefined' || filePaths_three==null || filePaths_three==''){
+	filePaths_three=null;
+}
+
+layui.use('upload', function(){
+  var $ = layui.jquery
+  ,upload = layui.upload;
+  
+  if(bindelem_three!=null && filePaths_three!=null){
+		$(bindelem_three).val(filePaths_three);
+		var fps=filePaths_three.split(";");
+		for (var i = 0; i < fps.length; i++) {
+		 $('#pluguploadimg'+type+'_three').append('<span class="pluguploadimgcss"  style="width: 100px;height:100px"><i onclick="deletepulgimg(this,\''+fps[i]+'\')" class="layui-icon layui-icon-close g_icon"></i><img onclick="openpulgimg(this)" src="'+ imgUrl+fps[i] +'"  style="width:100%"  class="layui-upload-img "></span>') 
+		}
+	}
+	$("#pluguploaddiv"+type+"_three").show();
+  
+  //普通图片上传
+  var uploadInst = upload.render({
+    elem: '#pluguploadbutton1_three'
+    ,url: '[[${sysUrl}]]/file/uploads'
+    ,before: function(obj){
+      $(".layui-icon-loading").show();
+      obj.preview(function(index, file, result){//预读本地文件示例,不支持ie8
+    	
+      });
+    },done: function(res){
+      $(".layui-icon-loading").hide();
+      if($(bindelem_three).val().split(";").length>=maxnum_three){
+		  return layer.msg('上传文件已超过最大值');
+	  }
+      if(res.code == '000'){
+    	  return layer.msg('上传失败,刷新后重试!');
+      }
+      layer.msg('上传成功');
+      if(res != null && res != ""){
+		 var obj = res;
+		 var filePath = obj.data.pics[0].filePath;
+		 var fileCode = obj.data.pics[0].fileCode;
+		 var fileExt = obj.data.pics[0].fileExts;
+		 var id = obj.data.pics[0].id;
+		 var name = obj.data.pics[0].name;
+		 var fileWidth = obj.data.pics[0].fileWidth;
+		 var fileHeight = obj.data.pics[0].fileHeight;
+		 var fileName = obj.data.pics[0].fileName;
+		 var fileSize = obj.data.pics[0].fileSize;
+		 var fileThumPath = obj.data.pics[0].fileThumPath;
+		 $('#pluguploadimg1_three').append('<span class="pluguploadimgcss"  style="width: 100px;height:100px"><i onclick="deletepulgimg(this,\''+filePath+'\')" class="layui-icon layui-icon-close g_icon"></i><img onclick="openpulgimg(this)" src="'+ fileThumPath +'"  style="width:100%"  class="layui-upload-img "></span>') //图片链接(base64)
+		 if(bindelem_three!=null){
+			$(bindelem_three).val($(bindelem_three).val()!=''? $(bindelem_three).val()+";"+filePath : filePath);
+		 }
+	   }
+    },error: function(){
+    	  $(".layui-icon-loading").hide();
+    	  return layer.msg('上传失败,刷新后重试!');
+    }
+  });
+});
+
+function deletepulgimg(obj,filePath){
+	$(obj).parent().remove();
+	$(bindelem_three).val($(bindelem_three).val().replace(filePath+";",""));
+	$(bindelem_three).val($(bindelem_three).val().replace(";"+filePath,""));
+	$(bindelem_three).val($(bindelem_three).val().replace(filePath,""));
+}
+
+
+
+
+</script>

+ 156 - 0
src/main/resources/templates/sys/poster/activity_edit.html

@@ -0,0 +1,156 @@
+<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="${posterActivity.id}"/>
+			
+			<li>
+				<label>活动名称:	<b>*</b></label>
+				<input type="text" id="name" class="dfinput fl" name="name" th:value="${posterActivity.name}" />
+			</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');
+     }); 
+})
+
+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>

+ 141 - 0
src/main/resources/templates/sys/poster/activity_list.html

@@ -0,0 +1,141 @@
+<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>
+</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/activity/list.html}" method="post">
+	<input type="hidden" name="pageSize" id="pageSize" value="10" />
+	<ul class="seachform">
+			<li>
+			 <label>商户名称</label>
+			  <input name="name" type="text" class="scinput" th:value="${search.name}"  />
+		    </li>
+			<li>
+				<input type="button" class="scbtn" value="查询" />
+			</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>
+		    </tr> 
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" >
+				<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}">
+				</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>
+					
+					
+				</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="添加活动";
+		if(id!=null && id!='' && id!=undefined){
+			title="编辑活动";
+		}
+		parent.layer.open({
+		    type: 2,
+		    title: title,
+		    closeBtn: 1, //不显示关闭按钮
+		    shift: 0.8,
+		    offset: '100px',
+		    area: ['50%', '60%'],
+		    content: '[[${sysUrl}]]/sys/poster/activity/edit.html?id='+id
+		});
+	}
+	
+	function activityDel(id){
+		parent.layer.confirm("您确定要删除活动?", {
+			icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+		}, function(){
+			var url="[[${sysUrl}]]/sys/poster/activity/del?id="+id;
+			var params ={};
+			$.post(url,params,function(data){
+				if(data.meta.success){
+					parent.layer.msg("删除成功",{icon:1});
+					location.reload();
+				}else{
+					parent.layer.msg(data.meta.message,{icon:11});
+				}
+			});
+		});
+	}
+	
+	
+	
+	
+	
+</script>
+
+</html>

+ 195 - 0
src/main/resources/templates/sys/poster/join_edit.html

@@ -0,0 +1,195 @@
+<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="${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}" />
+			</li>
+			
+			<li>
+				<label>机构号码:	<b>*</b></label>
+				<input type="text" id="phone" class="dfinput fl" name="phone" th:value="${posterJoin.phone}" />
+			</li>
+			
+			<li>
+				<label>机构地址:	<b>*</b></label>
+				<input type="text" id="address" class="dfinput fl" name="address" th:value="${posterJoin.address}" />
+			</li>
+			
+			<li style="margin-bottom:3px">
+				<label>机构LOGO:<b>*</b></label>
+				<input type="hidden" id="logoImg" th:data-path="${posterJoin.logoImg}" />
+				<plug id="pluguploadid" th:include="sys/common/imgUpload"  th:inline="javascript"  data-bindelem="#logoImg" th:data-filepaths="${posterJoin.logoImg}"  data-type="1" data-maxnum="2"  \>
+			</li>
+			
+			<li style="margin-bottom:3px">
+				<label>机构二维码1:<b>*</b></label>
+				<input type="hidden" id="qrcodeImg1" th:data-path="${posterJoin.qrcodeImg1}" />
+				<plug id="pluguploadid_to" th:include="sys/common/imgUpload_to"  th:inline="javascript"  data-bindelem="#qrcodeImg1" th:data-filepaths="${posterJoin.qrcodeImg1}"  data-type="1" data-maxnum="2"  \>
+			</li>
+			
+			<li style="margin-bottom:3px">
+				<label>机构二维码2:<b></b></label>
+				<input type="hidden" id="qrcodeImg2" th:data-path="${posterJoin.qrcodeImg2}" />
+				<plug id="pluguploadid_three" th:include="sys/common/imgUpload_three"  th:inline="javascript"  data-bindelem="#qrcodeImg2" th:data-filepaths="${posterJoin.qrcodeImg2}"  data-type="1" data-maxnum="2"  \>
+			</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 (){
+
+})
+
+function save(){
+	if($("#name").val()==''){
+		parent.layer.msg("机构名称不能为空",{icon:11});
+		return
+	}
+	if($("#phone").val()==''){
+		parent.layer.msg("机构号码不能为空",{icon:11});
+		return
+	}
+// 	if($("#logoImg").val()==''){
+// 		parent.layer.msg("机构LOGO不能为空",{icon:11});
+// 		return
+// 	}
+// 	if($("#qrcodeImg").val()==''){
+// 		parent.layer.msg("机构二维码不能为空",{icon:11});
+// 		return
+// 	}
+	
+	parent.layer.confirm("确定保存机构信息?", {
+		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+	}, function(){
+		var url="[[${sysUrl}]]/sys/poster/join/save";
+		var params ={
+			'id' : $("#id").val(),
+            'activityId' : $("#activityId").val(),
+            'name' : $("#name").val(),
+            'phone' : $("#phone").val(),
+            'address' : $("#address").val(),
+            'logoImg' : $("#logoImg").val(),
+            'qrcodeImg1' : $("#qrcodeImg1").val(),
+            'qrcodeImg2' : $("#qrcodeImg2").val()
+        };
+		$.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>

+ 221 - 0
src/main/resources/templates/sys/poster/join_list.html

@@ -0,0 +1,221 @@
+<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/join/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" 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>
+				<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> 
+	
+	<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=" + 导入机构" />
+		  <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>
+	     </li>
+     </ul>
+
+	<table class="tablelist">
+		<thead>
+		    <tr>
+		    	<th style="width: 50px;">序号</th>
+		    	<th >活动名称 </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.aname}"></td>
+				<td th:text="${item.name}"></td>
+				<td th:text="${item.phone}"></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>
+				<td>
+					<img  th:if="${item.logo_img!=null && item.logo_img!=''}" style="height: 40px;" th:src="${imgUrl+item.logo_img}">
+				</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>
+				<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>
+	</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">
+	var aid="[[${param.id}]]";
+	
+	$(function (){
+		
+		$("#teacherimput").click(function (){
+			$("#teacherfile").click();
+		})
+	
+	    var $teacherfile =$("#teacherfile");
+	    $teacherfile.change(function () {
+	        if($(this).val() != ""){
+	        	fileJoinLoad(this);
+	        }
+	    })
+	    
+	    function fileJoinLoad(ele){
+		  var formData = new FormData();
+		  var name = $(ele).val();
+		  var files = $(ele)[0].files[0];
+		  formData.append("file", files);
+		  formData.append("name", name);
+		  $.ajax({
+		      url: "[[${sysUrl}]]/sys/poster/join/import?id="+aid,
+		      type: 'POST',
+		      data: formData,
+		      processData: false,
+		      contentType: false, 
+		      beforeSend: function () {
+		    	  parent.layer.msg("数据正在导入中....",{icon:2});
+		      },
+		      success: function (responseStr) {
+		    	  if(responseStr.meta.success){
+		    	  	 parent.layer.msg("导入成功",{icon:1});
+					 $("#teacherfile").val("");
+					 $(".selectbtu").click();
+		    	  }else{
+		    		 parent.layer.msg(responseStr.meta.message,{icon:11});
+		    		 $("#teacherfile").val("");
+		    	  }
+		      }
+		      ,
+		      error : function (responseStr) {
+		    		parent.layer.msg("导入失败,请刷新后重试!",{icon:11});
+		    		$("#teacherfile").val("");
+		      }
+		  });
+		 
+		}
+		
+		
+	})
+	
+	
+	function edit(id){
+		var title="添加活动";
+		if(id!=null && id!='' && id!=undefined){
+			title="编辑活动";
+		}
+		parent.layer.open({
+		    type: 2,
+		    title: title,
+		    closeBtn: 1, //不显示关闭按钮
+		    shift: 0.8,
+		    offset: '100px',
+		    area: ['50%', '60%'],
+		    content: '[[${sysUrl}]]/sys/poster/join/edit.html?aid='+aid+'&id='+id
+		});
+	}
+	
+	function joinDel(id){
+		parent.layer.confirm("您确定要删除机构?", {
+			icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+		}, function(){
+			var url="[[${sysUrl}]]/sys/poster/join/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>