Przeglądaj źródła

各省销售总数据

李天标 5 lat temu
rodzic
commit
f56401a0f8
25 zmienionych plików z 2382 dodań i 17 usunięć
  1. 26 0
      src/main/java/com/shawn/model/Bean/Child.java
  2. 23 0
      src/main/java/com/shawn/model/Bean/Childlast.java
  3. 29 0
      src/main/java/com/shawn/model/Bean/Children2.java
  4. 29 0
      src/main/java/com/shawn/model/Bean/Children3.java
  5. 74 0
      src/main/java/com/shawn/model/entity/TPromoCode.java
  6. 832 0
      src/main/java/com/shawn/model/entity/TPromoCodeExample.java
  7. 5 0
      src/main/java/com/shawn/model/param/StatisticsParam.java
  8. 49 0
      src/main/java/com/shawn/model/param/TPromoCodeParam.java
  9. 6 0
      src/main/java/com/shawn/repository/TEquipmentMapper.java
  10. 5 0
      src/main/java/com/shawn/repository/TOrderMapper.java
  11. 11 0
      src/main/java/com/shawn/repository/TPromoCodeMapper.java
  12. 7 0
      src/main/java/com/shawn/service/impl/TAreaServiceImpl.java
  13. 75 7
      src/main/java/com/shawn/service/impl/TOrderServiceImpl.java
  14. 29 0
      src/main/java/com/shawn/service/impl/TPromoCodeServiceImpl.java
  15. 3 0
      src/main/java/com/shawn/service/interfac/TAreaServiceInterface.java
  16. 5 0
      src/main/java/com/shawn/service/interfac/TOrderServiceInterface.java
  17. 11 0
      src/main/java/com/shawn/service/interfac/TPromoCodeServiceInterface.java
  18. 260 0
      src/main/java/com/shawn/util/JoinpayConstant.java
  19. 11 0
      src/main/java/com/shawn/web/controller/TAdminController.java
  20. 325 10
      src/main/java/com/shawn/web/controller/TEquipmentController.java
  21. 18 0
      src/main/java/com/shawn/web/controller/TOrderController.java
  22. 200 0
      src/main/java/com/shawn/web/controller/TPromoCodeController.java
  23. 16 0
      src/main/resources/com/shawn/repository/mybatis/TEquipmentMapper.xml
  24. 24 0
      src/main/resources/com/shawn/repository/mybatis/TOrderMapper.xml
  25. 309 0
      src/main/resources/com/shawn/repository/mybatis/TPromoCodeMapper.xml

+ 26 - 0
src/main/java/com/shawn/model/Bean/Child.java

@@ -0,0 +1,26 @@
+package com.shawn.model.Bean;
+
+import com.shawn.model.entity.TEquipment;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class Child {
+    @ApiModelProperty(value="id")
+    private Long id;
+    @ApiModelProperty(value="名称")
+    private String name;
+    @ApiModelProperty(value="机器列表")
+    private List<Childlast> children;
+}

+ 23 - 0
src/main/java/com/shawn/model/Bean/Childlast.java

@@ -0,0 +1,23 @@
+package com.shawn.model.Bean;
+
+import com.shawn.model.entity.TEquipment;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class Childlast {
+    @ApiModelProperty(value="id")
+    private Long id;
+    @ApiModelProperty(value="名称")
+    private String name;
+}

+ 29 - 0
src/main/java/com/shawn/model/Bean/Children2.java

@@ -0,0 +1,29 @@
+package com.shawn.model.Bean;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+import java.util.Set;
+
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class Children2 {
+    @ApiModelProperty(value="id")
+    private Long id;
+    @ApiModelProperty(value="名称")
+    private String name;
+    @ApiModelProperty(value="商家列表")
+    private List<Child> children;
+    @ApiModelProperty(value="属于该市的所有id")
+    private Set<Long> city;
+    @ApiModelProperty(value="销售数据")
+    private String money;
+}

+ 29 - 0
src/main/java/com/shawn/model/Bean/Children3.java

@@ -0,0 +1,29 @@
+package com.shawn.model.Bean;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+import java.util.Set;
+
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class Children3 {
+    @ApiModelProperty(value="id")
+    private Long id;
+    @ApiModelProperty(value="名称")
+    private String name;
+    @ApiModelProperty(value="市级列表")
+    private List<Children2> children;
+    @ApiModelProperty(value="属于该省的所有id")
+    private Set<Long> province;
+    @ApiModelProperty(value="销售数据")
+    private String money;
+}

+ 74 - 0
src/main/java/com/shawn/model/entity/TPromoCode.java

@@ -0,0 +1,74 @@
+package com.shawn.model.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class TPromoCode {
+
+  @ApiModelProperty(value="")
+  private Integer id;
+
+  @ApiModelProperty(value="")
+  private String adminId;
+
+  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+  @ApiModelProperty(value="")
+  private Date createDate;
+
+  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+  @ApiModelProperty(value="")
+  private Date modifyDate;
+
+  @ApiModelProperty(value="")
+  private String userName;
+
+  @ApiModelProperty(value="")
+  private Long code;
+
+  @ApiModelProperty(value="")
+  private String isUse;
+
+  @ApiModelProperty(value="")
+  private String useDate;
+
+  @ApiModelProperty(value="")
+  private String useBy;
+
+  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+  @ApiModelProperty(value="")
+  private Date lastUseDate;
+
+  /**自定义统一方法设置主键**/
+  public void setPrimaryKey(Integer primaryKey) {
+    setId(primaryKey);
+  }
+
+  /**自定义统一方法获取主键**/
+  @JsonIgnore
+  public Integer getPrimaryKey() {
+    return getId();
+  }
+
+  /**判断该实体是否存在主键**/
+  public boolean hasPrimaryKey() {
+    return true;
+  }
+
+}

+ 832 - 0
src/main/java/com/shawn/model/entity/TPromoCodeExample.java

@@ -0,0 +1,832 @@
+package com.shawn.model.entity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class TPromoCodeExample {
+    /**
+     * t_promo_code
+     */
+    protected String orderByClause;
+
+    /**
+     * t_promo_code
+     */
+    protected boolean distinct;
+
+    /**
+     * t_promo_code
+     */
+    protected List<Criteria> oredCriteria;
+
+    private Integer limit;
+
+    private Integer offset;
+
+    public TPromoCodeExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setLimit(Integer limit) {
+        this.limit = limit;
+    }
+
+    public Integer getLimit() {
+        return limit;
+    }
+
+    public void setOffset(Integer offset) {
+        this.offset = offset;
+    }
+
+    public Integer getOffset() {
+        return offset;
+    }
+
+    /**
+     * t_promo_code 2019-10-25
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Integer value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Integer value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Integer value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Integer value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Integer value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Integer> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Integer> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Integer value1, Integer value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdIsNull() {
+            addCriterion("admin_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdIsNotNull() {
+            addCriterion("admin_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdEqualTo(String value) {
+            addCriterion("admin_id =", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdNotEqualTo(String value) {
+            addCriterion("admin_id <>", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdGreaterThan(String value) {
+            addCriterion("admin_id >", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdGreaterThanOrEqualTo(String value) {
+            addCriterion("admin_id >=", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdLessThan(String value) {
+            addCriterion("admin_id <", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdLessThanOrEqualTo(String value) {
+            addCriterion("admin_id <=", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdLike(String value) {
+            addCriterion("admin_id like", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdNotLike(String value) {
+            addCriterion("admin_id not like", value, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdIn(List<String> values) {
+            addCriterion("admin_id in", values, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdNotIn(List<String> values) {
+            addCriterion("admin_id not in", values, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdBetween(String value1, String value2) {
+            addCriterion("admin_id between", value1, value2, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andAdminIdNotBetween(String value1, String value2) {
+            addCriterion("admin_id not between", value1, value2, "adminId");
+            return (Criteria) this;
+        }
+
+        public Criteria andOpenIdIsNull() {
+            addCriterion("user_name is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameIsNotNull() {
+            addCriterion("user_name is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameEqualTo(String value) {
+            addCriterion("user_name =", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameNotEqualTo(String value) {
+            addCriterion("user_name <>", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameGreaterThan(String value) {
+            addCriterion("user_name >", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameGreaterThanOrEqualTo(String value) {
+            addCriterion("user_name >=", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameLessThan(String value) {
+            addCriterion("user_name <", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameLessThanOrEqualTo(String value) {
+            addCriterion("user_name <=", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameLike(String value) {
+            addCriterion("user_name like", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameNotLike(String value) {
+            addCriterion("user_name not like", value, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameIn(List<String> values) {
+            addCriterion("user_name in", values, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameNotIn(List<String> values) {
+            addCriterion("user_name not in", values, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameBetween(String value1, String value2) {
+            addCriterion("user_name between", value1, value2, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andUserNameNotBetween(String value1, String value2) {
+            addCriterion("user_name not between", value1, value2, "userName");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateIsNull() {
+            addCriterion("create_date is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateIsNotNull() {
+            addCriterion("create_date is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateEqualTo(Date value) {
+            addCriterion("create_date =", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateNotEqualTo(Date value) {
+            addCriterion("create_date <>", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateGreaterThan(Date value) {
+            addCriterion("create_date >", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_date >=", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateLessThan(Date value) {
+            addCriterion("create_date <", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateLessThanOrEqualTo(Date value) {
+            addCriterion("create_date <=", value, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateIn(List<Date> values) {
+            addCriterion("create_date in", values, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateNotIn(List<Date> values) {
+            addCriterion("create_date not in", values, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateBetween(Date value1, Date value2) {
+            addCriterion("create_date between", value1, value2, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateDateNotBetween(Date value1, Date value2) {
+            addCriterion("create_date not between", value1, value2, "createDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateIsNull() {
+            addCriterion("modify_date is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateIsNotNull() {
+            addCriterion("modify_date is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateEqualTo(Date value) {
+            addCriterion("modify_date =", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateNotEqualTo(Date value) {
+            addCriterion("modify_date <>", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateGreaterThan(Date value) {
+            addCriterion("modify_date >", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateGreaterThanOrEqualTo(Date value) {
+            addCriterion("modify_date >=", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateLessThan(Date value) {
+            addCriterion("modify_date <", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateLessThanOrEqualTo(Date value) {
+            addCriterion("modify_date <=", value, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateIn(List<Date> values) {
+            addCriterion("modify_date in", values, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateNotIn(List<Date> values) {
+            addCriterion("modify_date not in", values, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateBetween(Date value1, Date value2) {
+            addCriterion("modify_date between", value1, value2, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andModifyDateNotBetween(Date value1, Date value2) {
+            addCriterion("modify_date not between", value1, value2, "modifyDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIsNull() {
+            addCriterion("is_use is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIsNotNull() {
+            addCriterion("is_use is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseEqualTo(String value) {
+            addCriterion("is_use =", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotEqualTo(String value) {
+            addCriterion("is_use <>", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseGreaterThan(String value) {
+            addCriterion("is_use >", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseGreaterThanOrEqualTo(String value) {
+            addCriterion("is_use >=", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseLessThan(String value) {
+            addCriterion("is_use <", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseLessThanOrEqualTo(String value) {
+            addCriterion("is_use <=", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseLike(String value) {
+            addCriterion("is_use like", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotLike(String value) {
+            addCriterion("is_use not like", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIn(List<String> values) {
+            addCriterion("is_use in", values, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotIn(List<String> values) {
+            addCriterion("is_use not in", values, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseBetween(String value1, String value2) {
+            addCriterion("is_use between", value1, value2, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotBetween(String value1, String value2) {
+            addCriterion("is_use not between", value1, value2, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateIsNull() {
+            addCriterion("use_date is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateIsNotNull() {
+            addCriterion("use_date is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateEqualTo(String value) {
+            addCriterion("use_date =", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateNotEqualTo(String value) {
+            addCriterion("use_date <>", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateGreaterThan(String value) {
+            addCriterion("use_date >", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateGreaterThanOrEqualTo(String value) {
+            addCriterion("use_date >=", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateLessThan(String value) {
+            addCriterion("use_date <", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateLessThanOrEqualTo(String value) {
+            addCriterion("use_date <=", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateLike(String value) {
+            addCriterion("use_date like", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateNotLike(String value) {
+            addCriterion("use_date not like", value, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateIn(List<String> values) {
+            addCriterion("use_date in", values, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateNotIn(List<String> values) {
+            addCriterion("use_date not in", values, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateBetween(String value1, String value2) {
+            addCriterion("use_date between", value1, value2, "useDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseDateNotBetween(String value1, String value2) {
+            addCriterion("use_date not between", value1, value2, "useDate");
+            return (Criteria) this;
+        }
+
+
+
+        public Criteria andUseByIsNull() {
+            addCriterion("use_by is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByIsNotNull() {
+            addCriterion("use_by is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByEqualTo(String value) {
+            addCriterion("use_by =", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByNotEqualTo(String value) {
+            addCriterion("use_by <>", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByGreaterThan(String value) {
+            addCriterion("use_by >", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByGreaterThanOrEqualTo(String value) {
+            addCriterion("use_by >=", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByLessThan(String value) {
+            addCriterion("use_by <", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByLessThanOrEqualTo(String value) {
+            addCriterion("use_by <=", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByLike(String value) {
+            addCriterion("use_by like", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByNotLike(String value) {
+            addCriterion("use_by not like", value, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByIn(List<String> values) {
+            addCriterion("use_by in", values, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByNotIn(List<String> values) {
+            addCriterion("use_by not in", values, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByBetween(String value1, String value2) {
+            addCriterion("use_by between", value1, value2, "useBy");
+            return (Criteria) this;
+        }
+
+        public Criteria andUseByNotBetween(String value1, String value2) {
+            addCriterion("use_by not between", value1, value2, "useBy");
+            return (Criteria) this;
+        }
+
+
+        public Criteria andLastUseDateIsNull() {
+            addCriterion("last_use_date is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateIsNotNull() {
+            addCriterion("last_use_date is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateEqualTo(Date value) {
+            addCriterion("last_use_date =", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateNotEqualTo(Date value) {
+            addCriterion("last_use_date <>", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateGreaterThan(Date value) {
+            addCriterion("last_use_date >", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateGreaterThanOrEqualTo(Date value) {
+            addCriterion("last_use_date >=", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateLessThan(Date value) {
+            addCriterion("last_use_date <", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateLessThanOrEqualTo(Date value) {
+            addCriterion("last_use_date <=", value, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateIn(List<Date> values) {
+            addCriterion("last_use_date in", values, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateNotIn(List<Date> values) {
+            addCriterion("last_use_date not in", values, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateBetween(Date value1, Date value2) {
+            addCriterion("last_use_date between", value1, value2, "lastUseDate");
+            return (Criteria) this;
+        }
+
+        public Criteria andLastUseDateNotBetween(Date value1, Date value2) {
+            addCriterion("last_use_date not between", value1, value2, "lastUseDate");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * t_promo_code
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * t_promo_code 2019-10-25
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 5 - 0
src/main/java/com/shawn/model/param/StatisticsParam.java

@@ -8,6 +8,8 @@ import lombok.Setter;
 import lombok.ToString;
 import lombok.experimental.Accessors;
 
+import java.util.List;
+
 @Accessors(chain = true)
 @NoArgsConstructor
 @Getter
@@ -20,6 +22,9 @@ public class StatisticsParam {
     @ApiModelProperty(value="设备id")
     private String equipmentId;
 
+    @ApiModelProperty(value="地址id")
+    private List<Long> areaIds;
+
     @ApiModelProperty(value="开始日期")
     private String startDate;
 

+ 49 - 0
src/main/java/com/shawn/model/param/TPromoCodeParam.java

@@ -0,0 +1,49 @@
+
+package com.shawn.model.param;
+
+import com.shawn.common.myAnnotation.CamelCaseToUnderscore;
+import com.shawn.model.entity.TPromoCode;
+import com.shawn.model.entity.TWeixin;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+@SuppressWarnings("serial")
+@Accessors(chain = true)
+@NoArgsConstructor
+@Getter
+@Setter
+@ToString
+public class TPromoCodeParam extends TPromoCode {
+	@CamelCaseToUnderscore
+    @ApiModelProperty(value = "排序,如:id desc")
+    private String orderByClause;
+    @ApiModelProperty(value = "是否distinct")
+    private boolean distinct;
+    @ApiModelProperty(value = "分页,展示多少条记录")
+    private Integer limit;
+    @ApiModelProperty(value = "分页,从第几条开始,默认从0开始")
+    private Integer offset;
+    @ApiModelProperty(value = "主键id 集合,用于批量删除和批量修改")
+    private List primaryKeyList;
+    private List<TWeixin> entityList;//实体集合,用于批量新增
+    
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	private Date createDate_start;
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	private Date createDate_end;
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	private Date modifyDate_start;
+	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	private Date modifyDate_end;
+
+/*==================================以上是自动生成部分字段======================================*/
+	
+}

+ 6 - 0
src/main/java/com/shawn/repository/TEquipmentMapper.java

@@ -11,10 +11,16 @@ import com.shawn.model.param.StatisticsParam;
 import com.shawn.model.param.TEquipmentParam;
 import com.shawn.repository.base.BaseDaoInterface;
 
+import java.util.List;
+
 public interface TEquipmentMapper extends BaseDaoInterface<TEquipment,TEquipmentExample,TEquipmentParam, Long>{
     String findMachineTotalNum(StatisticsParam param);
 
     String findMachineUseNum(StatisticsParam param);
 
     String getMuchaineNum(StatisticsParam param);
+
+    List<TEquipment> findByArea(Long id);
+
+    List<TEquipment> findByAdmin(Long adminId);
 }

+ 5 - 0
src/main/java/com/shawn/repository/TOrderMapper.java

@@ -9,10 +9,12 @@ import com.shawn.model.Bean.ChartBean;
 import com.shawn.model.entity.TOrder;
 import com.shawn.model.entity.TOrderExample;
 import com.shawn.model.param.StatisticsParam;
+import com.shawn.model.param.TAreaParam;
 import com.shawn.model.param.TOrderParam;
 import com.shawn.repository.base.BaseDaoInterface;
 
 import java.util.List;
+import java.util.Map;
 
 public interface TOrderMapper extends BaseDaoInterface<TOrder,TOrderExample,TOrderParam, Long>{
 
@@ -31,4 +33,7 @@ public interface TOrderMapper extends BaseDaoInterface<TOrder,TOrderExample,TOrd
     public List<ChartBean> getEquipmentStatistics(StatisticsParam param);
 
     String getProvincePrice(StatisticsParam param);
+
+    Double getAreaPrice(Map<String, Object> param);
+//    String getAreaPrice(StatisticsParam param);
 }

+ 11 - 0
src/main/java/com/shawn/repository/TPromoCodeMapper.java

@@ -0,0 +1,11 @@
+package com.shawn.repository;
+
+import com.shawn.model.entity.TPromoCode;
+import com.shawn.model.entity.TPromoCodeExample;
+import com.shawn.model.param.TPromoCodeParam;
+import com.shawn.repository.base.BaseDaoInterface;
+
+public interface TPromoCodeMapper extends BaseDaoInterface<TPromoCode, TPromoCodeExample, TPromoCodeParam,Integer>{
+
+    Double findPrice();
+}

+ 7 - 0
src/main/java/com/shawn/service/impl/TAreaServiceImpl.java

@@ -14,6 +14,9 @@ import com.shawn.model.param.TAreaParam;
 import com.shawn.repository.TAreaMapper;
 import com.shawn.service.base.BaseService;
 import com.shawn.service.interfac.TAreaServiceInterface;
+
+import java.util.List;
+
 @Service
 public class TAreaServiceImpl extends BaseService<TArea,TAreaExample,TAreaParam,Long> implements TAreaServiceInterface{
 	@Autowired
@@ -28,4 +31,8 @@ public class TAreaServiceImpl extends BaseService<TArea,TAreaExample,TAreaParam,
 		return "TArea";
 	}
 
+	@Override
+	public List<TArea> getProvinceList() {
+		return tAreaMapper.getProvinceList();
+	}
 }

+ 75 - 7
src/main/java/com/shawn/service/impl/TOrderServiceImpl.java

@@ -6,19 +6,16 @@
 package com.shawn.service.impl;
 
 import com.shawn.constant.ChartType;
-import com.shawn.model.Bean.ChartBean;
-import com.shawn.model.Bean.ChartColumn;
-import com.shawn.model.Bean.ChartColumn2;
-import com.shawn.model.Bean.ChartSerie;
-import com.shawn.model.entity.TArea;
-import com.shawn.model.entity.TOrder;
-import com.shawn.model.entity.TOrderExample;
+import com.shawn.model.Bean.*;
+import com.shawn.model.entity.*;
 import com.shawn.model.param.StatisticsParam;
 import com.shawn.model.param.TOrderParam;
 import com.shawn.repository.TAreaMapper;
 import com.shawn.repository.TEquipmentMapper;
 import com.shawn.repository.TOrderMapper;
 import com.shawn.service.base.BaseService;
+import com.shawn.service.interfac.TAdminServiceInterface;
+import com.shawn.service.interfac.TAreaServiceInterface;
 import com.shawn.service.interfac.TOrderServiceInterface;
 import com.shawn.web.exception.MyException;
 import lombok.extern.slf4j.Slf4j;
@@ -50,6 +47,12 @@ public class TOrderServiceImpl extends BaseService<TOrder, TOrderExample, TOrder
     @Autowired
     private TAreaMapper tAreaMapper;
 
+    @Autowired
+    private TAreaServiceInterface tAreaServiceInterface;
+
+    @Autowired
+    private TAdminServiceInterface tAdminService;
+
     @Override
     public ChartColumn getStatistics(StatisticsParam param) {
 
@@ -177,4 +180,69 @@ public class TOrderServiceImpl extends BaseService<TOrder, TOrderExample, TOrder
         chartColumn.setCategories(categories);
         return chartColumn;
     }
+
+    /**
+     *  统计 各个省份销售排行
+     * @param param
+     * @return
+     */
+    @Override
+    public ChartColumn2 getProvinceAll(StatisticsParam param) {
+        //获取有多少个省份
+        List<TArea> list1 = tAreaMapper.getProvinceList();
+        Map<Long, String> map1 = new HashMap<>();
+        for (TArea area : list1) {
+            String fullname = area.getFullName();
+            String provinceName = fullname.substring(0, 3);
+            String treePath = area.getTreePath();
+            String[] str = treePath.split(",");
+            Long s = null;
+            if (str.length > 1) {
+                s = Long.valueOf(str[1]);
+            }
+            if (str.length <= 1) {
+                s = area.getId();
+            }
+            map1.put(s, provinceName);
+        }
+        Map<String, Long> map2 = new HashMap<>();
+        for (Long key : map1.keySet()) {
+            //当前时间之前某个省总有多少台机器
+            param.setAdminId(String.valueOf(key));
+            param.setChartType(map1.get(key));
+//            String num = tEquipmentMapper.getMuchaineNum(param);
+            String price = tOrderMapper.getProvincePrice(param);
+            if (price != null) {
+                Double Price = Double.valueOf(price);
+                map2.put(map1.get(key), Math.round(Price));
+            }
+        }
+
+        List<Map.Entry<String, Long>> infoIds = new ArrayList<Map.Entry<String, Long>>(map2.entrySet());
+        Collections.sort(infoIds, new Comparator<Map.Entry<String, Long>>() {
+            public int compare(Map.Entry<String, Long> o1,
+                               Map.Entry<String, Long> o2) {
+                return (int)(o2.getValue() - o1.getValue());
+            }
+        });
+        ChartColumn2 chartColumn = new ChartColumn2();
+        ArrayList<ChartSerie> series = new ArrayList<>();
+        ChartSerie chartSerie=new ChartSerie();
+        ArrayList<String> categories = new ArrayList<>();
+        ArrayList<Integer> data = new ArrayList<>();
+        for(Map.Entry<String, Long> a:infoIds){
+            categories.add(a.getKey());
+            data.add(Math.toIntExact(a.getValue()));
+        }
+        chartSerie.setName("销售额");
+        chartSerie.setData(data);
+        series.add(chartSerie);
+        chartColumn.setSeries(series);
+        chartColumn.setCategories(categories);
+        return chartColumn;
+    }
+    @Override
+    public Double getAreaPrice(Map<String, Object> params) {
+        return tOrderMapper.getAreaPrice(params);
+    }
 }

+ 29 - 0
src/main/java/com/shawn/service/impl/TPromoCodeServiceImpl.java

@@ -0,0 +1,29 @@
+package com.shawn.service.impl;
+
+import com.shawn.model.entity.TPromoCode;
+import com.shawn.model.entity.TPromoCodeExample;
+import com.shawn.model.param.TPromoCodeParam;
+import com.shawn.repository.TPromoCodeMapper;
+import com.shawn.service.base.BaseService;
+import com.shawn.service.interfac.TPromoCodeServiceInterface;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class TPromoCodeServiceImpl extends BaseService<TPromoCode, TPromoCodeExample, TPromoCodeParam,Integer> implements TPromoCodeServiceInterface {
+    @Autowired
+    private TPromoCodeMapper tPromoCodeMapper;
+    @Autowired
+    public TPromoCodeServiceImpl(TPromoCodeMapper dao) {
+        super(dao);
+    }
+    @Override
+    public String getResourceName() {
+        return "TPromoCode";
+    }
+
+    @Override
+    public Double findPrice() {
+        return tPromoCodeMapper.findPrice();
+    }
+}

+ 3 - 0
src/main/java/com/shawn/service/interfac/TAreaServiceInterface.java

@@ -10,5 +10,8 @@ import com.shawn.model.entity.TAreaExample;
 import com.shawn.model.param.TAreaParam;
 import com.shawn.service.base.BaseServiceInterface;
 
+import java.util.List;
+
 public interface TAreaServiceInterface extends BaseServiceInterface<TArea,TAreaExample,TAreaParam,Long>{
+    List<TArea> getProvinceList();
 }

+ 5 - 0
src/main/java/com/shawn/service/interfac/TOrderServiceInterface.java

@@ -15,6 +15,7 @@ import com.shawn.model.param.TOrderParam;
 import com.shawn.service.base.BaseServiceInterface;
 
 import java.util.List;
+import java.util.Map;
 
 public interface TOrderServiceInterface extends BaseServiceInterface<TOrder,TOrderExample,TOrderParam,Long>{
 
@@ -34,4 +35,8 @@ public interface TOrderServiceInterface extends BaseServiceInterface<TOrder,TOrd
      * @return
      */
     ChartColumn2 getProvince(StatisticsParam param);
+
+    Double getAreaPrice(Map<String, Object> params);
+
+    ChartColumn2 getProvinceAll(StatisticsParam param);
 }

+ 11 - 0
src/main/java/com/shawn/service/interfac/TPromoCodeServiceInterface.java

@@ -0,0 +1,11 @@
+package com.shawn.service.interfac;
+
+import com.shawn.model.entity.TPromoCode;
+import com.shawn.model.entity.TPromoCodeExample;
+import com.shawn.model.param.TPromoCodeParam;
+import com.shawn.service.base.BaseServiceInterface;
+
+public interface TPromoCodeServiceInterface extends BaseServiceInterface<TPromoCode, TPromoCodeExample, TPromoCodeParam,Integer>{
+
+    Double findPrice();
+}

+ 260 - 0
src/main/java/com/shawn/util/JoinpayConstant.java

@@ -0,0 +1,260 @@
+package com.shawn.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 汇聚支付 常量
+ */
+public class JoinpayConstant {
+
+
+    /**
+     * 商户编码
+     */
+    public final static String mch_no = "888106600000003";
+
+
+    /**
+     * 商户密钥 : MD5
+     */
+    public final static String key = "8cb1d25eba7d4f3caecf1f0569150e04";
+
+
+    /**
+     * 汇聚公钥
+     */
+    public final static String publickey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLgawJlQ3O8/O9YmJt6mi0pzh9JiDGp2G6IW3p8NTZXE5tIBZRbQAkHnr/zaLh0kDHMtIGAcGUtgXilRxXeUIuc0/j561YLsxAORma2XerniRCLWrXS4yM8F1/813Rv21JoNFkDZWHdTgEpKTH8GaGYOHiEytIN0LvPzEvNsimWQIDAQAB";
+
+    /**
+     * >>>>>>>>>>>>> 币种 >>>>>>>>>>>>>
+     *
+     */
+    /**
+     * 人民币
+     */
+    public final static String Cur_RMB = "1";
+
+
+    /**
+     *  支付成功回调
+     */
+    public final static String Notify_Url = "http://app.sunzee.com.cn/api/order/notify.htm";
+
+    public final static String Notify_Url_PromoCode = "http://app.sunzee.com.cn/api/order/promoCodeNotify.htm";
+
+    public final static Map<String,String> Result_status = new HashMap<>();
+    /**
+     *  退款成功回调
+     */
+    public final static String Notify_Refund_Url = "http://app.sunzee.com.cn/api/order/notifyRefund.htm";
+
+
+    /**
+     * 支付回调支付状态代码
+     */
+    public final static String r6_Status_100 = "100";
+    public final static String r6_Status_101 = "101";
+
+    /**
+     * >>>>>>>>>>>>> 签名类型 >>>>>>>>>>>>>
+     * 1=MD5,2=RSA
+     */
+    public final static String sign_type_MD5 = "1";
+    public final static String sign_type_RSA = "2";
+
+
+    /**
+     * >>>>>>>>>>>>> 分账方商户类型 >>>>>>>>>>>>>
+     * 10:个人,11:个体工商户,12:企业
+     */
+    public final static Integer alt_merchant_type1 = 10;
+    public final static Integer alt_merchant_type2 = 11;
+    public final static Integer alt_merchant_type3 = 12;
+
+    /**
+     * >>>>>>>>>>>>> 分账方结算方式 >>>>>>>>>>>>>
+     * 1 由汇聚自动结算
+     * 2 由商户平台手工结算(结算接口)
+     */
+    public final static Integer sett_mode1 = 1;
+    public final static Integer sett_mode2 = 2;
+
+
+    /**
+     * >>>>>>>>>>>>> 结算周期类型 >>>>>>>>>>>>>
+     * 1 工作日,2 自然日,3 月结日
+     */
+    public final static Integer sett_date_type1 = 1;
+    public final static Integer sett_date_type2 = 2;
+    public final static Integer sett_date_type3 = 3;
+
+
+    /**
+     * >>>>>>>>>>>>> 账户类型 >>>>>>>>>>>>>
+     * 1 借记卡,4 对公账户
+     */
+    public final static Integer bank_account_type1 = 1;
+    public final static Integer bank_account_type4 = 4;
+
+
+    /**
+     *
+     *
+     *  >>>>>>>>>>>>> 响应码 >>>>>>>>>>>>>
+     *
+     *
+     */
+
+    /**
+     * 受理响应码
+     */
+    public static final Map<String, String> resp_code = new HashMap<>();
+    public static final String resp_code1 = "A1000";
+    public static final String resp_code2 = "A2000";
+    public static final String resp_code3 = "A3000";
+
+    static {
+        resp_code.put(resp_code1, "受理成功");
+        resp_code.put(resp_code2, "受理失败,具体失败原因查看业务响应码");
+        resp_code.put(resp_code3, "受理未知(如:接口调用超时)");
+    }
+
+    /**
+     * 商户状态
+     */
+    public static final Map<String, String> order_status = new HashMap<>();
+    public static final String order_status1 = "P0001";
+    public static final String order_status2 = "P1000";
+    public static final String order_status3 = "P2000";
+    public static final String order_status4 = "P3000";
+    public static final String order_status5 = "P3001";
+    public static final String order_status6 = "P3002";
+    public static final String order_status7 = "P3003";
+
+    static {
+        order_status.put(order_status1, "待处理中(受理中)");
+        order_status.put(order_status2, "交易成功");
+        order_status.put(order_status3, "交易失败");
+        order_status.put(order_status4, "结果未知");
+        order_status.put(order_status5, "处理中");
+        order_status.put(order_status6, "激活");
+        order_status.put(order_status7, "冻结");
+    }
+
+    /**
+     * 业务响应码
+     */
+    public static final Map<String, String> biz_code = new HashMap<>();
+    public static final String biz_code1 = "B100000";
+    public static final String biz_code2 = "B100001";
+    public static final String biz_code3 = "B100002";
+    public static final String biz_code4 = "B100003";
+    public static final String biz_code5 = "B101001";
+    public static final String biz_code6 = "B101002";
+    public static final String biz_code7 = "B101003";
+    public static final String biz_code8 = "B101004";
+    public static final String biz_code9 = "B101005";
+    public static final String biz_code10 = "B103012";
+    public static final String biz_code11 = "B103013";
+    public static final String biz_code12 = "B102001";
+
+    static {
+        biz_code.put(biz_code1, "受理成功");
+        biz_code.put(biz_code2, "验签失败");
+        biz_code.put(biz_code3, "验参失败");
+        biz_code.put(biz_code4, "结果未知,SYS_ERROR");
+        biz_code.put(biz_code5, "登录名已存在");
+        biz_code.put(biz_code6, "找不到卡bin");
+        biz_code.put(biz_code7, "联行号有误");
+        biz_code.put(biz_code8, "查找不到银行信息");
+        biz_code.put(biz_code9, "不支持的结算卡类型");
+        biz_code.put(biz_code10, "担保账户不存在");
+        biz_code.put(biz_code11, "担保账户余额不足");
+        biz_code.put(biz_code12, "分账方不存在");
+    }
+
+
+    /**
+     * >>>>>>>>>>>>> 支付交易类型 >>>>>>>>>>>>>
+     */
+    public static final Map<String, String> frp_code = new HashMap<>();
+    public static final String frp_code_ALIPAY_NATIVE = "ALIPAY_NATIVE";
+    public static final String frp_code_ALIPAY_CARD = "ALIPAY_CARD";
+    public static final String frp_code_ALIPAY_APP = "ALIPAY_APP";
+    public static final String frp_code_ALIPAY_H5 = "ALIPAY_H5";
+    public static final String frp_code_ALIPAY_FWC = "ALIPAY_FWC";
+    public static final String frp_code_ALIPAY_SYT = "ALIPAY_SYT";
+    public static final String frp_code_WEIXIN_NATIVE = "WEIXIN_NATIVE";
+    public static final String frp_code_WEIXIN_CARD = "WEIXIN_CARD";
+    public static final String frp_code_WEIXIN_APP = "WEIXIN_APP";
+    public static final String frp_code_WEIXIN_APP2 = "WEIXIN_APP2";
+    public static final String frp_code_WEIXIN_H5 = "WEIXIN_H5";
+    public static final String frp_code_WEIXIN_GZH = "WEIXIN_GZH";
+    public static final String frp_code_WEIXIN_XCX = "WEIXIN_XCX";
+    public static final String frp_code_JD_NATIVE = "JD_NATIVE";
+    public static final String frp_code_JD_CARD = "JD_CARD";
+    public static final String frp_code_JD_APP = "JD_APP";
+    public static final String frp_code_JD_H5 = "JD_H5";
+    public static final String frp_code_QQ_NATIVE = "QQ_NATIVE";
+    public static final String frp_code_QQ_CARD = "QQ_CARD";
+    public static final String frp_code_QQ_APP = "QQ_APP";
+    public static final String frp_code_QQ_H5 = "QQ_H5";
+    public static final String frp_code_QQ_GZH = "QQ_GZH";
+    public static final String frp_code_UNIONPAY_NATIVE = "UNIONPAY_NATIVE";
+    public static final String frp_code_UNIONPAY_CARD = "UNIONPAY_CARD";
+    public static final String frp_code_UNIONPAY_APP = "UNIONPAY_APP";
+    public static final String frp_code_UNIONPAY_H5 = "UNIONPAY_H5";
+    public static final String frp_code_BAIDU_NATIVE = "BAIDU_NATIVE";
+    public static final String frp_code_SUNING_NATIVE = "SUNING_NATIVE";
+
+
+    static {
+        biz_code.put(frp_code_ALIPAY_NATIVE, "支付宝扫码(主扫)");
+        biz_code.put(frp_code_ALIPAY_CARD, "支付宝刷卡(被扫)");
+        biz_code.put(frp_code_ALIPAY_APP, "支付宝APP 支付");
+        biz_code.put(frp_code_ALIPAY_H5, "支付宝H5");
+        biz_code.put(frp_code_ALIPAY_FWC, "支付宝服务窗");
+        biz_code.put(frp_code_ALIPAY_SYT, "支付宝收银台");
+        biz_code.put(frp_code_WEIXIN_NATIVE, "微信扫码(主扫)");
+        biz_code.put(frp_code_WEIXIN_CARD, "微信刷卡(被扫)");
+        biz_code.put(frp_code_WEIXIN_APP, "微信APP 支付");
+        biz_code.put(frp_code_WEIXIN_APP2, "微信APP2 支付");
+        biz_code.put(frp_code_WEIXIN_H5, "微信H5 支付");
+        biz_code.put(frp_code_WEIXIN_GZH, "微信公众号支付");
+        biz_code.put(frp_code_WEIXIN_XCX, "微信小程序支付");
+        biz_code.put(frp_code_JD_NATIVE, "京东扫码(主扫)");
+        biz_code.put(frp_code_JD_CARD, "京东刷卡(被扫)");
+        biz_code.put(frp_code_JD_APP, "京东APP 支付");
+        biz_code.put(frp_code_JD_H5, "京东H5 支付");
+        biz_code.put(frp_code_QQ_NATIVE, "QQ 扫码(主扫)");
+        biz_code.put(frp_code_QQ_CARD, "QQ 刷卡(被扫)");
+        biz_code.put(frp_code_QQ_APP, "QQ APP 支付");
+        biz_code.put(frp_code_QQ_H5, "QQH5 支付");
+        biz_code.put(frp_code_QQ_GZH, "QQ 公众号支付");
+        biz_code.put(frp_code_UNIONPAY_NATIVE, "银联扫码(主扫)");
+        biz_code.put(frp_code_UNIONPAY_CARD, "银联刷卡(被扫)");
+        biz_code.put(frp_code_UNIONPAY_APP, "银联APP 支付");
+        biz_code.put(frp_code_UNIONPAY_H5, "银联H5");
+        biz_code.put(frp_code_BAIDU_NATIVE, "百度扫码(主扫)");
+        biz_code.put(frp_code_SUNING_NATIVE, "苏宁扫码(主扫)");
+    }
+
+
+    /**
+     *
+     *
+     *  >>>>>>>>>>>>> 汇聚支付接口 >>>>>>>>>>>>>
+     *
+     *
+     */
+
+    /**
+     * 版本
+     */
+    public static final String pay_version = "1.0";
+
+
+
+
+}

+ 11 - 0
src/main/java/com/shawn/web/controller/TAdminController.java

@@ -63,5 +63,16 @@ public class TAdminController extends BaseController<TAdmin,TAdminExample,TAdmin
 				.body(new ResultMessage().setCode(false).setData(null).setMessage("用户名或密码错误"));
 
 	}
+	/**
+	 *
+	 * @param param
+	 * @return
+	 */
+	@PostMapping("/findById")
+	public ResponseEntity<?> findById(@RequestBody TAdmin param) {
+		TAdmin tAdmin = tAdminService.selectEntityById(param.getId());
+		return ResponseEntity.status(HttpStatus.OK)
+				.body(new ResultMessage().setCode(false).setData(tAdmin).setMessage(""));
 
+	}
 }

+ 325 - 10
src/main/java/com/shawn/web/controller/TEquipmentController.java

@@ -5,18 +5,23 @@
 
 package com.shawn.web.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.stream.Collectors;
 
+import com.shawn.model.Bean.Child;
+import com.shawn.model.Bean.Childlast;
+import com.shawn.model.Bean.Children2;
+import com.shawn.model.Bean.Children3;
 import com.shawn.model.dto.TAdminDTO;
 import com.shawn.model.dto.TEquipmentDTO;
-import com.shawn.model.entity.TAdmin;
-import com.shawn.model.entity.TAlarmRecord;
+import com.shawn.model.entity.*;
 import com.shawn.model.param.StatisticsParam;
-import com.shawn.service.interfac.TAdminServiceInterface;
-import com.shawn.service.interfac.TAlarmRecordServiceInterface;
+import com.shawn.model.param.TAreaParam;
+import com.shawn.repository.TAreaMapper;
+import com.shawn.repository.TEquipmentMapper;
+import com.shawn.repository.TOrderMapper;
+import com.shawn.service.interfac.*;
 import com.shawn.util.BeanUtils;
 import com.shawn.util.PushUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,10 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.shawn.model.dto.ResultMessage;
 import com.shawn.web.controller.base.BaseController;
-import com.shawn.model.entity.TEquipment;
-import com.shawn.model.entity.TEquipmentExample;
 import com.shawn.model.param.TEquipmentParam;
-import com.shawn.service.interfac.TEquipmentServiceInterface;
 
 import lombok.extern.apachecommons.CommonsLog;
 @CommonsLog
@@ -45,7 +47,19 @@ public class TEquipmentController extends BaseController<TEquipment,TEquipmentEx
 	private TAdminServiceInterface tAdminService;
 	@Autowired
 	private TAlarmRecordServiceInterface tAlarmRecordService;
+	@Autowired
+	private TAreaServiceInterface tAreaServiceInterface;
+	@Autowired
+	private TOrderServiceInterface tOrderServiceInterface;
 
+	@Autowired
+	private TEquipmentMapper tEquipmentMapper;
+
+	@Autowired
+	private TAreaMapper tAreaMapper;
+
+	@Autowired
+	private TOrderMapper tOrderMapper;
 
 	@Autowired
 	public TEquipmentController(TEquipmentServiceInterface service) {
@@ -137,6 +151,14 @@ public class TEquipmentController extends BaseController<TEquipment,TEquipmentEx
 		}
 
 	}
+	//根据机器id获取用户信息
+	@PostMapping("/findByEquipment")
+	public ResponseEntity<?> findByEquipment(@RequestBody TEquipment equipment){
+		TEquipment tEquipment = tEquipmentService.selectEntityById(equipment.getId());
+		TAdmin tAdmin = tAdminService.selectEntityById(tEquipment.getAdminId());
+		return  ResponseEntity.status(HttpStatus.OK)
+					.body(new ResultMessage().setCode(false).setData(tAdmin).setMessage(""));
+	}
 	//获取机器数量
 	@PostMapping("/getMachineNum")
 	public ResponseEntity<?> getMachineNum(@RequestBody StatisticsParam param) {
@@ -195,4 +217,297 @@ public class TEquipmentController extends BaseController<TEquipment,TEquipmentEx
 						.setData("SUCCESS")
 						.setMessage("SUCCESS"));
 	}
+
+	@PostMapping("/getEquipmentListByProvince")
+	public ResponseEntity<?> getEquipmentListByProvince(@RequestBody TAdmin param) {
+		List<TAdminDTO> resultList = new ArrayList<>();
+		if("admin".equals(param.getUsername())){ // 管理员查所有商家
+			//获取有多少个省份
+			List<TArea> list1 = tAreaServiceInterface.getProvinceList();
+			Map<Long, String> map1 = new HashMap<>();
+			for (TArea area : list1) {
+				String fullname = area.getFullName();
+				String provinceName = fullname.substring(0, 3);
+				String treePath = area.getTreePath();
+				String[] str = treePath.split(",");
+				Long s = null;
+				if (str.length > 1) {
+					s = Long.valueOf(str[1]);
+				}
+				if (str.length <= 1) {
+					s = area.getId();
+				}
+				map1.put(s, provinceName);
+			}
+
+			List<Children3> children3List = new ArrayList<>();
+			for (Long key : map1.keySet()) {
+				Children3 children3 = new Children3();
+				children3.setId(key);
+//				children3.setName(map1.get(key));
+				int pday = 0 ;
+				int pweek = 0 ;
+				int pmonth = 0 ;
+				int pyear = 0 ;
+				Set<Long> province = new HashSet<>();
+				//本省有多少个市
+				Map<Long,String> cityMap = new HashMap<>();
+				for (TArea carea : list1) {
+					String fullName = carea.getFullName();
+					if(fullName.substring(0,3).equals(map1.get(key))){
+						province.add(carea.getId());
+						if(key.equals(carea.getParent())){
+							cityMap.put(carea.getId(),carea.getName());
+						}else{
+							TArea cityArea = tAreaServiceInterface.selectEntityById(carea.getParent());
+							cityMap.put(cityArea.getId(),cityArea.getName());
+						}
+					}
+				}
+				List<Children2> children2List = new ArrayList<>();
+				//有多少个市,市有多少个商家
+				for (Long citykey : cityMap.keySet()) {
+					for (TArea area : list1) {
+
+					  String fullName = area.getFullName();
+					  if(fullName.substring(0,3).equals(map1.get(key))){
+							//市级
+							Children2 children2 = new Children2();
+							//市级下所有商家集合
+							List<Child> Children = new ArrayList<>();
+							//属于这个市的所以设备的areaid
+							Set<Long> city = new HashSet<>();
+						  		//添加市级
+								if((area.getId()).equals(citykey)||(area.getParent()).equals(citykey)){
+									children2.setId(citykey);
+									for (TArea cityArea2 : list1) {
+										if((cityArea2.getId()).equals(citykey)||(cityArea2.getParent()).equals(citykey)){
+											city.add(cityArea2.getId());
+										}
+									}
+									children2.setCity(city);
+									int i = 0;
+									for(Children2 children21:children2List){
+										if(children21.getId().equals(citykey)){
+											i++;
+										}
+									}
+									if(i==0){
+										for(Long id:city){
+											List<Childlast> childlasts = new ArrayList<>();
+
+											List<TEquipment> equipments =tEquipmentMapper.findByArea(id);
+											TAdmin tAdmin = tAdminService.selectEntityById(equipments.get(0).getAdminId());
+											int k = 0;
+											for(Child child:Children){
+												if(child.getId().equals(tAdmin.getId())){
+													k++;
+												}
+											}
+											if(k==0){
+												//商家的机器
+												Child child =new Child();
+												child.setId(tAdmin.getId());
+												child.setName(tAdmin.getName());
+												Childlast childlast1 = new Childlast();
+												childlast1.setId(tAdmin.getId());
+												childlast1.setName("总销售情况");
+												Long adminId  = tAdmin.getId();
+												List<TEquipment> tEquipmentList=tEquipmentMapper.findByAdmin(adminId);
+												for(TEquipment tEquipment:tEquipmentList){
+													int j =0;
+													for(Long id1:city){
+														Long areaId=tEquipment.getAreaId();
+														if(areaId!=null&&areaId.equals(id1)){
+															j++;
+														}
+													}
+													if(j>0){
+														Childlast childlast2 = new Childlast();
+														childlast2.setId(tEquipment.getId());
+														childlast2.setName(tEquipment.getName());
+														childlasts.add(childlast2);
+													}
+												}
+												if(childlasts!=null){
+													childlasts.add(0,childlast1);
+												}
+												child.setChildren(childlasts);
+												Children.add(child);
+											}
+
+										}
+										children2.setChildren(Children);
+										//这个市的销售数据  日 周 月 年
+										List<Long> cityIds = new ArrayList();
+										for(Long cityid:city){
+											cityIds.add(cityid);
+										}
+										StringBuffer namelast = new StringBuffer();
+										namelast.append(cityMap.get(citykey)).append("  ");
+										String day = "";
+										String week = "";
+										String month = "";
+										String year = "";
+										//数据为空时要处理
+										for(int s=1;s<5;s++){
+											String startDate = null;
+											String endDate = null;
+											if(s==1){
+												//日
+												Date date = new Date();
+												SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy/MM/dd");
+												String format = dateFormat.format(date);
+												startDate = format;
+												endDate = format;
+												Map<String, Object> params = new HashMap<String, Object>();
+												params.put("areaIds",cityIds);
+												params.put("startDate",startDate);
+												params.put("endDate",endDate);
+												Double day1 = tOrderServiceInterface.getAreaPrice(params);
+													if(day1!=null){
+														double ceil = Math.ceil(day1);
+														int ceil1 = (int) ceil;
+														pday +=ceil1;
+														day = String.valueOf(ceil1);
+														namelast.append("-----日:").append(day);
+													}else{
+														namelast.append("-----日:0 ");
+													}
+											}
+											if(s==2){
+												//周
+												Map<String, String> weekDate = getWeekDate();
+												startDate = weekDate.get("mondayDate");
+												endDate = weekDate.get("sundayDate");
+												Map<String, Object> params = new HashMap<String, Object>();
+												params.put("areaIds",cityIds);
+												params.put("startDate",startDate);
+												params.put("endDate",endDate);
+												Double day1 = tOrderServiceInterface.getAreaPrice(params);
+												if(day1!=null){
+													double ceil = Math.ceil(day1);
+													int ceil1 = (int) ceil;
+													pweek +=ceil1;
+													week = String.valueOf(ceil1);
+													namelast.append(" 周:").append(week);
+												}else{
+													namelast.append(" 周:0 ");
+												}
+											}
+											if(s==3){
+												//月
+												SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy/MM/dd");
+												//获取当前月第一天:
+												Calendar c = Calendar.getInstance();
+												c.add(Calendar.MONTH, 0);
+												c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
+												String first = dateFormat.format(c.getTime());
+												//获取当前月最后一天
+												Calendar ca = Calendar.getInstance();
+												ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
+												String last = dateFormat.format(ca.getTime());
+												startDate = first;
+												endDate = last;
+												Map<String, Object> params = new HashMap<String, Object>();
+												params.put("areaIds",cityIds);
+												params.put("startDate",startDate);
+												params.put("endDate",endDate);
+												Double day1 = tOrderServiceInterface.getAreaPrice(params);
+												if(day1!=null){
+													double ceil = Math.ceil(day1);
+													int ceil1 = (int) ceil;
+													pmonth+=ceil1;
+													month = String.valueOf(ceil1);
+													namelast.append(" 月:").append(month);
+												}else{
+													namelast.append(" 月:0 ");
+												}
+											}
+											if(s==4){
+												//年
+												SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy/MM/dd");
+												Calendar cale = Calendar.getInstance();
+												int year1 = cale.get(Calendar.YEAR);
+												String y = String.valueOf(year1);
+												StringBuffer st = new StringBuffer();
+												st.append(y).append("/01/01");
+												startDate = st.toString();
+												StringBuffer e = new StringBuffer();
+												e.append(y).append("/12/30");
+												endDate = e.toString();
+												Map<String, Object> params = new HashMap<String, Object>();
+												params.put("areaIds",cityIds);
+												params.put("startDate",startDate);
+												params.put("endDate",endDate);
+												Double day1 = tOrderServiceInterface.getAreaPrice(params);
+												if(day1!=null){
+													double ceil = Math.ceil(day1);
+													int ceil1 = (int) ceil;
+													pyear +=ceil1;
+													year = String.valueOf(ceil1);
+													namelast.append(" 年:").append(year);
+												}else{
+													namelast.append(" 年:0 ");
+												}
+											}
+										}
+										children2.setName(namelast.toString());
+										children2List.add(children2);
+									}else{
+										i=0;
+									}
+								}
+						}
+					}
+				}
+				children3.setChildren(children2List);
+				children3.setProvince(province);
+
+				StringBuffer pnameLast = new StringBuffer();
+				pnameLast.append(map1.get(key)).append("-----日:").append(pday).append(" 周:").append(pweek).append(" 月:").append(pmonth).append(" 年:").append(pyear);
+				children3.setName(pnameLast.toString());
+				children3List.add(children3);
+
+			}
+			return ResponseEntity.status(HttpStatus.OK)
+					.body(new ResultMessage().setCode(true).setData(children3List).setMessage("SUCCESS"));
+
+		}else{ // 只查当前商家的设备列表
+			return ResponseEntity.status(HttpStatus.OK)
+					.body(new ResultMessage().setCode(true).setData(resultList).setMessage("SUCCESS"));
+		}
+
+//		return ResponseEntity.status(HttpStatus.OK)
+//				.body(new ResultMessage().setCode(true).setData(resultList).setMessage("SUCCESS"));
+
+	}
+	public static Map<String,String> getWeekDate() {
+		Map<String,String> map = new HashMap();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
+
+		Calendar cal = Calendar.getInstance();
+		cal.setFirstDayOfWeek(Calendar.MONDAY);// 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
+		int dayWeek = cal.get(Calendar.DAY_OF_WEEK);// 获得当前日期是一个星期的第几天
+		if(dayWeek==1){
+			dayWeek = 8;
+		}
+//		System.out.println("要计算日期为:" + sdf.format(cal.getTime())); // 输出要计算日期
+
+		cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - dayWeek);// 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
+		Date mondayDate = cal.getTime();
+		String weekBegin = sdf.format(mondayDate);
+//		System.out.println("所在周星期一的日期:" + weekBegin);
+
+
+		cal.add(Calendar.DATE, 4 +cal.getFirstDayOfWeek());
+		Date sundayDate = cal.getTime();
+		String weekEnd = sdf.format(sundayDate);
+//		System.out.println("所在周星期日的日期:" + weekEnd);
+
+		map.put("mondayDate", weekBegin);
+		map.put("sundayDate", weekEnd);
+		return map;
+	}
+
 }

+ 18 - 0
src/main/java/com/shawn/web/controller/TOrderController.java

@@ -104,4 +104,22 @@ public class TOrderController extends BaseController<TOrder,TOrderExample,TOrder
 						.setData(chartColumn)
 						.setMessage("SUCCESS"));
 	}
+	/**
+	 *  统计 各个省份销售排行
+	 * @param param
+	 * @return
+	 */
+	@PostMapping("/getProvinceAll")
+	public ResponseEntity<?> getProvinceAll(@RequestBody StatisticsParam param) {
+		log.info("param:{}", param);
+		FgObjectUtil.objectNullOrEmptySel(param, "chartType$");
+		ChartColumn2 chartColumn  = tOrderService.getProvinceAll(param);
+
+		return ResponseEntity
+				.status(HttpStatus.OK)
+				.body(new ResultMessage()
+						.setCode(true)
+						.setData(chartColumn)
+						.setMessage("SUCCESS"));
+	}
 }

+ 200 - 0
src/main/java/com/shawn/web/controller/TPromoCodeController.java

@@ -0,0 +1,200 @@
+package com.shawn.web.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.shawn.model.dto.ResultMessage;
+import com.shawn.model.entity.*;
+import com.shawn.model.param.TPromoCodeParam;
+import com.shawn.service.interfac.TAdminServiceInterface;
+import com.shawn.service.interfac.TEquipmentServiceInterface;
+import com.shawn.service.interfac.TPromoCodeServiceInterface;
+import com.shawn.util.JoinpayConstant;
+import com.shawn.web.controller.base.BaseController;
+import lombok.extern.apachecommons.CommonsLog;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@CommonsLog
+@RestController
+@RequestMapping("TPromoCode")
+public class TPromoCodeController extends BaseController<TPromoCode, TPromoCodeExample, TPromoCodeParam,Integer> {
+    @Autowired
+    public TPromoCodeController(TPromoCodeServiceInterface service) {
+        super(service);
+    }
+    @Autowired
+    private TPromoCodeServiceInterface tPromoCodeService;
+    @Override
+    protected TPromoCodeExample createNewExample() {
+        return new TPromoCodeExample();
+    }
+    @Autowired
+    private TAdminServiceInterface tAdminServiceInterface;
+    @Autowired
+    private TEquipmentServiceInterface tEquipmentServiceInterface;
+    /**
+     * 优惠码列表
+     * @param
+     * @return
+     */
+    @PostMapping("/findList")
+    public ResponseEntity<?> findList(@RequestBody TPromoCode tPromoCode) {
+        TPromoCodeExample example = new TPromoCodeExample();
+        TPromoCodeExample.Criteria criteria = example.createCriteria();
+        if(tPromoCode.getAdminId().equals("1")){
+
+        }else{
+            criteria.andAdminIdEqualTo(tPromoCode.getAdminId());
+        }
+
+        if(tPromoCode.getIsUse()!=null){
+            criteria.andIsUseEqualTo(tPromoCode.getIsUse());
+        }
+        List<TPromoCode> tPromoCodes = tPromoCodeService.selectByOption(example);
+        List<TPromoCode> tPromoCodes2 =new ArrayList<>();
+        if(tPromoCodes!=null){
+            for(TPromoCode tPromoCode1:tPromoCodes){
+                Date lastUseDate=tPromoCode1.getLastUseDate();
+                if(lastUseDate!=null&&lastUseDate.getTime()<((new Date()).getTime())){
+                    tPromoCode1.setIsUse("2");
+                    tPromoCodeService.updateById(tPromoCode1);
+                }
+                tPromoCodes2.add(tPromoCode1);
+            }
+        }
+
+        return ResponseEntity.status(HttpStatus.OK)
+                .body(new ResultMessage().setCode(true).setData(tPromoCodes2).setMessage("SUCCESS"));
+    }
+    /**
+     * 优惠码价格
+     * @param
+     * @return
+     */
+    @GetMapping("/findPrice")
+    public ResponseEntity<?> findPrice() {
+        Double price = tPromoCodeService.findPrice();
+        return ResponseEntity.status(HttpStatus.OK)
+                .body(new ResultMessage().setCode(true).setData(price).setMessage("SUCCESS"));
+    }
+    /**
+     * 购买优惠码
+     * @param
+     * @return
+     */
+    @GetMapping("/buy")
+    public ResponseEntity<?> buy(int number,Long id) {
+        TAdmin admin = tAdminServiceInterface.selectEntityById(id);
+        TEquipmentExample tEquipmentExample = new TEquipmentExample();
+        TEquipmentExample.Criteria criteria = tEquipmentExample.createCriteria();
+        criteria.andAdminIdEqualTo(id);
+        List<TEquipment> equipmentList = tEquipmentServiceInterface.selectByOption(tEquipmentExample);
+        TEquipment equipment = equipmentList.get(0);
+        Long equipmentId = equipment.getId();
+        TProportion proportion = proportionService.getUniqueness(equipment.getAdminId());
+        TProportion.Type type = proportion.getType();
+        Order.Type orderType = null;
+        Long agencyId = admin.getAgencyId();
+        Long merchantId = admin.getMerchantId();
+        Long personageId = admin.getPersonageId();
+        switch (type) {
+            case agency:
+                orderType = Order.Type.agency;
+                break;
+            case merchant:
+                orderType = Order.Type.merchant;
+                break;
+            case personage:
+                orderType = Order.Type.personage;
+                break;
+        }
+        Double money = null;
+        List<Price> prices = priceService.findAll();
+        for(Price price:prices){
+            if(price.getName().equals("优惠码")){
+                money = price.getPrice();
+            }
+        }
+
+        String sn = orderService.initSn(equipmentId);
+        String orderNo = sn;
+        String productName = "优惠码";
+        BigDecimal price = BigDecimal.valueOf(money*number);
+        BigDecimal cutPrice = price.multiply(new BigDecimal(100)).divide(new BigDecimal(100));
+        BigDecimal amount = cutPrice;
+        String productDesc = "";
+        String commonParameter = "";
+        String returnUrl = null;
+        String notifyUrl = JoinpayConstant.Notify_Url_PromoCode;
+        String isShowPic = "1";
+        String openId = null;
+        String authCode = null;
+        String appid = null;
+        String transactionModel = null;
+        String tradeMerchantNo = null;
+        String buyerId = null;
+        String isAlt = "0";
+        String altType = null;
+        String altUrl = null;
+        BigDecimal marketingAmount = null;
+
+//        com.hboxs.entity.Order order = new com.hboxs.entity.Order(sn, product.getId(), productName, price, equipment.getClientId(), equipmentId,
+//                orderType, admin.getId(), agencyId, merchantId, personageId,
+//                frpCode, altInfo.toString(), adminProportion, agencyProportion, merchantProportion, personageProportion, Order.Status.unpay);
+        Order order1 = new Order();
+        order1.setSn(sn);
+        order1.setType(orderType);
+        order1.setAgencyId(agencyId);
+        order1.setMerchantId(merchantId);
+        order1.setPersonageId(personageId);
+        order1.setAdminId(admin.getId());
+        order1.setProductName(productName);
+        order1.setPrice(price);
+        order1.setEquipmentId(equipmentId);
+        order1.setClientId(equipment.getClientId());
+        order1.setStatus(Order.Status.unpay);
+        order1.setFrp_code(frpCode);
+        orderService.create(order1);
+
+        JSONArray altInfo = new JSONArray();
+        String result = null;
+        try {
+            result = tradeService.uniPay(
+
+                    orderNo, amount, productName, productDesc,
+                    commonParameter, returnUrl, notifyUrl, frpCode,
+                    isShowPic, openId, authCode, appid, transactionModel, tradeMerchantNo,
+                    buyerId, isAlt, altType, altInfo, altUrl, marketingAmount
+            );
+
+        } catch (
+                UnsupportedEncodingException e) {
+            e.printStackTrace();
+//            return JsonMessage.error("申请支付失败");
+            return "申请支付失败";
+        }
+
+        JSONObject resultJson = JSONObject.parseObject(result);
+        // 汇聚支付支付申请返回支付二维码图片
+        String rd_Pic = resultJson.getString("rd_Pic");
+
+        if (resultJson == null || StringUtils.isBlank(rd_Pic)) {
+            return "找不到支付图片";
+        }
+//        ModelMap model = new ModelMap();
+        model.addAttribute("image", rd_Pic);
+        model.addAttribute("price", price);
+        return ResponseEntity.status(HttpStatus.OK)
+                .body(new ResultMessage().setCode(true).setData(price).setMessage("SUCCESS"));
+    }
+}

+ 16 - 0
src/main/resources/com/shawn/repository/mybatis/TEquipmentMapper.xml

@@ -1129,4 +1129,20 @@
        b.full_name LIKE "%"#{chartType}"%"
      );
   </select>
+    <select id="findByArea" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
+        select
+        <include refid="Base_Column_List"/>
+        ,
+        <include refid="Blob_Column_List"/>
+        from t_equipment
+        where area_id = #{areaId,jdbcType=BIGINT}
+    </select>
+    <select id="findByAdmin" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
+        select
+        <include refid="Base_Column_List"/>
+        ,
+        <include refid="Blob_Column_List"/>
+        from t_equipment
+        where admin_id = #{adminId,jdbcType=BIGINT}
+    </select>
 </mapper>

+ 24 - 0
src/main/resources/com/shawn/repository/mybatis/TOrderMapper.xml

@@ -799,6 +799,7 @@ group by b.id
 order by salePrice desc
 limit 30
   </select>
+  <!-- 统计 省销售数据-->
   <select id="getProvincePrice"  parameterType="com.shawn.model.param.StatisticsParam" resultType="java.lang.String">
        SELECT
         	sum(c.price)
@@ -828,4 +829,27 @@ limit 30
          AND c.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
       <![CDATA[ AND c.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
   </select>
+
+  <!-- 统计 地区销售数据-->
+  <select id="getAreaPrice" resultType="java.lang.Double">
+       SELECT
+        	sum(c.price)
+        FROM
+        	t_order c
+        WHERE
+        	c. STATUS = '1'
+        AND c.equipment_id IN (
+        	SELECT
+        		a.id
+        	FROM
+        		t_equipment a
+        	WHERE
+                a.area_id in
+                <foreach  item="item" collection="areaIds" index="index"  open="(" separator="," close=")">
+                     #{item}
+                </foreach>
+        )
+         AND c.create_date >= STR_TO_DATE(CONCAT(#{startDate},' 00:00:00'),'%Y/%m/%d %H:%i:%s')
+      <![CDATA[ AND c.create_date <= STR_TO_DATE(CONCAT(#{endDate},' 23:59:59'),'%Y/%m/%d %H:%i:%s') ]]>
+  </select>
 </mapper>

+ 309 - 0
src/main/resources/com/shawn/repository/mybatis/TPromoCodeMapper.xml

@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.shawn.repository.TPromoCodeMapper">
+  <resultMap id="BaseResultMap" type="com.shawn.model.entity.TPromoCode">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="admin_id" jdbcType="VARCHAR" property="adminId" />
+    <result column="user_name" jdbcType="VARCHAR" property="userName" />
+    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
+    <result column="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
+    <result column="last_use_date" jdbcType="TIMESTAMP" property="lastUseDate" />
+    <result column="code" jdbcType="BIGINT" property="code" />
+    <result column="is_use" jdbcType="VARCHAR" property="isUse" />
+    <result column="use_date" jdbcType="VARCHAR" property="useDate" />
+    <result column="use_by" jdbcType="VARCHAR" property="useBy" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    id, admin_id, last_use_date, create_date, modify_date, code, user_name,is_use,use_date,use_by
+  </sql>
+  <select id="selectByExample" parameterType="com.shawn.model.entity.TPromoCodeExample" resultMap="BaseResultMap">
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from t_promo_code
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+    <if test="limit != null">
+      <if test="offset != null">
+        limit ${offset}, ${limit}
+      </if>
+      <if test="offset == null">
+        limit ${limit}
+      </if>
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_promo_code
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <select id="findByEntity" parameterType="com.shawn.model.entity.TPromoCode" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_promo_code
+    where code = #{code,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_promo_code
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.shawn.model.entity.TPromoCodeExample">
+    delete from t_promo_code
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.shawn.model.entity.TPromoCode">
+    insert into t_promo_code (id, admin_id, last_use_date,
+      create_date, modify_date, code, user_name,is_use,use_date,use_by
+      avatar_url)
+    values (#{id,jdbcType=INTEGER}, #{adminId,jdbcType=VARCHAR}, #{lastUseDate,jdbcType=TIMESTAMP},
+      #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP}, #{code,jdbcType=BIGINT},
+      #{userName,jdbcType=VARCHAR}),#{isUse,jdbcType=VARCHAR}),#{useDate,jdbcType=VARCHAR}),#{useBy,jdbcType=VARCHAR})
+  </insert>
+
+  <select id="findPrice" resultType="java.lang.Double">
+    select price from t_price where name="优惠码"
+  </select>
+<!--  <insert id="insertSelective" parameterType="com.shawn.model.entity.TPromoCode">-->
+<!--    insert into t_promo_code-->
+<!--    <trim prefix="(" suffix=")" suffixOverrides=",">-->
+<!--      <if test="id != null">-->
+<!--        id,-->
+<!--      </if>-->
+<!--      <if test="adminId != null">-->
+<!--        admin_id,-->
+<!--      </if>-->
+<!--      <if test="openId != null">-->
+<!--        open_id,-->
+<!--      </if>-->
+<!--      <if test="createDate != null">-->
+<!--        create_date,-->
+<!--      </if>-->
+<!--      <if test="modifyDate != null">-->
+<!--        modify_date,-->
+<!--      </if>-->
+<!--      <if test="nickName != null">-->
+<!--        nick_name,-->
+<!--      </if>-->
+<!--      <if test="avatarUrl != null">-->
+<!--        avatar_url,-->
+<!--      </if>-->
+<!--    </trim>-->
+<!--    <trim prefix="values (" suffix=")" suffixOverrides=",">-->
+<!--      <if test="id != null">-->
+<!--        #{id,jdbcType=INTEGER},-->
+<!--      </if>-->
+<!--      <if test="adminId != null">-->
+<!--        #{adminId,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="openId != null">-->
+<!--        #{openId,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="createDate != null">-->
+<!--        #{createDate,jdbcType=TIMESTAMP},-->
+<!--      </if>-->
+<!--      <if test="modifyDate != null">-->
+<!--        #{modifyDate,jdbcType=TIMESTAMP},-->
+<!--      </if>-->
+<!--      <if test="nickName != null">-->
+<!--        #{nickName,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="avatarUrl != null">-->
+<!--        #{avatarUrl,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--    </trim>-->
+<!--  </insert>-->
+<!--  <select id="countByExample" parameterType="com.shawn.model.entity.TPromoCodeExample" resultType="java.lang.Long">-->
+<!--    select count(*) from t_promo_code-->
+<!--    <if test="_parameter != null">-->
+<!--      <include refid="Example_Where_Clause" />-->
+<!--    </if>-->
+<!--  </select>-->
+<!--  <update id="updateByExampleSelective" parameterType="map">-->
+<!--    update t_promo_code-->
+<!--    <set>-->
+<!--      <if test="record.id != null">-->
+<!--        id = #{record.id,jdbcType=INTEGER},-->
+<!--      </if>-->
+<!--      <if test="record.adminId != null">-->
+<!--        admin_id = #{record.adminId,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="record.openId != null">-->
+<!--        open_id = #{record.openId,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="record.createDate != null">-->
+<!--        create_date = #{record.createDate,jdbcType=TIMESTAMP},-->
+<!--      </if>-->
+<!--      <if test="record.modifyDate != null">-->
+<!--        modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},-->
+<!--      </if>-->
+<!--      <if test="record.nickName != null">-->
+<!--        nick_name = #{record.nickName,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--      <if test="record.avatarUrl != null">-->
+<!--        avatar_url = #{record.avatarUrl,jdbcType=VARCHAR},-->
+<!--      </if>-->
+<!--    </set>-->
+<!--    <if test="_parameter != null">-->
+<!--      <include refid="Update_By_Example_Where_Clause" />-->
+<!--    </if>-->
+<!--  </update>-->
+<!--  <update id="updateByExample" parameterType="map">-->
+<!--    update t_promo_code-->
+<!--    set id = #{record.id,jdbcType=INTEGER},-->
+<!--      admin_id = #{record.adminId,jdbcType=VARCHAR},-->
+<!--      open_id = #{record.openId,jdbcType=VARCHAR},-->
+<!--      create_date = #{record.createDate,jdbcType=TIMESTAMP},-->
+<!--      modify_date = #{record.modifyDate,jdbcType=TIMESTAMP},-->
+<!--      nick_name = #{record.nickName,jdbcType=VARCHAR},-->
+<!--      avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}-->
+<!--    <if test="_parameter != null">-->
+<!--      <include refid="Update_By_Example_Where_Clause" />-->
+<!--    </if>-->
+<!--  </update>-->
+  <update id="updateByPrimaryKeySelective" parameterType="com.shawn.model.entity.TPromoCode">
+    update t_promo_code
+    <set>
+      <if test="adminId != null">
+        admin_id = #{adminId,jdbcType=VARCHAR},
+      </if>
+      <if test="isUse != null">
+        is_use = #{isUse,jdbcType=VARCHAR},
+      </if>
+      <if test="createDate != null">
+        create_date = #{createDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifyDate != null">
+        modify_date = #{modifyDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="lastUseDate != null">
+        last_use_date = #{lastUseDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="userName != null">
+        user_name = #{userName,jdbcType=VARCHAR},
+      </if>
+      <if test="useBy != null">
+        use_by = #{useBy,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+<!--  <update id="updateByPrimaryKey" parameterType="com.shawn.model.entity.TPromoCode">-->
+<!--    update t_promo_code-->
+<!--    set admin_id = #{adminId,jdbcType=VARCHAR},-->
+<!--      open_id = #{openId,jdbcType=VARCHAR},-->
+<!--      create_date = #{createDate,jdbcType=TIMESTAMP},-->
+<!--      modify_date = #{modifyDate,jdbcType=TIMESTAMP},-->
+<!--      nick_name = #{nickName,jdbcType=VARCHAR},-->
+<!--      avatar_url = #{avatarUrl,jdbcType=VARCHAR}-->
+<!--    where id = #{id,jdbcType=INTEGER}-->
+<!--  </update>-->
+<!--  <insert id="insertBatch" parameterType="java.util.List">-->
+<!--    insert into t_promo_code (id,admin_id,open_id,create_date,modify_date,nick_name,avatar_url)-->
+<!--    <foreach collection="list" index="index" item="item" separator="union all">-->
+<!--      select #{item.id,jdbcType=INTEGER},#{item.adminId,jdbcType=VARCHAR},#{item.openId,jdbcType=VARCHAR},#{item.createDate,jdbcType=TIMESTAMP},#{item.modifyDate,jdbcType=TIMESTAMP},#{item.nickName,jdbcType=VARCHAR},#{item.avatarUrl,jdbcType=VARCHAR} from dual-->
+<!--    </foreach>-->
+<!--  </insert>-->
+<!--  <delete id="deleteBatchByIdList" parameterType="java.util.List">-->
+<!--    DELETE FROM t_promo_code where id in-->
+<!--    <foreach close=")" collection="list" item="item" open="(" separator=",">-->
+<!--      #{item}-->
+<!--    </foreach>-->
+<!--  </delete>-->
+<!--  <update id="updateBatchByIdList" parameterType="com.shawn.model.param.TPromoCodeParam">-->
+<!--    update t_promo_code-->
+<!--    <trim prefix="set" suffixOverrides=",">-->
+<!--      <if test="id != null">-->
+<!--        id = #{id},-->
+<!--      </if>-->
+<!--      <if test="adminId != null">-->
+<!--        admin_id = #{adminId},-->
+<!--      </if>-->
+<!--      <if test="openId != null">-->
+<!--        open_id = #{openId},-->
+<!--      </if>-->
+<!--      <if test="createDate != null">-->
+<!--        create_date = #{createDate},-->
+<!--      </if>-->
+<!--      <if test="modifyDate != null">-->
+<!--        modify_date = #{modifyDate},-->
+<!--      </if>-->
+<!--      <if test="nickName != null">-->
+<!--        nick_name = #{nickName},-->
+<!--      </if>-->
+<!--      <if test="avatarUrl != null">-->
+<!--        avatar_url = #{avatarUrl},-->
+<!--      </if>-->
+<!--    </trim>-->
+<!--     where id in -->
+<!--    <foreach close=")" collection="primaryKeyList" item="item" open="(" separator=",">-->
+<!--      #{item}-->
+<!--    </foreach>-->
+<!--  </update>-->
+</mapper>