| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.ks.app.pojo.DTO.OptionDTO; |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.vip.pojo.DO.VipCombo; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.ks.vip.service.VipComboService; |
| | | import com.ks.vip.service.VipGradeService; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "getGradeTypes") |
| | | public Result getGradeTypes(HttpServletRequest request) { |
| | | try { |
| | | List<OptionDTO> list = new ArrayList(); |
| | | VIPEnum[] array = VIPEnum.values(); |
| | | if (array.length > 0) { |
| | | for (VIPEnum vipEnum: array) { |
| | | list.add(new OptionDTO(vipEnum.getDesc(), vipEnum.name())); |
| | | } |
| | | } |
| | | return ResultUtils.loadTrue(list); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("获取失败!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.ks.app.pojo.VO.PageEntity; |
| | | import com.ks.app.pojo.VO.Result; |
| | | import com.ks.app.util.ResultUtils; |
| | | import com.ks.vip.exception.VipGradePotenceException; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | | import com.ks.vip.pojo.DO.VipGradePotence; |
| | | import com.ks.vip.service.VipGradePotenceService; |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "add") |
| | | public Result add(VipGradePotence t, HttpServletRequest request) { |
| | | @RequestMapping(value = "save") |
| | | public Result save(VipGradePotence t, HttpServletRequest request) { |
| | | try { |
| | | vipGradePotenceService.insertSelective(t); |
| | | vipGradePotenceService.save(t); |
| | | return ResultUtils.loadTrue(); |
| | | } catch (VipGradePotenceException e) { |
| | | return ResultUtils.loadFalse(e.getMsg()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "modify") |
| | | public Result modify(VipGradePotence t, HttpServletRequest request) { |
| | | @RequestMapping(value = "getByGradeId") |
| | | public Result getByGradeId(Long gradeId, HttpServletRequest request) { |
| | | try { |
| | | vipGradePotenceService.updateByPrimaryKeySelective(t); |
| | | return ResultUtils.loadTrue(); |
| | | VipGradePotence t = vipGradePotenceService.getPotenceByGradeId(gradeId); |
| | | return ResultUtils.loadTrue(t); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtils.loadFalse("保存失败!"); |
| | | return ResultUtils.loadFalse("查询失败!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "delete") |
New file |
| | |
| | | package com.ks.app.pojo.DTO; |
| | | |
| | | public class OptionDTO { |
| | | |
| | | private String name; |
| | | private String value; |
| | | |
| | | public OptionDTO(){} |
| | | |
| | | public OptionDTO(String name,String value){ |
| | | this.name = name; |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | } |
| | |
| | | name: lijin-provider |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://193.112.35.168:2181 |
| | | # address: zookeeper://118.195.138.153:2181 |
| | | # address: zookeeper://193.112.35.168:2181 |
| | | address: zookeeper://118.195.138.153:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |
| | |
| | | <i class="iconfont"></i> |
| | | <cite>套餐管理</cite></a> |
| | | </li> |
| | | <li> |
| | | <!--<li> |
| | | <a onclick="xadmin.add_tab('订单管理','/views/vip/order-list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>订单管理</cite></a> |
| | | </li> |
| | | </li>--> |
| | | </ul> |
| | | </li> |
| | | </ul> |
| | |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | |
| | | $.ajax({ |
| | | type:"GET", |
| | | url:"/admin/api/vip/vipGrade/getValidList", |
| | | dataType:"json", |
| | | success:function(data){ |
| | | if(data.code == 0) { |
| | | $("#gradeId").empty(); |
| | | |
| | | $("#gradeId").append("<option selected value='0'>---请选择---</option>"); |
| | | for(var i = 0; i < data.data.length; i++) { |
| | | $("#gradeId").append("<option value='" + data.data[i].id + "'>" + data.data[i].name + "</option>"); |
| | | } |
| | | form.render();//注意渲染页面表单,否则不显示数据 |
| | | } else { |
| | | alert(data.msg); |
| | | } |
| | | }, |
| | | error:function(jqXHR){ |
| | | alert("请求失败!"); |
| | | } |
| | | }); |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
| | | |
| | | <script> |
| | | function member_del(obj, index, id) { |
| | | $.ajax({ |
| | | type:"GET", |
| | | url:"admin/api/vip/vipGrade/getValidList", |
| | | dataType:"json", |
| | | success:function(data){ |
| | | |
| | | }, |
| | | error:function(jqXHR){ |
| | | alert("请求失败!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | | |
| | | </body> |
| | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="identity" class="layui-form-label"> |
| | | 等级标识</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="identity" name="identity" class="layui-select"> |
| | | <option value="silver">-请选择-</option> |
| | | <option value="silver">白银</option> |
| | | <option value="platinum">铂金</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="name" class="layui-form-label"> |
| | | <span class="x-red">*</span>等级名称</label> |
| | | <div class="layui-input-inline"> |
| | |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script>layui.use(['form', 'layer', 'jquery'], |
| | | <script> |
| | | |
| | | layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | |
| | | // |
| | | // }); |
| | | |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | |
| | | }); |
| | | return false; |
| | | }); |
| | | |
| | | });</script> |
| | | }); |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | |
| | | |
| | | <script type="text/html" id="barAction"> |
| | | <a class="layui-btn layui-btn-xs" onclick="openPotencePage({{d.id}})">权益管理</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="member_del(this,{{d.LAY_INDEX }},{{d.id}})" >删除</a> |
| | | </script> |
| | | |
| | | <script> |
| | | |
| | | function openPotencePage(id) { |
| | | xadmin.open('账号管理','gradePotence-add.html?pid='+ id,500,480,false); |
| | | } |
| | | |
| | | function member_del(obj, index, id) { |
| | | layer.confirm('确认要删除吗?', function (index) { |
| | | app.delete(obj, index, id); //发异步删除数据 |
| | |
| | | [{type: 'checkbox', title: "ID"}, |
| | | {field: 'id', width: 80, sort: true, title: "ID"}, |
| | | {field: 'state', width: 80, title: "状态", templet: "#switchTpl"}, |
| | | {field: 'gradeId', edit: 'text', width: 150, title: "等级名称"}, |
| | | {field: 'name',edit: 'text', width: 120, sort: true, title: "等级图标"}, |
| | | {field: 'icon', edit: 'text', width: 150, title: "等级序号"}, |
| | | {field: 'name', edit: 'text', width: 150, title: "等级名称"}, |
| | | {field: 'icon',edit: 'text', width: 120, sort: true, title: "等级图标"}, |
| | | {field: 'sort', edit: 'text', width: 150, title: "等级序号"}, |
| | | {field: 'updateTime', sort: true, width: 150, title: "修改时间", templet:"#dateFomat"}, |
| | | {fixed: 'right', width: 250, title: "操作", toolbar: '#barAction'}, |
| | | ] |
| | |
| | | <div class="layui-fluid"> |
| | | <div class="layui-row"> |
| | | <form class="layui-form"> |
| | | <input type="hidden" name="id" id="id"/> |
| | | <input type="hidden" name="gradeId" id="gradeId"/> |
| | | <div class="layui-form-item"> |
| | | <label for="state" class="layui-form-label"> |
| | | 状态</label> |
| | | <label for="rebatePercent" class="layui-form-label"> |
| | | <span class="x-red">*</span>返利比例</label> |
| | | <div class="layui-input-inline"> |
| | | <select id="state" name="state" class="layui-select"> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="name" class="layui-form-label"> |
| | | <span class="x-red">*</span>等级名称</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="name" name="name" required="" lay-verify="name" autocomplete="off" |
| | | <input type="text" id="rebatePercent" name="rebatePercent" required="" lay-verify="name" autocomplete="off" |
| | | class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="icon" class="layui-form-label"> |
| | | <span class="x-red">*</span>等级图标</label> |
| | | <label for="taolijinPercent" class="layui-form-label"> |
| | | <span class="x-red">*</span>淘礼金比例</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="icon" name="icon" required="" lay-verify="icon" |
| | | <input type="text" id="taolijinPercent" name="taolijinPercent" required="" lay-verify="icon" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="sort" class="layui-form-label"> |
| | | 等级序号</label> |
| | | <label for="taolijinMaxNumber" class="layui-form-label"> |
| | | 每日创建淘礼金的次数</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="sort" name="sort" required="" lay-verify="sort" |
| | | <input type="text" id="taolijinMaxNumber" name="taolijinMaxNumber" required="" lay-verify="sort" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label for="taolijinMaxMoney" class="layui-form-label"> |
| | | 每日创建淘礼金的最大金额</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" id="taolijinMaxMoney" name="taolijinMaxMoney" required="" lay-verify="sort" |
| | | autocomplete="off" class="layui-input"></div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <!-- <label for="L_remarks" class="layui-form-label"></label>--> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">增加</button> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | <script>layui.use(['form', 'layer', 'jquery'], |
| | | <script> |
| | | var gradeId= GetQueryString("pid"); // 上级did |
| | | |
| | | //封装GetQueryString()方法来获取URL后面的value值 |
| | | function GetQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) |
| | | return decodeURI(r[2]); |
| | | return null; |
| | | } |
| | | $("#gradeId").val(gradeId); |
| | | |
| | | |
| | | $.ajax({ |
| | | url: "/admin/api/vip/vipGradePotence/getByGradeId", |
| | | type: "POST", |
| | | data: {"gradeId":gradeId}, |
| | | success: function(data) { |
| | | if(data.code == 0) { |
| | | $("#id").val(data.data.id); |
| | | $("#rebatePercent").val(data.data.rebatePercent); |
| | | $("#taolijinPercent").val(data.data.taolijinPercent); |
| | | $("#taolijinMaxNumber").val(data.data.taolijinMaxNumber); |
| | | $("#taolijinMaxMoney").val(data.data.taolijinMaxMoney); |
| | | } else { |
| | | alert(data.msg); |
| | | } |
| | | } |
| | | }) |
| | | |
| | | |
| | | |
| | | layui.use(['form', 'layer', 'jquery'], |
| | | function () { |
| | | $ = layui.jquery; |
| | | var form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | // //自定义验证规则 |
| | | // form.verify({ |
| | | // username: function (value) { |
| | | // if (value.length < 3) { |
| | | // return '应用名称至少得3个字符啊'; |
| | | // } |
| | | // }, |
| | | // appcode: [/^([A-Za-z0-9]|\-|_)+$/, '应用标识只能包含 数字、英文字符、_ 、-'], |
| | | // desc: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '简介最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // remarks: function (value) { |
| | | // if (value != null && value.length > 128) { |
| | | // return '备注最大为128个字符'; |
| | | // } |
| | | // }, |
| | | // |
| | | // }); |
| | | |
| | | //监听提交 |
| | | form.on('submit(add)', |
| | | function (data) { |
| | | console.log(data.field); |
| | | //发异步,把数据提交给php |
| | | ksapp.post('/admin/api/vip/vipGrade/add', data.field, function (res) { |
| | | ksapp.post('/admin/api/vip/vipGradePotence/save', data.field, function (res) { |
| | | if (res.code == 0) { |
| | | layer.alert("增加成功", { |
| | | layer.alert("保存成功", { |
| | | icon: 6 |
| | | }, |
| | | function () { |
| | |
| | | return false; |
| | | }); |
| | | |
| | | });</script> |
| | | }); |
| | | |
| | | |
| | | |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | <span class="layui-breadcrumb"> |
| | | <a href="">会员管理</a> |
| | | <a> |
| | | <cite>等级列表</cite></a> |
| | | <cite>会员权益列表</cite></a> |
| | | </span> |
| | | <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" |
| | | onclick="location.reload()" title="刷新"> |
| | |
| | | </body> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn" onclick="xadmin.open('添加等级','grade-add.html',500,480)"><i class="layui-icon"></i>添加 |
| | | <button class="layui-btn" onclick="xadmin.open('添加权益','gradePotence-add.html',500,480)"><i class="layui-icon"></i>添加 |
| | | </button> |
| | | </div> |
| | | </script> |
| | |
| | | }); |
| | | }, |
| | | deleteList: function (ids, success) { |
| | | ksapp.post("/admin/api/vip/vipGrade/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | ksapp.post("/admin/api/vip/vipGradePotence/delete", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | | success(); |
| | | } else { |
| | |
| | | }, |
| | | update: function (id, params) { |
| | | params.id = id; |
| | | ksapp.post("/admin/api/vip/vipGrade/modify", params, function (e) { |
| | | ksapp.post("/admin/api/vip/vipGradePotence/modify", params, function (e) { |
| | | if (e.code == 0) { |
| | | layer.msg("修改成功"); |
| | | } else |
| | |
| | | |
| | | var table = layui.table; |
| | | |
| | | var url = "/admin/api/vip/vipGrade/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | var url = "/admin/api/vip/vipGradePotence/listByPage?page=1&pageSize=20&key=" + encodeURIComponent(app.key) + "&startDate=" + app.start + "&endDate=" + app.end; |
| | | |
| | | |
| | | table.render({ |
New file |
| | |
| | | package com.ks.vip.exception; |
| | | |
| | | import com.ks.lib.common.exception.BaseException; |
| | | |
| | | public class VipGradePotenceException extends BaseException { |
| | | |
| | | public VipGradePotenceException(int code, String msg) { |
| | | super(code, msg); |
| | | } |
| | | |
| | | public VipGradePotenceException() { |
| | | super(); |
| | | } |
| | | |
| | | @Override |
| | | public synchronized Throwable fillInStackTrace() { |
| | | return this; |
| | | } |
| | | } |
| | |
| | | package com.ks.vip.pojo.DO; |
| | | |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | |
| | | package com.ks.vip.service; |
| | | |
| | | |
| | | import com.ks.vip.exception.VipGradePotenceException; |
| | | import com.ks.vip.pojo.DO.VipGradePotence; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public VipGradePotence getPotenceByVipEnum(VIPEnum vipEnum); |
| | | |
| | | /** |
| | | * 保存 |
| | | * @param t |
| | | * @throws VipGradePotenceException |
| | | */ |
| | | public void save(VipGradePotence t) throws VipGradePotenceException; |
| | | } |
| | |
| | | name: lijin-provider |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://193.112.35.168:2181 |
| | | address: zookeeper://118.195.138.153:2181 |
| | | # address: zookeeper://118.195.138.153:2181 |
| | | client: curator |
| | | protocol: |
| | |
| | | public Integer state; |
| | | // 名称 |
| | | public String name; |
| | | |
| | | //等级ID |
| | | public Long gradeId; |
| | | |
| | |
| | | query.state = VipCombo.STATE_VALID; |
| | | query.start = 0; |
| | | query.count = 10; |
| | | |
| | | return vipComboMapper.listByPage(query); |
| | | } |
| | | |
| | |
| | | package com.ks.vip.service.remote; |
| | | |
| | | |
| | | import com.ks.vip.exception.VipGradePotenceException; |
| | | import com.ks.vip.mapper.VipGradePotenceMapper; |
| | | import com.ks.vip.mapper.VipGradePotenceMapper; |
| | | import com.ks.vip.pojo.DO.VipGrade; |
| | |
| | | import org.apache.dubbo.config.annotation.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service(version = "1.0") |
| | |
| | | return vipGradePotenceMapper.getByGradeId(gradeId); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void save(VipGradePotence t) throws VipGradePotenceException { |
| | | Long gradeId = t.getGradeId(); |
| | | if (gradeId == null) { |
| | | throw new VipGradePotenceException(1, "等级ID为空"); |
| | | } |
| | | |
| | | if(t.getId() != null && t.getId().longValue() > 0) { |
| | | t.setUpdateTime(new Date()); |
| | | vipGradePotenceMapper.updateByPrimaryKeySelective(t); |
| | | } else { |
| | | VipGradePotence obj = vipGradePotenceMapper.getByGradeId(gradeId); |
| | | if (obj == null) { |
| | | t.setCreateTime(new Date()); |
| | | vipGradePotenceMapper.insertSelective(t); |
| | | } else { |
| | | t.setId(obj.getId()); |
| | | t.setUpdateTime(new Date()); |
| | | vipGradePotenceMapper.updateByPrimaryKeySelective(t); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public VipGradePotence getDefaultGradePotence() { |
| | | VipGrade grade = vipGradeService.getDefaultGrade(); |
| | |
| | | public List<VipGrade> getValidList(){ |
| | | VipGrade t = new VipGrade(); |
| | | t.setState(1); |
| | | return listByPage(0, Integer.MAX_VALUE, t); |
| | | return listByPage(1, Integer.MAX_VALUE, t); |
| | | } |
| | | |
| | | @Override |
| | |
| | | name: lijin-provider |
| | | registry: |
| | | protocol: zookeeper |
| | | address: zookeeper://193.112.35.168:2181 |
| | | address: zookeeper://118.195.138.153:2181 |
| | | client: curator |
| | | protocol: |
| | | name: dubbo |