浏览代码

Merge remote-tracking branch 'origin/master'

shenhao 6 年之前
父节点
当前提交
cc959a1bd3
共有 50 个文件被更改,包括 3709 次插入806 次删除
  1. 33 0
      .classpath
  2. 1 31
      .gitignore
  3. 42 0
      .project
  4. 4 0
      .settings/org.eclipse.core.resources.prefs
  5. 11 0
      .settings/org.eclipse.jdt.core.prefs
  6. 10 0
      .settings/org.eclipse.wst.common.component
  7. 7 0
      .settings/org.eclipse.wst.common.project.facet.core.xml
  8. 2 0
      .settings/org.eclipse.wst.validation.prefs
  9. 10 0
      src/main/java/com/ssj/bean/sys/analysis/bean/Analysis.java
  10. 67 0
      src/main/java/com/ssj/bean/sys/analysis/bean/AnalysisCount.java
  11. 87 0
      src/main/java/com/ssj/bean/sys/analysis/bean/AnalysisWeek.java
  12. 27 21
      src/main/java/com/ssj/bean/sys/fx/domain/Merchant.java
  13. 116 0
      src/main/java/com/ssj/bean/sys/fx/domain/MerchantSign.java
  14. 43 8
      src/main/java/com/ssj/bean/weixin/libmy/domain/TbLibJoin.java
  15. 20 0
      src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisCountDao.java
  16. 2 1
      src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisDao.java
  17. 75 40
      src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisQueryDao.java
  18. 24 0
      src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisWeekDao.java
  19. 404 370
      src/main/java/com/ssj/dao/sys/analysis/dao/impl/AnalysisQueryDaoImpl.java
  20. 2 0
      src/main/java/com/ssj/dao/sys/fx/dao/FxQueryDao.java
  21. 6 2
      src/main/java/com/ssj/dao/sys/fx/dao/MerchantDao.java
  22. 20 0
      src/main/java/com/ssj/dao/sys/fx/dao/MerchantSignDao.java
  23. 30 6
      src/main/java/com/ssj/dao/sys/fx/dao/impl/FxQueryDaoImpl.java
  24. 20 0
      src/main/java/com/ssj/service/sys/analysis/service/AnalysisCountService.java
  25. 35 38
      src/main/java/com/ssj/service/sys/analysis/service/AnalysisService.java
  26. 20 0
      src/main/java/com/ssj/service/sys/analysis/service/AnalysisWeekService.java
  27. 88 0
      src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisCountServiceImpl.java
  28. 30 31
      src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisServiceImpl.java
  29. 104 0
      src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisWeekServiceImpl.java
  30. 12 4
      src/main/java/com/ssj/service/sys/fx/service/MerchantService.java
  31. 30 0
      src/main/java/com/ssj/service/sys/fx/service/MerchantSignService.java
  32. 34 14
      src/main/java/com/ssj/service/sys/fx/service/impl/MerchantServiceImpl.java
  33. 182 0
      src/main/java/com/ssj/service/sys/fx/service/impl/MerchantSignServiceImpl.java
  34. 740 79
      src/main/java/com/ssj/sys/controller/AnalysisController.java
  35. 265 82
      src/main/java/com/ssj/sys/controller/FxController.java
  36. 1 1
      src/main/resources/templates/sys/analysis/balance.html
  37. 12 8
      src/main/resources/templates/sys/analysis/balance_vip.html
  38. 27 3
      src/main/resources/templates/sys/analysis/parent.html
  39. 12 8
      src/main/resources/templates/sys/analysis/parent_info.html
  40. 3 3
      src/main/resources/templates/sys/analysis/student.html
  41. 12 7
      src/main/resources/templates/sys/analysis/student_info.html
  42. 9 9
      src/main/resources/templates/sys/analysis/teacher.html
  43. 14 9
      src/main/resources/templates/sys/analysis/teacher_info.html
  44. 557 0
      src/main/resources/templates/sys/analysis/week.html
  45. 17 6
      src/main/resources/templates/sys/fx/merchantAdd.html
  46. 284 17
      src/main/resources/templates/sys/fx/merchantAllList.html
  47. 40 8
      src/main/resources/templates/sys/fx/merchantInfo.html
  48. 118 0
      src/main/resources/templates/sys/fx/merchantSignList.html
  49. 二进制
      target/classes/static/sys/js/uploadify/v3/__MACOSX/._Change Log.txt
  50. 二进制
      target/classes/static/sys/js/uploadify/v3/__MACOSX/._uploadify.swf

+ 33 - 0
.classpath

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="test" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+			<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

+ 1 - 31
.gitignore

@@ -1,31 +1 @@
-# Created by .ignore support plugin (hsz.mobi)
-### Java template
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-*rebel.xml
-.rebel-remote.xml.bak
-.rebel.xml.bak
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-/.rebel-remote.xml.bak
-/.rebel.xml.bak
+/target/

+ 42 - 0
.project

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>v_sys</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>

+ 4 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=utf-8
+encoding/<project>=UTF-8

+ 11 - 0
.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8

+ 10 - 0
.settings/org.eclipse.wst.common.component

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
+    <wb-module deploy-name="ssj-sys">
+        <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
+        <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
+        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
+        <property name="context-root" value="ssj-sys"/>
+        <property name="java-output-path" value="/v_sys/target/classes"/>
+    </wb-module>
+</project-modules>

+ 7 - 0
.settings/org.eclipse.wst.common.project.facet.core.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+  <fixed facet="wst.jsdt.web"/>
+  <installed facet="java" version="1.8"/>
+  <installed facet="jst.web" version="3.1"/>
+  <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>

+ 2 - 0
.settings/org.eclipse.wst.validation.prefs

@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1

+ 10 - 0
src/main/java/com/ssj/bean/sys/analysis/bean/Analysis.java

@@ -30,6 +30,8 @@ public class Analysis extends BaseEntity {
 	 */
 	private Integer type;
 	
+	private Date dayTime;
+	
 	private Date createTime;
 
 	public String getLibId() {
@@ -79,6 +81,14 @@ public class Analysis extends BaseEntity {
 	public void setSource(Integer source) {
 		this.source = source;
 	}
+
+	public Date getDayTime() {
+		return dayTime;
+	}
+
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
 	
 	
 }

+ 67 - 0
src/main/java/com/ssj/bean/sys/analysis/bean/AnalysisCount.java

@@ -0,0 +1,67 @@
+package com.ssj.bean.sys.analysis.bean;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.util.Date;
+
+@Entity
+@Table(name = "tb_analysis_count")
+public class AnalysisCount extends BaseEntity {
+	
+	private static final long serialVersionUID = 890135943022798129L;
+ 
+	private String libId;
+	
+	private Integer source;
+
+	private Integer type;
+	
+	private Integer count;
+	
+	private Date dayTime;
+
+	public String getLibId() {
+		return libId;
+	}
+
+	public void setLibId(String libId) {
+		this.libId = libId;
+	}
+
+	public Integer getSource() {
+		return source;
+	}
+
+	public void setSource(Integer source) {
+		this.source = source;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+
+	public Date getDayTime() {
+		return dayTime;
+	}
+
+	public void setDayTime(Date dayTime) {
+		this.dayTime = dayTime;
+	}
+	
+	
+	
+}

+ 87 - 0
src/main/java/com/ssj/bean/sys/analysis/bean/AnalysisWeek.java

@@ -0,0 +1,87 @@
+package com.ssj.bean.sys.analysis.bean;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+import java.util.Date;
+
+@Entity
+@Table(name = "tb_analysis_week")
+public class AnalysisWeek extends BaseEntity {
+	
+	private static final long serialVersionUID = 890135943022798129L;
+ 
+	private String libId;
+	
+	private Integer yearWeek;
+
+	private Integer memberNum;
+	
+	private Integer activeNum;
+	
+	private Integer activeRatio;
+	
+	private Date createTime;
+	
+	private Date updateTime;
+
+	public String getLibId() {
+		return libId;
+	}
+
+	public void setLibId(String libId) {
+		this.libId = libId;
+	}
+
+	public Integer getYearWeek() {
+		return yearWeek;
+	}
+
+	public void setYearWeek(Integer yearWeek) {
+		this.yearWeek = yearWeek;
+	}
+
+	public Integer getMemberNum() {
+		return memberNum;
+	}
+
+	public void setMemberNum(Integer memberNum) {
+		this.memberNum = memberNum;
+	}
+
+	public Integer getActiveNum() {
+		return activeNum;
+	}
+
+	public void setActiveNum(Integer activeNum) {
+		this.activeNum = activeNum;
+	}
+
+	public Integer getActiveRatio() {
+		return activeRatio;
+	}
+
+	public void setActiveRatio(Integer activeRatio) {
+		this.activeRatio = activeRatio;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	
+	
+}

+ 27 - 21
src/main/java/com/ssj/bean/sys/fx/domain/Merchant.java

@@ -1,16 +1,24 @@
 package com.ssj.bean.sys.fx.domain;
 
-import com.ssj.bean.common.framework.core.domain.BaseEntity;
-import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
 import org.hibernate.annotations.Fetch;
 import org.hibernate.annotations.FetchMode;
 import org.hibernate.annotations.NotFound;
 import org.hibernate.annotations.NotFoundAction;
 
-import javax.persistence.*;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
 
 @Entity
 @Table(name = "fx_merchant")
@@ -79,14 +87,11 @@ public class Merchant extends BaseEntity {
 	private Date nextSummaryTime;
 	
 	private Integer curIsSummary;
-
-	/**
-	 * 地址
-	 */
-	private String address;
 	
-	//private Integer cnAreaType;
+	private String address;
 	
+	private Integer signType;
+
 	@Transient
 	private List<Merchant> subMerchants=new ArrayList<Merchant>();
 	
@@ -278,15 +283,7 @@ public class Merchant extends BaseEntity {
 	public void setEndSignTime(Date endSignTime) {
 		this.endSignTime = endSignTime;
 	}
-
-//	public Integer getCnAreaType() {
-//		return cnAreaType;
-//	}
-//
-//	public void setCnAreaType(Integer cnAreaType) {
-//		this.cnAreaType = cnAreaType;
-//	}
-
+	
 	public Integer getPortNum() {
 		return portNum;
 	}
@@ -371,4 +368,13 @@ public class Merchant extends BaseEntity {
 	public void setAddress(String address) {
 		this.address = address;
 	}
+
+	public Integer getSignType() {
+		return signType;
+	}
+
+	public void setSignType(Integer signType) {
+		this.signType = signType;
+	}
+
 }

+ 116 - 0
src/main/java/com/ssj/bean/sys/fx/domain/MerchantSign.java

@@ -0,0 +1,116 @@
+package com.ssj.bean.sys.fx.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 = "fx_merchant_sign")
+public class MerchantSign extends BaseEntity {
+	
+    private static final long serialVersionUID = 1L;
+    
+    private String merchantId;
+    
+    private Integer signType;
+    
+    private Integer num;
+    
+    private Date signTime;
+    
+    private Date endSignTime;
+    
+    private Integer libService;
+    
+    private Date createTime;
+    
+    private Integer status;
+    
+    private Date updateTime;
+    
+    private String remarks;
+
+	public String getMerchantId() {
+		return merchantId;
+	}
+
+	public void setMerchantId(String merchantId) {
+		this.merchantId = merchantId;
+	}
+
+	public Integer getSignType() {
+		return signType;
+	}
+
+	public void setSignType(Integer signType) {
+		this.signType = signType;
+	}
+
+	public Date getSignTime() {
+		return signTime;
+	}
+
+	public void setSignTime(Date signTime) {
+		this.signTime = signTime;
+	}
+
+	public Date getEndSignTime() {
+		return endSignTime;
+	}
+
+	public void setEndSignTime(Date endSignTime) {
+		this.endSignTime = endSignTime;
+	}
+
+	public Integer getLibService() {
+		return libService;
+	}
+
+	public void setLibService(Integer libService) {
+		this.libService = libService;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public Integer getNum() {
+		return num;
+	}
+
+	public void setNum(Integer num) {
+		this.num = num;
+	}
+
+	public String getRemarks() {
+		return remarks;
+	}
+
+	public void setRemarks(String remarks) {
+		this.remarks = remarks;
+	}
+    
+}

+ 43 - 8
src/main/java/com/ssj/bean/weixin/libmy/domain/TbLibJoin.java

@@ -1,13 +1,15 @@
 package com.ssj.bean.weixin.libmy.domain;
 
-import com.ssj.bean.common.framework.core.domain.BaseEntity;
-import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;
 import javax.persistence.Version;
-import java.util.Date;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+import com.ssj.bean.common.framework.core.domain.BaseEntity;
 
 @Entity
 @Table(name = "tb_lib_join")
@@ -65,15 +67,21 @@ public class TbLibJoin extends BaseEntity{
 	 * 平台服务币数
 	 */
 	private int platformService;
-	/**
-	 * 机构服务币数
-	 */
-	private int libService;
+	
 	/**
 	 * 版本号
 	 */
 	private long version;
-
+	
+	//机构服务币数/套餐模式人数
+	private int libService;
+	//套餐模式
+	private Integer signType;
+	//套餐模式开始时间
+	private Date signTime;
+	//套餐模式结束时间
+	private Date endSignTime;
+	
 	@Version
 	public long getVersion() {
 		return version;
@@ -257,4 +265,31 @@ public class TbLibJoin extends BaseEntity{
 	public void setCancelStat(Integer cancelStat) {
 		this.cancelStat = cancelStat;
 	}
+
+	public Integer getSignType() {
+		return signType;
+	}
+
+	public void setSignType(Integer signType) {
+		this.signType = signType;
+	}
+
+	public Date getSignTime() {
+		return signTime;
+	}
+
+	public void setSignTime(Date signTime) {
+		this.signTime = signTime;
+	}
+
+	public Date getEndSignTime() {
+		return endSignTime;
+	}
+
+	public void setEndSignTime(Date endSignTime) {
+		this.endSignTime = endSignTime;
+	}
+	
+	
+	
 }

+ 20 - 0
src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisCountDao.java

@@ -0,0 +1,20 @@
+package com.ssj.dao.sys.analysis.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.analysis.bean.AnalysisCount;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+public interface AnalysisCountDao extends JpaRepository<AnalysisCount, String> {
+
+	@Query(nativeQuery = true,value = "SELECT * from tb_analysis_count t WHERE t.lib_id=?1 AND t.source=?2 AND t.type=?3 AND t.day_time=?4 LIMIT 1 ")
+	AnalysisCount getAnalysisCountByDay(String libId,Integer source,Integer type,String dayTime);
+	
+	
+}

+ 2 - 1
src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisDao.java

@@ -1,9 +1,10 @@
 package com.ssj.dao.sys.analysis.dao;
 
-import com.ssj.bean.sys.analysis.bean.Analysis;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
 
+import com.ssj.bean.sys.analysis.bean.Analysis;
+
 /**
  * @author Mount Liu
  * @date 2019/3/17

+ 75 - 40
src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisQueryDao.java

@@ -1,40 +1,75 @@
-package com.ssj.dao.sys.analysis.dao;
-
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-import java.util.List;
-import java.util.Map;
-
-
-public interface AnalysisQueryDao {
-
-	//type=1月份的消费币的总量
-	public Long countLibJoinConsumeSumByLibService(String date);
-	
-	//type=1的总端口数
-	public Long countFxMerchantSumByPortNum();
-	
-	//type=1的月top10
-	public List<Map<String,Object>> countFxMerchantSumByTop(String date);
-	
-	//月机构会员的统计列表
-	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable);
-	
-	//学生端的统计列表
-	public Page<Map<String, Object>> countFxMerchantHomeworkByDay(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantHomeworkByVipDay(Map<String, Object> params, Pageable pageable);
-	
-	//公用查询方式
-	public Page<Map<String, Object>> countFxMerchantCommonByDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByCountUserDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable);
-	
-}
+package com.ssj.dao.sys.analysis.dao;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.ssj.bean.sys.analysis.bean.Analysis;
+
+
+public interface AnalysisQueryDao {
+
+	//type=1月份的消费币的总量
+	public Long countLibJoinConsumeSumByLibService(String date);
+	
+	//type=1的总端口数
+	public Long countFxMerchantSumByPortNum();
+	
+	//type=1的月top10
+	public List<Map<String,Object>> countFxMerchantSumByTop(String date);
+	
+	//月机构会员的统计列表
+	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable);
+
+	//公用查询方式
+	public Page<Map<String, Object>> countFxMerchantCommonByCountDate(Map<String, Object> params, Pageable pageable);
+	
+	//公用查询明细方式
+	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable);
+	
+	//查出时间内的记录
+	public Analysis getAnalysisByDay(String libId,String userId,String vipId,Integer source,Integer type,String dayTime);
+	
+	
+	//查出一周内和上周的功能使用总数
+	public Map<String, Object> countAnalysisCountCommonByCountDate(Map<String, Object> params);
+	
+	//召回机构数据(1周不用机构)
+	public Map<String, Object> countRecallCommonByCountDate(Map<String, Object> params);
+	
+	//上传作业的人数
+	public Map<String, Object> countUploadWorkCommonByCountDate(Map<String, Object> params);
+	
+	//返回指定机构的活跃人数
+	public Integer countActiveNumCommonByLibCountWeek(Map<String, Object> params);
+	
+	//返回指定机构的会员人数
+	public Integer countMemberNumCommonByLibCountWeek(Map<String, Object> params);
+	
+	//查出一周内和上周的机构活泼数(账号活跃占比50%以上)
+	public Map<String, Object> countAnalysisWeekCountCommonByCountCurDate(Map<String, Object> params);
+	
+	
+	//新机构(1个月内)活泼数,老机构(持续用3个月)
+	public List<Map<String, Object>> countAnalysisWeekCountCommonByCountMonthDate(Map<String, Object> params);
+	
+	//新签机构1周内账号开通数(校长&教师)
+	public List<Map<String, Object>> countLibJoinCountCommonByCountDate(Map<String, Object> params);
+	
+	//新签机构2周内学生账号激活
+	public Map<String, Object> countVipActivateCountCommonByCountDate(Map<String, Object> params);
+	
+	//统计时间的type数量
+	public List<Map<String, Object>> countAnalysisCountCommonByCountTask();
+	
+
+	
+	
+	
+}

+ 24 - 0
src/main/java/com/ssj/dao/sys/analysis/dao/AnalysisWeekDao.java

@@ -0,0 +1,24 @@
+package com.ssj.dao.sys.analysis.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.analysis.bean.AnalysisWeek;
+
+/**
+ * @author Mount Liu
+ * @date 2019/3/17
+ */
+@Repository
+public interface AnalysisWeekDao extends JpaRepository<AnalysisWeek, String> {
+
+	@Query(nativeQuery = true,value = " SELECT * from tb_analysis_week t WHERE t.lib_id=?1 AND t.year_week=concat(DATE_FORMAT(NOW(),'%Y'),DATE_FORMAT(NOW(),'%u')) LIMIT 1 ")
+	AnalysisWeek getAnalysisWeekByCurWeek(String libId);
+	
+	@Modifying
+	@Query(nativeQuery = true, value = "insert into tb_analysis_week ( id, lib_id, year_week, member_num, active_num,active_ratio,create_time) values ( UUID(), ?1 , concat(DATE_FORMAT(NOW(),'%Y'),DATE_FORMAT(NOW(),'%u')), ?2 ,?3,?4,NOW() )  ")
+	void saveAnalysisWeek(String libId, Integer memberNum, Integer activeNum, Integer activeRatio);
+	
+}

+ 404 - 370
src/main/java/com/ssj/dao/sys/analysis/dao/impl/AnalysisQueryDaoImpl.java

@@ -1,370 +1,404 @@
-package com.ssj.dao.sys.analysis.dao.impl;
-
-import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
-import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
-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 java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-@Repository
-public class AnalysisQueryDaoImpl  implements AnalysisQueryDao {
-
-    @Autowired
-    private PagingHibernateJdbcDao dao;
-    
-
-	@Override
-	public Long countLibJoinConsumeSumByLibService(String date) {
-		Long count=new Long(0);
-		StringBuilder sb = new StringBuilder();
-        sb.append(" SELECT IFNULL(SUM(t.lib_service),0) as count from tb_lib_join_consume t LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id WHERE m.type=1 AND t.type in ('2') AND date_format(t.create_time, '%Y-%m') =?  ");
-        List<Object> param = new ArrayList<>();
-        param.add(date);
-        List<Map<String, Object>> list=dao.findMap(sb.toString(), param.toArray());
-        if(list!=null && list.size()>0) {
-        	count=Long.parseLong(list.get(0).get("count").toString());
-        }
-        return count;
-	}
-
-	@Override
-	public Long countFxMerchantSumByPortNum() {
-		Long count=new Long(0);
-		StringBuilder sb = new StringBuilder();
-        sb.append(" SELECT IFNULL(SUM(t.port_num),0) as count from  fx_merchant t WHERE t.type=1 ");
-        List<Object> param = new ArrayList<>();
-        List<Map<String, Object>> list=dao.findMap(sb.toString(), param.toArray());
-        if(list!=null && list.size()>0) {
-        	count=Long.parseLong(list.get(0).get("count").toString());
-        }
-        return count;
-	}
-
-	@Override
-	public List<Map<String,Object>> countFxMerchantSumByTop(String date) {
-		StringBuilder sb = new StringBuilder();
-        sb.append(" SELECT *,IFNULL(count/lib_service,0) as lcount from ( ");
-        sb.append(" SELECT ");
-        sb.append(" (SELECT IFNULL(SUM(c.lib_service),0) from tb_lib_join_consume c WHERE c.type in ('2') AND date_format(c.create_time, '%Y-%m') =? AND c.from_merchant_id=t.id ) as count,	");
-        sb.append(" t.lib_service,");
-        sb.append(" t.unit_name");
-        sb.append(" from fx_merchant t WHERE t.type=1 ");
-        sb.append(" ) as tmp ORDER BY lcount desc LIMIT 10 ");
-        
-        List<Object> param = new ArrayList<>();
-        param.add(date);
-        return dao.findMap(sb.toString(), param.toArray());
-	}
-
-	@Override
-	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-        sb.append("  SELECT ");
-        sb.append("  t.id,t.unit_name,j.league_name, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.start_time, '%Y-%m') =? 	) as count_1, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') =? ) as count_2, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') >=? ) as count_3, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') >? ) as count_4");
-        sb.append(" from fx_merchant t  ");
-        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
-        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
-        List<Object> param = new ArrayList<>();
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
-        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
-        	 param.add(params.get("unitName"));
-        }
-        sb.append(" ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-    
-	@Override
-	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		List<Object> param = new ArrayList<>();
-		 
-        String type=params.get("type")!=null ? params.get("type").toString() : "1";
-       
-        switch (type) {
-			case "1":
-				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
-				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append(" WHERE date_format(s.start_time, '%Y-%m') =?");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "2":
-				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
-				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append(" WHERE date_format(s.end_time, '%Y-%m') =?");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "3":
-				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
-				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append(" WHERE date_format(s.end_time, '%Y-%m') >=?");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "4":
-				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
-				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append(" WHERE date_format(s.end_time, '%Y-%m') =?");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			default:
-				return null;
-		}
-       
-	}
-    
-	
-	
-	
-	@Override
-	public  Page<Map<String, Object>> countFxMerchantHomeworkByDay(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-        sb.append("  SELECT ");
-        sb.append("  t.id,t.unit_name,j.league_name, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from zyb_student_push s LEFT JOIN tb_lib_vip v ON s.vip_id=v.id WHERE v.lib_id=t.lib_id AND TO_DAYS(s.submit_time)=TO_DAYS(?) 	) as count_1, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from scon_homework s LEFT JOIN tb_lib_vip v ON s.vip_id=v.id WHERE v.lib_id=t.lib_id AND s.start_time is NOT NULL AND s.end_time is NOT NULL AND TO_DAYS(s.create_time)=TO_DAYS(?) ) as count_2, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from scon_homework_picture s LEFT JOIN tb_lib_vip v ON s.vip_id=v.id WHERE v.lib_id=t.lib_id AND TO_DAYS(s.create_time)=TO_DAYS(?) ) as count_3, ");
-        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from zyb_student_push s LEFT JOIN tb_lib_vip v ON s.vip_id=v.id WHERE v.lib_id=t.lib_id AND s.view_time IS not NULL AND TO_DAYS(s.submit_time)=TO_DAYS(?) ) as count_4");
-        sb.append(" from fx_merchant t  ");
-        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
-        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
-        List<Object> param = new ArrayList<>();
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        param.add(params.get("date"));
-        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
-        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
-        	 param.add(params.get("unitName"));
-        }
-        sb.append(" ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-
-	@Override
-	public Page<Map<String, Object>> countFxMerchantHomeworkByVipDay(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		List<Object> param = new ArrayList<>();
-		 
-        String type=params.get("type")!=null ? params.get("type").toString() : "1";
-       
-        switch (type) {
-			case "1":
-				sb.append("  SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.submit_time ");
-				sb.append("  from zyb_student_push s ");
-				sb.append("  LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append("  LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append("  LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append("  WHERE TO_DAYS(s.submit_time)=TO_DAYS(?) ");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append("  GROUP BY s.vip_id ORDER BY s.submit_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "2":
-				sb.append("  SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,SUM(s.used_time) as used_time ");
-				sb.append("  from scon_homework s ");
-				sb.append("  LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append("  LEFT JOIN fx_merchant t ON v.lib_id=t.lib_id ");
-				sb.append("  LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append("  WHERE s.start_time is NOT NULL AND s.end_time is NOT NULL ");
-				sb.append("  AND TO_DAYS(s.create_time)=TO_DAYS(?) ");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append("  GROUP BY s.vip_id ORDER BY s.start_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "3":
-				sb.append("  SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,count(1) as count_num ");
-				sb.append("  from scon_homework_picture s ");
-				sb.append("  LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append("  LEFT JOIN fx_merchant t ON v.lib_id=t.lib_id ");
-				sb.append("  LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append("  WHERE TO_DAYS(s.create_time)=TO_DAYS(?) ");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append("  GROUP BY s.vip_id ORDER BY s.create_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			case "4":
-				sb.append("  SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.view_time ");
-				sb.append("  from zyb_student_push s ");
-				sb.append("  LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
-				sb.append("  LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
-				sb.append("  LEFT JOIN tb_user u ON v.user_id=u.id ");
-				sb.append("  WHERE s.view_time IS not NULL AND TO_DAYS(s.submit_time)=TO_DAYS(?) ");
-				sb.append(" AND t.id=? ");
-				param.add(params.get("date"));
-				param.add(params.get("id"));
-				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-					sb.append(" AND v.child_name like concat('%',?,'%')  ");
-					param.add(params.get("name"));
-				}
-				sb.append("  GROUP BY s.vip_id ORDER BY s.submit_time DESC ");
-				return dao.findPage(sb.toString(),param.toArray(),pageable);
-			default:
-				return null;
-		}
-	}
-
-	
-	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		String[] types=params.get("types").toString().split(";");
-		List<Object> param = new ArrayList<>();
-        sb.append("  SELECT ");
-        sb.append("  t.id,t.unit_name,j.id as lib_id, j.league_name");
-        for (int i = 0; i < types.length; i++) {
-        	 sb.append(" , ( SELECT COUNT(DISTINCT a.vip_id) from tb_analysis a WHERE a.lib_id=t.lib_id AND a.type=? AND a.source=? AND TO_DAYS(a.create_time)>=TO_DAYS(?) AND TO_DAYS(a.create_time)<=TO_DAYS(?) ) as count_"+i );
-        	 param.add(types[i]);
-        	 param.add(params.get("source"));
-        	 param.add(params.get("date"));
-        	 param.add(params.get("date2"));
-		}
-        sb.append(" from fx_merchant t  ");
-        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
-        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
-        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
-        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
-        	 param.add(params.get("unitName"));
-        }
-        sb.append(" ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-	
-	
-	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByCountUserDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		String[] types=params.get("types").toString().split(";");
-		List<Object> param = new ArrayList<>();
-        sb.append("  SELECT ");
-        sb.append("  t.id,t.unit_name,j.id as lib_id, j.league_name");
-        for (int i = 0; i < types.length; i++) {
-        	 sb.append(" , ( SELECT COUNT(DISTINCT a.user_id) from tb_analysis a WHERE a.lib_id=t.lib_id AND a.type=? AND a.source=? AND TO_DAYS(a.create_time)=TO_DAYS(?)  AND TO_DAYS(a.create_time)<=TO_DAYS(?) ) as count_"+i );
-        	 param.add(types[i]);
-        	 param.add(params.get("source"));
-        	 param.add(params.get("date"));
-        	 param.add(params.get("date2"));
-		}
-        sb.append(" from fx_merchant t  ");
-        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
-        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
-        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
-        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
-        	 param.add(params.get("unitName"));
-        }
-        sb.append(" ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-
-	
-	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		List<Object> param = new ArrayList<>();
-        sb.append(" SELECT t.user_id,t.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,t.create_time ");
-        sb.append(" from tb_analysis t  ");
-        sb.append(" LEFT JOIN tb_lib_vip v ON t.vip_id=v.id ");
-        sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
-        sb.append(" WHERE t.lib_id=? AND t.type=? AND t.source =? AND TO_DAYS(t.create_time)>=TO_DAYS(?) AND TO_DAYS(t.create_time)<=TO_DAYS(?)  ");
-        param.add(params.get("libId"));
-        param.add(params.get("type"));
-        param.add(params.get("source"));
-        param.add(params.get("date"));
-        param.add(params.get("date2"));
-        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-        	 sb.append(" and v.child_name like concat('%',?,'%')  ");
-        	 param.add(params.get("name"));
-        }
-        sb.append(" GROUP BY TO_DAYS(t.create_time),t.vip_id ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-	
-	
-	
-	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable) {
-		StringBuilder sb = new StringBuilder();
-		List<Object> param = new ArrayList<>();
-        sb.append(" SELECT t.vip_id,u.wx_name,u.photo,u.user_name,t.create_time ");
-        sb.append(" from tb_analysis t  ");
-        sb.append(" LEFT JOIN tb_user u ON t.user_id=u.id ");
-        sb.append(" WHERE t.lib_id=? AND t.type=? AND t.source =? AND TO_DAYS(t.create_time)>=TO_DAYS(?) AND TO_DAYS(t.create_time)<=TO_DAYS(?)  ");
-        param.add(params.get("libId"));
-        param.add(params.get("type"));
-        param.add(params.get("source"));
-        param.add(params.get("date"));
-        param.add(params.get("date2"));
-        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
-        	 sb.append(" and u.user_name like concat('%',?,'%')  ");
-        	 param.add(params.get("name"));
-        }
-        sb.append(" GROUP BY TO_DAYS(t.create_time),t.user_id ORDER BY t.create_time asc ");
-        return dao.findPage(sb.toString(),param.toArray(),pageable);
-	}
-
-
-
-}
+package com.ssj.dao.sys.analysis.dao.impl;
+
+import java.util.ArrayList;
+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.data.domain.Pageable;
+import org.springframework.stereotype.Repository;
+
+import com.ssj.bean.sys.analysis.bean.Analysis;
+import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
+import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
+
+@Repository
+public class AnalysisQueryDaoImpl  implements AnalysisQueryDao {
+
+    @Autowired
+    private PagingHibernateJdbcDao dao;
+    
+
+	@Override
+	public Long countLibJoinConsumeSumByLibService(String date) {
+		Long count=new Long(0);
+		StringBuilder sb = new StringBuilder();
+        sb.append(" SELECT IFNULL(SUM(t.lib_service),0) as count from tb_lib_join_consume t LEFT JOIN fx_merchant m ON t.from_merchant_id=m.id WHERE m.type=1 AND t.type in ('2') AND date_format(t.create_time, '%Y-%m') =?  ");
+        List<Object> param = new ArrayList<>();
+        param.add(date);
+        List<Map<String, Object>> list=dao.findMap(sb.toString(), param.toArray());
+        if(list!=null && list.size()>0) {
+        	count=Long.parseLong(list.get(0).get("count").toString());
+        }
+        return count;
+	}
+
+	@Override
+	public Long countFxMerchantSumByPortNum() {
+		Long count=new Long(0);
+		StringBuilder sb = new StringBuilder();
+        sb.append(" SELECT IFNULL(SUM(t.port_num),0) as count from  fx_merchant t WHERE t.type=1 ");
+        List<Object> param = new ArrayList<>();
+        List<Map<String, Object>> list=dao.findMap(sb.toString(), param.toArray());
+        if(list!=null && list.size()>0) {
+        	count=Long.parseLong(list.get(0).get("count").toString());
+        }
+        return count;
+	}
+
+	@Override
+	public List<Map<String,Object>> countFxMerchantSumByTop(String date) {
+		StringBuilder sb = new StringBuilder();
+        sb.append(" SELECT *,IFNULL(count/lib_service,0) as lcount from ( ");
+        sb.append(" SELECT ");
+        sb.append(" (SELECT IFNULL(SUM(c.lib_service),0) from tb_lib_join_consume c WHERE c.type in ('2') AND date_format(c.create_time, '%Y-%m') =? AND c.from_merchant_id=t.id ) as count,	");
+        sb.append(" t.lib_service,");
+        sb.append(" t.unit_name");
+        sb.append(" from fx_merchant t WHERE t.type=1 ");
+        sb.append(" ) as tmp ORDER BY lcount desc LIMIT 10 ");
+        
+        List<Object> param = new ArrayList<>();
+        param.add(date);
+        return dao.findMap(sb.toString(), param.toArray());
+	}
+
+	@Override
+	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable) {
+		StringBuilder sb = new StringBuilder();
+        sb.append("  SELECT ");
+        sb.append("  t.id,t.unit_name,j.league_name, ");
+        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.start_time, '%Y-%m') =? 	) as count_1, ");
+        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') =? ) as count_2, ");
+        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') >=? ) as count_3, ");
+        sb.append("  	( SELECT COUNT(DISTINCT s.vip_id) from tb_lib_vip_service s WHERE s.lib_id=t.lib_id AND date_format(s.end_time, '%Y-%m') >? ) as count_4");
+        sb.append(" from fx_merchant t  ");
+        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
+        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
+        List<Object> param = new ArrayList<>();
+        param.add(params.get("date"));
+        param.add(params.get("date"));
+        param.add(params.get("date"));
+        param.add(params.get("date"));
+        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
+        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
+        	 param.add(params.get("unitName"));
+        }
+        sb.append(" ORDER BY count_1 desc,count_2 desc,count_3 desc,count_4 desc ");
+        return dao.findPage(sb.toString(),param.toArray(),pageable);
+	}
+    
+	@Override
+	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+		 
+        String type=params.get("type")!=null ? params.get("type").toString() : "1";
+       
+        switch (type) {
+			case "1":
+				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
+				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
+				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
+				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
+				sb.append(" WHERE date_format(s.start_time, '%Y-%m') =?");
+				sb.append(" AND t.id=? ");
+				param.add(params.get("date"));
+				param.add(params.get("id"));
+				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+					sb.append(" AND v.child_name like concat('%',?,'%')  ");
+					param.add(params.get("name"));
+				}
+				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
+				return dao.findPage(sb.toString(),param.toArray(),pageable);
+			case "2":
+				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
+				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
+				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
+				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
+				sb.append(" WHERE date_format(s.end_time, '%Y-%m') =?");
+				sb.append(" AND t.id=? ");
+				param.add(params.get("date"));
+				param.add(params.get("id"));
+				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+					sb.append(" AND v.child_name like concat('%',?,'%')  ");
+					param.add(params.get("name"));
+				}
+				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
+				return dao.findPage(sb.toString(),param.toArray(),pageable);
+			case "3":
+				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
+				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
+				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
+				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
+				sb.append(" WHERE date_format(s.end_time, '%Y-%m') >=?");
+				sb.append(" AND t.id=? ");
+				param.add(params.get("date"));
+				param.add(params.get("id"));
+				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+					sb.append(" AND v.child_name like concat('%',?,'%')  ");
+					param.add(params.get("name"));
+				}
+				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
+				return dao.findPage(sb.toString(),param.toArray(),pageable);
+			case "4":
+				sb.append(" SELECT s.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,s.start_time,s.end_time from tb_lib_vip_service s  ");
+				sb.append(" LEFT JOIN fx_merchant t ON s.lib_id=t.lib_id ");
+				sb.append(" LEFT JOIN tb_lib_vip v ON s.vip_id=v.id ");
+				sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
+				sb.append(" WHERE date_format(s.end_time, '%Y-%m') =?");
+				sb.append(" AND t.id=? ");
+				param.add(params.get("date"));
+				param.add(params.get("id"));
+				if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+					sb.append(" AND v.child_name like concat('%',?,'%')  ");
+					param.add(params.get("name"));
+				}
+				sb.append(" GROUP BY s.vip_id ORDER BY s.start_time DESC ");
+				return dao.findPage(sb.toString(),param.toArray(),pageable);
+			default:
+				return null;
+		}
+       
+	}
+    
+	
+	@Override
+	public Page<Map<String, Object>> countFxMerchantCommonByCountDate(Map<String, Object> params, Pageable pageable) {
+		StringBuilder sb = new StringBuilder();
+		String[] types=params.get("types").toString().split(";");
+		List<Object> param = new ArrayList<>();
+        sb.append("  SELECT ");
+        sb.append("  t.id,t.unit_name,j.id as lib_id, j.league_name");
+        for (int i = 0; i < types.length; i++) {
+        	 sb.append(" , ( SELECT IFNULL(SUM(a.count),0) from tb_analysis_count a WHERE a.lib_id=t.lib_id AND a.type=? AND a.source=? AND a.day_time>=? AND a.day_time<=? ) as count_"+i );
+        	 param.add(types[i]);
+        	 param.add(params.get("source"));
+        	 param.add(params.get("date"));
+        	 param.add(params.get("date2"));
+		}
+        sb.append(" from fx_merchant t  ");
+        sb.append(" LEFT JOIN  tb_lib_join j ON t.lib_id=j.id ");
+        sb.append(" WHERE t.type=1 AND t.lib_id is NOT null ");
+        if(params.get("unitName")!=null && StringUtils.isNotEmpty(params.get("unitName").toString())) {
+        	 sb.append(" and t.unit_name like concat('%',?,'%')  ");
+        	 param.add(params.get("unitName"));
+        }
+        for (int i = 0; i < types.length; i++) {
+        	if(i==0) {
+        		sb.append(" ORDER BY count_"+i+" desc ");
+        	}else {
+        		sb.append("  , count_"+i+" desc ");
+        	}
+        }
+        return dao.findPage(sb.toString(),param.toArray(),pageable);
+	}
+	
+	@Override
+	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append(" SELECT t.user_id,t.vip_id,u.wx_name,u.photo,v.parent_name,v.child_name,t.create_time ");
+        sb.append(" from tb_analysis t  ");
+        sb.append(" LEFT JOIN tb_lib_vip v ON t.vip_id=v.id ");
+        sb.append(" LEFT JOIN tb_user u ON v.user_id=u.id ");
+        sb.append(" WHERE t.lib_id=? AND t.type=? AND t.source =? AND TO_DAYS(t.create_time)>=TO_DAYS(?) AND TO_DAYS(t.create_time)<=TO_DAYS(?)  ");
+        param.add(params.get("libId"));
+        param.add(params.get("type"));
+        param.add(params.get("source"));
+        param.add(params.get("date"));
+        param.add(params.get("date2"));
+        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+        	 sb.append(" and v.child_name like concat('%',?,'%')  ");
+        	 param.add(params.get("name"));
+        }
+        sb.append(" GROUP BY TO_DAYS(t.create_time),t.vip_id ORDER BY t.create_time asc ");
+        return dao.findPage(sb.toString(),param.toArray(),pageable);
+	}
+	
+	
+	
+	@Override
+	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append(" SELECT t.user_id,u.wx_name,u.photo,u.user_name,t.create_time ");
+        sb.append(" from tb_analysis t  ");
+        sb.append(" LEFT JOIN tb_user u ON t.user_id=u.id ");
+        sb.append(" WHERE t.lib_id=? AND t.type=? AND t.source =? AND TO_DAYS(t.create_time)>=TO_DAYS(?) AND TO_DAYS(t.create_time)<=TO_DAYS(?)  ");
+        param.add(params.get("libId"));
+        param.add(params.get("type"));
+        param.add(params.get("source"));
+        param.add(params.get("date"));
+        param.add(params.get("date2"));
+        if(params.get("name")!=null && StringUtils.isNotEmpty(params.get("name").toString())) {
+        	 sb.append(" and u.user_name like concat('%',?,'%')  ");
+        	 param.add(params.get("name"));
+        }
+        sb.append(" GROUP BY TO_DAYS(t.create_time),t.user_id ORDER BY t.create_time asc ");
+        return dao.findPage(sb.toString(),param.toArray(),pageable);
+	}
+
+	@Override
+	public Analysis getAnalysisByDay(String libId, String userId, String vipId, Integer source, Integer type,String dayTime) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append(" SELECT * FROM `tb_analysis` t WHERE t.source=? AND t.type=? AND t.day_time=? AND t.lib_id=? ");
+        param.add(source);
+        param.add(type);
+        param.add(dayTime);
+        param.add(libId);
+        if(StringUtils.isNotEmpty(userId)) {
+       	 	sb.append(" AND t.user_id=? ");
+       	 	param.add(userId);
+        }
+        if(StringUtils.isNotEmpty(userId)) {
+          	sb.append(" AND t.vip_id=? ");
+          	param.add(vipId);
+        }
+        sb.append(" LIMIT 1 ");
+        List<Analysis> list=dao.findList(sb.toString(),param.toArray(),Analysis.class);
+        return list!=null && list.size()>0 ? list.get(0) : null ;
+	}
+	
+	
+	
+	
+	@Override
+	public Map<String, Object> countAnalysisCountCommonByCountDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		String[] types=params.get("types").toString().split(";");
+		List<Object> param = new ArrayList<>();
+        sb.append("  SELECT 1 ");
+        for (int i = 0; i < types.length; i++) {
+        	 sb.append(" , ( SELECT IFNULL(SUM(t.count),0) as count from tb_analysis_count t WHERE t.source=? AND t.type=? AND t.day_time>=? AND t.day_time<=?  ) as count_"+i );
+        	 param.add(params.get("source"));
+        	 param.add(types[i]);
+        	 param.add(params.get("date"));
+        	 param.add(params.get("date2"));
+        	 
+        	 sb.append(" , ( SELECT IFNULL(SUM(t.count),0) as count from tb_analysis_count t WHERE t.source=? AND t.type=? AND t.day_time>=? AND t.day_time<=?  ) as count_"+i+"_"+i );
+        	 param.add(params.get("source"));
+        	 param.add(types[i]);
+        	 param.add(params.get("date3"));
+        	 param.add(params.get("date4"));
+		}
+        List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? list.get(0) : new HashMap<String, Object>();
+	}
+	
+	
+	
+	@Override
+	public Map<String, Object> countRecallCommonByCountDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append("	SELECT 	");
+      	sb.append("	IFNULL((SELECT COUNT(lib_id) from tb_analysis_count a WHERE a.day_time>=? AND a.day_time<=? GROUP BY a.lib_id),0)  as count_0, " );
+    	sb.append(" IFNULL((SELECT COUNT(lib_id) from tb_analysis_count a WHERE a.day_time>=? AND a.day_time<=? GROUP BY a.lib_id),0)  as count_1 ");
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	param.add(params.get("date3"));
+    	param.add(params.get("date4"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? list.get(0) : new HashMap<String, Object>();
+	}
+	
+	
+	@Override
+	public Map<String, Object> countUploadWorkCommonByCountDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append("	SELECT  	");
+      	sb.append("	 (SELECT IFNULL(count(1),0) from (SELECT t.vip_id,count(t.day_time) as count from tb_analysis t WHERE t.type=3 AND t.day_time>=? AND t.day_time<=? GROUP BY t.vip_id HAVING count>=3) as tmp) as count_0, " );
+    	sb.append("  (SELECT IFNULL(count(1),0) from (SELECT t.vip_id,count(t.day_time) as count from tb_analysis t WHERE t.type=3 AND t.day_time>=? AND t.day_time<=? GROUP BY t.vip_id HAVING count>=3) as tmp) as count_1 ");
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	param.add(params.get("date3"));
+    	param.add(params.get("date4"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? list.get(0) : new HashMap<String, Object>();
+	}
+	
+	@Override
+	public Integer countActiveNumCommonByLibCountWeek(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	SELECT IFNULL(count(1),0) as count from (SELECT t.vip_id,count(t.day_time) as count from tb_analysis t WHERE t.lib_id=? AND t.type=3 AND DATE_FORMAT(t.day_time,'%Y')=DATE_FORMAT(DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d'),'%Y') AND DATE_FORMAT(t.day_time,'%Y')=DATE_FORMAT(DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d'),'%u') GROUP BY t.vip_id HAVING count>=3) as tmp" );
+    	param.add(params.get("libId"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? (int)list.get(0).get("count") : 0;
+	}
+	
+	
+	public Integer countMemberNumCommonByLibCountWeek(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	SELECT COUNT(1) as count from tb_lib_vip t WHERE t.lib_id=? " );
+    	param.add(params.get("libId"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? (int)list.get(0).get("count") : 0;
+	}
+
+	@Override
+	public Map<String, Object> countAnalysisWeekCountCommonByCountCurDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+        sb.append("	SELECT ");
+      	sb.append("	 (SELECT COUNT(DISTINCT t.lib_id) from tb_analysis_week t WHERE t.year_week=? AND t.active_ratio>=50) as count_0, " );
+    	sb.append("  (SELECT COUNT(DISTINCT t.lib_id) from tb_analysis_week t WHERE t.year_week=? AND t.active_ratio>=50) as count_1, ");
+    	sb.append("	 (SELECT COUNT(1) from fx_merchant t WHERE t.type=1 AND t.lib_id is NOT NULL) as count_2	");
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? list.get(0) : new HashMap<String, Object>();
+	}
+
+	@Override
+	public List<Map<String, Object>> countAnalysisWeekCountCommonByCountMonthDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	 SELECT t.lib_id,COUNT(DISTINCT t.year_week) as count from tb_analysis_week t WHERE t.year_week>=? AND t.year_week<=? GROUP BY t.lib_id HAVING count>=?" );
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	param.add(params.get("count"));
+    	return dao.findMap(sb.toString(),param.toArray());
+	}
+
+	@Override
+	public List<Map<String, Object>> countLibJoinCountCommonByCountDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	 SELECT t.id,COUNT(m.id) as count from tb_lib_join t LEFT JOIN tb_lib_manager m ON t.id=m.lib_id  " );
+       	sb.append("	WHERE TO_DAYS(t.create_time) >=TO_DAYS(?) AND TO_DAYS(t.create_time) <=TO_DAYS(?) ");
+       	sb.append(" GROUP BY t.id HAVING count<=0 	");
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	return dao.findMap(sb.toString(),param.toArray());
+	}
+
+	@Override
+	public Map<String, Object> countVipActivateCountCommonByCountDate(Map<String, Object> params) {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	 SELECT  " );
+       	sb.append(" (SELECT count(1) from tb_lib_vip t WHERE TO_DAYS(t.activate_time)>=TO_DAYS(?) AND TO_DAYS(t.activate_time)>=TO_DAYS(?)) AS count_0, ");
+       	sb.append(" (SELECT count(1) from tb_lib_vip t WHERE t.activate_time is NOT null ) AS count_1	");
+      	param.add(params.get("date"));
+    	param.add(params.get("date2"));
+    	List<Map<String, Object>>  list=dao.findMap(sb.toString(),param.toArray());
+        return list!=null && list.size()>0 ? list.get(0) : new HashMap<String, Object>();
+	}
+
+	@Override
+	public List<Map<String, Object>> countAnalysisCountCommonByCountTask() {
+		StringBuilder sb = new StringBuilder();
+		List<Object> param = new ArrayList<>();
+      	sb.append("	SELECT t.lib_id,t.source,t.type,DATE_FORMAT(t.create_time,'%Y-%m-%d') as day_time,IF(type=3,COUNT(DISTINCT t.user_id),COUNT(DISTINCT t.vip_id)) as count from tb_analysis t WHERE  TO_DAYS(t.create_time)=TO_DAYS(DATE_SUB(NOW(),INTERVAL 1 DAY)) GROUP BY t.lib_id,t.source,t.type " );
+    	return dao.findMap(sb.toString(),param.toArray());
+	}
+
+	
+}

+ 2 - 0
src/main/java/com/ssj/dao/sys/fx/dao/FxQueryDao.java

@@ -49,4 +49,6 @@ public interface FxQueryDao {
     Page<Map<String, Object>> deviceInAndOutList(Map<String, Object> params, Pageable initPage);
 
     Page<Map<String, Object>> deviceOutList(Map<String, Object> params, Pageable initPage);
+    
+    Page<Map<String, Object>> findMerchantSignByPage(Map<String, Object> params, Pageable initPage);
 }

+ 6 - 2
src/main/java/com/ssj/dao/sys/fx/dao/MerchantDao.java

@@ -1,6 +1,7 @@
 package com.ssj.dao.sys.fx.dao;
 
-import com.ssj.bean.sys.fx.domain.Merchant;
+import java.util.List;
+
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
@@ -8,7 +9,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
-import java.util.List;
+import com.ssj.bean.sys.fx.domain.Merchant;
 
 @Repository
 public interface MerchantDao extends JpaRepository<Merchant, String> {
@@ -42,5 +43,8 @@ public interface MerchantDao extends JpaRepository<Merchant, String> {
 	@Query(nativeQuery = true, value = " SELECT t.* from fx_merchant t LEFT JOIN tb_lib_vip v ON t.lib_id=v.lib_id WHERE v.id IS NOT NULL AND v.id=?1 ORDER BY t.create_time DESC LIMIT 1 ")
 	public Merchant getMerchantByVipId(String vipId);
 	
+	@Query(nativeQuery = true, value = " SELECT * from fx_merchant t where t.sign_type in (1,2,3) AND TO_DAYS(t.end_sign_time)<TO_DAYS(NOW()) ORDER BY t.create_time ASC ")
+	public List<Merchant> findMerchantSignByEndTime();
+	
 	
 }

+ 20 - 0
src/main/java/com/ssj/dao/sys/fx/dao/MerchantSignDao.java

@@ -0,0 +1,20 @@
+package com.ssj.dao.sys.fx.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.fx.domain.MerchantSign;
+
+@Repository
+public interface MerchantSignDao extends JpaRepository<MerchantSign, String> {
+	
+	@Query(nativeQuery = true, value = " SELECT * FROM `fx_merchant_sign` t WHERE t.`status`=0 AND TO_DAYS(t.end_sign_time)<TO_DAYS(NOW())  ")
+	public List<MerchantSign> findMerchantSignByEndTime();
+	
+	@Query(nativeQuery = true, value = " SELECT * FROM `fx_merchant_sign` t WHERE t.merchant_id=?1 and t.`status`=?2   ")
+	public List<MerchantSign> findMerchantSignByMerchantId(String merchantId,Integer status);
+	
+}

+ 30 - 6
src/main/java/com/ssj/dao/sys/fx/dao/impl/FxQueryDaoImpl.java

@@ -1,17 +1,18 @@
 package com.ssj.dao.sys.fx.dao.impl;
 
-import com.ssj.dao.sys.fx.dao.FxQueryDao;
-import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
-import com.ssj.service.conch.parents.v1.dto.PositionSchoolV1Dto;
+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 java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import com.ssj.dao.sys.fx.dao.FxQueryDao;
+import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
+import com.ssj.service.conch.parents.v1.dto.PositionSchoolV1Dto;
 
 @Repository
 
@@ -682,4 +683,27 @@ public class FxQueryDaoImpl implements FxQueryDao {
         sql.append(" union select date_format((curdate() - interval 11 month),'%Y-%m') AS `year_month`");
         return sql.toString();
     }
+    
+    
+    
+    @Override
+    public Page<Map<String, Object>> findMerchantSignByPage(Map<String, Object> params, Pageable initPage) {
+        StringBuilder selSql = new StringBuilder();
+        List<Object> queryParams = new ArrayList<Object>();
+        selSql.append("SELECT t.*,m.pos_code,m.unit_name FROM `fx_merchant_sign` t LEFT JOIN fx_merchant m ON t.merchant_id=m.id  where 1=1 ");
+        if(params.containsKey("merchantId") && StringUtils.isNotEmpty(params.get("merchantId").toString())){
+            selSql.append(" AND t.merchant_id=? ");
+            queryParams.add(params.get("merchantId"));
+        }
+        if(params.containsKey("signType") && StringUtils.isNotEmpty(params.get("signType").toString())){
+            selSql.append(" AND t.sign_type=? ");
+            queryParams.add(params.get("signType"));
+        }
+        selSql.append(" ORDER BY t.create_time DESC  ");
+        return dao.findPage(selSql.toString(),queryParams.toArray(), initPage);
+    }
+    
+    
+    
+    
 }

+ 20 - 0
src/main/java/com/ssj/service/sys/analysis/service/AnalysisCountService.java

@@ -0,0 +1,20 @@
+package com.ssj.service.sys.analysis.service;
+
+import java.util.Map;
+
+import com.ssj.bean.sys.analysis.bean.AnalysisCount;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface AnalysisCountService extends BaseService<AnalysisCount, String> {
+	
+	public void runTaskAnalysisCount();
+	
+	public AnalysisCount getAnalysisCountByDay(String libId,Integer source,Integer type,String dayTime);
+	
+	public Map<String, Object> countAnalysisCountCommonByCountDate(Map<String, Object> params);
+	
+	public Map<String, Object> countRecallCommonByCountDate(Map<String, Object> params);
+	
+	public Map<String, Object> countUploadWorkCommonByCountDate(Map<String, Object> params);
+	
+}

+ 35 - 38
src/main/java/com/ssj/service/sys/analysis/service/AnalysisService.java

@@ -1,38 +1,35 @@
-package com.ssj.service.sys.analysis.service;
-
-import com.ssj.bean.sys.analysis.bean.Analysis;
-import com.ssj.framework.core.common.service.BaseService;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-import java.util.List;
-import java.util.Map;
-
-public interface AnalysisService extends BaseService<Analysis, String> {
-	
-	public boolean save(String libId,String userId,String vipId,Integer source,Integer type);
-
-	public Long countLibJoinConsumeSumByLibService(String date);
-	
-	public Long countFxMerchantSumByPortNum();
-	
-	public List<Map<String,Object>> countFxMerchantSumByTop(String date);
-	
-	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantHomeworkByDay(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantHomeworkByVipDay(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByCountUserDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable);
-	
-	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable);
-	
-	
-}
+package com.ssj.service.sys.analysis.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.ssj.bean.sys.analysis.bean.Analysis;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface AnalysisService extends BaseService<Analysis, String> {
+	
+	public boolean save(String libId,String userId,String vipId,Integer source,Integer type);
+	
+	public Analysis getAnalysisByDay(String libId,String userId,String vipId,Integer source,Integer type,String dayTime);
+
+	public Long countLibJoinConsumeSumByLibService(String date);
+	
+	public Long countFxMerchantSumByPortNum();
+	
+	public List<Map<String,Object>> countFxMerchantSumByTop(String date);
+	
+	public Page<Map<String, Object>> countFxMerchantServiceByDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantCommonByCountDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable);
+	
+	public Page<Map<String, Object>> countFxMerchantCommonByUserDate(Map<String, Object> params, Pageable pageable);
+	
+	
+}

+ 20 - 0
src/main/java/com/ssj/service/sys/analysis/service/AnalysisWeekService.java

@@ -0,0 +1,20 @@
+package com.ssj.service.sys.analysis.service;
+
+import java.util.Map;
+
+import com.ssj.bean.sys.analysis.bean.AnalysisWeek;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface AnalysisWeekService extends BaseService<AnalysisWeek, String> {
+	
+	void runTaskByAnalysisWeek();
+	
+	public Map<String, Object> countAnalysisWeekCountCommonByCountCurDate(Map<String, Object> params);
+	
+	public Map<String, Object> countAnalysisWeekCountCommonByCountMonthDate(Map<String, Object> params);
+	
+	public Map<String, Object> countLibJoinCountCommonByCountDate(Map<String, Object> params);
+	
+	public Map<String, Object> countVipActivateCountCommonByCountDate(Map<String, Object> params);
+	
+}

+ 88 - 0
src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisCountServiceImpl.java

@@ -0,0 +1,88 @@
+package com.ssj.service.sys.analysis.service.impl;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.List;
+import java.util.Map;
+
+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.analysis.bean.AnalysisCount;
+import com.ssj.dao.sys.analysis.dao.AnalysisCountDao;
+import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.analysis.service.AnalysisCountService;
+
+@Service
+@Transactional
+public class AnalysisCountServiceImpl extends BaseServiceImpl<AnalysisCount, String> implements AnalysisCountService {
+
+    @Autowired
+    private AnalysisCountDao analysisCountDao;
+    
+    @Autowired
+    private AnalysisQueryDao analysisQueryDao;
+
+    @Override
+	public PagingAndSortingRepository<AnalysisCount, String> getDao() {
+		return analysisCountDao;
+	}
+
+    //0点定时任务,统计Analysis数据到AnalysisCount表
+	@Override
+	public void runTaskAnalysisCount() {
+		List<Map<String, Object>> list=analysisQueryDao.countAnalysisCountCommonByCountTask();
+		for (Map<String, Object> map : list) {
+			try {
+				String libId=map.get("lib_id").toString();
+				String dayTime=map.get("day_time").toString();
+				Integer source=map.get("source")!=null ? Integer.parseInt(map.get("source").toString()): 0;
+				Integer type=map.get("type")!=null ? Integer.parseInt(map.get("type").toString()): 0;
+				Integer count=map.get("count")!=null ? Integer.parseInt(map.get("count").toString()): 0;
+				
+				AnalysisCount analysisCount=this.getAnalysisCountByDay(libId, source, type, dayTime);
+				analysisCount.setCount(count);
+				this.save(analysisCount);
+			} catch (Exception e) {
+			}
+		}
+	}
+    
+    
+	@Override
+	public AnalysisCount getAnalysisCountByDay(String libId, Integer source, Integer type, String dayTime) {
+		AnalysisCount analysisCount=analysisCountDao.getAnalysisCountByDay(libId, source, type, dayTime);
+		if(analysisCount==null) {
+			analysisCount=new AnalysisCount();
+			analysisCount.setCount(0);
+			analysisCount.setLibId(libId);
+			analysisCount.setSource(source);
+			analysisCount.setType(type);
+			try {
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+				analysisCount.setDayTime(sdf.parse(dayTime));
+			} catch (ParseException e) {
+			}
+		}
+		return analysisCount;
+	}
+
+	@Override
+	public Map<String, Object> countAnalysisCountCommonByCountDate(Map<String, Object> params) {
+		return analysisQueryDao.countAnalysisCountCommonByCountDate(params);
+	}
+
+	@Override
+	public Map<String, Object> countRecallCommonByCountDate(Map<String, Object> params) {
+		return analysisQueryDao.countRecallCommonByCountDate(params);
+	}
+
+	@Override
+	public Map<String, Object> countUploadWorkCommonByCountDate(Map<String, Object> params) {
+		return analysisQueryDao.countUploadWorkCommonByCountDate(params);
+	}
+
+}

+ 30 - 31
src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisServiceImpl.java

@@ -1,14 +1,9 @@
 package com.ssj.service.sys.analysis.service.impl;
 
-import com.ssj.bean.sys.analysis.bean.Analysis;
-import com.ssj.bean.weixin.libmy.domain.LibVip;
-import com.ssj.bean.weixin.libmy.domain.TbLibManager;
-import com.ssj.dao.sys.analysis.dao.AnalysisDao;
-import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
-import com.ssj.framework.core.common.service.BaseServiceImpl;
-import com.ssj.service.sys.analysis.service.AnalysisService;
-import com.ssj.service.weixin.library.service.IBookManagerService;
-import com.ssj.service.weixin.library.service.ILibVipService;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -19,9 +14,15 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import com.ssj.bean.sys.analysis.bean.Analysis;
+import com.ssj.bean.weixin.libmy.domain.LibVip;
+import com.ssj.bean.weixin.libmy.domain.TbLibManager;
+import com.ssj.dao.sys.analysis.dao.AnalysisDao;
+import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.analysis.service.AnalysisService;
+import com.ssj.service.weixin.library.service.IBookManagerService;
+import com.ssj.service.weixin.library.service.ILibVipService;
 
 @Service
 @Transactional
@@ -40,7 +41,7 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
     
     @Autowired
     private IBookManagerService managerService;
-
+    
     @Override
 	public PagingAndSortingRepository<Analysis, String> getDao() {
 		return analysisDao;
@@ -67,6 +68,14 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
 					}
 				}
 			}
+			//libId不能为空
+			if(StringUtils.isEmpty(libId)) {
+				return false;
+			}
+			//userId和vipId不能同时为空
+			if(StringUtils.isEmpty(userId) && StringUtils.isEmpty(vipId)) {
+				return false;
+			}
 			Analysis analysis=new Analysis();
 			analysis.setLibId(libId);
 			analysis.setUserId(userId);
@@ -77,7 +86,7 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
 			this.save(analysis);
 			return true;
 		} catch (Exception e) {
-			logger.info("saveAnalysis异常...");
+			logger.info("保存接口分析数据异常...");
 		}
 		return false;
 	}
@@ -98,11 +107,6 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
 	}
 
 	@Override
-	public Page<Map<String, Object>> countFxMerchantHomeworkByDay(Map<String, Object> params, Pageable pageable) {
-		return analysisQueryDao.countFxMerchantHomeworkByDay(params,pageable);
-	}
-	
-	@Override
 	public Page<Map<String, Object>> countFxMerchantServiceByVipDate(Map<String, Object> params, Pageable pageable) {
 		return analysisQueryDao.countFxMerchantServiceByVipDate(params, pageable);
 	}
@@ -113,21 +117,11 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
 	}
 
 	@Override
-	public Page<Map<String, Object>> countFxMerchantHomeworkByVipDay(Map<String, Object> params, Pageable pageable) {
-		return analysisQueryDao.countFxMerchantHomeworkByVipDay(params, pageable);
-	}
-
-	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByDate(Map<String, Object> params, Pageable pageable) {
-		return analysisQueryDao.countFxMerchantCommonByDate(params, pageable);
+	public Page<Map<String, Object>> countFxMerchantCommonByCountDate(Map<String, Object> params, Pageable pageable) {
+		return analysisQueryDao.countFxMerchantCommonByCountDate(params, pageable);
 	}
 	
 	@Override
-	public Page<Map<String, Object>> countFxMerchantCommonByCountUserDate(Map<String, Object> params, Pageable pageable) {
-		return analysisQueryDao.countFxMerchantCommonByCountUserDate(params, pageable);
-	}
-
-	@Override
 	public Page<Map<String, Object>> countFxMerchantCommonByVipDate(Map<String, Object> params, Pageable pageable) {
 		return analysisQueryDao.countFxMerchantCommonByVipDate(params, pageable);
 	}
@@ -137,6 +131,11 @@ public class AnalysisServiceImpl extends BaseServiceImpl<Analysis, String> imple
 		return analysisQueryDao.countFxMerchantCommonByUserDate(params, pageable);
 	}
 
+	@Override
+	public Analysis getAnalysisByDay(String libId, String userId, String vipId, Integer source, Integer type,String dayTime) {
+		return analysisQueryDao.getAnalysisByDay(libId, userId, vipId, source, type, dayTime);
+	}
+
 
 	
  

+ 104 - 0
src/main/java/com/ssj/service/sys/analysis/service/impl/AnalysisWeekServiceImpl.java

@@ -0,0 +1,104 @@
+package com.ssj.service.sys.analysis.service.impl;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.ssj.bean.sys.analysis.bean.AnalysisWeek;
+import com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.dao.sys.analysis.dao.AnalysisQueryDao;
+import com.ssj.dao.sys.analysis.dao.AnalysisWeekDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.analysis.service.AnalysisWeekService;
+import com.ssj.service.sys.fx.service.MerchantService;
+import com.ssj.service.weixin.library.service.ILibJoinService;
+
+@Service
+@Transactional
+public class AnalysisWeekServiceImpl extends BaseServiceImpl<AnalysisWeek, String> implements AnalysisWeekService {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+    @Autowired
+    private AnalysisWeekDao analysisWeekDao;
+
+    @Autowired
+    private AnalysisQueryDao analysisQueryDao;
+    
+    @Autowired
+    private MerchantService merchantService;
+    
+    @Autowired
+    private ILibJoinService libJoinService;
+    
+    @Override
+	public PagingAndSortingRepository<AnalysisWeek, String> getDao() {
+		return analysisWeekDao;
+	}
+
+	@Override
+	public void runTaskByAnalysisWeek() {
+		List<Merchant> merchants=merchantService.findMerchantByType(new int[] {1});
+		for (Merchant merchant : merchants) {
+			if(StringUtils.isEmpty(merchant.getLibId())) {
+				continue;
+			}
+			String libId=merchant.getLibId();
+			
+			Map<String, Object> params=new HashMap<String, Object>();
+			params.put("libId", libId);
+			Integer activeNum=analysisQueryDao.countActiveNumCommonByLibCountWeek(params);
+			Integer memberNum=analysisQueryDao.countMemberNumCommonByLibCountWeek(params);
+			Integer activeRatio=(memberNum!=0 ? activeNum*100/memberNum : 0);
+			
+			AnalysisWeek analysisWeek=analysisWeekDao.getAnalysisWeekByCurWeek(libId);
+			if(analysisWeek==null) {
+				analysisWeekDao.saveAnalysisWeek(libId, memberNum, activeNum, activeRatio);
+			}else {
+				analysisWeek.setActiveNum(activeNum);
+				analysisWeek.setMemberNum(memberNum);
+				analysisWeek.setActiveRatio(activeRatio);
+				analysisWeek.setUpdateTime(new Date());
+				this.save(analysisWeek);
+			}
+		}
+	}
+
+	@Override
+	public Map<String, Object> countAnalysisWeekCountCommonByCountCurDate(Map<String, Object> params) {
+		return analysisQueryDao.countAnalysisWeekCountCommonByCountCurDate(params);
+	}
+
+	@Override
+	public Map<String, Object> countAnalysisWeekCountCommonByCountMonthDate(Map<String, Object> params) {
+		Map<String, Object> map=new HashMap<String, Object>();
+		List<Map<String, Object>> list= analysisQueryDao.countAnalysisWeekCountCommonByCountMonthDate(params);
+		map.put("count_0", list!=null?list.size():0);
+		map.put("count_1", merchantService.findMerchantByType(new int[] {1}).size());
+		return map;
+	}
+
+	@Override
+	public Map<String, Object> countLibJoinCountCommonByCountDate(Map<String, Object> params) {
+		Map<String, Object> map=new HashMap<String, Object>();
+		List<Map<String, Object>> list= analysisQueryDao.countLibJoinCountCommonByCountDate(params);
+		map.put("count_0", list!=null?list.size():0);
+		map.put("count_1", libJoinService.findAll().size());
+		return map;
+	}
+
+	@Override
+	public Map<String, Object> countVipActivateCountCommonByCountDate(Map<String, Object> params) {
+		return analysisQueryDao.countVipActivateCountCommonByCountDate(params);
+	}
+
+}

+ 12 - 4
src/main/java/com/ssj/service/sys/fx/service/MerchantService.java

@@ -1,12 +1,14 @@
 package com.ssj.service.sys.fx.service;
 
-import com.ssj.bean.sys.fx.domain.Merchant;
-import com.ssj.framework.core.common.service.BaseService;
+import java.util.List;
+import java.util.Map;
+
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
-import java.util.List;
-import java.util.Map;
+import com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.bean.sys.fx.domain.MerchantSign;
+import com.ssj.framework.core.common.service.BaseService;
 
 public interface MerchantService extends BaseService<Merchant, String> {
 	
@@ -121,6 +123,12 @@ public interface MerchantService extends BaseService<Merchant, String> {
 	//通过vipId查出这个绑定机构对应的商户,两个月内绑定的商户
 	Merchant getDefaultMerchantByVipId(String vipId);
 	
+	
+	public List<Merchant> findMerchantByType(int[] type);
+	
+	//套餐过期的商户
+	List<Merchant> findMerchantSignByEndTime();
+	
 
 
 }

+ 30 - 0
src/main/java/com/ssj/service/sys/fx/service/MerchantSignService.java

@@ -0,0 +1,30 @@
+package com.ssj.service.sys.fx.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.bean.sys.fx.domain.MerchantSign;
+import com.ssj.framework.core.common.service.BaseService;
+
+public interface MerchantSignService extends BaseService<MerchantSign, String> {
+	
+	//fx_merchant_sign和加油包过期的定时任务。
+	void runMerchantSignByEndTime();
+
+	//同步套餐人数,商户表 -> 机构表。
+	void syncMerchantByLibJoin(Merchant merchant);
+	
+	//开通套餐加油包,添加数据到MerchantSign,增量Merchant,同步套餐人数机构表
+	void insertMerchantSignAndSync(String merchantId,Integer signType,Integer num);
+	
+	//查出商户有效的加油包
+	List<MerchantSign> findMerchantSignByMerchantId(String merchantId,Integer status);
+	
+	//加油包明细列表
+	Page<Map<String, Object>> findMerchantSignByPage(Map<String, Object> params, Pageable initPage);
+
+}

+ 34 - 14
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantServiceImpl.java

@@ -1,5 +1,26 @@
 package com.ssj.service.sys.fx.service.impl;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+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.jpa.domain.Specification;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ssj.bean.sys.fx.domain.Merchant;
 import com.ssj.bean.sys.organization.domain.Organization;
 import com.ssj.bean.sys.role.domain.Admin;
@@ -29,20 +50,6 @@ import com.ssj.service.weixin.library.service.ILibVipService;
 import com.ssj.service.weixin.push.service.PushTemplateService;
 import com.ssj.service.weixin.sales.service.LibVipServiceService;
 import com.ssj.taskthread.ThreadPool;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateUtils;
-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.jpa.domain.Specification;
-import org.springframework.data.repository.PagingAndSortingRepository;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.math.BigDecimal;
-import java.util.*;
 
 
 @Service
@@ -810,6 +817,9 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 		}
 		for (Merchant merchant : merchants) {
 			
+			if(merchant.getSignType()!=0) {
+				continue;
+			}
 			//没有签约时间的,不进行结算
 			if(merchant.getNextSummaryTime()==null) {
 				continue;
@@ -1187,6 +1197,16 @@ public class MerchantServiceImpl extends BaseServiceImpl<Merchant, String> imple
 		}
 		return null;
 	}
+
+	@Override
+	public List<Merchant> findMerchantByType(int[] type) {
+		return dao.findMerchantByType(type);
+	}
+
+	@Override
+	public List<Merchant> findMerchantSignByEndTime() {
+		return dao.findMerchantSignByEndTime();
+	}
 	
 
 }

+ 182 - 0
src/main/java/com/ssj/service/sys/fx/service/impl/MerchantSignServiceImpl.java

@@ -0,0 +1,182 @@
+package com.ssj.service.sys.fx.service.impl;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+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 com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.bean.sys.fx.domain.MerchantSign;
+import com.ssj.bean.weixin.libmy.domain.LibVip;
+import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
+import com.ssj.dao.sys.fx.dao.FxQueryDao;
+import com.ssj.dao.sys.fx.dao.MerchantSignDao;
+import com.ssj.framework.core.common.service.BaseServiceImpl;
+import com.ssj.service.sys.fx.service.MerchantService;
+import com.ssj.service.sys.fx.service.MerchantSignService;
+import com.ssj.service.weixin.library.service.ILibJoinService;
+import com.ssj.service.weixin.library.service.ILibVipService;
+
+
+@Service
+public class MerchantSignServiceImpl extends BaseServiceImpl<MerchantSign, String> implements MerchantSignService {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+	@Autowired
+	private MerchantSignDao dao;
+	
+    @Autowired
+    private FxQueryDao queryDao;
+	
+	@Autowired
+	private MerchantService merchantService;
+	
+	@Autowired
+	private ILibJoinService libJoinService;
+	
+	@Autowired
+	private ILibVipService libVipService;
+	
+    @Override
+    public PagingAndSortingRepository<MerchantSign, String> getDao() {
+        return dao;
+    }
+
+    //12点定时任务,处理套餐的数据
+    //1:处理加油包过期的数据
+    //2:处理商户主套餐过期的数据,加油包全过期。
+    @Override
+	public void runMerchantSignByEndTime() {
+    	//1:处理加油包过期的数据
+		List<MerchantSign> merchantSigns=dao.findMerchantSignByEndTime();
+		for (MerchantSign merchantSign : merchantSigns) {
+			try {
+				merchantSign.setRemarks("加油包过期");
+				merchantSign.setStatus(1);
+				merchantSign.setUpdateTime(new Date());
+				this.save(merchantSign);
+				
+				Merchant merchant = merchantService.getById(merchantSign.getMerchantId());
+				merchant.setLibService(merchant.getLibService()-merchantSign.getLibService());
+				merchantService.save(merchant);
+	
+				//同步商户表与机构表
+				this.syncMerchantByLibJoin(merchant);
+				
+				//如果加油包过期后,现有的学生大于商户的套餐人数, 就全部学生停止服务。
+				if(StringUtils.isNotEmpty(merchant.getLibId())) {
+					List<LibVip> libVips=libVipService.findByLibId(merchant.getLibId());
+					if(libVips.size()>merchant.getLibService()) {
+						//这里需要调用灿哥的代码。
+						
+					}
+				}
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		
+		
+		//2:处理商户主套餐过期的数据
+		List<Merchant> merchants=merchantService.findMerchantSignByEndTime();
+		for (Merchant merchant : merchants) {
+			try {
+				List<MerchantSign> signs=this.findMerchantSignByMerchantId(merchant.getId(), 0);
+				for (MerchantSign merchantSign : signs) {
+					merchantSign.setRemarks("主套餐过期引起加油包过期");
+					merchantSign.setStatus(1);
+					merchantSign.setUpdateTime(new Date());
+					this.save(merchantSign);
+				}
+				
+				merchant.setSignTime(null);
+				merchant.setEndSignTime(null);
+				merchant.setLibService(0);
+				merchantService.save(merchant);
+				
+				this.syncMerchantByLibJoin(merchant);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+			
+		}
+	}
+    
+    
+	//套餐模式 【1优选套餐 2VIP套餐 3尊享套餐】 4加油包月包+月 5加油包量包+量。
+	//现在暂时只记录加油的记录。
+	@Override
+	public void insertMerchantSignAndSync(String merchantId, Integer signType,Integer num) {
+		Merchant merchant = merchantService.getById(merchantId);
+		MerchantSign merchantSign=new MerchantSign();
+		merchantSign.setMerchantId(merchantId);
+		merchantSign.setSignType(signType);
+		merchantSign.setNum(num);
+		merchantSign.setStatus(0);
+		merchantSign.setCreateTime(new Date());
+		
+		Calendar cal = Calendar.getInstance();
+		cal.setTime(merchant.getSignTime());
+		switch (signType) {
+		case 4:
+			cal.add(Calendar.MONTH, num);
+			
+			merchantSign.setLibService(10);
+			merchantSign.setSignTime(merchant.getSignTime());
+			merchantSign.setEndSignTime(cal.getTime());
+			break;
+		case 5:
+			cal.add(Calendar.MONTH, 1);
+			
+			merchantSign.setLibService(10*num);
+			merchantSign.setSignTime(merchant.getSignTime());
+			merchantSign.setEndSignTime(cal.getTime());
+			break;
+		default:
+			break;
+		}
+		//保存加油包的记录
+		this.save(merchantSign);
+		
+		//增量商户表的人数
+		merchant.setLibService(merchant.getLibService()+merchantSign.getLibService());
+		merchantService.save(merchant);	
+		
+		//同步商户表与机构表
+		this.syncMerchantByLibJoin(merchant);
+	}
+
+	
+	@Override
+	public void syncMerchantByLibJoin(Merchant merchant) {
+		if(merchant!=null && StringUtils.isNotEmpty(merchant.getLibId())) {
+			TbLibJoin libJoin = libJoinService.getById(merchant.getLibId());
+			libJoin.setLibService(merchant.getLibService());
+			libJoinService.save(libJoin);
+		}
+	}
+
+	@Override
+	public List<MerchantSign> findMerchantSignByMerchantId(String merchantId, Integer status) {
+		return dao.findMerchantSignByMerchantId(merchantId, status);
+	}
+
+	@Override
+	public Page<Map<String, Object>> findMerchantSignByPage(Map<String, Object> params, Pageable initPage) {
+		return queryDao.findMerchantSignByPage(params, initPage);
+	}
+	
+
+}
+
+

文件差异内容过多而无法显示
+ 740 - 79
src/main/java/com/ssj/sys/controller/AnalysisController.java


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

@@ -1,9 +1,58 @@
 package com.ssj.sys.controller;
 
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFFont;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort.Direction;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+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 org.springframework.web.multipart.MultipartHttpServletRequest;
+
 import com.ssj.bean.common.files.domain.FileInfo;
 import com.ssj.bean.common.framework.core.domain.Response;
 import com.ssj.bean.conch.conch.domain.ConchDerver;
-import com.ssj.bean.sys.fx.domain.*;
+import com.ssj.bean.sys.fx.domain.Device;
+import com.ssj.bean.sys.fx.domain.DeviceAct;
+import com.ssj.bean.sys.fx.domain.DeviceParts;
+import com.ssj.bean.sys.fx.domain.DevicePartsAct;
+import com.ssj.bean.sys.fx.domain.Merchant;
+import com.ssj.bean.sys.fx.domain.MerchantArea;
+import com.ssj.bean.sys.fx.domain.MerchantSign;
 import com.ssj.bean.sys.organization.domain.Organization;
 import com.ssj.bean.sys.role.domain.Admin;
 import com.ssj.bean.weixin.libmy.domain.TbLibJoin;
@@ -19,7 +68,14 @@ import com.ssj.framework.files.service.FileInfoService;
 import com.ssj.framework.idworker.IdWorker;
 import com.ssj.service.conch.conch.service.ConchDerverService;
 import com.ssj.service.conch.parents.v1.dto.PositionSchoolV1Dto;
-import com.ssj.service.sys.fx.service.*;
+import com.ssj.service.sys.fx.service.DeviceActService;
+import com.ssj.service.sys.fx.service.DevicePartsActService;
+import com.ssj.service.sys.fx.service.DevicePartsService;
+import com.ssj.service.sys.fx.service.DeviceSalesService;
+import com.ssj.service.sys.fx.service.DeviceService;
+import com.ssj.service.sys.fx.service.MerchantAreaService;
+import com.ssj.service.sys.fx.service.MerchantService;
+import com.ssj.service.sys.fx.service.MerchantSignService;
 import com.ssj.service.sys.organization.service.OrganizationService;
 import com.ssj.service.sys.role.service.AdminService;
 import com.ssj.service.sys.role.service.RoleService;
@@ -29,31 +85,6 @@ import com.ssj.service.weixin.problem.service.CnAreaService;
 import com.ssj.sys.util.thirdparty.excel.CustomizeToExcel;
 import com.ssj.sys.util.thirdparty.excel.ExcelColumn;
 import com.ssj.sys.utils.ExcelUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.xssf.usermodel.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Sort.Direction;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.util.*;
 
 @RequestMapping("sys/fx")
 @Controller
@@ -72,6 +103,9 @@ public class FxController  extends BaseController {
 	private MerchantService merchantService;
 	
 	@Autowired
+	private MerchantSignService merchantSignService;
+	
+	@Autowired
 	private ConchDerverService conchDerverService;
 	
 	@Autowired
@@ -104,8 +138,6 @@ public class FxController  extends BaseController {
 	@Autowired
 	private MerchantAreaService merchantAreaService;
 
-
-	
 	
 	
 	
@@ -399,6 +431,95 @@ public class FxController  extends BaseController {
     }
 	
 	
+	
+	@RequestMapping("/merchantSignList")
+    public String merchantSignList(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("merchantId", request.getParameter("merchantId")==null?"":request.getParameter("merchantId"));
+        params.put("signType", request.getParameter("signType")==null?"":request.getParameter("signType"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<Map<String, Object>> page = merchantSignService.findMerchantSignByPage(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);
+        List<Merchant> list=merchantService.findMerchantByPage();
+		model.addAttribute("poslist", list);
+        return "sys/fx/merchantSignList";
+    }
+	
+	
+	
+	@RequestMapping(value = "/exportMerchantSignList", method = RequestMethod.POST)
+    @ResponseBody
+    public void exportMerchantSignList( HttpServletRequest request, HttpServletResponse response) {  
+    	ServletOutputStream os = null;
+    	try { 
+    		String libName="加油包明细";
+    		os = response.getOutputStream(); //获得输出流  
+    		response.reset();   //清空输出流  
+    		String fileName = new String(libName.getBytes("gb2312"), "ISO8859-1") +".xlsx";  
+    		response.setHeader("Content-disposition", "attachment; filename="+ fileName); //设定输出文件头  
+    		response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+    		response.setCharacterEncoding("utf-8");
+    		
+    		Map<String, Object> params = new HashMap<String, Object>();
+		  	params.put("merchantId", request.getParameter("merchantId")==null?"":request.getParameter("merchantId"));
+	        params.put("signType", request.getParameter("signType")==null?"":request.getParameter("signType"));
+	        Page<Map<String, Object>> page = merchantSignService.findMerchantSignByPage(params, initPage(1, 10000));
+            
+	        List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
+	        for (Map<String, Object> map : page.getContent()) {
+	        	if(map.get("sign_type").toString().equals("4")) {
+	        		map.put("sign_type","加油包-月包");
+	        	}else 	if(map.get("sign_type").toString().equals("5")) {
+	        		map.put("sign_type","加油包-量包");
+	        	}
+	        	if(map.get("status").toString().equals("0")) {
+	        		map.put("status","服务中");
+	        	}else 	if(map.get("status").toString().equals("1")) {
+	        		map.put("status","已结束");
+	        	}
+	     	}
+    		List<ExcelColumn> myColumns3 = new ArrayList<ExcelColumn>();
+    		myColumns3.add(new ExcelColumn("商户", "pos_code", 20));
+    		myColumns3.add(new ExcelColumn("商户名称", "unit_name", 20));
+    		myColumns3.add(new ExcelColumn("加油包类型", "sign_type", 20));
+    		myColumns3.add(new ExcelColumn("加油包数量", "num", 20));
+    		myColumns3.add(new ExcelColumn("套餐总人数", "lib_service", 20));
+    		myColumns3.add(new ExcelColumn("开始时间", "sign_time", 20));
+    		myColumns3.add(new ExcelColumn("结束时间", "end_sign_time", 20));
+    		myColumns3.add(new ExcelColumn("是否服务", "status", 20));
+    		myColumns3.add(new ExcelColumn("添加时间", "create_time", 20));
+    		myColumns3.add(new ExcelColumn("备注", "remarks", 20));
+    		
+			CustomizeToExcel.downFile(myColumns3, objectToPartsMap(list), os);
+    	}catch (IOException e) {  
+    		e.printStackTrace();  
+    	}catch (Exception e1){
+    		e1.printStackTrace();
+    	}finally{
+    		if(os != null){
+    			try {
+    				os.flush();
+    				os.close(); 
+    			} catch (IOException e) {
+    				e.printStackTrace();
+    			}  
+    		}
+    	}
+    }  
+	
+	
+	
 	@RequestMapping("/partsAllList")
     public String partsAllList(Model model,
             @RequestParam(required = false, defaultValue = "100") int pageSize,
@@ -911,13 +1032,12 @@ public class FxController  extends BaseController {
 			for (String i : ids) {
 				try {
 					Device device=deviceService.getById(i);
-					Merchant merchant=merchantService.getById(device.getMerchantId());
-					if(merchant!=null && StringUtils.isNotEmpty(merchant.getParentPosCode())){
-						Merchant pmerchant=merchantService.getMerchantByPosCode(merchant.getParentPosCode());
-						
-						DeviceAct deviceAct=null;
-						if(3==status){
-							deviceAct=new DeviceAct();
+					if(3==status){
+						Merchant merchant=merchantService.getById(device.getMerchantId());
+						if(merchant!=null && StringUtils.isNotEmpty(merchant.getParentPosCode())){
+							Merchant pmerchant=merchantService.getMerchantByPosCode(merchant.getParentPosCode());
+							
+							DeviceAct deviceAct=new DeviceAct();
 							deviceAct.setFromMerchantId(device.getMerchantId());
 							deviceAct.setToMerchantId(pmerchant.getId());
 							deviceAct.setOperatorAdminId(admin.getId());
@@ -953,18 +1073,22 @@ public class FxController  extends BaseController {
 							deviceAct.setType(4);
 							deviceActService.save(deviceAct);
 							device.setIsUsed(1);//标识为二手
-						}
-						
-						device.setDeviceAct(deviceAct);
-						
-						device.setLastMerchantId(device.getMerchantId());
-						device.setMerchantId(pmerchant.getId());
-						device.setPosCode(pmerchant.getPosCode());
-						device.setOrgCode(pmerchant.getOrgCode());
+							
+							device.setDeviceAct(deviceAct);
+							
+							device.setLastMerchantId(device.getMerchantId());
+							device.setMerchantId(pmerchant.getId());
+							device.setPosCode(pmerchant.getPosCode());
+							device.setOrgCode(pmerchant.getOrgCode());
+							device.setUpdateTime(new Date());
+							device.setStatus(status);
+							deviceService.save(device);
+						}	
+					}else {
 						device.setUpdateTime(new Date());
 						device.setStatus(status);
 						deviceService.save(device);
-					}	
+					}
 					successNum=successNum+1;
 				} catch (Exception e) {
 				}
@@ -1094,6 +1218,22 @@ public class FxController  extends BaseController {
 	
 
 	
+	@RequestMapping(value="/merchant/updateMeal/{id}")
+	@ResponseBody
+	public Response updateMeal(Model model,@PathVariable String id,Integer num,Integer type) {
+		Response response = new  Response();
+		if(num<=0) {
+			response.failure("添加的加油包不能少于1");
+			return response;
+		}
+		Merchant merchant=merchantService.getById(id);
+		if(merchant!=null) {
+			merchantSignService.insertMerchantSignAndSync(id, type, num);
+		}
+		response.success("操作成功");
+		return response;
+	}	
+	
 	
 	
 	
@@ -1203,7 +1343,9 @@ public class FxController  extends BaseController {
 		HttpSession session = request.getSession();
 		Admin curadmin =(Admin) session.getAttribute("admin");
 		Response response = new  Response();
+		
 		if(StringUtils.isNotEmpty(merchant.getId())){
+			
 			Merchant oldmerchant =merchantService.getById(merchant.getId());
 			if(StringUtils.isNotEmpty(merchant.getLibId())) {
 				Merchant libMerchant=merchantService.getMerchantByLibId(merchant.getLibId());
@@ -1227,27 +1369,14 @@ public class FxController  extends BaseController {
 			oldmerchant.setHardwareService(merchant.getHardwareService());
 			oldmerchant.setHardwarePrice(merchant.getHardwarePrice());
 			oldmerchant.setAddress(merchant.getAddress());
-
-			if(StringUtils.isNotEmpty(location)) {
-				oldmerchant.setLocation(location);
-			}
-			
-			if(StringUtils.isNotEmpty(merchant.getLibId())) {
-				oldmerchant.setLibId(merchant.getLibId());
-				
-				TbLibJoin  libJoin= libJoinService.getById(merchant.getLibId());
-				if(libJoin!=null) {
-					libJoin.setLibService(oldmerchant.getLibService());
-					libJoin.setPlatformService(oldmerchant.getPlatformService());
-					libJoinService.save(libJoin);
-				}	
-			}
+			oldmerchant.setLocation(location);
 			
+			//删除所有关联的学校
 			List<MerchantArea> merchantAreas=merchantAreaService.findSchoolByMerchantList(merchant.getId());
 			for (MerchantArea merchantArea : merchantAreas) {
 				merchantAreaService.delete(merchantArea);
 			}
-			
+			//重新关联学校
 			if(StringUtils.isNotEmpty(schoollist)) {
 				merchantAreas=new ArrayList<MerchantArea>();
 				String[] areaIds=schoollist.split(";");
@@ -1262,20 +1391,66 @@ public class FxController  extends BaseController {
 				merchantAreaService.save(merchantAreas);
 			}
 			
-			//修改了签约的时间,重新计算结算时间
-			if(oldmerchant.getSignTime()==null || DateHelper.parseDate(startTime, "yyyy-MM-dd").getTime()!=oldmerchant.getSignTime().getTime()) {
+			//如果修改了套餐的模式,就重新处理数据,清理加油包
+			if(oldmerchant.getSignType()!=merchant.getSignType()) {
+				oldmerchant.setSignType(merchant.getSignType());
+				List<MerchantSign> merchantSigns=merchantSignService.findMerchantSignByMerchantId(merchant.getId(),0);
+				Integer signNum=0;
+				for (MerchantSign merchantSign : merchantSigns) {
+					signNum=signNum+merchantSign.getLibService();
+				}
+				switch (merchant.getSignType()) {
+				case 1:
+					oldmerchant.setLibService(30+signNum);
+					break;
+				case 2:
+					oldmerchant.setLibService(50+signNum);
+					break;
+				case 3:
+					oldmerchant.setLibService(100+signNum);
+					break;
+				default:
+					oldmerchant.setLibService(0);
+					break;
+				}
+
+			}
+			
+			//判断的是否是旧模式兼容,修改了签约的时间,重新计算结算时间
+			if(merchant.getSignType()==0) {
+				if(oldmerchant.getSignTime()==null || DateHelper.parseDate(startTime, "yyyy-MM-dd").getTime()!=oldmerchant.getSignTime().getTime()) {
+					oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
+					oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
+					//如果是总部直签的商户,才会更新结算日期,同时更新所有下级的结算日期
+					if("ssj001".equals(oldmerchant.getParentPosCode())) {
+						oldmerchant.setCurSummaryTime(oldmerchant.getSignTime());
+						oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),3));
+						//计算结算日期。
+						merchantService.updateSubMerchantSummaryTime(oldmerchant);
+					}
+				}
+			}else {
 				oldmerchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
 				oldmerchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
-				
-				//如果是总部直签的商户,才会更新结算日期,同时更新所有下级的结算日期
-				if("ssj001".equals(oldmerchant.getParentPosCode())) {
-					oldmerchant.setCurSummaryTime(oldmerchant.getSignTime());
-					oldmerchant.setNextSummaryTime(DateHelper.getMonthDate(oldmerchant.getCurSummaryTime(),3));
+				oldmerchant.setCurSummaryTime(null);
+				oldmerchant.setNextSummaryTime(null);
+			}
+			
+			//商户同步学币/人数 到机构 / 时间
+			if(StringUtils.isNotEmpty(merchant.getLibId())) {
+				oldmerchant.setLibId(merchant.getLibId());
+				TbLibJoin  libJoin= libJoinService.getById(oldmerchant.getLibId());
+				if(libJoin!=null) {
+					libJoin.setLibService(oldmerchant.getLibService());
+					libJoin.setPlatformService(oldmerchant.getPlatformService());
 					
-					//计算结算日期。
-					merchantService.updateSubMerchantSummaryTime(oldmerchant);
-				}
+					libJoin.setSignType(oldmerchant.getSignType());
+					libJoin.setSignTime(oldmerchant.getSignTime());
+					libJoin.setEndSignTime(oldmerchant.getEndSignTime());
+					libJoinService.save(libJoin);
+				}	
 			}
+			
 			merchantService.save(oldmerchant);
 			merchantService.syncRecordByMerchant(curadmin.getLoginName(), oldmerchant.getId(),WebUtil.getRemoteAddr(request), "修改商户");
 		}else{
@@ -1296,25 +1471,30 @@ public class FxController  extends BaseController {
 				response.failure("商户账号已存在");
 		        return response;
 			}
-			
 			merchant.setLocation(location);
-			merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
-			merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
 			merchant.setPortNum(0);
 			merchant.setLibService(0);
 			merchant.setPlatformService(0);
 			merchant.setHardwareService(0);
 			merchant.setHardwarePrice((double)0);
 			
-			//商户同步学币到机构
-			if(StringUtils.isNotEmpty(merchant.getLibId())) {
-				TbLibJoin  libJoin= libJoinService.getById(merchant.getLibId());
-				if(libJoin!=null) {
-					libJoin.setLibService(0);
-					libJoin.setPlatformService(0);
-					libJoinService.save(libJoin);
-				}	
+			merchant.setSignTime(DateHelper.parseDate(startTime, "yyyy-MM-dd"));
+			merchant.setEndSignTime(DateHelper.parseDate(endTime, "yyyy-MM-dd"));
+			switch (merchant.getSignType()) {
+			case 1:
+				merchant.setLibService(30);
+				break;
+			case 2:
+				merchant.setLibService(50);
+				break;
+			case 3:
+				merchant.setLibService(100);
+				break;
+			default:
+				merchant.setLibService(0);
+				break;
 			}
+			
 			adminService.saveFXAdmin(merchant, password, curadmin.getLoginName(), province, city, area,schoollist,WebUtil.getRemoteAddr(request));
 		}
 		response.success("成功");
@@ -1337,6 +1517,9 @@ public class FxController  extends BaseController {
 					TbLibJoin libJoin=libJoinService.getById(merchant.getLibId());
 					libJoin.setLibService(0);
 					libJoin.setPlatformService(0);
+					libJoin.setSignType(0);
+					libJoin.setSignTime(null);
+					libJoin.setEndSignTime(null);
 					libJoinService.save(libJoin);
 				}
 				merchant.setLibId(null);

+ 1 - 1
src/main/resources/templates/sys/analysis/balance.html

@@ -104,7 +104,7 @@
 <script type="text/javascript">
 $(function () {
 	$("#button").on('click',function(){
-		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/exportBalance.html";
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/balance/export.html";
 		$("#seachform").submit();
 		window.setTimeout(function(){
 			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/balance.html";

+ 12 - 8
src/main/resources/templates/sys/analysis/balance_vip.html

@@ -48,6 +48,7 @@
 				<input type="hidden" name="date" id="date" th:value="${search.date}">
 				
 				<input type="button" class="scbtn" value="查询" />
+				<input type="button" id="button" class="scbtn" value="导出" />
 			</li>
 			
 			<li>
@@ -63,7 +64,7 @@
 		<thead>
 		    <tr>
 		    	<th >序号</th>
-		    	<th >VIPID</th>
+		    	<th >vipId</th>
 		    	<th >微信昵称 </th>
 		    	<th >微信头像</th>
 		    	<th >家长姓名</th>
@@ -97,11 +98,14 @@
 </body>
 
 <script type="text/javascript">
-	$(function () {
-		
-		
-	
-	})
-	</script>
-
+$(function () {
+	$("#button").on('click',function(){
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/balance/vip/export.html";
+		$("#seachform").submit();
+		window.setTimeout(function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/balance/vip.html";
+		},3000);
+	});
+})
+</script>
 </html>

+ 27 - 3
src/main/resources/templates/sys/analysis/parent.html

@@ -42,11 +42,11 @@
 	<ul class="seachform">
 			<li>
 			 <label>开始日期</label>
-			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 		   	<li>
 			 <label>结束日期</label>
-			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 			<li>
 			 <label>商户名称</label>
@@ -67,6 +67,10 @@
 		    	<th >作业任务</th>
 		    	<th >错题本</th>
 		    	<th >成长报告 </th>
+		        <th >成长报告·周报</th>
+		        <th >成长报告·月报</th>
+		    	<th >成长报告·学期</th>
+		    	<th >定制练习</th>			
 		    </tr> 
 		</thead>
 		<tbody>
@@ -88,6 +92,26 @@
 						[[${item.get('count_2')}]]
 					</a>
 				</td>
+				<td >
+					<a th:href="@{/sys/analysis/parent/info/15.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='成长报告·周报')}">
+						[[${item.get('count_3')}]]
+					</a>
+				</td>
+				<td >
+					<a th:href="@{/sys/analysis/parent/info/16.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='成长报告·月报')}">
+						[[${item.get('count_4')}]]
+					</a>
+				</td>
+				<td >
+					<a th:href="@{/sys/analysis/parent/info/17.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='成长报告·学期')}">
+						[[${item.get('count_5')}]]
+					</a>
+				</td>
+				<td >
+					<a th:href="@{/sys/analysis/parent/info/18.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='定制练习')}">
+						[[${item.get('count_6')}]]
+					</a>
+				</td>
 			</tr>
 		</tbody>
 	</table>
@@ -103,7 +127,7 @@
 <script type="text/javascript">
 $(function () {
 	$("#button").on('click',function(){
-		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/exportParent.html";
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/parent/export.html";
 		$("#seachform").submit();
 		window.setTimeout(function(){
 			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/parent.html";

+ 12 - 8
src/main/resources/templates/sys/analysis/parent_info.html

@@ -34,7 +34,7 @@
 	</ul>
 </div>
 <div class="rightinfo">
-	<form id="seachform" th:action="@{/sys/analysis/balance/vip.html}" method="post">
+	<form id="seachform" th:action="@{/sys/analysis/parent/info/${search.type}.html}" method="post">
 	<input type="hidden" name="pageSize" id="pageSize" value="10" />
 	<ul class="seachform">
 			<li>
@@ -48,6 +48,7 @@
 				<input type="hidden" name="date2" id="date2" th:value="${search.date2}">
 				
 				<input type="button" class="scbtn" value="查询" />
+				<input type="button" id="button" class="scbtn" value="导出" />
 			</li>
 			
 			<li>
@@ -95,11 +96,14 @@
 </body>
 
 <script type="text/javascript">
-	$(function () {
-		
-		
-	
-	})
-	</script>
-
+$(function () {
+	$("#button").on('click',function(){
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/parent/info/[[${search.type}]]/export.html?title=[[${param.title}]]";
+		$("#seachform").submit();
+		window.setTimeout(function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/parent/info/[[${search.type}]].html";
+		},3000);
+	});
+})
+</script>
 </html>

+ 3 - 3
src/main/resources/templates/sys/analysis/student.html

@@ -41,11 +41,11 @@
 	<ul class="seachform">
 			<li>
 			 <label>开始日期</label>
-			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 		   	<li>
 			 <label>结束日期</label>
-			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date2}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date2}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 			<li>
 			 <label>商户名称</label>
@@ -108,7 +108,7 @@
 <script type="text/javascript">
 	$(function () {
 		$("#button").on('click',function(){
-			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/exportStudent.html";
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/student/export.html";
 			$("#seachform").submit();
 			window.setTimeout(function(){
 				document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/student.html";

+ 12 - 7
src/main/resources/templates/sys/analysis/student_info.html

@@ -34,7 +34,7 @@
 	</ul>
 </div>
 <div class="rightinfo">
-	<form id="seachform" th:action="@{/sys/analysis/balance/vip.html}" method="post">
+	<form id="seachform" th:action="@{/sys/analysis/student/info/${search.type}.html}" method="post">
 	<input type="hidden" name="pageSize" id="pageSize" value="10" />
 	<ul class="seachform">
 			
@@ -49,6 +49,7 @@
 				<input type="hidden" name="date2" id="date2" th:value="${search.date2}">
 				
 				<input type="button" class="scbtn" value="查询" />
+				<input type="button" id="button" class="scbtn" value="导出" />
 			</li>
 			
 			<li>
@@ -96,11 +97,15 @@
 </body>
 
 <script type="text/javascript">
-	$(function () {
-		
-		
-	
-	})
-	</script>
+$(function () {
+	$("#button").on('click',function(){
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/student/info/[[${search.type}]]/export.html?title=[[${param.title}]]";
+		$("#seachform").submit();
+		window.setTimeout(function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/student/info/[[${search.type}]].html";
+		},3000);
+	});
+})
+</script>
 
 </html>

+ 9 - 9
src/main/resources/templates/sys/analysis/teacher.html

@@ -41,11 +41,11 @@
 	<ul class="seachform">
 			<li>
 			 <label>开始日期</label>
-			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date" name="date"  class="form-control scinput"  autocomplete="off"   th:value="${search.date}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 		   	<li>
 			 <label>结束日期</label>
-			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date2}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M'})">
+			  <input type="text" id="date2" name="date2"  class="form-control scinput"  autocomplete="off"   th:value="${search.date2}"  onclick="WdatePicker({dateFmt: 'yyyy-MM-dd',maxDate:'%y-%M-{%d-1}'})">
 		    </li>	
 			<li>
 			 <label>商户名称</label>
@@ -66,10 +66,10 @@
 		    	<th >签到签离</th>
 		    	<th >作业标注</th>
 		    	<th >作业反馈编辑</th>
-		    	<th >查看错题 </th>
+		    	<th >错题本</th>
 		    	<th >定制练习 </th>
-		    	<th >学回顾 </th>
-		    	<th >成长报告 </th>
+		    	<th >学回顾 </th>
+		    	<th >学习成长报告 </th>
 		    </tr> 
 		</thead>
 		<tbody>
@@ -92,7 +92,7 @@
 					</a>
 				</td>
 				<td >
-					<a th:href="@{/sys/analysis/teacher/info/8.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='查看错题' )}">
+					<a th:href="@{/sys/analysis/teacher/info/8.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='错题' )}">
 						[[${item.get('count_3')}]]
 					</a>
 				</td>
@@ -102,12 +102,12 @@
 					</a>
 				</td>
 				<td >
-					<a th:href="@{/sys/analysis/teacher/info/10.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='学回顾' )}">
+					<a th:href="@{/sys/analysis/teacher/info/10.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='学回顾' )}">
 						[[${item.get('count_5')}]]
 					</a>
 				</td>
 				<td >
-					<a th:href="@{/sys/analysis/teacher/info/11.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='成长报告' )}">
+					<a th:href="@{/sys/analysis/teacher/info/11.html(libId=${item.get('lib_id')},date=${search.get('date')},date2=${search.get('date2')},title='学习成长报告' )}">
 						[[${item.get('count_6')}]]
 					</a>
 				</td>
@@ -126,7 +126,7 @@
 <script type="text/javascript">
 	$(function () {
 		$("#button").on('click',function(){
-			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/exportTeacher.html";
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/teacher/export.html";
 			$("#seachform").submit();
 			window.setTimeout(function(){
 				document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/teacher.html";

+ 14 - 9
src/main/resources/templates/sys/analysis/teacher_info.html

@@ -34,7 +34,7 @@
 	</ul>
 </div>
 <div class="rightinfo">
-	<form id="seachform" th:action="@{/sys/analysis/balance/vip.html}" method="post">
+	<form id="seachform" th:action="@{/sys/analysis/teacher/info/${search.type}.html}" method="post">
 	<input type="hidden" name="pageSize" id="pageSize" value="10" />
 	<ul class="seachform">
 			<li>
@@ -48,6 +48,7 @@
 				<input type="hidden" name="date2" id="date2" th:value="${search.date2}">
 				
 				<input type="button" class="scbtn" value="查询" />
+				<input type="button" id="button" class="scbtn" value="导出" />
 			</li>
 			
 			<li>
@@ -63,7 +64,7 @@
 		<thead>
 		    <tr>
 		    	<th >序号</th>
-		    	<th >TeacherId</th>
+		    	<th >teacherId</th>
 		    	<th >微信昵称 </th>
 		    	<th >微信头像</th>
 		    	<th >老师姓名</th>
@@ -73,7 +74,7 @@
 		<tbody>
 			<tr th:each="item:${list}" >
 				<td th:text="${itemStat.count}" ></td>
-				<td th:title="${item.vip_id}" th:text="${item.vip_id}"></td>
+				<td th:title="${item.user_id}" th:text="${item.user_id}"></td>
 				<td th:text="${item.wx_name}"></td>
 				<td >
 					<img alt="" th:if="${item.photo!=null}" th:src="${imgUrl+item.photo}" style="width: 30px">
@@ -93,11 +94,15 @@
 </body>
 
 <script type="text/javascript">
-	$(function () {
-		
-		
-	
-	})
-	</script>
+$(function () {
+	$("#button").on('click',function(){
+		document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/teacher/info/[[${search.type}]]/export.html?title=[[${param.title}]]";
+		$("#seachform").submit();
+		window.setTimeout(function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/teacher/info/[[${search.type}]].html";
+		},3000);
+	});
+})
+</script>
 
 </html>

+ 557 - 0
src/main/resources/templates/sys/analysis/week.html

@@ -0,0 +1,557 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+	<title>私塾家</title>
+
+	<script type="text/javascript" th:src="@{/static/js/echarts.min.js}"></script>
+	<script type="text/javascript" th:src="@{/static/sys/js/meun/jquery/jquery-1.9.1.min.js}"></script>
+
+	<!-- bootstrap-css -->
+	<link rel="stylesheet" th:href="@{/static/sys/css/counter/bootstrap.min.css}" >
+	<link th:href="@{/static/sys/css/counter/style.css}" rel='stylesheet' type='text/css' />
+	<link th:href="@{/static/sys/css/counter/styletop.css}" rel='stylesheet' type='text/css' />
+
+	<link rel="stylesheet" th:href="@{/static/sys/css/counter/font-awesome.min.css}">
+	<link rel="stylesheet" th:href="@{/static/sys/css/counter/bootstrapDatepickr-1.0.0.css}">
+	<script th:src="@{/static/sys/js/counter/bootstrapDatepickr-1.0.0.min.js}"></script>
+	
+	<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+
+<style type="text/css">
+	.input-group{
+		width: 200px;
+   	 	float: left;
+   	 	margin-bottom:0px;
+   	 	margin-left: 10px;
+   	 	margin-right: 10px
+	}
+	
+	.s-index-side .title h3{
+		padding-left: 10px;
+	    font-weight: 800;
+	    border-bottom: 0px solid #d8d8d8;
+	    line-height: 50px;
+	}
+	
+	.s-index-side .title {
+		height: 50px;
+		line-height: 50px;
+	}
+	td{
+		background: #f5f5f5;
+	}
+	.market-update-block{
+		padding: 0em 0em;
+	}
+	
+	.market-update-left{
+		height: 120px
+	}
+	
+	.market-update-left h4{
+		height: 30px;
+    	background: #ccc;
+   	 	line-height: 30px;
+   	 	margin: 0px
+	}
+	
+	.market-update-block{
+		background: #f5f5f5;
+		color: #000;
+	}
+	
+	.market-update-block h3{
+		color: #000;
+		padding-left: 10px;
+		padding: 10px;
+	}
+	
+	.market-update-block p {
+		color: #000;
+		padding-left: 10px
+	}
+	
+	.market-update-block h4 {
+		color: #000;
+		padding-left: 10px
+	}
+	table{
+		border: 1px solid #999;
+	}
+	td{
+		border: 1px solid #999;
+	}
+</style>
+
+</head>
+<body>
+<section class="wrapper">
+    <div style="text-align: center"><h1>周数据汇总分析</h1></div>
+</section>
+
+<div style="width: 98%; padding-left: 20px;">
+	<div class="s-index-side" style="width: 100%;margin-bottom: 30px">
+		<div class="title">
+			<h3 style="color: #FF4E00;float: left;">小塾学伴新增数据</h3>
+			<div style="height: 40px;padding-top: 11px;float: left;">
+				<div >
+					<div class="input-group">
+						<span class="input-group-addon addonclick_id-calendar" id="basic-addon1"><i class="fa fa-calendar"></i></span>
+						<input type="text" id="calendar" placeholder="test" class="form-control"  autocomplete="off" th:value="${weekDate}"  onclick="WdatePicker({isShowWeek:true,onpicked:funccc,errDealMode:3})">
+					</div>
+				</div>
+			</div>
+			<div style="height: 40px;padding-top: 3px;float: left;">
+				<button class="btn btn-large btn-primary" type="button" id="calendarBtu">刷新</button>
+				<form id="seachform"  method="post" style="float: right;margin-left: 10px;">
+					<input type="button" id="button" class="btn btn-large btn-primary" value="导出" />
+				</form>
+			</div>
+		</div>
+		
+		<!-- --------------------------------------------- -->
+		<div class="market-updates" >
+        
+            <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+              <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>新签机构1周内账号开通数(校长&教师)</h4>
+                        <h3 id="count_1_source_1">0个</h3>
+                         <p id="count_1_source_1_p">
+                        	新签开通率:<span>0%</span>
+                        </p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+
+            </div>
+        
+            <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+               <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>新签机构2周内学生账号激活</h4>
+                        <h3 id="count_1_source_2">0个</h3>
+                        <p id="count_1_source_2_p">
+                        	新签激活率:<span>0%</span>
+                        </p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+            </div>
+
+		</div>
+			
+	
+	</div>
+</div>
+
+
+<div style="width: 98%; padding-left: 20px;">
+	<div class="s-index-side" style="width: 100%;margin-bottom: 30px">
+		<div class="title">
+			<h3 style="color: #FF4E00;float: left;">小塾学伴活泼用户数据</h3>
+			<div style="height: 40px;padding-top: 11px;float: left;">
+				<div >
+					<div class="input-group">
+						<span class="input-group-addon addonclick_id-calendar" id="basic-addon1"><i class="fa fa-calendar"></i></span>
+						<input type="text" id="calendar2" placeholder="test" class="form-control"  autocomplete="off" th:value="${weekDate}"  onclick="WdatePicker({isShowWeek:true,onpicked:funccc2,errDealMode:3})">
+					</div>
+				</div>
+			</div>
+			<div style="height: 40px;padding-top: 3px;float: left;">
+				<button class="btn btn-large btn-primary" type="button" id="calendar2Btu">刷新</button>
+				<form id="seachform2"  method="post" style="float: right;margin-left: 10px;">
+					<input type="button" id="button2" class="btn btn-large btn-primary" value="导出" />
+				</form>
+			</div>
+		</div>
+		
+		<!-- --------------------------------------------- -->
+		<div class="market-updates" >
+            <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+                <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>机构活泼数(账号活跃占比50%以上)</h4>
+                        <h3 id="count_2_source_1">0个</h3>
+                        <p id="count_2_source_1_p_1">
+                        	环比:<span style="color: #ccc">-0%-</span>
+                        </p>
+                         <p id="count_2_source_1_p_2">
+                        	占总体签约机构数:<span>0%</span>
+                        </p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+            </div>
+        
+            <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+                <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>新机构(1个月内)活泼数</h4>
+                        <h3 id="count_2_source_2">0个</h3>
+                        <p id="count_2_source_2_p">占总体签约机构数:0%</p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+            </div>
+        
+            <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+                <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>账号活跃数(周上传作业3天以上)</h4>
+                        <h3 id="count_2_source_3">0个</h3>
+                        <p id="count_2_source_3_p">
+                        	环比:<span style="color: #ccc">-0%-</span>
+                        </p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+
+            </div>
+            
+             <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+                <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>老机构(持续用3个月)</h4>
+                        <h3 id="count_2_source_4">0个</h3>
+                        <p id="count_2_source_4_p">占总体签约机构数:0%</p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+
+            </div>
+            
+             <div class="col-md-3 market-update-gd" style="width: 20%;margin-bottom: 20px">
+                <div class="market-update-block clr-block-6">
+                    <div class="col-md-12 market-update-left">
+                        <h4>召回机构数据(1周不用机构)</h4>
+                        <h3 id="count_2_source_5">0个</h3>
+                        <p  id="count_2_source_5_p">
+                        	环比:<span style="color: #ccc">-0%-</span>
+                        </p>
+                    </div>
+                    <div class="clearfix"> </div>
+                </div>
+
+            </div>
+            
+		</div>
+			
+	</div>
+</div>
+
+
+
+<div style="width: 98%; padding-left: 20px;">
+	<div class="s-index-side" style="width: 100%;margin-bottom: 30px">
+		<div class="title">
+			<h3 style="color: #FF4E00;float: left;">小塾学伴功能使用数据</h3>
+			<div style="height: 40px;padding-top: 11px;float: left;">
+				<div >
+					<div class="input-group">
+						<span class="input-group-addon addonclick_id-calendar" id="basic-addon1"><i class="fa fa-calendar"></i></span>
+						<input type="text" id="calendar3" placeholder="test" class="form-control"  autocomplete="off" th:value="${weekDate}"  onclick="WdatePicker({isShowWeek:true,onpicked:funccc3,errDealMode:3})">
+					</div>
+				</div>
+			</div>
+			<div style="height: 40px;padding-top: 3px;float: left;">
+				<button class="btn btn-large btn-primary" type="button" id="calendar3Btu">刷新</button>
+				<form id="seachform3" method="post" style="float: right;margin-left: 10px;">
+					<input type="button" id="button3" class=" btn btn-large btn-primary" value="导出" />
+				</form>
+			</div>
+		</div>
+		
+		<!-- --------------------------------------------- -->
+		
+		<table style="width: 98%;height: 100px;text-align: center;margin: 10px;margin-top: 30px"  >
+			<tr>
+				<td rowspan="2" style="width: 100px;background: #999;">教师端</td>
+				<td >签到签离</td>
+				<td >作业标注</td>
+				<td >作业反馈编辑</td>
+				<td >错题本</td>
+				<td >定制练习</td>
+				<td >学期回顾</td>
+				<td >学习成长报告</td>
+			</tr>
+			<tr id="source_3">
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+			</tr>
+		</table>
+		
+		
+		
+		<table style="width: 98%;height: 100px;text-align: center;margin: 10px;margin-top: 30px"  >
+			<tr>
+				<td rowspan="2" style="width: 100px;background: #999;">学生端</td>
+				<td >作业登记本</td>
+				<td >计时</td>
+				<td >上传作业</td>
+				<td >查看批改结果</td>
+			</tr>
+			<tr id="source_1">
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+			</tr>
+		</table>
+		
+		
+		<table style="width: 98%;height: 100px;text-align: center;margin: 10px;margin-top: 30px;margin-bottom: 50px"  >
+			<tr>
+				<td rowspan="2" style="width: 100px;background: #999;">家长端</td>
+				<td >作业任务</td>
+				<td >错题本</td>
+				<td >成长报告·周报</td>
+				<td >成长报告·月报</td>
+				<td >成长报告·学期</td>
+				<td >定制练习</td>
+			</tr>
+			<tr id="source_2">
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+				<td ></td>
+			</tr>
+		</table>
+		
+		
+	</div>
+</div>
+
+<script type="text/javascript">
+	$(function () {
+		$("#button").on('click',function(){
+			document.getElementById("seachform").action = "[[${sysUrl}]]/sys/analysis/week/data/count_1/export.html?weekDate="+$("#calendar").val();
+			$("#seachform").submit();
+		});
+		
+		$("#button2").on('click',function(){
+			document.getElementById("seachform2").action = "[[${sysUrl}]]/sys/analysis/week/data/count_2/export.html?weekDate="+$("#calendar2").val();
+			$("#seachform2").submit();
+		});
+		
+		$("#button3").on('click',function(){
+			document.getElementById("seachform3").action = "[[${sysUrl}]]/sys/analysis/week/data/count_3/export.html?weekDate="+$("#calendar3").val();
+			$("#seachform3").submit();
+		});
+	})
+</script>
+
+<script>
+	function funccc(){
+		$dp.$('calendar').value=$dp.cal.getP('y')+'年-第'+$dp.cal.getP('W','WW')+'周';
+	};
+	function funccc2(){
+		$dp.$('calendar2').value=$dp.cal.getP('y')+'年-第'+$dp.cal.getP('W','WW')+'周';
+	};
+	function funccc3(){
+		$dp.$('calendar3').value=$dp.cal.getP('y')+'年-第'+$dp.cal.getP('W','WW')+'周';
+	};
+</script>
+
+<script>
+	$(function(){
+		funccc_count_1();
+		funccc_count_2();
+		funccc_count_3();
+		
+		$("#calendarBtu").on('click',function(){
+			funccc_count_1();
+		});
+		
+		$("#calendar2Btu").on('click',function(){
+			funccc_count_2();
+		});
+		
+		$("#calendar3Btu").on('click',function(){
+			funccc_count_3();
+		});
+	})
+	
+	
+	function funccc_count_1(){
+		$.ajax({
+	        url:"[[${sysUrl}]]/sys/analysis/week/data/count_1",
+	        dataType:'json',
+	        cache:false,
+	        type:'get',
+	        data:{
+	        	weekDate:$("#calendar").val()
+	        },
+	        error:function(){return false;},
+	        success:function(data){       
+	        	var source_1=data.data.source_1;
+	        	var source_2=data.data.source_2;
+
+	        	$("#count_1_source_1").html(source_1.count_0+"个");
+	        	$("#count_1_source_1_p").html("新签开通率:<span>"+parseInt(source_1.count_0/source_1.count_1*100)+"%</span>");
+	        	
+	        	$("#count_1_source_2").html(source_2.count_0+"个");
+	        	$("#count_1_source_2_p").html("新签激活率:<span>"+parseInt(source_2.count_0/source_2.count_1*100)+"%</span>");
+
+	        }
+		});
+	}
+	
+	
+	function funccc_count_2(){
+		$.ajax({
+	        url:"[[${sysUrl}]]/sys/analysis/week/data/count_2",
+	        dataType:'json',
+	        cache:false,
+	        type:'get',
+	        data:{
+	        	weekDate:$("#calendar2").val()
+	        },
+	        error:function(){return false;},
+	        success:function(data){       
+	        	var source_1=data.data.source_1;
+	        	var source_2=data.data.source_2;
+	        	var source_3=data.data.source_3;
+	        	var source_4=data.data.source_4;
+	        	var source_5=data.data.source_5;
+	        	
+	        	var source_1_count=run_source_count_count(source_1.count_0,source_1.count_1);
+	        	$("#count_2_source_1").html(source_1.count_0+"个");
+	        	$("#count_2_source_1_p_2").html("占总体签约机构数:"+parseInt(source_1.count_0/source_1.count_2*100)+"%");
+	        	if(source_1_count > 0){
+	        		$("#count_2_source_1_p_1").html('环比:<span style="color: #0066ff">+'+source_1_count+'% &#8593;</span>');
+	        	}else if(source_1_count ==0 ){
+	        		$("#count_2_source_1_p_1").html('环比:<span style="color: #ccc">-0%- </span>');
+	        	}else{
+	        		$("#count_2_source_1_p_1").html('环比:<span style="color: red">'+source_1_count+'% &#8595;</span>');
+	        	}
+	        	
+	        	
+	        	$("#count_2_source_2").html(source_2.count_0+"个");
+	        	$("#count_2_source_2_p").html("占总体签约机构数:"+parseInt(source_2.count_0/source_2.count_1*100)+"%");
+	        	
+	        	
+	        	var source_3_count=run_source_count_count(source_3.count_0,source_3.count_1);
+	        	$("#count_2_source_3").html(source_3.count_0+"个");
+	        	if(source_3_count > 0){
+	        		$("#count_2_source_3_p").html('环比:<span style="color: #0066ff">+'+source_3_count+'% &#8593;</span>');
+	        	}else if(source_3_count ==0 ){
+	        		$("#count_2_source_3_p").html('环比:<span style="color: #ccc">-0%- </span></p>');
+	        	}else{
+	        		$("#count_2_source_3_p").html('环比:<span style="color: red">'+source_3_count+'% &#8595;</span>');
+	        	}
+	        	
+	        	
+	        	$("#count_2_source_4").html(source_4.count_0+"个");
+	        	$("#count_2_source_4_p").html("占总体签约机构数:"+parseInt(source_4.count_0/source_4.count_1*100)+"%");
+	        	
+	        	var source_5_count=run_source_count_count(source_5.count_0,source_5.count_1);
+	        	$("#count_2_source_5").html(source_5.count_0+"个");
+	        	if(source_5_count > 0){
+	        		$("#count_2_source_5_p").html('环比:<span style="color: #0066ff">+'+source_5_count+'% &#8593;</span>');
+	        	}else if(source_5_count ==0 ){
+	        		$("#count_2_source_5_p").html('环比:<span style="color: #ccc">-0%- </span>');
+	        	}else{
+	        		$("#count_2_source_5_p").html('环比:<span style="color: red">'+source_5_count+'% &#8595;</span>');
+	        	}
+	        	
+	        }
+		});
+	}
+	
+	function funccc_count_3(){
+		$.ajax({
+	        url:"[[${sysUrl}]]/sys/analysis/week/data/count_3",
+	        dataType:'json',
+	        cache:false,
+	        type:'get',
+	        data:{
+	        	weekDate:$("#calendar3").val()
+	        },
+	        error:function(){return false;},
+	        success:function(data){
+	        	var source_1=data.data.source_1;
+	        	var source_2=data.data.source_2;
+	        	var source_3=data.data.source_3;
+	        	
+	        	var source_1_count_0=run_source_count_count(source_1.count_0,source_1.count_0_0);
+	        	var source_1_count_1=run_source_count_count(source_1.count_1,source_1.count_1_1);
+	        	var source_1_count_2=run_source_count_count(source_1.count_2,source_1.count_2_2);
+	        	var source_1_count_3=run_source_count_count(source_1.count_3,source_1.count_3_3);
+	        
+	        	
+	        	var source_2_count_0=run_source_count_count(source_2.count_0,source_2.count_0_0);
+	        	var source_2_count_1=run_source_count_count(source_2.count_1,source_2.count_1_1);
+	        	var source_2_count_2=run_source_count_count(source_2.count_2,source_2.count_2_2);
+	        	var source_2_count_3=run_source_count_count(source_2.count_3,source_2.count_3_3);
+	        	var source_2_count_4=run_source_count_count(source_2.count_4,source_2.count_4_4);
+	        	var source_2_count_5=run_source_count_count(source_2.count_5,source_2.count_5_5);
+	        	
+	        	var source_3_count_0=run_source_count_count(source_3.count_0,source_3.count_0_0);
+	        	var source_3_count_1=run_source_count_count(source_3.count_1,source_3.count_1_1);
+	        	var source_3_count_2=run_source_count_count(source_3.count_2,source_3.count_2_2);
+	        	var source_3_count_3=run_source_count_count(source_3.count_3,source_3.count_3_3);
+	        	var source_3_count_4=run_source_count_count(source_3.count_4,source_3.count_4_4);
+	        	var source_3_count_5=run_source_count_count(source_3.count_5,source_3.count_5_5);
+	        	var source_3_count_6=run_source_count_count(source_3.count_6,source_3.count_6_6);
+	        	
+	        	//------------------
+	        	show_source("#source_1",0,source_1.count_0,source_1_count_0);
+	        	show_source("#source_1",1,source_1.count_1,source_1_count_1);
+	        	show_source("#source_1",2,source_1.count_2,source_1_count_2);
+	        	show_source("#source_1",3,source_1.count_3,source_1_count_3);
+	        	
+	        	//------------------
+	        	
+	        	show_source("#source_2",0,source_2.count_0,source_2_count_0);
+	        	show_source("#source_2",1,source_2.count_1,source_2_count_1);
+	        	show_source("#source_2",2,source_2.count_2,source_2_count_2);
+	        	show_source("#source_2",3,source_2.count_3,source_2_count_3);
+	        	show_source("#source_2",4,source_2.count_4,source_2_count_4);
+	        	show_source("#source_2",5,source_2.count_5,source_2_count_5);
+	        	
+	        	//------------------
+	        	
+	        	show_source("#source_3",0,source_3.count_0,source_3_count_0);
+	        	show_source("#source_3",1,source_3.count_1,source_3_count_1);
+	        	show_source("#source_3",2,source_3.count_2,source_3_count_2);
+	        	show_source("#source_3",3,source_3.count_3,source_3_count_3);
+	        	show_source("#source_3",4,source_3.count_4,source_3_count_4);
+	        	show_source("#source_3",5,source_3.count_5,source_3_count_5);
+	        	show_source("#source_3",6,source_3.count_6,source_3_count_6);
+	        	
+	        }
+		});
+	}
+	
+	
+	function run_source_count_count(count,count_count){
+		count=parseInt(count);
+		count_count=parseInt(count_count);
+		return parseInt(((count/(count+count_count==0 ? 1 : count+count_count))-(count_count/(count+count_count==0 ? 1 : count+count_count)))*100);
+	}
+	
+	
+	function show_source(obj,index,source_count,source_count_count){
+		if(source_count_count > 0){
+    		$(obj).children('td:eq('+index+')').html('<h2>'+source_count+'次</h2><p>环比:<span style="color: #0066ff">+'+source_count_count+'% &#8593;</span></p>');
+    	}else if(source_count_count ==0 ){
+    		$(obj).children('td:eq('+index+')').html('<h2>'+source_count+'次</h2><p>环比:<span style="color: #ccc">-0%- </span></p>');
+    	}else{
+    		$(obj).children('td:eq('+index+')').html('<h2>'+source_count+'次</h2><p>环比:<span style="color: red">'+source_count_count+'% &#8595;</span></p>');
+    	}
+	}
+	
+	
+</script>
+
+
+</body>
+</html>

+ 17 - 6
src/main/resources/templates/sys/fx/merchantAdd.html

@@ -122,7 +122,20 @@ dtext{
 			</li>
 			
 			<li>
-				<label>合同签约时间:<b >*</b></label>
+				<label>套餐:套餐模式<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="signType" id="signType" class="select1"  > 
+						<option value="0" th:selected="${merchant.signType==0 ? true : false}">旧模式</option>
+						<option value="1" th:selected="${merchant.signType==1 ? true : false}">优选套餐</option>
+						<option value="2" th:selected="${merchant.signType==2 ? true : false}">VIP套餐</option>
+						<option value="3" th:selected="${merchant.signType==3 ? true : false}">尊享套餐</option>
+					</select>
+				</div>
+				<label th:if="${merchant.id!=null}"  style="width: 230px;color:red">[修改套餐模式,会直接影响加油包有效性 ]</label>
+			</li>
+			
+			<li>
+				<label>[合同签约]/[套餐模式]时间:<b >*</b></label>
 				<input type="hidden"  id="minDate" value="2020-01-01" >
 				<input type="text" id="signTime" name="signTime"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'minDate\')}'})" autocomplete="off" th:value="${#dates.format(merchant.signTime, 'yyyy-MM-dd')}" class="scinput date_width " placeholder="开始时间">
 				&nbsp;&nbsp;&nbsp;~~&nbsp;&nbsp;
@@ -218,7 +231,7 @@ dtext{
 			</li>
 				
 		    <li>
-				<label>服务:签约单价<b>*</b></label>
+				<label>服务:签约单价<b></b></label>
 				<div class="vocation" style="margin-right: 5px; width: 345px">
 					<select name="price" id="price" class="select1"> 
 						<option value="0" th:selected="${merchant.price!=50.0 && merchant.price!=55.0 && merchant.price!=68.0 ? true : false}">请选择</option>
@@ -688,10 +701,7 @@ function save(){
 		return
 	}
 	
-	if($("#price").val()<=0){
-		parent.layer.msg("进货单价不能为空",{icon:11});
-		return
-	}
+
 	
 	var title="您确定要保存商户信息?<br/>此动作会把商户塾币覆盖到机构塾币";
 	if(id!=''){
@@ -723,6 +733,7 @@ function save(){
             'signService':$("#signService").val(),
             'hardwareService':$("#hardwareService").val(),
             
+            'signType':$("#signType").val(),
             'startTime':$("#signTime").val(),
             'endTime':$("#endSignTime").val(),
             

+ 284 - 17
src/main/resources/templates/sys/fx/merchantAllList.html

@@ -22,6 +22,101 @@
 		text-overflow: ellipsis;
 		overflow: hidden;
 	}
+	#mealServiceAdd .zwfb_shop_table {
+		margin-top: 10px
+	}
+	#mealServiceAdd tbody {
+	    display: table-row-group;
+	    vertical-align: middle;
+    	border-color: inherit;
+	}
+	#mealServiceAdd .fwmc_xxk {
+	    overflow: hidden;
+	    margin-left: 20px;
+	}
+	#mealServiceAdd .fwmc_xxk li {
+	    float: left;
+	    width: 150px;
+	    height: 52px;
+	    border: 1px solid #ddd;
+	    font-size: 18px;
+	    color: #666;
+	    margin-right: 30px;
+	    text-align: center;
+	    margin-bottom: 25px;
+	    overflow: hidden;
+	    cursor: pointer;
+	}
+	#mealServiceAdd .fwmc_xxk li p {
+	    line-height: 18px;
+	    font-size: 12px;
+	    color: #999;
+	    margin-top: 5px;
+	}
+	#mealServiceAdd .zwsl_num {
+	    margin-left: 20px;
+	    font-size: 16px;
+	    color: #333;
+	}
+	#mealServiceAdd .zwsl_num span {
+	    color: #999;
+	    font-size: 12px;
+	    padding-left: 10px;
+	}
+	#mealServiceAdd .nmb_jj {
+	    overflow: hidden;
+	    margin-left: 20px;
+	}
+	#mealServiceAdd .nmb_jj li.jian {
+	    border-right: none;
+	    cursor: pointer;
+	    color: #999;
+	    width: 30px;
+	    padding: 0;
+	}
+	#mealServiceAdd .nmb_jj li {
+	    float: left;
+	    text-align: center;
+	    line-height: 30px;
+	    border: 1px solid #ddd;
+	    font-size: 20px;
+	    padding: 0 8px;
+	}
+	#mealServiceAdd .nmb_jj li .srkk {
+	    width: 30px;
+	    font-size: 16px;
+	    border: none;
+	    line-height: 30px;
+	    text-align: center;
+	    outline: 0;
+	    background: #FFF;
+	}
+	#mealServiceAdd .nmb_jj li.jia {
+	    border-left: none;
+	    cursor: pointer;
+	    color: #999;
+	    width: 30px;
+	    padding: 0;
+	}
+	#mealServiceAdd a.ty_but {
+	    width: 130px;
+	    height: 40px;
+	    line-height: 40px;
+	    text-align: center;
+	    display: block;
+	    font-size: 16px;
+	    color: #fff;
+	    border-radius: 3px;
+	    background: #169ed8;
+	}
+	#mealServiceAdd a.ty_but:hover {
+	    background: #1187ba;
+	}
+	#mealServiceAdd .fwmc_xxk li.sign_type_select_on {
+	    background: url(/static/sys/images/fwkk.jpg) no-repeat center;
+	    color: #169ed8;
+	    border: 1px solid #169ed8;
+	}
 	
 </style>
 <body>
@@ -53,6 +148,10 @@
 					<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>添加</li>
 				</a>
 			</ul>
+			
+			<a href="javascript:;" onclick="savemerchant('')">
+				<li class="click"><span><img th:src="@{/static/sys/images/t01.png}"></span>添加</li>
+			</a>
 		</li>
 	</ul>
 	</form>
@@ -71,14 +170,15 @@
 		    	<th >商户账号</th>
 		    	<th >单位名称 </th>
 		    	<th style="width: 60px;">商户级别</th>
-		    	<th  >关联机构 </th>
+		    	<th >关联机构 </th>
+		    	<th >商户模式 </th>
 		    	<th style="width: 60px;">签约端口数量</th>
-		    	<th style="width: 60px;">机构塾币</th>
+		    	<th style="width: 60px;">机构塾币/套餐人数</th>
 		    	<th style="width: 60px;">平台塾币</th>
 		    	<th style="width: 60px;">合同硬件采购数量</th>
-		    	<th style="max-width: 160px;" >签约时间</th>
+		    	<th style="max-width: 160px;" >签约时间/套餐时间</th>
 		    	<th style="width: 60px;" >下个结算日</th>
-		        <th  >状态</th>
+<!-- 		        <th  >状态</th> -->
 <!-- 		        <th  >创建时间</th>  -->
 		        <th  >操作</th> 
 		    </tr> 
@@ -97,7 +197,18 @@
 					   <span th:case="*" >--</span>
 					</td>
 					
-					<td  th:title="${item.libJoin!=null ? item.libJoin.leagueName : '' }"   th:text="${item.libJoin!=null ? item.libJoin.leagueName : '--' }"></td>
+					<td  th:title="${item.libJoin!=null ? item.libJoin.leagueName : '' }" >
+						<a href="javascript:;" th:onclick="'openNew(\''+${item.libId}+'\')'" th:if="${item.libId!='' && item.libId!=null}"	class="tablelink">[[${item.libJoin.leagueName}]]</a>
+					</td>
+					
+					<td  th:switch="${item.signType}">
+					   <span th:case="0" style="color:red">旧兼容模式</span>
+					   <span th:case="1" >优选套餐</span>
+					   <span th:case="2" >VIP套餐</span>
+					   <span th:case="3" >尊享套餐</span>
+					   <span th:case="*" style="color:red">旧兼容模式</span>
+					</td>
+					
 					<td  th:text="${item.portNum}"></td>
 					<td  th:text="${item.libService}"></td>
 					<td  th:text="${item.platformService}"></td>
@@ -107,23 +218,33 @@
 					<td th:title="${item.signTime!=null ?  #dates.format(item.signTime, 'yyyy-MM-dd')+'~'+#dates.format(item.endSignTime, 'yyyy-MM-dd') : '--' }"  th:text="${item.signTime!=null ?  #dates.format(item.signTime, 'yyyy-MM-dd')+'~'+#dates.format(item.endSignTime, 'yyyy-MM-dd') : '--' }"></td>
 					<td  th:text="${#calendars.format(item.nextSummaryTime,'yyyy-MM-dd')}" ></td> 
 					
-					<td  th:switch="${item.status}">
-					   <span th:case="1">待签</span>
-					   <span th:case="2">已签待交付</span>
-					   <span th:case="3">已签已交付</span>
-					   <span th:case="4">无效</span>
-					</td>
+<!-- 					<td  th:switch="${item.status}"> -->
+<!-- 					   <span th:case="1">待签</span> -->
+<!-- 					   <span th:case="2">已签待交付</span> -->
+<!-- 					   <span th:case="3">已签已交付</span> -->
+<!-- 					   <span th:case="4">无效</span> -->
+<!-- 					</td> -->
 
 <!-- 					<td  th:text="${#calendars.format(item.createTime,'yyyy-MM-dd')}" ></td>   -->
 					<td  >   
 						<di th:if="${ #httpSession.getAttribute('admin') !=null   &&  (#lists.contains(#httpSession.getAttribute('admin').authorities,'财务管理员') ||  #lists.contains(#httpSession.getAttribute('admin').authorities,'分销管理员'))  }">
-							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'joinServiceEdit(\''+${item.id}+'\')'" class="tablelink">塾币</a>
+							
+							<a href="javascript:;" th:if="${item.signType==0 && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'joinServiceEdit(\''+${item.id}+'\')'" class="tablelink">塾币</a>
+							<a href="javascript:;" th:if="${item.signType!=0 && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'mealServiceAdd(\''+${item.id}+'\')'" class="tablelink">加油包</a>
+						
 							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'updatemerchant(\''+${item.id}+'\',\'4\')'"   class="tablelink">删除</a>
 							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'savemerchant(\''+${item.id}+'\')'"  	class="tablelink">修改</a>
 						</di>
+						
+							<a href="javascript:;" th:if="${item.signType==0 && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'joinServiceEdit(\''+${item.id}+'\')'" class="tablelink">塾币</a>
+							<a href="javascript:;" th:if="${item.signType!=0 && item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'mealServiceAdd(\''+${item.id}+'\')'" class="tablelink">加油包</a>
+							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'updatemerchant(\''+${item.id}+'\',\'4\')'"   class="tablelink">删除</a>
+							<a href="javascript:;" th:if="${item.status!=4 && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'savemerchant(\''+${item.id}+'\')'"  	class="tablelink">修改</a>
+						
+												
 						<a href="javascript:;" th:if="${item.status!=4 && item.libId!='' && item.libId!=null && (curMerchant.orgCode eq 'SSJ-FX' || #strings.contains(item.orgCode,curMerchant.orgCode) ) }"  th:onclick="'untyingmerchant(\''+${item.id}+'\')'"  	class="tablelink">解绑</a>
 						<a href="javascript:;" th:onclick="'infomerchant(\''+${item.id}+'\')'"  	class="tablelink">查看</a>
-						<a href="javascript:;" th:onclick="'openNew(\''+${item.libId}+'\')'" th:if="${item.libId!='' && item.libId!=null}"	class="tablelink">校长端数据查看</a>
+						
 					 </td>  
 					
 					
@@ -132,8 +253,6 @@
 	</table>
 	
 	
-	
-	
 <div class="formbody" id="joinServiceEdit" style="display: none">
 	<input type="hidden" id="merchant_id" value="" >
 	<ul class="forminfo">
@@ -165,6 +284,59 @@
 </div>
 
 
+<div class="formbody" id="mealServiceAdd" style="display: none;">
+	<input type="hidden" id="meal_merchant_id" value="" >
+	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="zwfb_shop_table">
+	      <tbody>
+	      	<tr valign="top">
+		        <td align="right" width="70" style="line-height: 50px;font-weight: 700">加油包类型:</td>
+		        <td>
+		        	<ul class="fwmc_xxk">
+		            <li class="sign_type_select sign_type_select_on" data-type="4">
+		              <p>加油包-月包</p>
+		              1个月<i>/10人</i>
+		           	</li>
+		           	<li class="sign_type_select"  data-type="5">
+		              <p>加油包-数量包</p>
+		              10人<i>/1个月</i>
+		           	</li>
+		          </ul>
+		        </td>
+	      	</tr>
+	      <tr>
+	        <td height="20"></td>
+	        <td></td>
+	      </tr>
+	      <tr>
+	        <td align="right" style="font-weight: 700">添加数量:</td>
+	        <td>
+	        	<ul class="nmb_jj">
+		            <li class="jian" id="meal_reduce_num">-</li>
+		            <li>
+		              <input name="" id="meal_add_service_num" type="text" value="1" class="srkk">
+		            </li>
+		            <li class="jia" id="meal_add_num">+</li>  
+	          </ul>
+	        </td>
+	      </tr>
+	      <tr>
+	        <td height="20"></td>
+	        <td></td>
+	      </tr>
+	   	 <tr>
+	        <td height="20"></td>
+	        <td></td>
+	      </tr>
+	      <tr>
+	        <td></td>
+	        <td><a class="ty_but ml20" href="javascript:#" onclick="saveMeal();">添 加</a></td>
+	      </tr>
+	    </tbody>
+   	</table>
+    
+</div>
+
+
 
 <div class="formbody" id="joinServiceAdd" style="display: none;">
 	<input type="hidden" id="service_type" value="" >
@@ -209,6 +381,24 @@ $(function () {
 	$("#add_num").click(function (){
 		$("#add_service_num").val(parseInt($("#add_service_num").val())+1);
 	});
+	
+	$("#meal_reduce_num").click(function (){
+		if($("#meal_add_service_num").val()<=1){
+			parent.layer.msg("添加加油包数量不能小于1",{icon:11});
+			return;
+		}
+		$("#meal_add_service_num").val(parseInt($("#meal_add_service_num").val())-1);
+	});
+	
+	$("#meal_add_num").click(function (){
+		$("#meal_add_service_num").val(parseInt($("#meal_add_service_num").val())+1);
+	});
+	
+	$(".sign_type_select").click(function (){
+		$(".sign_type_select").removeClass("sign_type_select_on");
+		$(this).addClass("sign_type_select_on");
+	});
+	
 
 })
 
@@ -280,6 +470,83 @@ function joinServiceAdd(type){
 }
 
 
+function mealServiceAdd(id){
+	  $.ajax({
+		  url: "[[${sysUrl}]]/sys/fx/getMerchant/"+id,
+	      type: 'POST',
+	      data: {},
+	      processData: false,
+	      contentType: false, 
+	      beforeSend: function () {
+	      },
+	      success: function (responseStr) {
+	    	  if(responseStr.meta.success){
+	    		  $("#meal_merchant_id").val(id);
+	    		  var meal_merchant_li1="旧兼容模式";
+	    		  switch (responseStr.data.merchant.signType) {
+					case 1:
+						meal_merchant_li1="优选套餐";
+						break;
+					case 2:
+						meal_merchant_li1="VIP套餐";
+						break;
+					case 3:
+						meal_merchant_li1="尊享套餐";
+						break;
+					default:
+						break;
+					}
+	    		  $("#meal_merchant_li1").html("["+responseStr.data.merchant.unitName+"] 商户当前套餐模式:"+meal_merchant_li1);
+	    		  $("#meal_merchant_li2").html("["+responseStr.data.merchant.unitName+"] 商户当前套餐人数:"+responseStr.data.merchant.libService);
+	    		  layer.open({
+    			    type: 1,
+    			    title: "["+responseStr.data.merchant.unitName+"]"+' 添加加油包',
+    			    closeBtn: 1, //不显示关闭按钮
+    			    shift: 0.8,
+    			    offset: '150px',
+    			    area: ['40%', '40%'],
+    			    content: $("#mealServiceAdd")
+    			 });
+	    	  }else{
+	    		  parent.layer.msg(responseStr.meta.message,{icon:11});
+	    	  }
+	      }
+	      ,
+	      error : function (responseStr) {
+	    	  parent.layer.msg("查询失败,请刷新后重试!",{icon:11});
+	      }
+	  });
+}
+
+
+
+function saveMeal(){
+	parent.layer.confirm("确定为此商户添加加油包?", {
+		icon: 4, btn: ['确定','关闭'],offset: '100px' //按钮
+	}, function(){
+		var type=$(".sign_type_select_on").data("type");
+		var num=$("#meal_add_service_num").val();
+		var merchantId=$("#meal_merchant_id").val();
+		var url="[[${sysUrl}]]/sys/fx/merchant/updateMeal/"+merchantId;
+		var params ={
+	        'num':num,
+	        'type':type
+	    };
+		$.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 joinServiceEdit(id){
 	  $.ajax({
 		  url: "[[${sysUrl}]]/sys/fx/getMerchant/"+id,
@@ -362,7 +629,7 @@ function joinServiceEdit(id){
 			    closeBtn: 1, //不显示关闭按钮
 			    shift: 0.8,
 			    offset: '10px',
-			    area: ['60%', '90%'],
+			    area: ['90%', '95%'],
 			    content: '[[${sysUrl}]]/sys/fx/merchantInfo.html?id='+id
 			});
 		}
@@ -379,7 +646,7 @@ function joinServiceEdit(id){
 			    closeBtn: 1, //不显示关闭按钮
 			    shift: 0.8,
 			    offset: '10px',
-			    area: ['60%', '90%'],
+			    area: ['90%', '95%'],
 			    content: '[[${sysUrl}]]/sys/fx/merchantAdd.html?id='+id
 			});
 		}

+ 40 - 8
src/main/resources/templates/sys/fx/merchantInfo.html

@@ -116,7 +116,19 @@ dtext{
 			</li>
 
 			<li>
-				<label>签约时间:<b >*</b></label>
+				<label>套餐:套餐模式<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="signType" id="signType" class="select1" disabled="disabled"  > 
+						<option value="0" th:selected="${merchant.signType==0 ? true : false}">旧模式</option>
+						<option value="1" th:selected="${merchant.signType==1 ? true : false}">优选套餐</option>
+						<option value="2" th:selected="${merchant.signType==2 ? true : false}">VIP套餐</option>
+						<option value="3" th:selected="${merchant.signType==3 ? true : false}">尊享套餐</option>
+					</select>
+				</div>
+			</li>
+
+			<li>
+				<label>[合同签约]/[套餐模式]时间:<b >*</b></label>
 				<input type="text" id="signTime" disabled="disabled" name="signTime"  onclick="WdatePicker()" th:value="${#dates.format(merchant.signTime, 'yyyy-MM-dd')}" class="scinput date_width " placeholder="开始时间">
 				&nbsp;&nbsp;&nbsp;~~&nbsp;&nbsp;
 				<input type="text" id="endSignTime" disabled="disabled" name="endSignTime"  onclick="WdatePicker()" th:value="${#dates.format(merchant.endSignTime, 'yyyy-MM-dd')}" class="scinput date_width" placeholder="结束时间">
@@ -128,14 +140,14 @@ dtext{
 			</li>
 			
 			<li>
-				<label>硬件数量:<b>*</b></label>
+				<label>合同硬件采购数量:<b>*</b></label>
 				<input type="text" id="hardwareService" disabled="disabled"  class="dfinput fl" name="hardwareService" th:value="${merchant.hardwareService!=null ? merchant.hardwareService : 0}"/>
 			</li>
 			
 			
 			
 			<li >
-				<label>上级商户:<b >*</b></label>
+				<label>上级商户:上级渠道:<b >*</b></label>
 				<div class="vocation" style="margin-right: 5px; width: 345px">
 					<select name="parentposcode" id="parentposcode" disabled="disabled" class="select1" > 
 						<option th:if="${merchant.id==null || merchant.parentPosCode=='' || merchant.parentPosCode==null }" data-orgcode="" data-id="" value="" >无商户上级</option>
@@ -157,6 +169,18 @@ dtext{
 				</div>
 			</li>
 			
+			<li>
+				<label>商户类型:<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px" disabled="disabled">
+					<select name="type" id="type" class="select1" disabled="disabled"> 
+						<option value="1" th:selected="${merchant.type==1 ? true : false}">直接签约</option>
+						<option value="2" th:selected="${merchant.type==2 ? true : false}">内部消耗</option>
+						<option value="3" th:selected="${merchant.type==3 ? true : false}">外部签约</option>
+						<option value="4" th:selected="${merchant.type==4 ? true : false}">内部不结算(财务)</option>
+					</select>
+				</div>
+			</li>
+			
 			 <li>
 				<label>签约状态:<b>*</b></label>
 				<div class="vocation" style="margin-right: 5px; width: 345px">
@@ -169,13 +193,21 @@ dtext{
 				</div>
 			</li>
 				
-		    <li>
-				<label>进货单价:<b>*</b></label>
-				<input type="text" id="price" class="dfinput fl" disabled="disabled" name="price" th:value="${merchant.price!=null ? merchant.price : 0}"/>
+		 	 <li>
+				<label>服务:签约单价<b>*</b></label>
+				<div class="vocation" style="margin-right: 5px; width: 345px">
+					<select name="price" id="price" class="select1" disabled="disabled"> 
+						<option value="0" th:selected="${merchant.price!=50.0 && merchant.price!=55.0 && merchant.price!=68.0 ? true : false}">请选择</option>
+						<option value="50" th:selected="${merchant.price==50.0 ? true : false}">50.0</option>
+						<option value="55" th:selected="${merchant.price==55.0 ? true : false}">55.0</option>
+						<option value="68" th:selected="${merchant.price==68.0 ? true : false}">68.0</option>
+					</select>
+				</div>
 			</li>
+			
 			<li>
-				<label>出货单价:<b>*</b></label>
-				<input type="text" id="outPrice" class="dfinput fl" disabled="disabled" name="outPrice" th:value="${merchant.price!=null ? merchant.outPrice : 0}"/>
+				<label>硬件:签约单价<b></b></label>
+				<input type="text" id="hardwarePrice" class="dfinput fl" disabled="disabled" name="hardwarePrice" th:value="${merchant.hardwarePrice}"/>
 			</li>
 			
 			<li>

+ 118 - 0
src/main/resources/templates/sys/fx/merchantSignList.html

@@ -0,0 +1,118 @@
+<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;
+	}
+</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/fx/merchantSignList.html}" method="post">
+	<ul class="seachform">
+	    <li>
+			<label>所有商户</label>
+			<select class="scinput select_width"  name="merchantId"   style="width: 150px;" >
+				<option value="">全部</option>
+				<option th:each="item:${poslist}"  th:selected="${search.get('merchantId') eq item.id ? true : false}" th:value="${item.id}">[[${item.unitName}]]</option>
+			</select>
+		</li>
+		  <li>
+			<label>套餐类型</label>
+			<select class="scinput select_width"  name="signType"   style="width: 150px;" >
+				<option value="">全部</option>
+				<option value="4" th:selected="${search.get('signType')+'' eq '4' ? true : false}">加油包-月包</option>
+				<option value="5" th:selected="${search.get('signType')+'' eq '5' ? true : false}">加油包-量包</option>
+			</select>
+		</li>
+		<li>
+			<input type="button" class="scbtn" value="查询" />
+		</li>
+	</ul>
+	</form>
+	
+	<ul class="seachform">
+		<li>
+			<input type="button" id="button" class="scbtn" value="导出明细" />
+		</li>
+	</ul>
+	
+	<table class="tablelist">
+		<thead>
+		    <tr>
+		        <th>商户</th>
+		        <th>商户名称</th>
+		    	<th>加油包类型</th>
+		    	<th>加油包数量</th>
+		        <th>套餐总人数</th>
+		        <th>开始时间</th>
+		        <th>结束时间</th>
+		        <th>是否服务</th>
+		        <th>添加时间</th> 
+		        <th>备注</th> 
+		    </tr>
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" >
+					<td th:text="${item.pos_code}"></td>
+					<td th:text="${item.unit_name}"></td>
+					<td  th:switch="${item.sign_type}">
+					   <span th:case="4" style="color:red">加油包-月包</span>
+					   <span th:case="5" style="color:red">加油包-量包</span>
+					</td>
+					<td th:text="${item.num}"></td>
+					<td th:text="${item.lib_service}"></td>		
+					<td th:text="${#calendars.format(item.sign_time,'yyyy-MM-dd')}" ></td>  
+					<td th:text="${#calendars.format(item.end_sign_time,'yyyy-MM-dd')}" ></td>  
+					<td  th:switch="${item.status}">
+					   <span th:case="0" >服务中</span>
+					   <span th:case="1" style="color:red">已结束</span>
+					</td>
+					<td th:text="${#calendars.format(item.create_time,'yyyy-MM-dd HH:mm:ss')}" ></td>  
+					<td th:text="${item.remarks}" ></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">
+
+</script>
+
+<script type="text/javascript">
+$("#button").on('click',function(){
+	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/fx/exportMerchantSignList";
+	$("#seachform").submit();
+	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/fx/merchantSignList.html";
+});
+</script>
+
+</html>

二进制
target/classes/static/sys/js/uploadify/v3/__MACOSX/._Change Log.txt


二进制
target/classes/static/sys/js/uploadify/v3/__MACOSX/._uploadify.swf