suochencheng 7 years ago
parent
commit
2a896dba0d

+ 6 - 4
src/main/java/com/izouma/awesomeadmin/constant/AppConstant.java

@@ -316,14 +316,14 @@ public interface AppConstant {
     public interface ProductType {
 
         /**
-         * 修图
+         * 充值
          */
-        String IMAGE = "0";
+        Integer RECHARGE = 0;
 
         /**
-         * 实体商品
+         * 消费
          */
-        String PHYSICAL = "1";
+        Integer CONSUMPTION = 1;
     }
 
     /**
@@ -495,4 +495,6 @@ public interface AppConstant {
         Integer END = 3;
 
     }
+
+
 }

+ 33 - 0
src/main/java/com/izouma/awesomeadmin/dao/ProductInfoMapper.java

@@ -0,0 +1,33 @@
+package com.izouma.awesomeadmin.dao;
+
+import java.util.*;
+import com.izouma.awesomeadmin.datasource.DataSource;
+import org.springframework.stereotype.Repository;
+import com.izouma.awesomeadmin.model.ProductInfo;
+
+
+/**
+*  Dao接口
+*/
+@Repository("com.zoumaframe.dao.ProductInfoMapper")
+public interface ProductInfoMapper{
+
+    int deleteByPrimaryKey(Integer id);
+
+    int insertSelective(ProductInfo record);
+
+    ProductInfo selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(ProductInfo record);
+
+    List<ProductInfo> queryAllProductInfo(ProductInfo record);
+
+    List<ProductInfo> queryProductInfoByPage(Map<String, Object> parameter);
+
+    int delete(ProductInfo record);
+
+    ProductInfo queryProductInfo(ProductInfo record);
+
+    List<ProductInfo> query(ProductInfo record);
+}
+

+ 470 - 0
src/main/java/com/izouma/awesomeadmin/dao/ProductInfoMapper.xml

@@ -0,0 +1,470 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.izouma.awesomeadmin.dao.ProductInfoMapper">
+    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.ProductInfo">
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
+        <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
+        <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
+        <result column="product_name" property="productName" jdbcType="VARCHAR"/>
+        <result column="money" property="money" jdbcType="DECIMAL"/>
+        <result column="coin" property="coin" jdbcType="DECIMAL"/>
+        <result column="type_flag" property="typeFlag" jdbcType="INTEGER"/>
+        <result column="remark" property="remark" jdbcType="VARCHAR"/>
+        <result column="rank" property="rank" jdbcType="INTEGER"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <trim suffixOverrides=",">
+            id,
+
+            del_flag,
+
+            update_time,
+
+            update_user,
+
+            create_time,
+
+            create_user,
+
+            product_name,
+
+            money,
+
+            coin,
+
+            type_flag,
+
+            remark,
+
+            rank,
+
+        </trim>
+    </sql>
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
+        select
+        <include refid="Base_Column_List"/>
+        from product_info
+        where id = #{id,jdbcType=INTEGER}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+        delete from product_info
+        where id = #{id,jdbcType=INTEGER}
+    </delete>
+    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ProductInfo" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into product_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id!= null">
+                id,
+            </if>
+            <if test="delFlag!= null">
+                del_flag,
+            </if>
+            <if test="updateTime!= null">
+                update_time,
+            </if>
+            <if test="updateUser!= null">
+                update_user,
+            </if>
+            <if test="createTime!= null">
+                create_time,
+            </if>
+            <if test="createUser!= null">
+                create_user,
+            </if>
+            <if test="productName!= null">
+                product_name,
+            </if>
+            <if test="money!= null">
+                money,
+            </if>
+            <if test="coin!= null">
+                coin,
+            </if>
+            <if test="typeFlag!= null">
+                type_flag,
+            </if>
+            <if test="remark!= null">
+                remark,
+            </if>
+            <if test="rank!= null">
+                rank,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">
+                #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUser != null">
+                #{updateUser,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="createUser != null">
+                #{createUser,jdbcType=VARCHAR},
+            </if>
+            <if test="productName != null">
+                #{productName,jdbcType=VARCHAR},
+            </if>
+            <if test="money != null">
+                #{money,jdbcType=DECIMAL},
+            </if>
+            <if test="coin != null">
+                #{coin,jdbcType=DECIMAL},
+            </if>
+            <if test="typeFlag != null">
+                #{typeFlag,jdbcType=INTEGER},
+            </if>
+            <if test="remark != null">
+                #{remark,jdbcType=VARCHAR},
+            </if>
+            <if test="rank != null">
+                #{rank,jdbcType=INTEGER},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ProductInfo">
+        update product_info
+        <set>
+            <if test="id != null">
+                id= #{id,jdbcType=INTEGER},
+            </if>
+            <if test="delFlag != null">
+                del_flag= #{delFlag,jdbcType=CHAR},
+            </if>
+            <if test="updateTime != null">
+                update_time= #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUser != null">
+                update_user= #{updateUser,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null">
+                create_time= #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="createUser != null">
+                create_user= #{createUser,jdbcType=VARCHAR},
+            </if>
+            <if test="productName != null">
+                product_name= #{productName,jdbcType=VARCHAR},
+            </if>
+            <if test="money != null">
+                money= #{money,jdbcType=DECIMAL},
+            </if>
+            <if test="coin != null">
+                coin= #{coin,jdbcType=DECIMAL},
+            </if>
+            <if test="typeFlag != null">
+                type_flag= #{typeFlag,jdbcType=INTEGER},
+            </if>
+            <if test="remark != null">
+                remark= #{remark,jdbcType=VARCHAR},
+            </if>
+            <if test="rank != null">
+                rank= #{rank,jdbcType=INTEGER},
+            </if>
+        </set>
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
+
+    </update>
+    <select id="queryProductInfoByPage" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.ProductInfo">
+        select
+        <include refid="Base_Column_List"/>
+        from product_info
+        <where>
+            and del_flag = 'N'
+            <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
+                and id in (${record.idStr})
+            </if>
+            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
+                and id = #{record.id}
+            </if>
+            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
+                and del_flag = #{record.delFlag}
+            </if>
+            <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
+                and update_time = #{record.updateTime}
+            </if>
+            <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
+                and update_user = #{record.updateUser}
+            </if>
+            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
+                and create_time = #{record.createTime}
+            </if>
+            <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
+                and create_user = #{record.createUser}
+            </if>
+            <if test="record.productName != null and !&quot;&quot;.equals(record.productName)">
+                and product_name = #{record.productName}
+            </if>
+            <if test="record.money != null and !&quot;&quot;.equals(record.money)">
+                and money = #{record.money}
+            </if>
+            <if test="record.coin != null and !&quot;&quot;.equals(record.coin)">
+                and coin = #{record.coin}
+            </if>
+            <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
+                and type_flag = #{record.typeFlag}
+            </if>
+            <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
+                and remark = #{record.remark}
+            </if>
+            <if test="record.rank != null and !&quot;&quot;.equals(record.rank)">
+                and rank = #{record.rank}
+            </if>
+            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR product_name LIKE concat('%',#{record.searchKey},'%')
+                    OR money LIKE concat('%',#{record.searchKey},'%')
+                    OR coin LIKE concat('%',#{record.searchKey},'%')
+                    OR type_flag LIKE concat('%',#{record.searchKey},'%')
+                    OR remark LIKE concat('%',#{record.searchKey},'%')
+                    OR rank LIKE concat('%',#{record.searchKey},'%')
+                </trim>
+            </if>
+
+            <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
+                <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+
+        </where>
+        order by
+
+        <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+        rank desc , id desc
+    </select>
+    <select id="queryAllProductInfo" parameterType="java.util.Map"
+            resultType="com.izouma.awesomeadmin.model.ProductInfo">
+        select
+        <include refid="Base_Column_List"/>
+        from product_info
+        <where>
+            and del_flag = 'N'
+            <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+                and id in (${idStr})
+            </if>
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="productName != null and !&quot;&quot;.equals(productName)">
+                and product_name = #{productName}
+            </if>
+            <if test="money != null and !&quot;&quot;.equals(money)">
+                and money = #{money}
+            </if>
+            <if test="coin != null and !&quot;&quot;.equals(coin)">
+                and coin = #{coin}
+            </if>
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
+            </if>
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+            <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
+                <trim prefix="and (" suffix=")" prefixOverrides="OR">
+                    OR product_name LIKE concat('%',#{searchKey},'%')
+                    OR money LIKE concat('%',#{searchKey},'%')
+                    OR coin LIKE concat('%',#{searchKey},'%')
+                    OR type_flag LIKE concat('%',#{searchKey},'%')
+                    OR remark LIKE concat('%',#{searchKey},'%')
+                    OR rank LIKE concat('%',#{searchKey},'%')
+                </trim>
+            </if>
+            <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
+                <foreach item="item" index="index" collection="advancedQuery.split('_;')">
+                    <choose>
+                        <when test="item.indexOf('like') != -1">
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    concat('%',#{itemDetail},'%')
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </when>
+                        <otherwise>
+                            <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                                <if test="detailIndex == 3">
+                                    #{itemDetail}
+                                </if>
+
+                                <if test="detailIndex &lt; 3">
+                                    ${itemDetail}
+                                </if>
+
+                            </foreach>
+                        </otherwise>
+                    </choose>
+
+
+                </foreach>
+
+
+            </if>
+        </where>
+        order by
+
+        <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
+
+
+            <trim suffixOverrides=",">
+                <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
+                    <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
+                        ${itemDetail}
+                    </foreach>
+                </foreach>
+            </trim>
+            ,
+        </if>
+
+        rank desc , id desc
+    </select>
+    <select id="queryProductInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductInfo">
+        select
+        <include refid="Base_Column_List"/>
+        from product_info
+        <where>
+            and del_flag = 'N'
+            <if test="id != null and !&quot;&quot;.equals(id)">
+                and id = #{id}
+            </if>
+            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
+                and del_flag = #{delFlag}
+            </if>
+            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
+                and update_time = #{updateTime}
+            </if>
+            <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
+                and update_user = #{updateUser}
+            </if>
+            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
+                and create_time = #{createTime}
+            </if>
+            <if test="createUser != null and !&quot;&quot;.equals(createUser)">
+                and create_user = #{createUser}
+            </if>
+            <if test="productName != null and !&quot;&quot;.equals(productName)">
+                and product_name = #{productName}
+            </if>
+            <if test="money != null and !&quot;&quot;.equals(money)">
+                and money = #{money}
+            </if>
+            <if test="coin != null and !&quot;&quot;.equals(coin)">
+                and coin = #{coin}
+            </if>
+            <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
+                and type_flag = #{typeFlag}
+            </if>
+            <if test="remark != null and !&quot;&quot;.equals(remark)">
+                and remark = #{remark}
+            </if>
+            <if test="rank != null and !&quot;&quot;.equals(rank)">
+                and rank = #{rank}
+            </if>
+
+        </where>
+        LIMIT 1
+    </select>
+    <update id="delete">
+        UPDATE product_info SET del_flag = 'Y'
+        where
+        <if test="id != null and !&quot;&quot;.equals(id)">
+            id = #{id,jdbcType=INTEGER}
+        </if>
+
+        <if test="idStr != null and !&quot;&quot;.equals(idStr)">
+            id in (${idStr})
+        </if>
+    </update>
+    <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductInfo">
+        select
+        <include refid="Base_Column_List"/>
+        from product_info
+        <where>
+            and del_flag = 'N'
+        </where>
+        order by id desc
+    </select>
+</mapper>
+

+ 178 - 0
src/main/java/com/izouma/awesomeadmin/model/ProductInfo.java

@@ -0,0 +1,178 @@
+package com.izouma.awesomeadmin.model;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonAutoDetect
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ProductInfo {
+    private Integer id;
+    private String delFlag;
+    private Date updateTime;
+    private String updateUser;
+    private Date createTime;
+    private String createUser;
+    private String productName;
+    private BigDecimal money;
+    private BigDecimal coin;
+    private Integer typeFlag;
+    private String remark;
+    private Integer rank;
+
+    private Integer userId;
+
+    private String idStr;
+
+    private String searchKey;
+
+    /**
+     * and,test_name,like,value;or,remark,=,123
+     */
+    private String advancedQuery;
+
+    /**
+     * column_name_,desc_;column_name_,asc
+     */
+    private String orderByStr;
+
+    public Integer getId() {
+        return this.id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getDelFlag() {
+        return this.delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getUpdateTime() {
+        return this.updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getUpdateUser() {
+        return this.updateUser;
+    }
+
+    public void setUpdateUser(String updateUser) {
+        this.updateUser = updateUser;
+    }
+
+    public Date getCreateTime() {
+        return this.createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreateUser() {
+        return this.createUser;
+    }
+
+    public void setCreateUser(String createUser) {
+        this.createUser = createUser;
+    }
+
+    public String getProductName() {
+        return this.productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public BigDecimal getMoney() {
+        return this.money;
+    }
+
+    public void setMoney(BigDecimal money) {
+        this.money = money;
+    }
+
+    public BigDecimal getCoin() {
+        return this.coin;
+    }
+
+    public void setCoin(BigDecimal coin) {
+        this.coin = coin;
+    }
+
+    public Integer getTypeFlag() {
+        return this.typeFlag;
+    }
+
+    public void setTypeFlag(Integer typeFlag) {
+        this.typeFlag = typeFlag;
+    }
+
+    public String getRemark() {
+        return this.remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Integer getRank() {
+        return this.rank;
+    }
+
+    public void setRank(Integer rank) {
+        this.rank = rank;
+    }
+
+    public String getSearchKey() {
+        return searchKey;
+    }
+
+    public void setSearchKey(String searchKey) {
+        this.searchKey = searchKey;
+    }
+
+    public String getAdvancedQuery() {
+        return advancedQuery;
+    }
+
+    public void setAdvancedQuery(String advancedQuery) {
+        this.advancedQuery = advancedQuery;
+    }
+
+    public String getOrderByStr() {
+        return orderByStr;
+    }
+
+    public void setOrderByStr(String orderByStr) {
+        this.orderByStr = orderByStr;
+    }
+
+    public String getIdStr() {
+        return idStr;
+    }
+
+    public void setIdStr(String idStr) {
+        this.idStr = idStr;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+}
+

+ 2 - 0
src/main/java/com/izouma/awesomeadmin/service/MemberCoinService.java

@@ -27,5 +27,7 @@ public interface MemberCoinService{
     int song(MemberCoin memberCoin);
 
     int recharge(MemberCoin memberCoin);
+
+    int consumption(MemberCoin memberCoin);
 }
 

+ 29 - 0
src/main/java/com/izouma/awesomeadmin/service/ProductInfoService.java

@@ -0,0 +1,29 @@
+package com.izouma.awesomeadmin.service;
+
+import java.util.*;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.ProductInfo;
+
+
+/**
+*  service接口类
+*/
+public interface ProductInfoService{
+
+    List<ProductInfo> getProductInfoList(ProductInfo record);
+
+    List<ProductInfo> getProductInfoByPage(Page page, ProductInfo record);
+
+    ProductInfo getProductInfoById(String id);
+
+    ProductInfo getProductInfo(ProductInfo record);
+
+    boolean createProductInfo(ProductInfo record);
+
+    boolean deleteProductInfo(ProductInfo record);
+
+    boolean updateProductInfo(ProductInfo record);
+
+    boolean buyProductInfo(ProductInfo record);
+}
+

+ 50 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/MemberCoinServiceImpl.java

@@ -7,6 +7,7 @@ import com.izouma.awesomeadmin.dao.RechargeRecordMapper;
 import com.izouma.awesomeadmin.model.RechargeRecord;
 import com.izouma.awesomeadmin.model.UserInfo;
 import com.izouma.awesomeadmin.service.UserInfoService;
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -221,6 +222,10 @@ public class MemberCoinServiceImpl implements MemberCoinService {
 
             }
 
+            if (StringUtils.isNotEmpty(memberCoin.getRemark())) {
+                remark = memberCoin.getRemark();
+            }
+
 
             double balance = userInfo.getMoneyCoin();
             double moneyCoin = balance + money;
@@ -256,5 +261,50 @@ public class MemberCoinServiceImpl implements MemberCoinService {
 
         return 0;
     }
+
+    @Override
+    public int consumption(MemberCoin memberCoin) {
+
+        logger.info("consumption:电子币消耗  ");
+        try {
+
+            int key = 0;
+
+            double money = memberCoin.getMoney().doubleValue();
+
+
+            int userId = Integer.valueOf(memberCoin.getUserId());
+            UserInfo userInfo = userInfoService.getUserInfoById(userId + "");
+
+            UserInfo updateUser = new UserInfo();
+            updateUser.setId(userId);
+            String remark = "消费";
+
+            if (StringUtils.isNotEmpty(memberCoin.getRemark())) {
+                remark = memberCoin.getRemark();
+            }
+
+
+            double balance = userInfo.getMoneyCoin();
+            double moneyCoin = balance - money;
+
+            memberCoin.setMoney(BigDecimal.valueOf(-money));
+            memberCoin.setCreateUser(remark);
+            memberCoin.setBalance(BigDecimal.valueOf(moneyCoin));
+            memberCoin.setTypeFlag(AppConstant.CoinType.CONSUMPTION);
+            memberCoin.setRemark(remark + money + "余额");
+            key += memberCoinMapper.insertSelective(memberCoin);
+
+
+            updateUser.setMoneyCoin(moneyCoin);
+            userInfoService.updateUserInfo(updateUser);
+
+            return key;
+        } catch (Exception e) {
+            logger.error("consumption:电子币电子币消耗异常  ", e);
+        }
+
+        return 0;
+    }
 }
 

+ 189 - 0
src/main/java/com/izouma/awesomeadmin/service/impl/ProductInfoServiceImpl.java

@@ -0,0 +1,189 @@
+package com.izouma.awesomeadmin.service.impl;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.model.MemberCoin;
+import com.izouma.awesomeadmin.service.MemberCoinService;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.model.ProductInfo;
+import com.izouma.awesomeadmin.service.ProductInfoService;
+import com.izouma.awesomeadmin.dao.ProductInfoMapper;
+
+/**
+ * service接口实现类
+ */
+@Service
+public class ProductInfoServiceImpl implements ProductInfoService {
+
+    private static Logger logger = Logger.getLogger(ProductInfoServiceImpl.class);
+
+    @Autowired
+    private ProductInfoMapper productInfoMapper;
+
+    @Autowired
+    private MemberCoinService memberCoinService;
+
+    @Override
+    public List<ProductInfo> getProductInfoList(ProductInfo record) {
+
+        logger.info("getProductInfoList");
+        try {
+
+            return productInfoMapper.queryAllProductInfo(record);
+        } catch (Exception e) {
+            logger.error("getProductInfoList", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public List<ProductInfo> getProductInfoByPage(Page page, ProductInfo record) {
+
+        logger.info("getProductInfoByPage");
+        try {
+
+            Map<String, Object> parameter = new HashMap<String, Object>();
+            parameter.put("record", record);
+            parameter.put(AppConstant.PAGE, page);
+
+            return productInfoMapper.queryProductInfoByPage(parameter);
+        } catch (Exception e) {
+            logger.error("getProductInfoByPage", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public ProductInfo getProductInfoById(String id) {
+
+        logger.info("getProductInfoyId");
+        try {
+
+            return productInfoMapper.selectByPrimaryKey(Integer.valueOf(id));
+        } catch (Exception e) {
+            logger.error("getProductInfoById", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public ProductInfo getProductInfo(ProductInfo record) {
+
+        logger.info("getProductInfo");
+        try {
+
+            return productInfoMapper.queryProductInfo(record);
+        } catch (Exception e) {
+            logger.error("getProductInfo", e);
+        }
+
+        return null;
+    }
+
+    @Override
+    public boolean createProductInfo(ProductInfo record) {
+
+        logger.info("createProductInfo");
+        try {
+
+            int updates = productInfoMapper.insertSelective(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("createProductInfo", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean deleteProductInfo(ProductInfo record) {
+
+        logger.info("deleteProductInfo");
+        try {
+
+            int updates = productInfoMapper.delete(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("deleteProductInfo", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean updateProductInfo(ProductInfo record) {
+
+        logger.info("updateProductInfo");
+        try {
+
+            int updates = productInfoMapper.updateByPrimaryKeySelective(record);
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("updateProductInfo", e);
+        }
+
+        return false;
+    }
+
+    @Override
+    public boolean buyProductInfo(ProductInfo record) {
+
+        logger.info("buyProductInfo");
+        try {
+            ProductInfo productInfo = productInfoMapper.selectByPrimaryKey(record.getId());
+            int updates = 0;
+            if (productInfo != null) {
+                if (AppConstant.ProductType.RECHARGE == productInfo.getTypeFlag()) {//如果是充值类型
+                    if (record.getMoney().compareTo(productInfo.getMoney()) >= 0) {
+
+                        MemberCoin memberCoin = new MemberCoin();
+                        memberCoin.setMoney(productInfo.getCoin());
+                        memberCoin.setUserId(record.getUserId());
+                        memberCoin.setRemark("购买" + productInfo.getProductName() + "套餐,充值");
+                        memberCoin.setRechargeType(AppConstant.RechargeType.OTHER);
+
+                        updates = memberCoinService.recharge(memberCoin);
+
+                    }
+
+
+                } else {
+                    if (record.getMoney().compareTo(productInfo.getCoin()) >= 0) {
+                        MemberCoin memberCoin = new MemberCoin();
+                        memberCoin.setMoney(productInfo.getCoin());
+                        memberCoin.setUserId(record.getUserId());
+                        memberCoin.setRemark("购买" + productInfo.getProductName() + "套餐,消费");
+
+                        updates = memberCoinService.consumption(memberCoin);
+                    }
+                }
+
+            }
+
+            if (updates > 0) {
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error("buyProductInfo", e);
+        }
+
+        return false;
+    }
+}
+

+ 60 - 47
src/main/java/com/izouma/awesomeadmin/web/MemberCoinController.java

@@ -18,8 +18,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 /**
-*  controller类
-*/
+ * controller类
+ */
 @Controller
 @RequestMapping("/memberCoin")
 public class MemberCoinController {
@@ -28,8 +28,8 @@ public class MemberCoinController {
     private MemberCoinService memberCoinService;
 
     /**
-    * <p>获取全部记录。</p>
-    */
+     * <p>获取全部记录。</p>
+     */
     @RequiresAuthentication
     @RequestMapping(value = "/all", method = RequestMethod.GET)
     @ResponseBody
@@ -39,8 +39,8 @@ public class MemberCoinController {
     }
 
     /**
-    * <p>根据Id。</p>
-    */
+     * <p>根据Id。</p>
+     */
     @RequestMapping(value = "/getMemberCoin", method = RequestMethod.GET)
     @ResponseBody
     public Result getMemberCoin(@RequestParam(required = false, value = "id") String id) {
@@ -49,8 +49,8 @@ public class MemberCoinController {
     }
 
     /**
-    * <p>根据条件获取。</p>
-    */
+     * <p>根据条件获取。</p>
+     */
     @RequestMapping(value = "/getOne", method = RequestMethod.GET)
     @ResponseBody
     public Result getOne(MemberCoin record) {
@@ -60,14 +60,14 @@ public class MemberCoinController {
 
 
     /**
-    * <p>分页查询。</p>
-    */
+     * <p>分页查询。</p>
+     */
     @RequestMapping(value = "/page", method = RequestMethod.GET)
     @ResponseBody
     public Result page(Page page, MemberCoin record) {
         Map<String, Object> result = new HashMap<>();
 
-        List<MemberCoin> pp =memberCoinService.getMemberCoinByPage(page, record);
+        List<MemberCoin> pp = memberCoinService.getMemberCoinByPage(page, record);
 
         result.put(AppConstant.PAGE, page);
         result.put("pp", pp);
@@ -76,92 +76,93 @@ public class MemberCoinController {
 
 
     /**
-    * <p>保存。</p>
-    */
+     * <p>保存。</p>
+     */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
     @ResponseBody
     public Result save(MemberCoin record) {
         boolean num = memberCoinService.createMemberCoin(record);
         if (num) {
-        return new Result(true, record.getId());
+            return new Result(true, record.getId());
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>更新信息。</p>
-    */
+     * <p>更新信息。</p>
+     */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ResponseBody
     public Result updateMemberCoin(MemberCoin record) {
         boolean num = memberCoinService.updateMemberCoin(record);
         if (num) {
-        return new Result(true, "保存成功");
+            return new Result(true, "保存成功");
         }
         return new Result(false, "保存异常");
     }
 
     /**
-    * <p>删除。</p>
-    */
+     * <p>删除。</p>
+     */
     @RequestMapping(value = "/del", method = RequestMethod.POST)
     @ResponseBody
     public Result deleteMemberCoin(MemberCoin record) {
 
         boolean num = memberCoinService.deleteMemberCoin(record);
         if (num) {
-        return new Result(true, "删除成功");
+            return new Result(true, "删除成功");
         }
         return new Result(false, "删除异常");
     }
 
     /**
-    * 导出Excel
-    * @param request
-    * @param response
-    * @param record
-    * @throws Exception
-    */
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
     @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
     @ResponseBody
     public void exportExcel(HttpServletRequest request, HttpServletResponse response, MemberCoin record) throws Exception {
 
-    List<MemberCoin> memberCoins = memberCoinService.getMemberCoinList(record);
+        List<MemberCoin> memberCoins = memberCoinService.getMemberCoinList(record);
 
 
         String sheetName = "member_coin";
         String titleName = "金币记录数据表";
         String fileName = "金币记录表";
         int columnNumber = 15;
-        int[] columnWidth = { 20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20,  20 };
-        String[] columnName = {  "" ,   "删除标识" ,   "更新时间" ,   "更新人" ,   "创建时间" ,   "创建人" ,   "游戏" ,   "房间" ,   "用户" ,   "备注" ,   "类型" ,   "金额" ,   "余额" ,   "赛季ID" ,   "选手ID"  };
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "游戏", "房间", "用户", "备注", "类型", "金额", "余额", "赛季ID", "选手ID"};
         String[][] dataList = new String[memberCoins.size()][15];
 
         for (int i = 0; i < memberCoins.size(); i++) {
 
-                        dataList[i][0] = String.valueOf(memberCoins.get(i).getId());
-                        dataList[i][1] = String.valueOf(memberCoins.get(i).getDelFlag());
-                        dataList[i][2] = String.valueOf(memberCoins.get(i).getUpdateTime());
-                        dataList[i][3] = String.valueOf(memberCoins.get(i).getUpdateUser());
-                        dataList[i][4] = String.valueOf(memberCoins.get(i).getCreateTime());
-                        dataList[i][5] = String.valueOf(memberCoins.get(i).getCreateUser());
-                        dataList[i][6] = String.valueOf(memberCoins.get(i).getGameId());
-                        dataList[i][7] = String.valueOf(memberCoins.get(i).getHouseId());
-                        dataList[i][8] = String.valueOf(memberCoins.get(i).getUserId());
-                        dataList[i][9] = String.valueOf(memberCoins.get(i).getRemark());
-                        dataList[i][10] = String.valueOf(memberCoins.get(i).getTypeFlag());
-                        dataList[i][11] = String.valueOf(memberCoins.get(i).getMoney());
-                        dataList[i][12] = String.valueOf(memberCoins.get(i).getBalance());
-                        dataList[i][13] = String.valueOf(memberCoins.get(i).getSeasonId());
-                        dataList[i][14] = String.valueOf(memberCoins.get(i).getPlayerId());
-                    }
+            dataList[i][0] = String.valueOf(memberCoins.get(i).getId());
+            dataList[i][1] = String.valueOf(memberCoins.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(memberCoins.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(memberCoins.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(memberCoins.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(memberCoins.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(memberCoins.get(i).getGameId());
+            dataList[i][7] = String.valueOf(memberCoins.get(i).getHouseId());
+            dataList[i][8] = String.valueOf(memberCoins.get(i).getUserId());
+            dataList[i][9] = String.valueOf(memberCoins.get(i).getRemark());
+            dataList[i][10] = String.valueOf(memberCoins.get(i).getTypeFlag());
+            dataList[i][11] = String.valueOf(memberCoins.get(i).getMoney());
+            dataList[i][12] = String.valueOf(memberCoins.get(i).getBalance());
+            dataList[i][13] = String.valueOf(memberCoins.get(i).getSeasonId());
+            dataList[i][14] = String.valueOf(memberCoins.get(i).getPlayerId());
+        }
 
 
         ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
-        columnNumber, columnWidth, columnName, dataList, response);
+                columnNumber, columnWidth, columnName, dataList, response);
 
 
-        }
+    }
 
     @RequestMapping(value = "/song", method = RequestMethod.POST)
     @ResponseBody
@@ -187,5 +188,17 @@ public class MemberCoinController {
 
     }
 
+    @RequestMapping(value = "/consumption", method = RequestMethod.POST)
+    @ResponseBody
+    public Result consumption(MemberCoin memberCoin) {
+
+        int num = memberCoinService.consumption(memberCoin);
+        if (num > 0) {
+            return new Result(true, "消费成功");
+        }
+        return new Result(false, "消费异常");
+
     }
 
+}
+

+ 174 - 0
src/main/java/com/izouma/awesomeadmin/web/ProductInfoController.java

@@ -0,0 +1,174 @@
+package com.izouma.awesomeadmin.web;
+
+import java.util.*;
+
+import com.izouma.awesomeadmin.util.ExportExcelUtil;
+import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.authz.annotation.RequiresAuthentication;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import com.izouma.awesomeadmin.constant.AppConstant;
+import com.izouma.awesomeadmin.dto.Page;
+import com.izouma.awesomeadmin.dto.Result;
+import com.izouma.awesomeadmin.model.ProductInfo;
+import com.izouma.awesomeadmin.service.ProductInfoService;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * controller类
+ */
+@Controller
+@RequestMapping("/productInfo")
+public class ProductInfoController {
+
+    @Autowired
+    private ProductInfoService productInfoService;
+
+    /**
+     * <p>获取全部记录。</p>
+     */
+    @RequiresAuthentication
+    @RequestMapping(value = "/all", method = RequestMethod.GET)
+    @ResponseBody
+    public Result all(ProductInfo record) {
+        List<ProductInfo> pp = productInfoService.getProductInfoList(record);
+        return new Result(true, pp);
+    }
+
+    /**
+     * <p>根据Id。</p>
+     */
+    @RequestMapping(value = "/getProductInfo", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getProductInfo(@RequestParam(required = false, value = "id") String id) {
+        ProductInfo data = productInfoService.getProductInfoById(id);
+        return new Result(true, data);
+    }
+
+    /**
+     * <p>根据条件获取。</p>
+     */
+    @RequestMapping(value = "/getOne", method = RequestMethod.GET)
+    @ResponseBody
+    public Result getOne(ProductInfo record) {
+        ProductInfo data = productInfoService.getProductInfo(record);
+        return new Result(true, data);
+    }
+
+
+    /**
+     * <p>分页查询。</p>
+     */
+    @RequestMapping(value = "/page", method = RequestMethod.GET)
+    @ResponseBody
+    public Result page(Page page, ProductInfo record) {
+        Map<String, Object> result = new HashMap<>();
+
+        List<ProductInfo> pp = productInfoService.getProductInfoByPage(page, record);
+
+        result.put(AppConstant.PAGE, page);
+        result.put("pp", pp);
+        return new Result(true, result);
+    }
+
+
+    /**
+     * <p>保存。</p>
+     */
+    @RequestMapping(value = "/save", method = RequestMethod.POST)
+    @ResponseBody
+    public Result save(ProductInfo record) {
+        boolean num = productInfoService.createProductInfo(record);
+        if (num) {
+            return new Result(true, record.getId());
+        }
+        return new Result(false, "保存异常");
+    }
+
+    /**
+     * <p>更新信息。</p>
+     */
+    @RequestMapping(value = "/update", method = RequestMethod.POST)
+    @ResponseBody
+    public Result updateProductInfo(ProductInfo record) {
+        boolean num = productInfoService.updateProductInfo(record);
+        if (num) {
+            return new Result(true, "保存成功");
+        }
+        return new Result(false, "保存异常");
+    }
+
+    @RequestMapping(value = "/buy", method = RequestMethod.POST)
+    @ResponseBody
+    public Result buyProductInfo(ProductInfo record) {
+        boolean num = productInfoService.buyProductInfo(record);
+        if (num) {
+            return new Result(true, "购买成功");
+        }
+        return new Result(false, "购买异常");
+    }
+
+    /**
+     * <p>删除。</p>
+     */
+    @RequestMapping(value = "/del", method = RequestMethod.POST)
+    @ResponseBody
+    public Result deleteProductInfo(ProductInfo record) {
+
+        boolean num = productInfoService.deleteProductInfo(record);
+        if (num) {
+            return new Result(true, "删除成功");
+        }
+        return new Result(false, "删除异常");
+    }
+
+    /**
+     * 导出Excel
+     *
+     * @param request
+     * @param response
+     * @param record
+     * @throws Exception
+     */
+    @RequestMapping(value = "/exportExcel", method = RequestMethod.GET)
+    @ResponseBody
+    public void exportExcel(HttpServletRequest request, HttpServletResponse response, ProductInfo record) throws Exception {
+
+        List<ProductInfo> productInfos = productInfoService.getProductInfoList(record);
+
+
+        String sheetName = "product_info";
+        String titleName = "商品信息数据表";
+        String fileName = "商品信息表";
+        int columnNumber = 12;
+        int[] columnWidth = {20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20};
+        String[] columnName = {"", "删除标识", "更新时间", "更新人", "创建时间", "创建人", "名称", "现金", "余额", "类型", "备注", "排序"};
+        String[][] dataList = new String[productInfos.size()][12];
+
+        for (int i = 0; i < productInfos.size(); i++) {
+
+            dataList[i][0] = String.valueOf(productInfos.get(i).getId());
+            dataList[i][1] = String.valueOf(productInfos.get(i).getDelFlag());
+            dataList[i][2] = String.valueOf(productInfos.get(i).getUpdateTime());
+            dataList[i][3] = String.valueOf(productInfos.get(i).getUpdateUser());
+            dataList[i][4] = String.valueOf(productInfos.get(i).getCreateTime());
+            dataList[i][5] = String.valueOf(productInfos.get(i).getCreateUser());
+            dataList[i][6] = String.valueOf(productInfos.get(i).getProductName());
+            dataList[i][7] = String.valueOf(productInfos.get(i).getMoney());
+            dataList[i][8] = String.valueOf(productInfos.get(i).getCoin());
+            dataList[i][9] = String.valueOf(productInfos.get(i).getTypeFlag());
+            dataList[i][10] = String.valueOf(productInfos.get(i).getRemark());
+            dataList[i][11] = String.valueOf(productInfos.get(i).getRank());
+        }
+
+
+        ExportExcelUtil.ExportWithResponse(sheetName, titleName, fileName,
+                columnNumber, columnWidth, columnName, dataList, response);
+
+
+    }
+}
+

+ 136 - 0
src/main/vue/src/pages/ProductInfo.vue

@@ -0,0 +1,136 @@
+<template>
+    <div>
+        <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small" style="max-width: 500px;">
+            <el-form-item prop="productName" label="名称">
+                <el-input v-model="formData.productName" :disabled="'productName'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="money" label="现金">
+                <el-input type="number" v-model="formData.money" :disabled="'money'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="coin" label="余额">
+                <el-input type="number" v-model="formData.coin" :disabled="'coin'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="typeFlag" label="类型">
+                <template>
+                    <el-select v-model="formData.typeFlag" clearable placeholder="请选择" :disabled="'typeFlag'==subColumn">
+                        <el-option v-for="item in typeFlagOptions" :key="item.value" :label="item.label" :value="item.value">
+                        </el-option>
+                    </el-select>
+                </template>
+            </el-form-item>
+            <el-form-item prop="remark" label="备注">
+                <el-input v-model="formData.remark" :disabled="'remark'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item prop="rank" label="排序">
+                <el-input type="number" v-model="formData.rank" :disabled="'rank'==subColumn"></el-input>
+            </el-form-item>
+            <el-form-item>
+                <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
+                <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div>
+</template>
+<script>
+import formValidator from '../formValidator'
+
+export default {
+    created() {
+        if (this.$route.query.column) {
+            this.subColumn = this.$route.query.column.split(',')[1];
+            this.subValue = this.$route.query.column.split(',')[0];
+        }
+
+        if (this.$route.query.id) {
+            this.$http.get({
+                url: '/productInfo/getOne',
+                data: {
+                    id: this.$route.query.id
+                }
+            }).then(res => {
+                if (res.success) {
+
+
+                    this.formData = res.data;
+
+                    if (this.$route.query.column) {
+                        this.formData[this.subColumn] = this.subValue;
+                    }
+                }
+            })
+        } else {
+            if (this.$route.query.column) {
+                this.formData[this.subColumn] = this.subValue;
+            }
+        }
+
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {
+                typeFlag: 0
+            },
+            rules: {
+                productName:
+                    [
+                        { required: true, message: '请输入 名称', trigger: 'blur' },
+                    ],
+            },
+            typeFlagOptions: [{                value: 0,
+                label: '充值'
+            }, {
+                value: 1,
+                label: '消费'
+            }],
+            subColumn: '',
+            subValue: '',
+        }
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate((valid) => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            var data = JSON.parse(JSON.stringify(this.formData));
+            this.$http.post({
+                url: this.formData.id ? '/productInfo/update' : '/productInfo/save',
+                data: data
+            }).then(res => {
+                if (res.success) {
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                } else {
+                    this.$message.warning('失败')
+                }
+            });
+        },
+        onDelete() {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                return this.$http.post({
+                    url: '/productInfo/del',
+                    data: { id: this.formData.id }
+                })
+            }).then(() => {
+                this.$message.success('删除成功');
+                this.$router.go(-1);
+            }).catch(action => {
+                if (action === 'cancel') {
+                    this.$message.info('删除取消');
+                } else {
+                    this.$message.error('删除失败');
+                }
+            })
+        },
+    }
+}
+</script>
+<style lang="less" scoped>
+</style>

+ 467 - 0
src/main/vue/src/pages/ProductInfos.vue

@@ -0,0 +1,467 @@
+<template>
+    <div>
+        <div class="filters-container">
+
+            <el-input placeholder="关键字" size="small" v-model="filter1" clearable class="filter-item"></el-input>
+            <el-button @click="searchData" type="primary" size="small" icon="el-icon-search" class="filter-item">搜索
+            </el-button>
+            <el-button @click="showAdvancedQueryDialog = !showAdvancedQueryDialog" type="primary" size="small" icon="el-icon-search" class="filter-item">高级查询
+            </el-button>
+            <el-button @click="showTableSortDialog = !showTableSortDialog" type="primary" size="small" icon="el-icon-sort" class="filter-item">排序
+            </el-button>
+            <el-button @click="$router.push({path:'/productInfo',query:{column:$route.query.column}})" type="primary" size="small" icon="el-icon-edit" class="filter-item">添加
+            </el-button>
+            <el-button @click="exportExcel" type="primary" size="small" icon="el-icon-share" class="filter-item">导出EXCEL
+            </el-button>
+            <el-select placeholder="类型" size="small" v-model="filter2" clearable @change="searchData" class="filter-item">
+                <el-option label="充值" value="0">
+                </el-option>
+                <el-option label="消费" value="1">
+                </el-option>
+            </el-select>
+
+            <el-dropdown trigger="click" size="medium" class="table-column-filter">
+                <span>
+                    筛选数据
+                    <i class="el-icon-arrow-down el-icon--right"></i>
+                </span>
+                <el-dropdown-menu slot="dropdown" class="table-column-filter-wrapper">
+                    <el-checkbox v-for="item in tableColumns" :key="item.value" v-model="item.show">{{item.label}}
+                    </el-checkbox>
+                </el-dropdown-menu>
+            </el-dropdown>
+        </div>
+        <el-table :data="tableData" :height="tableHeight" row-key="id" ref="table">
+            <el-table-column v-if="multipleMode" align="center" type="selection" width="50">
+            </el-table-column>
+            <el-table-column type="index" min-width="50" align="center">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('id')" prop="id" label="ID" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('productName')" prop="productName" label="名称" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('money')" prop="money" label="现金" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('coin')" prop="coin" label="余额" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('typeFlag')" :formatter="TypeFlagFormatter" prop="typeFlag" label="类型" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('remark')" prop="remark" label="备注" min-width="100">
+            </el-table-column>
+
+            <el-table-column v-if="isColumnShow('rank')" prop="rank" label="排序" min-width="100">
+            </el-table-column>
+            <el-table-column label="操作" align="center" fixed="right" min-width="150">
+                <template slot-scope="scope">
+                    <el-button @click="editRow(scope.row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(scope.row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <div class="multiple-mode-wrapper" v-if="0">
+                <el-button size="small" v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button size="small" @click="operation1">批量操作1</el-button>
+                    <el-button size="small" @click="operation2">批量操作2</el-button>
+                    <el-button size="small" @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div>
+            <el-pagination background @size-change="pageSizeChange" @current-change="currentPageChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalNumber">
+            </el-pagination>
+        </div>
+        <el-dialog title="高级查询" :visible.sync="showAdvancedQueryDialog">
+            <el-button @click="addField" type="text" icon="el-icon-plus">添加</el-button>
+            <el-table :data="advancedQueryFields">
+
+                <el-table-column prop="link" label="链接符" align="center">
+                    <template slot-scope="{row}">
+                        <el-select placeholder="链接" size="small" v-model="row.link" class="filter-item">
+                            <el-option label="AND" value="AND">
+                            </el-option>
+                            <el-option label="OR" value="OR">
+                            </el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="name" label="字段" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.name">
+
+                            <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value" :key="item.value"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="searchMethod" label="搜索方式" width="150" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.searchMethod">
+                            <el-option v-for="item in searchMethods" :label="item" :value="item" :key="item"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="value" label="参数" align="center">
+                    <template slot-scope="{row}">
+                        <el-input v-model="row.value"></el-input>
+                    </template>
+                </el-table-column>
+                <el-table-column width="60" align="center">
+                    <template slot-scope="{ row, column, $index }">
+                        <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <span slot="footer" class="dialog-footer">
+
+                <el-button @click="advancedQuery" :loading="$store.state.fetchingData">确定</el-button>
+            </span>
+        </el-dialog>
+
+        <el-dialog title="排序" :visible.sync="showTableSortDialog">
+            <el-button @click="addSortField" type="text" icon="el-icon-plus">添加</el-button>
+            <el-table :data="tableSortFields">
+
+                <el-table-column prop="name" label="字段" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.name">
+
+                            <el-option v-for="item in advancedQueryColumns" :label="item.label" :value="item.value" :key="item.value"></el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column prop="order" label="排序" align="center">
+                    <template slot-scope="{row}">
+                        <el-select v-model="row.order">
+                            <el-option label="降序" value="desc">
+                            </el-option>
+                            <el-option label="升序" value="asc">
+                            </el-option>
+                        </el-select>
+                    </template>
+                </el-table-column>
+                <el-table-column width="60" align="center">
+                    <template slot-scope="{ row, column, $index }">
+                        <el-button @click="removeSortField($index)" size="small" type="text">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+
+            <span slot="footer" class="dialog-footer">
+
+                <el-button @click="tableSortQuery" :loading="$store.state.fetchingData">确定</el-button>
+            </span>
+        </el-dialog>
+
+        <el-dialog title="查看图片" :visible.sync="imageDialogVisible" size="small">
+            <img width="100%" :src="imgSrc" alt="">
+        </el-dialog>
+
+    </div>
+</template>
+<script>
+import { mapState } from 'vuex'
+import { format } from 'date-fns'
+import zh from 'date-fns/locale/zh_cn'
+
+export default {
+    created() {
+        this.getData();
+    },
+    data() {
+        return {
+            totalNumber: 0,
+            totalPage: 10,
+            currentPage: 1,
+            pageSize: 20,
+            tableData: [],
+            filter1: '',
+            filter2: '0',
+            tableColumns: [
+                {
+                    label: 'ID',
+                    value: 'id',
+                    show: true
+                },
+                {
+                    label: '名称',
+                    value: 'productName',
+                    show: true
+                },
+                {
+                    label: '现金',
+                    value: 'money',
+                    show: true
+                },
+                {
+                    label: '余额',
+                    value: 'coin',
+                    show: true
+                },
+                {
+                    label: '类型',
+                    value: 'typeFlag',
+                    show: true
+                },
+                {
+                    label: '备注',
+                    value: 'remark',
+                    show: true
+                },
+                {
+                    label: '排序',
+                    value: 'rank',
+                    show: true
+                },
+            ],
+            multipleMode: false,
+            showAdvancedQueryDialog: false,
+            advancedQueryFields: [],
+            showTableSortDialog: false,
+            tableSortFields: [],
+            searchMethods: ['=', '!=', '>', '>=', '<', '<=', 'like'],
+            advancedQueryColumns: [
+                {
+                    label: '',
+                    value: 'id'
+                },
+                {
+                    label: '名称',
+                    value: 'product_name'
+                },
+                {
+                    label: '现金',
+                    value: 'money'
+                },
+                {
+                    label: '余额',
+                    value: 'coin'
+                },
+                {
+                    label: '类型',
+                    value: 'type_flag'
+                },
+                {
+                    label: '备注',
+                    value: 'remark'
+                },
+                {
+                    label: '排序',
+                    value: 'rank'
+                },
+            ],
+            advancedQuerySearchKey: '',
+            orderByStr: '',
+            imgSrc: '',
+            imageDialogVisible: false,
+        }
+    },
+    computed: {
+        ...mapState(['tableHeight']),
+        selection() {
+            return this.$refs.table.selection.map(i => i.id);
+        }
+    },
+    methods: {
+        pageSizeChange(size) {
+            this.currentPage = 1;
+            this.pageSize = size;
+            this.getData();
+        },
+        currentPageChange(page) {
+            this.currentPage = page;
+            this.getData();
+        },
+        getData() {
+
+            var data = {
+                currentPage: this.currentPage,
+                pageNumber: this.pageSize,
+                searchKey: this.filter1,
+                advancedQuery: this.advancedQuerySearchKey,
+                orderByStr: this.orderByStr,
+                typeFlag: this.filter2,
+            }
+
+            if (this.$route.query.column) {
+                var tempColumn = this.$route.query.column;
+                data[tempColumn.split(',')[1]] = tempColumn.split(',')[0];
+            }
+
+            this.$http.get({
+                url: '/productInfo/page',
+                data: data
+            }).then(res => {
+                if (res.success) {
+                    this.totalNumber = res.data.page.totalNumber;
+                    this.tableData = res.data.pp;
+                }
+            })
+        },
+        isColumnShow(column) {
+            var row = this.tableColumns.find(i => i.value === column);
+            return row ? row.show : false;
+        },
+        toggleMultipleMode(multipleMode) {
+            this.multipleMode = multipleMode;
+            if (!multipleMode) {
+                this.$refs.table.clearSelection();
+            }
+        },
+        editRow(row) {
+            this.$router.push({
+                path: '/productInfo',
+                query: {
+                    id: row.id,
+                    column: this.$route.query.column,
+                }
+            })
+        },
+        operation1() {
+            this.$notify({
+                title: '提示',
+                message: this.selection
+            });
+        },
+        operation2() {
+            this.$message('操作2');
+        },
+        addField() {
+            this.advancedQueryFields.push({
+                link: 'AND',
+                name: '',
+                searchMethod: '=',
+                value: '',
+            });
+        },
+        removeField(i) {
+            if (this.advancedQueryFields.length > 0) {
+                this.advancedQueryFields.splice(i, 1);
+            }
+        },
+        advancedQuery() {
+
+            this.advancedQuerySearchKey = '';
+
+            if (this.advancedQueryFields.length > 0) {
+
+                var templist = [];
+
+                this.advancedQueryFields.forEach(item => {
+                    if (item.link && item.name && item.searchMethod && item.value) {
+                        var tempItem = item.link + '_,' + item.name + '_,' + item.searchMethod + '_,' + item.value;
+                        templist.push(tempItem);
+                    }
+                })
+
+                if (templist.length > 0) {
+
+                    this.advancedQuerySearchKey = templist.join('_;');
+                }
+            }
+
+            this.getData();
+            this.showAdvancedQueryDialog = false;
+        },
+        addSortField() {
+            this.tableSortFields.push({
+                name: '',
+                order: 'asc',
+            });
+        },
+        removeSortField(i) {
+            if (this.tableSortFields.length > 0) {
+                this.tableSortFields.splice(i, 1);
+            }
+        },
+        tableSortQuery() {
+
+            this.orderByStr = '';
+
+            if (this.tableSortFields.length > 0) {
+
+                var templist = [];
+
+                this.tableSortFields.forEach(item => {
+                    if (item.name && item.order) {
+                        var tempItem = item.name + '_,' + item.order;
+                        templist.push(tempItem);
+                    }
+                })
+
+                if (templist.length > 0) {
+
+                    this.orderByStr = templist.join('_;');
+                }
+            }
+
+            this.getData();
+            this.showTableSortDialog = false;
+        },
+        exportExcel() {
+            window.location.href = this.$baseUrl + "/productInfo/exportExcel?searchKey="
+                + this.filter1 + "&advancedQuery=" + this.advancedQuerySearchKey + "&orderByStr=" + this.orderByStr;
+        },
+        searchData() {
+            this.currentPage = 1;
+            this.getData();
+        },
+        deleteRow(row) {
+            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                return this.$http.post({
+                    url: '/productInfo/del',
+                    data: { id: row.id }
+                })
+            }).then(() => {
+                this.$message.success('删除成功');
+                this.getData();
+            }).catch(action => {
+                if (action === 'cancel') {
+                    this.$message.info('删除取消');
+                } else {
+                    this.$message.error('删除失败');
+                }
+            })
+        },
+        DateTimeFormatter(row, column, cellValue) {
+            if (cellValue) {
+                return format(cellValue, 'YYYY/MM/DD HH:mm', { locale: zh })
+            }
+
+        },
+        DateFormatter(row, column, cellValue) {
+            if (cellValue) {
+                return format(cellValue, 'YYYY/MM/DD', { locale: zh })
+            }
+
+        },
+        showImg(img) {
+            this.imgSrc = img;
+            this.imageDialogVisible = true;
+        },
+        TypeFlagFormatter(row) {
+            var label = '';
+            switch (row.typeFlag) {
+                case 0:
+                    label = '充值';
+                    break;
+                case 1:
+                    label = '消费';
+                    break;
+                default:
+                    type = 'info';
+                    label = '未知';
+            }
+            return label;
+        },
+
+    }
+}
+</script>
+<style lang="less" scoped>
+</style>

+ 12 - 2
src/main/vue/src/router/index.js

@@ -351,8 +351,18 @@ const router = new Router({
             path: '/bindGames',
             name: 'BindGames',
             component: () => import('../pages/BindGames')
-        }
-            /**INSERT_LOCATION**/
+        },
+            {
+                    path: '/productInfo',
+                    name: 'ProductInfo',
+                    component: () => import('../pages/ProductInfo')
+                },
+                {
+                    path: '/productInfos',
+                    name: 'ProductInfos',
+                    component: () => import('../pages/ProductInfos')
+                }
+                /**INSERT_LOCATION**/
         ]
     },
     {