diff --git a/README.md b/README.md index 048135b284..046e9a33bd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## 前言 `mall`项目致力于打造一个完整的电商系统,采用现阶段流行技术实现。 - +[码云地址](https://gitee.com/tPrograming/mall): https://gitee.com/tPrograming/mall ## 项目文档 - 文档地址:[http://www.macrozheng.com](http://www.macrozheng.com) diff --git a/document/sql/mall.sql b/document/sql/mall.sql index 8af6f9cbdb..c39f80e5b8 100644 --- a/document/sql/mall.sql +++ b/document/sql/mall.sql @@ -2578,3 +2578,18 @@ INSERT INTO `ums_role_resource_relation` VALUES ('174', '1', '5'); INSERT INTO `ums_role_resource_relation` VALUES ('175', '1', '6'); INSERT INTO `ums_role_resource_relation` VALUES ('176', '1', '23'); INSERT INTO `ums_role_resource_relation` VALUES ('177', '1', '24'); + +-- ---------------------------- +-- Table structure for ums_feedback +-- ---------------------------- +DROP TABLE IF EXISTS `ums_feedback`; +CREATE TABLE `ums_feedback` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, + `type` varchar(100) NOT NULL DEFAULT '' COMMENT '', + `typeString` varchar(100) NOT NULL DEFAULT '' COMMENT '', + `desc` varchar(512) NOT NULL DEFAULT '' COMMENT '', + `tel` varchar(11) NOT NULL DEFAULT '' COMMENT '', + `uID` bigint(20) NOT NULL DEFAULT 0 COMMENT '', + `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='用户反馈表'; \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/mapper/CommentMapper.java b/mall-mbg/src/main/java/com/macro/mall/mapper/CommentMapper.java new file mode 100644 index 0000000000..68680b08c0 --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/mapper/CommentMapper.java @@ -0,0 +1,30 @@ +package com.macro.mall.mapper; + +import com.macro.mall.model.Comment; +import com.macro.mall.model.CommentExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface CommentMapper { + long countByExample(CommentExample example); + + int deleteByExample(CommentExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(Comment record); + + int insertSelective(Comment record); + + List selectByExample(CommentExample example); + + Comment selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") Comment record, @Param("example") CommentExample example); + + int updateByExample(@Param("record") Comment record, @Param("example") CommentExample example); + + int updateByPrimaryKeySelective(Comment record); + + int updateByPrimaryKey(Comment record); +} \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/mapper/UmsFeedbackMapper.java b/mall-mbg/src/main/java/com/macro/mall/mapper/UmsFeedbackMapper.java new file mode 100644 index 0000000000..e9f3fae3b2 --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/mapper/UmsFeedbackMapper.java @@ -0,0 +1,30 @@ +package com.macro.mall.mapper; + +import com.macro.mall.model.UmsFeedback; +import com.macro.mall.model.UmsFeedbackExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface UmsFeedbackMapper { + long countByExample(UmsFeedbackExample example); + + int deleteByExample(UmsFeedbackExample example); + + int deleteByPrimaryKey(Long id); + + int insert(UmsFeedback record); + + int insertSelective(UmsFeedback record); + + List selectByExample(UmsFeedbackExample example); + + UmsFeedback selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") UmsFeedback record, @Param("example") UmsFeedbackExample example); + + int updateByExample(@Param("record") UmsFeedback record, @Param("example") UmsFeedbackExample example); + + int updateByPrimaryKeySelective(UmsFeedback record); + + int updateByPrimaryKey(UmsFeedback record); +} \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/model/Comment.java b/mall-mbg/src/main/java/com/macro/mall/model/Comment.java new file mode 100644 index 0000000000..f170bd6d30 --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/model/Comment.java @@ -0,0 +1,97 @@ +package com.macro.mall.model; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.Date; + +public class Comment implements Serializable { + private Integer id; + + private String type; + + private String typestring; + + private String desc; + + private Integer tel; + + private Integer uid; + + private Date time; + + private static final long serialVersionUID = 1L; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTypestring() { + return typestring; + } + + public void setTypestring(String typestring) { + this.typestring = typestring; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public Integer getTel() { + return tel; + } + + public void setTel(Integer tel) { + this.tel = tel; + } + + public Integer getUid() { + return uid; + } + + public void setUid(Integer uid) { + this.uid = uid; + } + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", type=").append(type); + sb.append(", typestring=").append(typestring); + sb.append(", desc=").append(desc); + sb.append(", tel=").append(tel); + sb.append(", uid=").append(uid); + sb.append(", time=").append(time); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/model/CommentExample.java b/mall-mbg/src/main/java/com/macro/mall/model/CommentExample.java new file mode 100644 index 0000000000..d82c9d7dbf --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/model/CommentExample.java @@ -0,0 +1,651 @@ +package com.macro.mall.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class CommentExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public CommentExample() { + oredCriteria = new ArrayList(); + } + + 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 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; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List 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 andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(String value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(String value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(String value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(String value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(String value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(String value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLike(String value) { + addCriterion("type like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotLike(String value) { + addCriterion("type not like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(String value1, String value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(String value1, String value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypestringIsNull() { + addCriterion("typeString is null"); + return (Criteria) this; + } + + public Criteria andTypestringIsNotNull() { + addCriterion("typeString is not null"); + return (Criteria) this; + } + + public Criteria andTypestringEqualTo(String value) { + addCriterion("typeString =", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotEqualTo(String value) { + addCriterion("typeString <>", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringGreaterThan(String value) { + addCriterion("typeString >", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringGreaterThanOrEqualTo(String value) { + addCriterion("typeString >=", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLessThan(String value) { + addCriterion("typeString <", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLessThanOrEqualTo(String value) { + addCriterion("typeString <=", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLike(String value) { + addCriterion("typeString like", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotLike(String value) { + addCriterion("typeString not like", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringIn(List values) { + addCriterion("typeString in", values, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotIn(List values) { + addCriterion("typeString not in", values, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringBetween(String value1, String value2) { + addCriterion("typeString between", value1, value2, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotBetween(String value1, String value2) { + addCriterion("typeString not between", value1, value2, "typestring"); + return (Criteria) this; + } + + public Criteria andDescIsNull() { + addCriterion("desc is null"); + return (Criteria) this; + } + + public Criteria andDescIsNotNull() { + addCriterion("desc is not null"); + return (Criteria) this; + } + + public Criteria andDescEqualTo(String value) { + addCriterion("desc =", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotEqualTo(String value) { + addCriterion("desc <>", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescGreaterThan(String value) { + addCriterion("desc >", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescGreaterThanOrEqualTo(String value) { + addCriterion("desc >=", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLessThan(String value) { + addCriterion("desc <", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLessThanOrEqualTo(String value) { + addCriterion("desc <=", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLike(String value) { + addCriterion("desc like", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotLike(String value) { + addCriterion("desc not like", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescIn(List values) { + addCriterion("desc in", values, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotIn(List values) { + addCriterion("desc not in", values, "desc"); + return (Criteria) this; + } + + public Criteria andDescBetween(String value1, String value2) { + addCriterion("desc between", value1, value2, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotBetween(String value1, String value2) { + addCriterion("desc not between", value1, value2, "desc"); + return (Criteria) this; + } + + public Criteria andTelIsNull() { + addCriterion("tel is null"); + return (Criteria) this; + } + + public Criteria andTelIsNotNull() { + addCriterion("tel is not null"); + return (Criteria) this; + } + + public Criteria andTelEqualTo(Integer value) { + addCriterion("tel =", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotEqualTo(Integer value) { + addCriterion("tel <>", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelGreaterThan(Integer value) { + addCriterion("tel >", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelGreaterThanOrEqualTo(Integer value) { + addCriterion("tel >=", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelLessThan(Integer value) { + addCriterion("tel <", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelLessThanOrEqualTo(Integer value) { + addCriterion("tel <=", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelIn(List values) { + addCriterion("tel in", values, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotIn(List values) { + addCriterion("tel not in", values, "tel"); + return (Criteria) this; + } + + public Criteria andTelBetween(Integer value1, Integer value2) { + addCriterion("tel between", value1, value2, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotBetween(Integer value1, Integer value2) { + addCriterion("tel not between", value1, value2, "tel"); + return (Criteria) this; + } + + public Criteria andUidIsNull() { + addCriterion("uID is null"); + return (Criteria) this; + } + + public Criteria andUidIsNotNull() { + addCriterion("uID is not null"); + return (Criteria) this; + } + + public Criteria andUidEqualTo(Integer value) { + addCriterion("uID =", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotEqualTo(Integer value) { + addCriterion("uID <>", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidGreaterThan(Integer value) { + addCriterion("uID >", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidGreaterThanOrEqualTo(Integer value) { + addCriterion("uID >=", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidLessThan(Integer value) { + addCriterion("uID <", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidLessThanOrEqualTo(Integer value) { + addCriterion("uID <=", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidIn(List values) { + addCriterion("uID in", values, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotIn(List values) { + addCriterion("uID not in", values, "uid"); + return (Criteria) this; + } + + public Criteria andUidBetween(Integer value1, Integer value2) { + addCriterion("uID between", value1, value2, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotBetween(Integer value1, Integer value2) { + addCriterion("uID not between", value1, value2, "uid"); + return (Criteria) this; + } + + public Criteria andTimeIsNull() { + addCriterion("time is null"); + return (Criteria) this; + } + + public Criteria andTimeIsNotNull() { + addCriterion("time is not null"); + return (Criteria) this; + } + + public Criteria andTimeEqualTo(Date value) { + addCriterion("time =", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotEqualTo(Date value) { + addCriterion("time <>", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThan(Date value) { + addCriterion("time >", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThanOrEqualTo(Date value) { + addCriterion("time >=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThan(Date value) { + addCriterion("time <", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThanOrEqualTo(Date value) { + addCriterion("time <=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeIn(List values) { + addCriterion("time in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotIn(List values) { + addCriterion("time not in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeBetween(Date value1, Date value2) { + addCriterion("time between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotBetween(Date value1, Date value2) { + addCriterion("time not between", value1, value2, "time"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + 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); + } + } +} \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedback.java b/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedback.java new file mode 100644 index 0000000000..6be4288462 --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedback.java @@ -0,0 +1,97 @@ +package com.macro.mall.model; + +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.Date; + +public class UmsFeedback implements Serializable { + private Long id; + + private String type; + + private String typestring; + + private String desc; + + private String tel; + + private Long uid; + + private Date time; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTypestring() { + return typestring; + } + + public void setTypestring(String typestring) { + this.typestring = typestring; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", type=").append(type); + sb.append(", typestring=").append(typestring); + sb.append(", desc=").append(desc); + sb.append(", tel=").append(tel); + sb.append(", uid=").append(uid); + sb.append(", time=").append(time); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedbackExample.java b/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedbackExample.java new file mode 100644 index 0000000000..ba6f4e3efc --- /dev/null +++ b/mall-mbg/src/main/java/com/macro/mall/model/UmsFeedbackExample.java @@ -0,0 +1,661 @@ +package com.macro.mall.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class UmsFeedbackExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public UmsFeedbackExample() { + oredCriteria = new ArrayList(); + } + + 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 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; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("type is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("type is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(String value) { + addCriterion("type =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(String value) { + addCriterion("type <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(String value) { + addCriterion("type >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(String value) { + addCriterion("type >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(String value) { + addCriterion("type <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(String value) { + addCriterion("type <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLike(String value) { + addCriterion("type like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotLike(String value) { + addCriterion("type not like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("type in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("type not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(String value1, String value2) { + addCriterion("type between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(String value1, String value2) { + addCriterion("type not between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypestringIsNull() { + addCriterion("typeString is null"); + return (Criteria) this; + } + + public Criteria andTypestringIsNotNull() { + addCriterion("typeString is not null"); + return (Criteria) this; + } + + public Criteria andTypestringEqualTo(String value) { + addCriterion("typeString =", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotEqualTo(String value) { + addCriterion("typeString <>", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringGreaterThan(String value) { + addCriterion("typeString >", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringGreaterThanOrEqualTo(String value) { + addCriterion("typeString >=", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLessThan(String value) { + addCriterion("typeString <", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLessThanOrEqualTo(String value) { + addCriterion("typeString <=", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringLike(String value) { + addCriterion("typeString like", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotLike(String value) { + addCriterion("typeString not like", value, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringIn(List values) { + addCriterion("typeString in", values, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotIn(List values) { + addCriterion("typeString not in", values, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringBetween(String value1, String value2) { + addCriterion("typeString between", value1, value2, "typestring"); + return (Criteria) this; + } + + public Criteria andTypestringNotBetween(String value1, String value2) { + addCriterion("typeString not between", value1, value2, "typestring"); + return (Criteria) this; + } + + public Criteria andDescIsNull() { + addCriterion("desc is null"); + return (Criteria) this; + } + + public Criteria andDescIsNotNull() { + addCriterion("desc is not null"); + return (Criteria) this; + } + + public Criteria andDescEqualTo(String value) { + addCriterion("desc =", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotEqualTo(String value) { + addCriterion("desc <>", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescGreaterThan(String value) { + addCriterion("desc >", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescGreaterThanOrEqualTo(String value) { + addCriterion("desc >=", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLessThan(String value) { + addCriterion("desc <", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLessThanOrEqualTo(String value) { + addCriterion("desc <=", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescLike(String value) { + addCriterion("desc like", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotLike(String value) { + addCriterion("desc not like", value, "desc"); + return (Criteria) this; + } + + public Criteria andDescIn(List values) { + addCriterion("desc in", values, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotIn(List values) { + addCriterion("desc not in", values, "desc"); + return (Criteria) this; + } + + public Criteria andDescBetween(String value1, String value2) { + addCriterion("desc between", value1, value2, "desc"); + return (Criteria) this; + } + + public Criteria andDescNotBetween(String value1, String value2) { + addCriterion("desc not between", value1, value2, "desc"); + return (Criteria) this; + } + + public Criteria andTelIsNull() { + addCriterion("tel is null"); + return (Criteria) this; + } + + public Criteria andTelIsNotNull() { + addCriterion("tel is not null"); + return (Criteria) this; + } + + public Criteria andTelEqualTo(String value) { + addCriterion("tel =", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotEqualTo(String value) { + addCriterion("tel <>", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelGreaterThan(String value) { + addCriterion("tel >", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelGreaterThanOrEqualTo(String value) { + addCriterion("tel >=", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelLessThan(String value) { + addCriterion("tel <", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelLessThanOrEqualTo(String value) { + addCriterion("tel <=", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelLike(String value) { + addCriterion("tel like", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotLike(String value) { + addCriterion("tel not like", value, "tel"); + return (Criteria) this; + } + + public Criteria andTelIn(List values) { + addCriterion("tel in", values, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotIn(List values) { + addCriterion("tel not in", values, "tel"); + return (Criteria) this; + } + + public Criteria andTelBetween(String value1, String value2) { + addCriterion("tel between", value1, value2, "tel"); + return (Criteria) this; + } + + public Criteria andTelNotBetween(String value1, String value2) { + addCriterion("tel not between", value1, value2, "tel"); + return (Criteria) this; + } + + public Criteria andUidIsNull() { + addCriterion("uID is null"); + return (Criteria) this; + } + + public Criteria andUidIsNotNull() { + addCriterion("uID is not null"); + return (Criteria) this; + } + + public Criteria andUidEqualTo(Long value) { + addCriterion("uID =", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotEqualTo(Long value) { + addCriterion("uID <>", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidGreaterThan(Long value) { + addCriterion("uID >", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidGreaterThanOrEqualTo(Long value) { + addCriterion("uID >=", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidLessThan(Long value) { + addCriterion("uID <", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidLessThanOrEqualTo(Long value) { + addCriterion("uID <=", value, "uid"); + return (Criteria) this; + } + + public Criteria andUidIn(List values) { + addCriterion("uID in", values, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotIn(List values) { + addCriterion("uID not in", values, "uid"); + return (Criteria) this; + } + + public Criteria andUidBetween(Long value1, Long value2) { + addCriterion("uID between", value1, value2, "uid"); + return (Criteria) this; + } + + public Criteria andUidNotBetween(Long value1, Long value2) { + addCriterion("uID not between", value1, value2, "uid"); + return (Criteria) this; + } + + public Criteria andTimeIsNull() { + addCriterion("time is null"); + return (Criteria) this; + } + + public Criteria andTimeIsNotNull() { + addCriterion("time is not null"); + return (Criteria) this; + } + + public Criteria andTimeEqualTo(Date value) { + addCriterion("time =", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotEqualTo(Date value) { + addCriterion("time <>", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThan(Date value) { + addCriterion("time >", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThanOrEqualTo(Date value) { + addCriterion("time >=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThan(Date value) { + addCriterion("time <", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThanOrEqualTo(Date value) { + addCriterion("time <=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeIn(List values) { + addCriterion("time in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotIn(List values) { + addCriterion("time not in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeBetween(Date value1, Date value2) { + addCriterion("time between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotBetween(Date value1, Date value2) { + addCriterion("time not between", value1, value2, "time"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + 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); + } + } +} \ No newline at end of file diff --git a/mall-mbg/src/main/resources/com/macro/mall/mapper/CommentMapper.xml b/mall-mbg/src/main/resources/com/macro/mall/mapper/CommentMapper.xml new file mode 100644 index 0000000000..35f8d589e9 --- /dev/null +++ b/mall-mbg/src/main/resources/com/macro/mall/mapper/CommentMapper.xml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, type, typeString, desc, tel, uID, time + + + + + delete from comment + where id = #{id,jdbcType=INTEGER} + + + delete from comment + + + + + + + SELECT LAST_INSERT_ID() + + insert into comment (type, typeString, desc, + tel, uID, time) + values (#{type,jdbcType=VARCHAR}, #{typestring,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, + #{tel,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{time,jdbcType=TIMESTAMP}) + + + + SELECT LAST_INSERT_ID() + + insert into comment + + + type, + + + typeString, + + + desc, + + + tel, + + + uID, + + + time, + + + + + #{type,jdbcType=VARCHAR}, + + + #{typestring,jdbcType=VARCHAR}, + + + #{desc,jdbcType=VARCHAR}, + + + #{tel,jdbcType=INTEGER}, + + + #{uid,jdbcType=INTEGER}, + + + #{time,jdbcType=TIMESTAMP}, + + + + + + update comment + + + id = #{record.id,jdbcType=INTEGER}, + + + type = #{record.type,jdbcType=VARCHAR}, + + + typeString = #{record.typestring,jdbcType=VARCHAR}, + + + desc = #{record.desc,jdbcType=VARCHAR}, + + + tel = #{record.tel,jdbcType=INTEGER}, + + + uID = #{record.uid,jdbcType=INTEGER}, + + + time = #{record.time,jdbcType=TIMESTAMP}, + + + + + + + + update comment + set id = #{record.id,jdbcType=INTEGER}, + type = #{record.type,jdbcType=VARCHAR}, + typeString = #{record.typestring,jdbcType=VARCHAR}, + desc = #{record.desc,jdbcType=VARCHAR}, + tel = #{record.tel,jdbcType=INTEGER}, + uID = #{record.uid,jdbcType=INTEGER}, + time = #{record.time,jdbcType=TIMESTAMP} + + + + + + update comment + + + type = #{type,jdbcType=VARCHAR}, + + + typeString = #{typestring,jdbcType=VARCHAR}, + + + desc = #{desc,jdbcType=VARCHAR}, + + + tel = #{tel,jdbcType=INTEGER}, + + + uID = #{uid,jdbcType=INTEGER}, + + + time = #{time,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update comment + set type = #{type,jdbcType=VARCHAR}, + typeString = #{typestring,jdbcType=VARCHAR}, + desc = #{desc,jdbcType=VARCHAR}, + tel = #{tel,jdbcType=INTEGER}, + uID = #{uid,jdbcType=INTEGER}, + time = #{time,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/mall-mbg/src/main/resources/com/macro/mall/mapper/UmsFeedbackMapper.xml b/mall-mbg/src/main/resources/com/macro/mall/mapper/UmsFeedbackMapper.xml new file mode 100644 index 0000000000..aba7ed6cfb --- /dev/null +++ b/mall-mbg/src/main/resources/com/macro/mall/mapper/UmsFeedbackMapper.xml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, type, typeString, desc, tel, uID, time + + + + + delete from ums_feedback + where id = #{id,jdbcType=BIGINT} + + + delete from ums_feedback + + + + + + + SELECT LAST_INSERT_ID() + + insert into ums_feedback (type, typeString, desc, + tel, uID, time) + values (#{type,jdbcType=VARCHAR}, #{typestring,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, + #{tel,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT}, #{time,jdbcType=TIMESTAMP}) + + + + SELECT LAST_INSERT_ID() + + insert into ums_feedback + + + type, + + + typeString, + + + desc, + + + tel, + + + uID, + + + time, + + + + + #{type,jdbcType=VARCHAR}, + + + #{typestring,jdbcType=VARCHAR}, + + + #{desc,jdbcType=VARCHAR}, + + + #{tel,jdbcType=VARCHAR}, + + + #{uid,jdbcType=BIGINT}, + + + #{time,jdbcType=TIMESTAMP}, + + + + + + update ums_feedback + + + id = #{record.id,jdbcType=BIGINT}, + + + type = #{record.type,jdbcType=VARCHAR}, + + + typeString = #{record.typestring,jdbcType=VARCHAR}, + + + desc = #{record.desc,jdbcType=VARCHAR}, + + + tel = #{record.tel,jdbcType=VARCHAR}, + + + uID = #{record.uid,jdbcType=BIGINT}, + + + time = #{record.time,jdbcType=TIMESTAMP}, + + + + + + + + update ums_feedback + set id = #{record.id,jdbcType=BIGINT}, + type = #{record.type,jdbcType=VARCHAR}, + typeString = #{record.typestring,jdbcType=VARCHAR}, + desc = #{record.desc,jdbcType=VARCHAR}, + tel = #{record.tel,jdbcType=VARCHAR}, + uID = #{record.uid,jdbcType=BIGINT}, + time = #{record.time,jdbcType=TIMESTAMP} + + + + + + update ums_feedback + + + type = #{type,jdbcType=VARCHAR}, + + + typeString = #{typestring,jdbcType=VARCHAR}, + + + desc = #{desc,jdbcType=VARCHAR}, + + + tel = #{tel,jdbcType=VARCHAR}, + + + uID = #{uid,jdbcType=BIGINT}, + + + time = #{time,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update ums_feedback + set type = #{type,jdbcType=VARCHAR}, + typeString = #{typestring,jdbcType=VARCHAR}, + desc = #{desc,jdbcType=VARCHAR}, + tel = #{tel,jdbcType=VARCHAR}, + uID = #{uid,jdbcType=BIGINT}, + time = #{time,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/mall-mbg/src/main/resources/generatorConfig.xml b/mall-mbg/src/main/resources/generatorConfig.xml index b5ec296ce5..82c9f253c7 100644 --- a/mall-mbg/src/main/resources/generatorConfig.xml +++ b/mall-mbg/src/main/resources/generatorConfig.xml @@ -30,12 +30,12 @@ - + - + + targetProject="mall-mbg/src/main/java"/> diff --git a/mall-portal/pom.xml b/mall-portal/pom.xml index f81a2b2edc..aae4f0734b 100644 --- a/mall-portal/pom.xml +++ b/mall-portal/pom.xml @@ -26,6 +26,11 @@ com.macro.mall mall-security + + com.alibaba + fastjson + 1.2.70 + org.springframework.boot @@ -41,6 +46,10 @@ org.springframework.boot spring-boot-starter-amqp + + org.apache.httpcomponents + httpclient + diff --git a/mall-portal/src/main/java/com/macro/mall/portal/config/RestTemplateConfig.java b/mall-portal/src/main/java/com/macro/mall/portal/config/RestTemplateConfig.java new file mode 100644 index 0000000000..c566fa9fab --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/config/RestTemplateConfig.java @@ -0,0 +1,33 @@ +package com.macro.mall.portal.config; + +import com.macro.mall.portal.util.SSL; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +/** + * 名称:RestTemplateConfig
+ * 描述:
+ * + * @author suzy2 + * @version 1.0 + * @since 1.0.0 + */ +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory){ + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ + SimpleClientHttpRequestFactory factory = new SSL(); + factory.setReadTimeout(5000);//单位为ms + factory.setConnectTimeout(5000);//单位为ms + return factory; + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/controller/FeedBackController.java b/mall-portal/src/main/java/com/macro/mall/portal/controller/FeedBackController.java new file mode 100644 index 0000000000..362262f3ca --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/controller/FeedBackController.java @@ -0,0 +1,31 @@ +package com.macro.mall.portal.controller; + +import com.macro.mall.common.api.CommonResult; +import com.macro.mall.model.UmsFeedBack; +import com.macro.mall.portal.service.UmsFeedBackService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@Api(tags = "FeedBackController", description = "会员意见反馈") +@RequestMapping("/feedback") +public class FeedBackController { + @Autowired + private UmsFeedBackService feedbackService; + + @ApiOperation("填写意见反馈") + @RequestMapping(value = "/add", method = RequestMethod.POST) + @ResponseBody + public CommonResult add(@RequestBody UmsFeedBack feedback) { + int count = feedbackService.add(feedback); + if (count > 0) { + return CommonResult.success(count); + } + return CommonResult.failed(); + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/controller/HomeController.java b/mall-portal/src/main/java/com/macro/mall/portal/controller/HomeController.java index f78c16dc17..a6c2f4d43a 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/controller/HomeController.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/controller/HomeController.java @@ -77,4 +77,11 @@ public CommonResult> newProductList(@RequestParam(value = "page List productList = homeService.newProductList(pageNum,pageSize); return CommonResult.success(productList); } + @ApiOperation("获得商品总数") + @RequestMapping(value = "/goodsCount", method = RequestMethod.GET) + @ResponseBody + public CommonResult goodsCount() { + int goodsCount = homeService.count(); + return CommonResult.success(goodsCount); + } } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java b/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java index 944e8a2c02..7e2723221e 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java @@ -6,12 +6,14 @@ import com.macro.mall.portal.domain.CartPromotionItem; import com.macro.mall.portal.service.OmsCartItemService; import com.macro.mall.portal.service.UmsMemberService; +import io.jsonwebtoken.lang.Strings; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; /** @@ -88,7 +90,12 @@ public CommonResult updateAttr(@RequestBody OmsCartItem cartItem) { @ApiOperation("删除购物车中的某个商品") @RequestMapping(value = "/delete", method = RequestMethod.POST) @ResponseBody - public CommonResult delete(@RequestParam("ids") List ids) { + public CommonResult delete(@RequestParam("ids") String idStr) { + String[] idArr = idStr.split(","); + List ids = new ArrayList<>(); + for (String s: idArr){ + ids.add(Long.valueOf(s)); + } int count = cartItemService.delete(memberService.getCurrentMember().getId(), ids); if (count > 0) { return CommonResult.success(count); @@ -106,4 +113,5 @@ public CommonResult clear() { } return CommonResult.failed(); } + } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/controller/WXController.java b/mall-portal/src/main/java/com/macro/mall/portal/controller/WXController.java new file mode 100644 index 0000000000..7bcf0a176d --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/controller/WXController.java @@ -0,0 +1,89 @@ +package com.macro.mall.portal.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.google.common.base.Strings; +import com.macro.mall.common.api.CommonResult; +import com.macro.mall.portal.domain.LoginInfo; +import com.macro.mall.portal.service.UmsMemberService; +import com.mysql.cj.util.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +/** + * Description + *

+ *

+ * DATE 2020/7/4. + * + * @author genglintong. + */ +@Api(tags = "WX 相关对外接口") +@RestController +@RequestMapping("/wx") +public class WXController { + + @Autowired + private RestTemplate restTemplate; + + @Value("${wx.webAccessTokenhttps}") + private String webAccessTokenhttps; + + @Value("${wx.appId}") + private String appId; + + @Value("${wx.secret}") + private String secret; + + @Value("${jwt.tokenHead}") + private String tokenHead; + + @Autowired + private UmsMemberService memberService; + + /** + * 登录 + */ + @ApiOperation(value = "登录") + @PostMapping("login_by_weixin") + public CommonResult loginByWeixin(@RequestBody LoginInfo loginInfo, HttpServletRequest request) { + //获取openid + String requestUrl = String.format(this.webAccessTokenhttps, + this.appId, + this.secret, + loginInfo.getCode());//通过自定义工具类组合出小程序需要的登录凭证 code + + String res = restTemplate.getForObject(requestUrl, String.class); + JSONObject sessionData = JSON.parseObject(res); + String openid=sessionData.getString("openid"); + if (StringUtils.isNullOrEmpty(openid)) { + return CommonResult.failed("登录失败"); + } + + String token = memberService.login(openid, openid); + if (token == null) { + String tel = String.valueOf(System.currentTimeMillis()); + memberService.register(openid, openid, tel, loginInfo.getNickName()); + token = memberService.login(loginInfo.getNickName(), openid); + } + + Map tokenMap = new HashMap<>(); + tokenMap.put("token", token); + tokenMap.put("tokenHead", tokenHead); + tokenMap.put("openid", openid); + tokenMap.put("userid", "1"); + + return CommonResult.success(tokenMap); + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalOrderItemDao.java b/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalOrderItemDao.java index fad5d48f9d..f41bf85ea8 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalOrderItemDao.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalOrderItemDao.java @@ -12,6 +12,6 @@ public interface PortalOrderItemDao { /** * 批量插入 - */ + */ int insertList(@Param("list") List list); } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalProductDao.java b/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalProductDao.java index ece7ef917c..3733323e40 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalProductDao.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/dao/PortalProductDao.java @@ -14,16 +14,16 @@ public interface PortalProductDao { /** * 获取购物车商品信息 - */ + */ CartProduct getCartProduct(@Param("id") Long id); /** * 获取促销商品信息列表 - */ + */ List getPromotionProductList(@Param("ids") List ids); /** * 获取可用优惠券列表 - */ - List getAvailableCouponList(@Param("productId") Long productId, @Param("productCategoryId") Long productCategoryId); + */ + List getAvailableCouponList(@Param("productId") Long productId,@Param("productCategoryId")Long productCategoryId); } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/dao/SmsCouponHistoryDao.java b/mall-portal/src/main/java/com/macro/mall/portal/dao/SmsCouponHistoryDao.java index 6a7e130dd2..eadde97dde 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/dao/SmsCouponHistoryDao.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/dao/SmsCouponHistoryDao.java @@ -14,11 +14,11 @@ public interface SmsCouponHistoryDao { /** * 获取优惠券历史详情 - */ + */ List getDetailList(@Param("memberId") Long memberId); - + /** * 获取指定会员优惠券列表 - */ + */ List getCouponList(@Param("memberId") Long memberId, @Param("useStatus")Integer useStatus); } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/domain/LoginInfo.java b/mall-portal/src/main/java/com/macro/mall/portal/domain/LoginInfo.java new file mode 100644 index 0000000000..bb0da7c4a7 --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/domain/LoginInfo.java @@ -0,0 +1,25 @@ +package com.macro.mall.portal.domain; + +import lombok.Data; + +/** + * Description + *

+ *

+ * DATE 2020/7/4. + * + * @author genglintong. + */ +@Data +public class LoginInfo { + private String code; + private String avatarUrl; + private int gender; + private String nickName; + private String language; + private String city; + private String province; + private String country; + private int promoterId; + private Long merchantId; //商户id +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/domain/PayParam.java b/mall-portal/src/main/java/com/macro/mall/portal/domain/PayParam.java new file mode 100644 index 0000000000..1af6a5104e --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/domain/PayParam.java @@ -0,0 +1,40 @@ +package com.macro.mall.portal.domain; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * Description + *

+ * 支付所需参数 + * https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5 + *

+ * DATE 2020/7/12. + * + * @author genglintong. + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class PayParam { + /** + * 位置支付生成的预支付单ID + */ + private String prepayID; + /** + * 随机字符串 + */ + private String nonceStr; + /** + * 当前时间戳 + */ + private Long timeStamp; + /** + * 签名类型 默认MD5 + */ + private String signType; + + /** + * 支付签名 + */ + private String paySign; +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/domain/userVo.java b/mall-portal/src/main/java/com/macro/mall/portal/domain/userVo.java new file mode 100644 index 0000000000..9671490f7d --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/domain/userVo.java @@ -0,0 +1,63 @@ +package com.macro.mall.portal.domain; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * Description + *

+ *

+ * DATE 2020/7/4. + * + * @author genglintong. + */ +@Data +public class userVo { + //主键 + private Long userId; + //会员名称 + private String username; + //会员密码 + private String password; + //性别 + private Integer gender; + //出生日期 + private Date birthday; + //注册时间 + private Date register_time; + //最后登录时间 + private Date last_login_time; + //最后登录Ip + private String last_login_ip; + //会员等级 + private Integer user_level_id; + //别名 + private String nickname; + //手机号码 + private String mobile; + //注册Ip + private String register_ip; + //头像 + private String avatar; + //微信Id + private String weixin_openid; + + //身份证号 + private String idCard; + //推广人id + private int promoterId; + //推广人姓名 + private String promoterName; + //是否实名认证 1:是 2:否 + private String isReal; + //是否推荐购买返现 0没有、1已返现 + private Integer is_return_cash; + //首次购买金额 + private BigDecimal first_buy_money; + //推广小程序二维码 + private String qrCode; + //真实姓名 + private String realName; +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/HomeService.java b/mall-portal/src/main/java/com/macro/mall/portal/service/HomeService.java index d502e42800..efaddf13f8 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/HomeService.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/HomeService.java @@ -44,4 +44,10 @@ public interface HomeService { * 分页获取新品推荐商品 */ List newProductList(Integer pageNum, Integer pageSize); + + /** + * 获得商品总数 + */ + int count(); } + diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/UmsFeedBackService.java b/mall-portal/src/main/java/com/macro/mall/portal/service/UmsFeedBackService.java new file mode 100644 index 0000000000..a714783987 --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/UmsFeedBackService.java @@ -0,0 +1,13 @@ +package com.macro.mall.portal.service; + +import com.macro.mall.model.UmsFeedBack; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +public interface UmsFeedBackService { + /** + * 添加意见反馈 + */ + int add(UmsFeedBack feedback); +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/HomeServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/HomeServiceImpl.java index 0f98a0a9fb..75649f8228 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/HomeServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/HomeServiceImpl.java @@ -100,6 +100,11 @@ public List newProductList(Integer pageNum, Integer pageSize) { return homeDao.getNewProductList(offset, pageSize); } + @Override + public int count() { + return productMapper.getGoodsCount(); + } + private HomeFlashPromotion getHomeFlashPromotion() { HomeFlashPromotion homeFlashPromotion = new HomeFlashPromotion(); //获取当前秒杀活动 diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java index bc021e608a..c9c0e08ae8 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java @@ -5,7 +5,6 @@ import com.github.pagehelper.PageHelper; import com.macro.mall.common.api.CommonPage; import com.macro.mall.common.exception.Asserts; -import com.macro.mall.common.service.RedisService; import com.macro.mall.mapper.*; import com.macro.mall.model.*; import com.macro.mall.portal.component.CancelOrderSender; @@ -14,6 +13,7 @@ import com.macro.mall.portal.dao.SmsCouponHistoryDao; import com.macro.mall.portal.domain.*; import com.macro.mall.portal.service.*; +import com.macro.mall.security.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -65,6 +65,8 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService { private OmsOrderItemMapper orderItemMapper; @Autowired private CancelOrderSender cancelOrderSender; + @Autowired + private PayServiceImpl payService; @Override public ConfirmOrderResult generateConfirmOrder(List cartIds) { @@ -141,7 +143,8 @@ public Map generateOrder(OrderParam orderParam) { for (OmsOrderItem orderItem : orderItemList) { orderItem.setIntegrationAmount(new BigDecimal(0)); } - } else { + } + else { //使用积分 BigDecimal totalAmount = calcTotalAmount(orderItemList); BigDecimal integrationAmount = getUseIntegrationAmount(orderParam.getUseIntegration(), totalAmount, currentMember, orderParam.getCouponId() != null); @@ -236,9 +239,14 @@ public Map generateOrder(OrderParam orderParam) { deleteCartItemList(cartPromotionItemList, currentMember); //发送延迟消息取消订单 sendDelayMessageCancelOrder(order.getId()); + + // 生成预支付单 + PayParam preParams = payService.genPayParams(); + Map result = new HashMap<>(); result.put("order", order); result.put("orderItemList", orderItemList); + result.put("params", preParams); return result; } diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPromotionServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPromotionServiceImpl.java index 0be2dce8b9..04bde3538e 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPromotionServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPromotionServiceImpl.java @@ -39,6 +39,8 @@ public List calcCartPromotion(List cartItemList) PromotionProduct promotionProduct = getPromotionProductById(productId, promotionProductList); List itemList = entry.getValue(); Integer promotionType = promotionProduct.getPromotionType(); + // 无促销 + promotionType = 0; if (promotionType == 1) { //单品促销 for (OmsCartItem item : itemList) { diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/PayServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/PayServiceImpl.java new file mode 100644 index 0000000000..378ab9026e --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/PayServiceImpl.java @@ -0,0 +1,24 @@ +package com.macro.mall.portal.service.impl; + +import com.macro.mall.portal.domain.PayParam; +import org.springframework.stereotype.Component; + +/** + * Description + *

+ *

+ * DATE 2020/7/12. + * + * @author genglintong. + */ +@Component +public class PayServiceImpl { + + /** + * 生成微信支付签名数据 + * @return + */ + public PayParam genPayParams() { + return new PayParam(); + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsFeedBackServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsFeedBackServiceImpl.java new file mode 100644 index 0000000000..709cc940ef --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsFeedBackServiceImpl.java @@ -0,0 +1,31 @@ +package com.macro.mall.portal.service.impl; + +import com.macro.mall.mapper.UmsFeedBackMapper; +import com.macro.mall.model.UmsMember; +import com.macro.mall.model.UmsFeedBack; +//import com.macro.mall.model.UmsMemberReceiveAddressExample; +import com.macro.mall.portal.service.UmsFeedBackService; +import com.macro.mall.portal.service.UmsMemberService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.List; + +/** + * 用户意见反馈Service实现类 + */ +@Service +public class UmsFeedBackServiceImpl implements UmsFeedBackService { + @Autowired + private UmsMemberService memberService; + @Autowired + private UmsFeedBackMapper feedbackMapper; + + @Override + public int add(UmsFeedBack feedback) { + UmsMember currentMember = memberService.getCurrentMember(); + feedback.setMemberId(currentMember.getId()); + return feedbackMapper.insert(feedback); + } +} \ No newline at end of file diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java index a75962e008..a969d56056 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java @@ -1,10 +1,11 @@ package com.macro.mall.portal.service.impl; -import com.macro.mall.common.service.RedisService; import com.macro.mall.mapper.UmsMemberMapper; import com.macro.mall.model.UmsMember; import com.macro.mall.portal.service.UmsMemberCacheService; import com.macro.mall.security.annotation.CacheException; +import com.macro.mall.security.config.RedisConfig; +import com.macro.mall.security.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/CharUtil.java b/mall-portal/src/main/java/com/macro/mall/portal/util/CharUtil.java new file mode 100644 index 0000000000..f073fd24ba --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/CharUtil.java @@ -0,0 +1,80 @@ +package com.macro.mall.portal.util; + +import java.util.Random; + +public class CharUtil { + + /** + * 获取随机字符串 + * + * @param num + * @return + */ + public static String getRandomString(Integer num) { + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < num; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } + + /** + * 获取随机字符串 + * + * @param num + * @return + */ + public static String getRandomNum(Integer num) { + String base = "0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < num; i++) { + int number = random.nextInt(base.length()); + sb.append(base.charAt(number)); + } + return sb.toString(); + } + + /** + * 右补位,左对齐 + * + * @param oriStr 原字符串 + * @param len 目标字符串长度 + * @param fillChar 补位字符 + * @return 目标字符串 + */ + public static String padRight(String oriStr, int len, char fillChar) { + String str = ""; + int strlen = oriStr.length(); + if (strlen < len) { + for (int i = 0; i < len - strlen; i++) { + str = str + fillChar; + } + } + str = str + oriStr; + return str; + } + + /** + * 左补位,右对齐 + * + * @param oriStr 原字符串 + * @param len 目标字符串长度 + * @param fillChar 补位字符 + * @return 目标字符串 + */ + public static String padLeft(String oriStr, int len, char fillChar) { + int strlen = oriStr.length(); + String str = ""; + if (strlen < len) { + for (int i = 0; i < len - strlen; i++) { + str = str + fillChar; + } + } + str = oriStr + str; + return str; + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/ResourceUtil.java b/mall-portal/src/main/java/com/macro/mall/portal/util/ResourceUtil.java new file mode 100644 index 0000000000..4540b8fcc0 --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/ResourceUtil.java @@ -0,0 +1,78 @@ +package com.macro.mall.portal.util; + +import java.io.UnsupportedEncodingException; +import java.util.ResourceBundle; + +/** + * 名称:ResourceUtil
+ * 描述:参数工具类
+ * + * @author 李鹏军 + * @version 1.0 + * @since 1.0.0 + */ +public class ResourceUtil { + private static ResourceUtil RESOURCE_UTIL = null; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle("platform"); + + private ResourceUtil() { + + } + + /** + * 工厂实现配置文件读取 + * + * @param properties 参数 + * @return ResourceUtil 工具类 + */ + public static ResourceUtil getInstance(String properties) { + if (RESOURCE_UTIL == null) { + RESOURCE_UTIL = new ResourceUtil(); + } + if (properties != null) { + BUNDLE = ResourceBundle.getBundle(properties); + } + return RESOURCE_UTIL; + } + + /** + * 工厂实现配置文件读取 + * + * @return ResourceUtil + */ + public static ResourceUtil getInstance() { + if (RESOURCE_UTIL == null) { + RESOURCE_UTIL = new ResourceUtil(); + } + return RESOURCE_UTIL; + } + + /** + * 主要功能:获取配置文件参数 + * 注意事项:无 + * + * @param name 参数名称 + * @return 参数名称对应值 + */ + public static String getConfigByName(String name) { + String value = ""; + try { + value = new String(BUNDLE.getString(name).getBytes("iso8859-1"), "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return value; + } + + /** + * 主要功能:取得分隔符 + * 注意事项:无 + * + * @return 分隔符 + */ + public static String getSeparator() { + return System.getProperty("file.separator"); + } + +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/SSL.java b/mall-portal/src/main/java/com/macro/mall/portal/util/SSL.java new file mode 100644 index 0000000000..dd33c5b98d --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/SSL.java @@ -0,0 +1,76 @@ +package com.macro.mall.portal.util; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + +import org.springframework.http.client.SimpleClientHttpRequestFactory; + + +/** + * HTTPS 跳过校验 + */ +public class SSL extends SimpleClientHttpRequestFactory { + + @Override + protected void prepareConnection(HttpURLConnection connection, String httpMethod) + throws IOException { + if (connection instanceof HttpsURLConnection) { + prepareHttpsConnection((HttpsURLConnection) connection); + } + super.prepareConnection(connection, httpMethod); + } + + private void prepareHttpsConnection(HttpsURLConnection connection) { + connection.setHostnameVerifier(new SkipHostnameVerifier()); + try { + connection.setSSLSocketFactory(createSslSocketFactory()); + } + catch (Exception ex) { + // Ignore + } + } + + private SSLSocketFactory createSslSocketFactory() throws Exception { + SSLContext context = SSLContext.getInstance("TLS"); + context.init(null, new TrustManager[] { new SkipX509TrustManager() }, + new SecureRandom()); + return context.getSocketFactory(); + } + + private class SkipHostnameVerifier implements HostnameVerifier { + + @Override + public boolean verify(String s, SSLSession sslSession) { + return true; + } + + } + + private static class SkipX509TrustManager implements X509TrustManager { + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + } + +} \ No newline at end of file diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/MD5.java b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/MD5.java new file mode 100644 index 0000000000..126606b5ac --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/MD5.java @@ -0,0 +1,29 @@ +package com.macro.mall.portal.util.wechat; + +import java.security.MessageDigest; + +public class MD5 { + private MD5() { + } + + /* * 生成 MD5 + * + * @param data 待处理数据 + * @return MD5结果 + */ + public static String getMessageDigest(String data) { + StringBuilder sb = new StringBuilder(); + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] array = md.digest(data.getBytes("UTF-8")); + + for (byte item : array) { + sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3)); + } + } catch (Exception e) { + return null; + } + return sb.toString().toUpperCase(); + } + +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatConfig.java b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatConfig.java new file mode 100644 index 0000000000..50a98b827b --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatConfig.java @@ -0,0 +1,40 @@ +//package com.macro.mall.portal.util.wechat; +// +//import com.platform.utils.ResourceUtil; +//import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +//import org.apache.http.conn.ssl.SSLContexts; +// +//import javax.net.ssl.SSLContext; +//import java.io.InputStream; +//import java.security.KeyStore; +// +//@SuppressWarnings("deprecation") +//public class WechatConfig { +// +// private static SSLConnectionSocketFactory sslcsf; +// +// public static SSLConnectionSocketFactory getSslcsf() { +// if (null == sslcsf) { +// setSsslcsf(); +// } +// return sslcsf; +// } +// +// private static void setSsslcsf() { +// try { +// KeyStore keyStore = KeyStore.getInstance("PKCS12"); +// Thread.currentThread().getContextClassLoader(); +// InputStream instream = new WechatRefundApiResult().getClass().getResourceAsStream(ResourceUtil.getConfigByName("wx.certName")); +// try { +// keyStore.load(instream, ResourceUtil.getConfigByName("wx.mchId").toCharArray()); +// } finally { +// instream.close(); +// } +// SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, ResourceUtil.getConfigByName("wx.mchId").toCharArray()).build(); +// sslcsf = new SSLConnectionSocketFactory(sslcontext, new String[]{"TLSv1"}, null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// +//} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatRefundApiResult.java b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatRefundApiResult.java new file mode 100644 index 0000000000..4b8adbca11 --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatRefundApiResult.java @@ -0,0 +1,169 @@ +package com.macro.mall.portal.util.wechat; + +public class WechatRefundApiResult { + private String return_code; + private String return_msg; + + private String result_code; + private String err_code; + private String err_code_des; + private String appid; + private String mch_id; + private String device_info; + private String nonce_str; + private String sign; + private String transaction_id; + private String out_trade_no; + private String out_refund_no; + private String refund_id; + private String refund_channel; + private String refund_fee; + private String settlement_refund_fee; + private String total_fee; + private String settlement_total_fee; + private String fee_type; + private String cash_fee; + private String cash_refund_fee; + private String refund_status; + + public String getRefund_status() { + return refund_status; + } + public void setRefund_status(String refund_status) { + this.refund_status = refund_status; + } + public String getReturn_code() { + return return_code; + } + public void setReturn_code(String return_code) { + this.return_code = return_code; + } + public String getReturn_msg() { + return return_msg; + } + public void setReturn_msg(String return_msg) { + this.return_msg = return_msg; + } + public String getResult_code() { + return result_code; + } + public void setResult_code(String result_code) { + this.result_code = result_code; + } + public String getErr_code() { + return err_code; + } + public void setErr_code(String err_code) { + this.err_code = err_code; + } + public String getErr_code_des() { + return err_code_des; + } + public void setErr_code_des(String err_code_des) { + this.err_code_des = err_code_des; + } + public String getAppid() { + return appid; + } + public void setAppid(String appid) { + this.appid = appid; + } + public String getMch_id() { + return mch_id; + } + public void setMch_id(String mch_id) { + this.mch_id = mch_id; + } + public String getDevice_info() { + return device_info; + } + public void setDevice_info(String device_info) { + this.device_info = device_info; + } + public String getNonce_str() { + return nonce_str; + } + public void setNonce_str(String nonce_str) { + this.nonce_str = nonce_str; + } + public String getSign() { + return sign; + } + public void setSign(String sign) { + this.sign = sign; + } + public String getTransaction_id() { + return transaction_id; + } + public void setTransaction_id(String transaction_id) { + this.transaction_id = transaction_id; + } + public String getOut_trade_no() { + return out_trade_no; + } + public void setOut_trade_no(String out_trade_no) { + this.out_trade_no = out_trade_no; + } + public String getOut_refund_no() { + return out_refund_no; + } + public void setOut_refund_no(String out_refund_no) { + this.out_refund_no = out_refund_no; + } + public String getRefund_id() { + return refund_id; + } + public void setRefund_id(String refund_id) { + this.refund_id = refund_id; + } + public String getRefund_channel() { + return refund_channel; + } + public void setRefund_channel(String refund_channel) { + this.refund_channel = refund_channel; + } + public String getRefund_fee() { + return refund_fee; + } + public void setRefund_fee(String refund_fee) { + this.refund_fee = refund_fee; + } + public String getSettlement_refund_fee() { + return settlement_refund_fee; + } + public void setSettlement_refund_fee(String settlement_refund_fee) { + this.settlement_refund_fee = settlement_refund_fee; + } + public String getTotal_fee() { + return total_fee; + } + public void setTotal_fee(String total_fee) { + this.total_fee = total_fee; + } + public String getSettlement_total_fee() { + return settlement_total_fee; + } + public void setSettlement_total_fee(String settlement_total_fee) { + this.settlement_total_fee = settlement_total_fee; + } + public String getFee_type() { + return fee_type; + } + public void setFee_type(String fee_type) { + this.fee_type = fee_type; + } + public String getCash_fee() { + return cash_fee; + } + public void setCash_fee(String cash_fee) { + this.cash_fee = cash_fee; + } + public String getCash_refund_fee() { + return cash_refund_fee; + } + public void setCash_refund_fee(String cash_refund_fee) { + this.cash_refund_fee = cash_refund_fee; + } + + +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatUtil.java b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatUtil.java new file mode 100644 index 0000000000..e302845472 --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/util/wechat/WechatUtil.java @@ -0,0 +1,382 @@ +//package com.macro.mall.portal.util.wechat; +// +//import com.alibaba.druid.support.logging.Log; +//import com.alibaba.druid.support.logging.LogFactory; +//import com.platform.utils.CharUtil; +//import com.platform.utils.MapUtils; +//import com.platform.utils.ResourceUtil; +//import com.platform.utils.XmlUtil; +//import org.apache.http.HttpEntity; +//import org.apache.http.HttpResponse; +//import org.apache.http.client.HttpClient; +//import org.apache.http.client.config.RequestConfig; +//import org.apache.http.client.methods.CloseableHttpResponse; +//import org.apache.http.client.methods.HttpPost; +//import org.apache.http.config.RegistryBuilder; +//import org.apache.http.conn.socket.ConnectionSocketFactory; +//import org.apache.http.conn.socket.PlainConnectionSocketFactory; +//import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +//import org.apache.http.entity.StringEntity; +//import org.apache.http.impl.client.CloseableHttpClient; +//import org.apache.http.impl.client.HttpClientBuilder; +//import org.apache.http.impl.client.HttpClients; +//import org.apache.http.impl.conn.BasicHttpClientConnectionManager; +//import org.apache.http.util.EntityUtils; +// +//import java.io.IOException; +//import java.io.UnsupportedEncodingException; +//import java.math.BigDecimal; +//import java.math.MathContext; +//import java.net.URLEncoder; +//import java.text.SimpleDateFormat; +//import java.util.Arrays; +//import java.util.Date; +//import java.util.HashMap; +//import java.util.Map; +//import java.util.Set; +// +///** +// *

Title: 微信退款工具类

+// *

Description: 微信退款工具类,通过充值客户端的不同初始化不同的工具类,得到相应微信退款相关的appid和muchid

+// * +// * @author xubo +// * @date 2017年6月6日 下午5:05:03 +// */ +//public class WechatUtil { +// private static Log logger = LogFactory.getLog(WechatUtil.class); +// /** +// * 充值客户端类型--微信公众号 +// */ +// public static Integer CLIENTTYPE_WX = 2; +// /** +// * 充值客户端类型--app +// */ +// public static Integer CLIENTTYPE_APP = 1; +// +// /** +// * 方法描述:企业付款到零钱 +// * @param openid 用户openId +// * @param payMoney 支付金额 +// * @param userName 真实姓名 +// * @param payCountId 流水号,唯一 +// * @return +// */ +// public static WechatRefundApiResult wxPayMoneyToUser(String openid, Double payMoney, String userName,String payCountId) { +// //初始化请求微信服务器的配置信息包括appid密钥等 +// //转换金钱格式 +// BigDecimal bdpayMoney = new BigDecimal(payMoney, MathContext.DECIMAL32); +// //构建请求参数 +// Map params = payMoneyToUser(openid, bdpayMoney, userName,payCountId); +// String mapToXml = MapUtils.convertMap2Xml(params); +// //请求微信 +// String reponseXml = sendorgPay(mapToXml, WechatConfig.getSslcsf()); +// WechatRefundApiResult result = (WechatRefundApiResult) XmlUtil.xmlStrToBean(reponseXml, WechatRefundApiResult.class); +// return result; +// } +// /** +// * 方法描述:分账请求参数 +// */ +// private static Map payMoneyToUser(String openid, BigDecimal bdpayMoney, String userName,String payCountId) { +// +// Map params = new HashMap(); +// //微信分配的公众账号ID(企业号corpid即为此appId) +// params.put("mch_appid", ResourceUtil.getConfigByName("wx.appId")); +// //微信支付分配的商户号 +// params.put("mchid", ResourceUtil.getConfigByName("wx.mchId")); +// //随机字符串,不长于32位。推荐随机数生成算法 +// params.put("nonce_str", CharUtil.getRandomString(16)); +// //商户侧传给微信的订单号 +// params.put("partner_trade_no", payCountId); +// params.put("openid", openid);//收款人openid +// params.put("check_name", "FORCE_CHECK");//强校验真实姓名 +// params.put("re_user_name", userName);//收款用户真实姓名。 +// params.put("amount", bdpayMoney.multiply(new BigDecimal(100)).intValue()); //转账总金额,单位为分,只能为整数 +// params.put("desc", "销售分润给"+userName+",金额:"+bdpayMoney);//转账备注。 +// //商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 +// params.put("spbill_create_ip", "192.168.0.1"); +// //签名前必须要参数全部写在前面 +// params.put("sign", arraySign(params, ResourceUtil.getConfigByName("wx.paySignKey"))); +// return params; +// } +// /** +// * 企业付款逻辑 +// **/ +// public static String sendorgPay(String mapToXml, SSLConnectionSocketFactory sslcsf) { +// logger.info("*******企业付款(WX Request:" + mapToXml); +// HttpPost httPost = new HttpPost(ResourceUtil.getConfigByName("wx.orgPay")); +// httPost.addHeader("Connection", "keep-alive"); +// httPost.addHeader("Accept", "*/*"); +// httPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); +// httPost.addHeader("Host", "api.mch.weixin.qq.com"); +// httPost.addHeader("X-Requested-With", "XMLHttpRequest"); +// httPost.addHeader("Cache-Control", "max-age=0"); +// httPost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); +// httPost.setEntity(new StringEntity(mapToXml, "UTF-8")); +// CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslcsf).build(); +// CloseableHttpResponse response = null; +// try { +// response = httpClient.execute(httPost); +// HttpEntity entity = response.getEntity(); +// String xmlStr = EntityUtils.toString(entity, "UTF-8"); +// logger.info("*******企业付款(WX Response:" + xmlStr); +// return xmlStr; +// } catch (Exception e) { +// logger.error(e.getMessage(), e); +// return null; +// } finally { +// try { +// if (response != null) { +// response.close(); +// } +// } catch (IOException e) { +// logger.error(e.getMessage(), e); +// } +// } +// } +// +// +// /** +// * 方法描述:微信退款逻辑 +// * 创建时间:2017年4月12日 上午11:04:25 +// * 作者: xubo +// * +// * @param +// * @return +// */ +// public static WechatRefundApiResult wxRefund(String out_trade_no, Double orderMoney, Double refundMoney) { +// //初始化请求微信服务器的配置信息包括appid密钥等 +// //转换金钱格式 +// BigDecimal bdOrderMoney = new BigDecimal(orderMoney, MathContext.DECIMAL32); +// BigDecimal bdRefundMoney = new BigDecimal(refundMoney, MathContext.DECIMAL32); +// //构建请求参数 +// Map params = buildRequsetMapParam(out_trade_no, bdOrderMoney, bdRefundMoney); +// String mapToXml = MapUtils.convertMap2Xml(params); +// //请求微信 +// String reponseXml = sendSSLPostToWx(mapToXml, WechatConfig.getSslcsf()); +// WechatRefundApiResult result = (WechatRefundApiResult) XmlUtil.xmlStrToBean(reponseXml, WechatRefundApiResult.class); +// return result; +// } +// +// /** +// * 方法描述:得到请求微信退款请求的参数 +// * 创建时间:2017年6月8日 上午11:27:02 +// * 作者: xubo +// * +// * @param +// * @return +// */ +// private static Map buildRequsetMapParam(String out_trade_no, BigDecimal bdOrderMoney, BigDecimal bdRefundMoney) { +// Map params = new HashMap(); +// //微信分配的公众账号ID(企业号corpid即为此appId) +// params.put("appid", ResourceUtil.getConfigByName("wx.appId")); +// //微信支付分配的商户号 +// params.put("mch_id", ResourceUtil.getConfigByName("wx.mchId")); +// //随机字符串,不长于32位。推荐随机数生成算法 +// params.put("nonce_str", CharUtil.getRandomString(16)); +// //商户侧传给微信的订单号 +// params.put("out_trade_no", out_trade_no); +// //商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 +// params.put("out_refund_no", getBundleId()); +// //订单总金额,单位为分,只能为整数 +// params.put("total_fee", bdOrderMoney.multiply(new BigDecimal(100)).intValue()); +// //退款总金额,订单总金额,单位为分,只能为整数 +// params.put("refund_fee", bdRefundMoney.multiply(new BigDecimal(100)).intValue()); +// //操作员帐号, 默认为商户号 +// params.put("op_user_id", ResourceUtil.getConfigByName("wx.mchId")); +// //签名前必须要参数全部写在前面 +// params.put("sign", arraySign(params, ResourceUtil.getConfigByName("wx.paySignKey"))); +// return params; +// } +// +// /** +// * 请求微信https +// **/ +// public static String sendSSLPostToWx(String mapToXml, SSLConnectionSocketFactory sslcsf) { +// logger.info("*******退款(WX Request:" + mapToXml); +// HttpPost httPost = new HttpPost(ResourceUtil.getConfigByName("wx.refundUrl")); +// httPost.addHeader("Connection", "keep-alive"); +// httPost.addHeader("Accept", "*/*"); +// httPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); +// httPost.addHeader("Host", "api.mch.weixin.qq.com"); +// httPost.addHeader("X-Requested-With", "XMLHttpRequest"); +// httPost.addHeader("Cache-Control", "max-age=0"); +// httPost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); +// httPost.setEntity(new StringEntity(mapToXml, "UTF-8")); +// CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslcsf).build(); +// CloseableHttpResponse response = null; +// try { +// response = httpClient.execute(httPost); +// HttpEntity entity = response.getEntity(); +// String xmlStr = EntityUtils.toString(entity, "UTF-8"); +// logger.info("*******退款(WX Response:" + xmlStr); +// return xmlStr; +// } catch (Exception e) { +// logger.error(e.getMessage(), e); +// return null; +// } finally { +// try { +// if (response != null) { +// response.close(); +// } +// } catch (IOException e) { +// logger.error(e.getMessage(), e); +// } +// } +// } +// +// /** +// * 方法描述:微信查询退款逻辑 +// * 创建时间:2017年4月12日 上午11:04:25 +// * 作者: xubo +// * +// * @param +// * @return +// */ +// public Map wxRefundquery(String out_trade_no, String out_refund_no) { +// Map params = new HashMap(); +// //微信分配的公众账号ID(企业号corpid即为此appId) +// params.put("appid", ResourceUtil.getConfigByName("wx.appId")); +// //微信支付分配的商户号 +// params.put("mch_id", ResourceUtil.getConfigByName("wx.mchId")); +// //随机字符串,不长于32位。推荐随机数生成算法 +// params.put("nonce_str", CharUtil.getRandomString(16)); +// //商户侧传给微信的订单号 +// params.put("out_trade_no", out_trade_no); +// //签名前必须要参数全部写在前面 +// //签名 +// params.put("sign", arraySign(params, ResourceUtil.getConfigByName("wx.paySignKey"))); +// String mapToXml = MapUtils.convertMap2Xml(params); +// HttpPost httPost = new HttpPost(ResourceUtil.getConfigByName("wx.refundqueryUrl")); +// httPost.addHeader("Connection", "keep-alive"); +// httPost.addHeader("Accept", "*/*"); +// httPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); +// httPost.addHeader("Host", "api.mch.weixin.qq.com"); +// httPost.addHeader("X-Requested-With", "XMLHttpRequest"); +// httPost.addHeader("Cache-Control", "max-age=0"); +// httPost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); +// httPost.setEntity(new StringEntity(mapToXml, "UTF-8")); +// CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(WechatConfig.getSslcsf()).build(); +// CloseableHttpResponse response = null; +// try { +// response = httpClient.execute(httPost); +// HttpEntity entity = response.getEntity(); +// String xmlStr = EntityUtils.toString(entity, "UTF-8"); +// System.out.println(xmlStr); +// Map result = XmlUtil.xmlStrToMap(xmlStr);//.xmlStrToBean(xmlStr, WechatRefundApiResult.class); +// return result; +// //将信息保存到数据库 +// } catch (Exception e) { +// logger.error(e.getMessage(), e); +// return null; +// } finally { +// try { +// if (response != null) { +// response.close(); +// } +// } catch (IOException e) { +// logger.error(e.getMessage(), e); +// } +// } +// } +// +// /** +// * 支付交易ID +// */ +// public static String getBundleId() { +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); +// String tradeno = dateFormat.format(new Date()); +// String str = "000000" + (int) (Math.random() * 1000000); +// tradeno = tradeno + str.substring(str.length() - 6); +// return tradeno; +// } +// +// /** +// * 方法描述:根据签名加密请求参数 +// * 创建时间:2017年6月8日 上午11:28:52 +// * 作者: xubo +// * +// * @param +// * @return +// */ +// public static String arraySign(Map params, String paySignKey) { +// boolean encode = false; +// Set keysSet = params.keySet(); +// Object[] keys = keysSet.toArray(); +// Arrays.sort(keys); +// StringBuffer temp = new StringBuffer(); +// boolean first = true; +// for (Object key : keys) { +// if (first) { +// first = false; +// } else { +// temp.append("&"); +// } +// temp.append(key).append("="); +// Object value = params.get(key); +// String valueString = ""; +// if (null != value) { +// valueString = value.toString(); +// } +// if (encode) { +// try { +// temp.append(URLEncoder.encode(valueString, "UTF-8")); +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } +// } else { +// temp.append(valueString); +// } +// } +// temp.append("&key="); +// temp.append(paySignKey); +// System.out.println(temp.toString()); +// String packageSign = MD5.getMessageDigest(temp.toString()); +// return packageSign; +// } +// +// /** +// * 请求,只请求一次,不做重试 +// * +// * @param url +// * @param data +// * @return +// * @throws Exception +// */ +// public static String requestOnce(final String url, String data) throws Exception { +// BasicHttpClientConnectionManager connManager; +// connManager = new BasicHttpClientConnectionManager( +// RegistryBuilder.create() +// .register("http", PlainConnectionSocketFactory.getSocketFactory()) +// .register("https", SSLConnectionSocketFactory.getSocketFactory()) +// .build(), +// null, +// null, +// null +// ); +// +// HttpClient httpClient = HttpClientBuilder.create() +// .setConnectionManager(connManager) +// .build(); +// +// HttpPost httpPost = new HttpPost(url); +// +// RequestConfig requestConfig = RequestConfig.custom() +// .setSocketTimeout(5000) +// .setConnectTimeout(5000) +// .setConnectionRequestTimeout(10000).build(); +// +// httpPost.setConfig(requestConfig); +// +// StringEntity postEntity = new StringEntity(data, "UTF-8"); +// httpPost.addHeader("Content-Type", "text/xml"); +// httpPost.addHeader("User-Agent", "wxpay sdk java v1.0 " + ResourceUtil.getConfigByName("wx.mchId")); +// httpPost.setEntity(postEntity); +// +// HttpResponse httpResponse = httpClient.execute(httpPost); +// HttpEntity httpEntity = httpResponse.getEntity(); +// String reusltObj = EntityUtils.toString(httpEntity, "UTF-8"); +// logger.info("请求结果:" + reusltObj); +// return reusltObj; +// +// } +//} diff --git a/mall-portal/src/main/resources/application-dev.yml b/mall-portal/src/main/resources/application-dev.yml index c0af59ee7e..0f845d8a09 100644 --- a/mall-portal/src/main/resources/application-dev.yml +++ b/mall-portal/src/main/resources/application-dev.yml @@ -38,6 +38,8 @@ logging: root: info com.macro.mall: debug -logstash: - host: localhost - +wx: + getCode: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=STAT#wechat_redirect" + webAccessTokenhttps: "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code" + appId: XXXXXXXXXX + secret: XXXXXXXXXXXX \ No newline at end of file diff --git a/mall-portal/src/main/resources/application-prod.yml b/mall-portal/src/main/resources/application-prod.yml index c272a4f78b..6cff78886c 100644 --- a/mall-portal/src/main/resources/application-prod.yml +++ b/mall-portal/src/main/resources/application-prod.yml @@ -43,6 +43,8 @@ logging: root: info com.macro.mall: info -logstash: - host: logstash - +wx: + getCode: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=STAT#wechat_redirect" + webAccessTokenhttps: "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code" + appId: XXXXXXXXX + secret: XXXXXXXXXX \ No newline at end of file diff --git a/mall-portal/src/main/resources/application.yml b/mall-portal/src/main/resources/application.yml index d2101edf4e..6431d6b53b 100644 --- a/mall-portal/src/main/resources/application.yml +++ b/mall-portal/src/main/resources/application.yml @@ -30,6 +30,7 @@ secure: - /druid/** - /actuator/** - /sso/** + - /wx/** - /home/** - /product/** - /brand/**