Explorar el Código

xwh增加门店短信配置功能

xwh hace 4 años
padre
commit
666af5c1cb

+ 114 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/StoreSmsConfigController.java

@@ -0,0 +1,114 @@
+package com.kmall.admin.controller;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.utils.ShiroUtils;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import com.kmall.admin.entity.StoreSmsConfigEntity;
+import com.kmall.admin.service.StoreSmsConfigService;
+
+/**
+ * 门店短信配置表Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-03-11 10:10:10
+ */
+@RestController
+@RequestMapping("storesmsconfig")
+public class StoreSmsConfigController {
+    @Autowired
+    private StoreSmsConfigService storeSmsConfigService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<StoreSmsConfigEntity> storeSmsConfigList = storeSmsConfigService.queryList(query);
+        int total = storeSmsConfigService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(storeSmsConfigList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{id}")
+    @ResponseBody
+    public R info(@PathVariable("id") Integer id) {
+        StoreSmsConfigEntity storeSmsConfig = storeSmsConfigService.queryObject(id);
+
+        return R.ok().put("storeSmsConfig", storeSmsConfig);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody StoreSmsConfigEntity storeSmsConfig) {
+        StoreSmsConfigEntity entity = storeSmsConfigService.queryObjectByMerchSnAndStoreId(storeSmsConfig.getMerchSn(),storeSmsConfig.getStoreId());
+        if (entity!=null){
+            return R.error("该门店已有配置,请在原基础上修改");
+        }
+        storeSmsConfig.setCreaterSn(ShiroUtils.getUserId().toString());
+        storeSmsConfig.setCreateTime(new Date());
+        storeSmsConfig.setModerSn(ShiroUtils.getUserId().toString());
+        storeSmsConfig.setModTime(new Date());
+        storeSmsConfigService.save(storeSmsConfig);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @ResponseBody
+    public R update(@RequestBody StoreSmsConfigEntity storeSmsConfig) {
+        storeSmsConfig.setModerSn(ShiroUtils.getUserId().toString());
+        storeSmsConfig.setModTime(new Date());
+        storeSmsConfigService.update(storeSmsConfig);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]ids) {
+        storeSmsConfigService.deleteBatch(ids);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<StoreSmsConfigEntity> list = storeSmsConfigService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+}

+ 23 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/StoreSmsConfigDao.java

@@ -0,0 +1,23 @@
+package com.kmall.admin.dao;
+
+import com.kmall.admin.entity.StoreSmsConfigEntity;
+import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 门店短信配置表Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-03-11 10:10:10
+ */
+public interface StoreSmsConfigDao extends BaseDao<StoreSmsConfigEntity> {
+
+
+    List<StoreSmsConfigEntity> queryListByIsValid();
+
+    StoreSmsConfigEntity queryObjectByMerchSnAndStoreId(@Param("merchSn") String merchSn,@Param("storeId") Integer storeId);
+}

+ 205 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/StoreSmsConfigEntity.java

@@ -0,0 +1,205 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 门店短信配置表实体
+ * 表名 mall_store_sms_config
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-03-11 10:10:10
+ */
+public class StoreSmsConfigEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Integer id;
+    /**
+     * 门店id
+     */
+    private Integer storeId;
+    /**
+     * 商户编号
+     */
+    private String merchSn;
+    /**
+     * 发送开始时间
+     */
+    private Date sendStartTime;
+    /**
+     * 发送结束时间
+     */
+    private Date sendEndTime;
+    /**
+     * 是否有效,0:有效,1:无效
+     */
+    private String isValid;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date createTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    /**
+     * 设置:主键
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:主键
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:门店id
+     */
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    /**
+     * 获取:门店id
+     */
+    public Integer getStoreId() {
+        return storeId;
+    }
+    /**
+     * 设置:商户编号
+     */
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    /**
+     * 获取:商户编号
+     */
+    public String getMerchSn() {
+        return merchSn;
+    }
+    /**
+     * 设置:发送开始时间
+     */
+    public void setSendStartTime(Date sendStartTime) {
+        this.sendStartTime = sendStartTime;
+    }
+
+    /**
+     * 获取:发送开始时间
+     */
+    public Date getSendStartTime() {
+        return sendStartTime;
+    }
+    /**
+     * 设置:发送结束时间
+     */
+    public void setSendEndTime(Date sendEndTime) {
+        this.sendEndTime = sendEndTime;
+    }
+
+    /**
+     * 获取:发送结束时间
+     */
+    public Date getSendEndTime() {
+        return sendEndTime;
+    }
+    /**
+     * 设置:是否有效,0:有效,1:无效
+     */
+    public void setIsValid(String isValid) {
+        this.isValid = isValid;
+    }
+
+    /**
+     * 获取:是否有效,0:有效,1:无效
+     */
+    public String getIsValid() {
+        return isValid;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间,yyyy-MM-dd HH:mm:ss
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

+ 74 - 0
kmall-admin/src/main/java/com/kmall/admin/service/StoreSmsConfigService.java

@@ -0,0 +1,74 @@
+package com.kmall.admin.service;
+
+import com.kmall.admin.entity.StoreSmsConfigEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 门店短信配置表Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-03-11 10:10:10
+ */
+public interface StoreSmsConfigService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    StoreSmsConfigEntity queryObject(Integer id);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<StoreSmsConfigEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param storeSmsConfig 实体
+     * @return 保存条数
+     */
+    int save(StoreSmsConfigEntity storeSmsConfig);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param storeSmsConfig 实体
+     * @return 更新条数
+     */
+    int update(StoreSmsConfigEntity storeSmsConfig);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[]ids);
+
+    StoreSmsConfigEntity queryObjectByMerchSnAndStoreId(String merchSn, Integer storeId);
+}

+ 38 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderProcessRecordServiceImpl.java

@@ -1,9 +1,13 @@
 package com.kmall.admin.service.impl;
 
+import com.kmall.admin.dao.OrderDao;
 import com.kmall.admin.dao.OrderProcessRecordDao;
 import com.kmall.admin.dao.PickUpCodeDao;
+import com.kmall.admin.dao.StoreSmsConfigDao;
+import com.kmall.admin.entity.OrderEntity;
 import com.kmall.admin.entity.OrderProcessRecordEntity;
 import com.kmall.admin.entity.PickUpCodeEntity;
+import com.kmall.admin.entity.StoreSmsConfigEntity;
 import com.kmall.admin.service.OrderProcessRecordService;
 import com.kmall.admin.service.PickUpCodeService;
 import com.kmall.api.util.SendMsgUtil;
@@ -11,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.text.SimpleDateFormat;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -32,6 +37,12 @@ public class OrderProcessRecordServiceImpl implements OrderProcessRecordService
     @Autowired
     private PickUpCodeService pickUpCodeService;
 
+    @Autowired
+    private StoreSmsConfigDao storeSmsConfigDao;
+
+    @Autowired
+    private OrderDao orderDao;
+
 
     @Override
     public OrderProcessRecordEntity queryObject(Integer id) {
@@ -81,6 +92,33 @@ public class OrderProcessRecordServiceImpl implements OrderProcessRecordService
         // 找到清关成功没发短信的订单
         List <OrderProcessRecordEntity> recordList = orderProcessRecordDao.queryListBySendSmsStatus("0");
         if (Objects.nonNull(recordList) && recordList.size()>0){
+
+            // ========== 排除不是该门店短信配置 时间段内的订单===========
+            List<StoreSmsConfigEntity> storeSmsConfigEntities = storeSmsConfigDao.queryListByIsValid();
+            if (storeSmsConfigEntities!=null && storeSmsConfigEntities.size()>0){
+                Iterator<OrderProcessRecordEntity> iterator = recordList.iterator();
+                while (iterator.hasNext()) {
+                    OrderProcessRecordEntity recordEntity = iterator.next();
+                    OrderEntity orderEntity = orderDao.queryObjectByOrderSn(recordEntity.getOrderSn());
+                    boolean isInclude = false;
+                    for (StoreSmsConfigEntity storeSmsConfigEntity : storeSmsConfigEntities) {
+                        if(orderEntity.getMerchSn().equals(storeSmsConfigEntity.getMerchSn()) &&
+                                orderEntity.getStoreId().intValue()==storeSmsConfigEntity.getStoreId().intValue()){
+                            isInclude = true;
+                            break;
+                        }
+                    }
+                    // 如果找了一圈没发现有在短信配置表里配置,就移除该元素
+                    if (!isInclude){
+                        iterator.remove();
+                    }
+
+                }
+            }
+
+
+
+
             for (OrderProcessRecordEntity orderProcessRecordEntity : recordList) {
                 orderProcessRecordEntity.setCustomsSendSmsStatus("3");// 状态改成发送中
                 orderProcessRecordDao.update(orderProcessRecordEntity);

+ 64 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/StoreSmsConfigServiceImpl.java

@@ -0,0 +1,64 @@
+package com.kmall.admin.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.dao.StoreSmsConfigDao;
+import com.kmall.admin.entity.StoreSmsConfigEntity;
+import com.kmall.admin.service.StoreSmsConfigService;
+
+/**
+ * 门店短信配置表Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2021-03-11 10:10:10
+ */
+@Service("storeSmsConfigService")
+public class StoreSmsConfigServiceImpl implements StoreSmsConfigService {
+    @Autowired
+    private StoreSmsConfigDao storeSmsConfigDao;
+
+    @Override
+    public StoreSmsConfigEntity queryObject(Integer id) {
+        return storeSmsConfigDao.queryObject(id);
+    }
+
+    @Override
+    public List<StoreSmsConfigEntity> queryList(Map<String, Object> map) {
+        return storeSmsConfigDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return storeSmsConfigDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(StoreSmsConfigEntity storeSmsConfig) {
+        return storeSmsConfigDao.save(storeSmsConfig);
+    }
+
+    @Override
+    public int update(StoreSmsConfigEntity storeSmsConfig) {
+        return storeSmsConfigDao.update(storeSmsConfig);
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return storeSmsConfigDao.delete(id);
+    }
+
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return storeSmsConfigDao.deleteBatch(ids);
+    }
+
+    @Override
+    public StoreSmsConfigEntity queryObjectByMerchSnAndStoreId(String merchSn, Integer storeId) {
+        return storeSmsConfigDao.queryObjectByMerchSnAndStoreId(merchSn,storeId);
+    }
+}

+ 162 - 0
kmall-admin/src/main/resources/mybatis/mapper/StoreSmsConfigDao.xml

@@ -0,0 +1,162 @@
+<?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.kmall.admin.dao.StoreSmsConfigDao">
+
+    <resultMap type="com.kmall.admin.entity.StoreSmsConfigEntity" id="storeSmsConfigMap">
+        <result property="id" column="id"/>
+        <result property="storeId" column="store_id"/>
+        <result property="merchSn" column="merch_sn"/>
+        <result property="sendStartTime" column="send_start_time"/>
+        <result property="sendEndTime" column="send_end_time"/>
+        <result property="isValid" column="is_valid"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="createTime" column="create_time"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="modTime" column="mod_time"/>
+        <result property="tstm" column="tstm"/>
+    </resultMap>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.StoreSmsConfigEntity">
+		select
+			`id`,
+			`store_id`,
+			`merch_sn`,
+			`send_start_time`,
+			`send_end_time`,
+			`is_valid`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`
+		from mall_store_sms_config
+		where id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.StoreSmsConfigEntity">
+		select
+    		`id`,
+    		`store_id`,
+    		`merch_sn`,
+    		`send_start_time`,
+    		`send_end_time`,
+    		`is_valid`,
+    		`creater_sn`,
+    		`create_time`,
+    		`moder_sn`,
+    		`mod_time`,
+    		`tstm`
+		from mall_store_sms_config
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND name LIKE concat('%',#{name},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from mall_store_sms_config
+		WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND name LIKE concat('%',#{name},'%')
+        </if>
+	</select>
+	<select id="queryListByIsValid" resultType="com.kmall.admin.entity.StoreSmsConfigEntity">
+		select
+		`id`,
+		`store_id`,
+		`merch_sn`,
+		`send_start_time`,
+		`send_end_time`,
+		`is_valid`,
+		`creater_sn`,
+		`create_time`,
+		`moder_sn`,
+		`mod_time`,
+		`tstm`
+		from mall_store_sms_config
+		WHERE is_valid='0'
+		and now() BETWEEN send_start_time and send_end_time
+	</select>
+	<select id="queryObjectByMerchSnAndStoreId" resultType="com.kmall.admin.entity.StoreSmsConfigEntity">
+		select
+		`id`,
+		`store_id`,
+		`merch_sn`,
+		`send_start_time`,
+		`send_end_time`,
+		`is_valid`,
+		`creater_sn`,
+		`create_time`,
+		`moder_sn`,
+		`mod_time`,
+		`tstm`
+		from mall_store_sms_config
+		WHERE merch_sn=#{merchSn} and store_id=#{storeId}
+	</select>
+
+	<insert id="save" parameterType="com.kmall.admin.entity.StoreSmsConfigEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into mall_store_sms_config(
+			`store_id`,
+			`merch_sn`,
+			`send_start_time`,
+			`send_end_time`,
+			`is_valid`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`)
+		values(
+			#{storeId},
+			#{merchSn},
+			#{sendStartTime},
+			#{sendEndTime},
+			#{isValid},
+			#{createrSn},
+			#{createTime},
+			#{moderSn},
+			#{modTime},
+			#{tstm})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.StoreSmsConfigEntity">
+		update mall_store_sms_config 
+		<set>
+			<if test="storeId != null">`store_id` = #{storeId}, </if>
+			<if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
+			<if test="sendStartTime != null">`send_start_time` = #{sendStartTime}, </if>
+			<if test="sendEndTime != null">`send_end_time` = #{sendEndTime}, </if>
+			<if test="isValid != null">`is_valid` = #{isValid}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="createTime != null">`create_time` = #{createTime}, </if>
+			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
+			<if test="modTime != null">`mod_time` = #{modTime}, </if>
+			<if test="tstm != null">`tstm` = #{tstm}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from mall_store_sms_config where id = #{value}
+	</delete>
+	
+	<delete id="deleteBatch">
+		delete from mall_store_sms_config where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 73 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/storesmsconfig.html

@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>门店短信配置表</title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+	<div v-show="showList">
+        <Row :gutter="16">
+<!--            <div class="search-group">-->
+<!--                <i-col span="4">-->
+<!--                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>-->
+<!--                </i-col>-->
+<!--                <i-button @click="query">查询</i-button>-->
+<!--                <i-button @click="reloadSearch">重置</i-button>-->
+<!--            </div>-->
+            <div class="buttons-group">
+                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
+                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
+                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
+            </div>
+        </Row>
+	    <table id="jqGrid"></table>
+	    <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+		<i-form ref="formValidate" :model="storeSmsConfig" :rules="ruleValidate" :label-width="80">
+
+            <Form-item label="商户" prop="merchSn">
+                <i-select v-model="storeSmsConfig.merchSn" filterable placeholder="商户"  label-in-value>
+                    <i-option v-for="merch in merchList" :value="merch.merchSn" :key="merch.merchSn">{{merch.merchName}}</i-option>
+                </i-select>
+            </Form-item>
+            <Form-item label="门店" prop="storeId">
+                <i-select v-model="storeSmsConfig.storeId" filterable placeholder="门店" label-in-value>
+                    <i-option v-for="store in storeList" :value="store.id" :key="store.id">{{store.storeName}}</i-option>
+                </i-select>
+            </Form-item>
+            <Form-item label="发送开始时间" prop="sendStartTime">
+                <i-input  type='date'  v-model="storeSmsConfig.sendStartTime" placeholder="发送开始时间" style="width:160px;"/>
+            </Form-item>
+            <Form-item label="发送结束时间" prop="sendEndTime">
+                <i-input  type='date'  v-model="storeSmsConfig.sendEndTime" placeholder="发送结束时间" style="width:160px;"/>
+            </Form-item>
+<!--            <Form-item label="是否有效" prop="isValid">-->
+<!--                <i-input v-model="storeSmsConfig.isValid" placeholder="是否有效"/>-->
+<!--            </Form-item>-->
+
+            <Form-item label="是否有效" prop="isValid">
+                <Radio-group v-model="storeSmsConfig.isValid">
+                    <Radio label="0">
+                        <span>有效</span>
+                    </Radio>
+                    <Radio label="1">
+                        <span>无效</span>
+                    </Radio>
+                </Radio-group>
+            </Form-item>
+            <Form-item>
+                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
+            </Form-item>
+        </i-form>
+	</Card>
+</div>
+
+<script src="${rc.contextPath}/js/shop/storesmsconfig.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 181 - 0
kmall-admin/src/main/webapp/js/shop/storesmsconfig.js

@@ -0,0 +1,181 @@
+$(function () {
+    $("#jqGrid").jqGrid({
+        url: '../storesmsconfig/list',
+        datatype: "json",
+        colModel: [
+			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: '商户编号', name: 'merchSn', index: 'merch_sn', align: 'center', width: 80},
+			{label: '门店id', name: 'storeId', index: 'store_id',  align: 'center',width: 80},
+			{label: '发送开始时间', name: 'sendStartTime', index: 'send_start_time',  align: 'center',width: 80,formatter: function (value) {
+					return transDate(value,'yyyy-MM-dd hh:mm:ss');
+				}},
+			{label: '发送结束时间', name: 'sendEndTime', index: 'send_end_time', align: 'center', width: 80,formatter: function (value) {
+					return transDate(value,'yyyy-MM-dd hh:mm:ss');
+				}},
+			{label: '是否有效', name: 'isValid', index: 'is_valid', width: 80, align: 'center',formatter: function (value) {
+					if (value == '0') {
+						return '有效';
+					} else if (value == '1') {
+						return '无效';
+					}
+					return '';
+				}}],
+		viewrecords: true,
+        height: 550,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+});
+
+let vm = new Vue({
+	el: '#rrapp',
+	data: {
+        showList: true,
+        title: null,
+		storeSmsConfig: {},
+		merchList:[],
+		storeList:[],
+		ruleValidate: {
+			merchSn: [
+				{required: true, message: '商户不能为空', trigger: 'blur'}
+			],
+			// storeId: [
+			// 	{required: true, message: '门店不能为空', trigger: 'blur'}
+			// ],
+			sendStartTime: [
+				{required: true, message: '发送开始时间不能为空', trigger: 'blur'}
+			],
+			sendEndTime: [
+				{required: true, message: '发送结束时间不能为空', trigger: 'blur'}
+			],
+			isValid: [
+				{required: true, message: '是否有效不能为空', trigger: 'blur'}
+			]
+		},
+		q: {
+		    name: ''
+		}
+	},
+	methods: {
+		query: function () {
+			vm.reload();
+		},
+		add: function () {
+			vm.showList = false;
+			vm.title = "新增";
+			vm.storeSmsConfig = {};
+			vm.getMerchList();
+			vm.getStoreList();
+		},
+		update: function (event) {
+            let id = getSelectedRow();
+			if (id == null) {
+				return;
+			}
+			vm.showList = false;
+            vm.title = "修改";
+			vm.getMerchList();
+			vm.getStoreList();
+            vm.getInfo(id)
+		},
+		saveOrUpdate: function (event) {
+            let url = vm.storeSmsConfig.id == null ? "../storesmsconfig/save" : "../storesmsconfig/update";
+			$.ajax({
+				type: "POST",
+			    url: url,
+			    contentType: "application/json",
+			    data: JSON.stringify(vm.storeSmsConfig),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+			});
+		},
+		del: function (event) {
+            let ids = getSelectedRows();
+			if (ids == null){
+				return;
+			}
+
+			confirm('确定要删除选中的记录?', function () {
+				$.ajax({
+					type: "POST",
+				    url: "../storesmsconfig/delete",
+				    contentType: "application/json",
+				    data: JSON.stringify(ids),
+				    success: function (r) {
+						if (r.code == 0) {
+							alert('操作成功', function (index) {
+								$("#jqGrid").trigger("reloadGrid");
+							});
+						} else {
+							alert(r.msg);
+						}
+					}
+				});
+			});
+		},
+		getInfo: function(id){
+			$.get("../storesmsconfig/info/"+id, function (r) {
+                vm.storeSmsConfig = r.storeSmsConfig;
+            });
+		},
+        reloadSearch: function() {
+            vm.q = {
+                name: ''
+            }
+            vm.reload();
+		},
+		reload: function (event) {
+			vm.showList = true;
+            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
+			$("#jqGrid").jqGrid('setGridParam', {
+                postData: {'name': vm.q.name},
+                page: page
+            }).trigger("reloadGrid");
+            vm.handleReset('formValidate');
+		},
+        handleSubmit: function (name) {
+            handleSubmitValidate(this, name, function () {
+                vm.saveOrUpdate()
+            });
+        },
+        handleReset: function (name) {
+            handleResetForm(this, name);
+        },
+		getMerchList: function() {
+			$.get("../merch/queryAll", function (r) {
+				vm.merchList = r.list;
+			});
+		},
+		getStoreList: function() {
+			$.get("../store/queryAll", function (r) {
+				vm.storeList = r.list;
+			});
+		}
+	}
+});