| | |
| | | package com.stylefeng.guns.modular.system.controller.general; |
| | | |
| | | import cn.hutool.system.UserInfo; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TSystemNotice; |
| | | import com.stylefeng.guns.modular.system.model.TUser; |
| | | import com.stylefeng.guns.modular.system.model.UserRedPacketRecord; |
| | | import com.stylefeng.guns.modular.system.service.ITSystemNoticeService; |
| | | import com.stylefeng.guns.modular.system.service.ITUserService; |
| | | import com.stylefeng.guns.modular.system.service.IUserRedPacketRecordService; |
| | | import com.stylefeng.guns.modular.system.service.impl.UserServiceImpl; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private ITSystemNoticeService systemNoticeService; |
| | | |
| | | @Autowired |
| | | private ITUserService userService; |
| | | |
| | | |
| | | @RequestMapping(value = "/direct") |
| | | @ResponseBody |
| | | public ResultUtil direct(String ids, Integer redId) { |
| | |
| | | money = Double.valueOf(String.valueOf(sysRedPacketRecord.getMoney())); |
| | | //计算剩余金额是否够 |
| | | |
| | | if (v <= 0){ |
| | | |
| | | if (v-money*ids.split(",").length <= 0){ |
| | | return ResultUtil.error("当前红包剩余金额不足"); |
| | | } |
| | | |
| | |
| | | // userRedPacketRecord.setOrderType(3); |
| | | userRedPacketRecord.setUserId(Integer.valueOf(s)); |
| | | userRedPacketRecordService.insert(userRedPacketRecord); |
| | | |
| | | TUser tUser = userService.selectById(Integer.valueOf(s)); |
| | | Integer language = tUser.getLanguage(); |
| | | try { |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您收到一个额度为GHS"+money+"的红包,请查收。" : language == 2 ? "You have received a red envelope with a limit of GHS"+money+". Please check it." : "Vous recevez un paquet rouge avec une limite de ghs+"+money+", veuillez vérifier.", tUser.getId()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | return ResultUtil.success("指派成功",null,"当前红包为随机红包,可能有部分用户无法领取"); |
| | |
| | | */ |
| | | @RequestMapping("/user") |
| | | public String userIndex(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 3)); |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType",1).eq("type", 3)); |
| | | model.addAttribute("one",one); |
| | | TAgreement two = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType",2).eq("type", 3)); |
| | | model.addAttribute("two",two); |
| | | return PREFIX + "tAgreementUser.html"; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping("/showCommonProblem") |
| | | public String showCommonProblem(Model model) { |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("type", 12)); |
| | | TAgreement one = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType",1).eq("type", 12)); |
| | | model.addAttribute("one",one); |
| | | TAgreement two = tAgreementService.selectOne(new EntityWrapper<TAgreement>().eq("useType",2).eq("type", 12)); |
| | | model.addAttribute("two",two); |
| | | return PREFIX + "commonProblem.html"; |
| | | } |
| | | |
| | |
| | | */ |
| | | @RequestMapping(value = "/updateAppParam") |
| | | @ResponseBody |
| | | public Object updateAppParam(@RequestParam Integer id,@RequestParam String context) { |
| | | public Object updateAppParam(@RequestParam Integer id,@RequestParam String context, Integer id1, String context1) { |
| | | TAgreement agreement = tAgreementService.selectById(id); |
| | | agreement.setContent(context); |
| | | agreement.setUpdateTime(new Date()); |
| | | agreement.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAgreementService.updateById(agreement); |
| | | |
| | | TAgreement agreement1 = tAgreementService.selectById(id1); |
| | | agreement1.setContent(context1); |
| | | agreement1.setUpdateTime(new Date()); |
| | | agreement1.setUpdateUser(ShiroKit.getUser().getId()); |
| | | tAgreementService.updateById(agreement1); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | * @since 2020-06-10 |
| | | */ |
| | | public interface ITSystemNoticeService extends IService<TSystemNotice> { |
| | | void addSystemNotice(Integer userType, String content, Integer userId) throws Exception; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统通知 服务实现类 |
| | |
| | | */ |
| | | @Service |
| | | public class TSystemNoticeServiceImpl extends ServiceImpl<TSystemNoticeMapper, TSystemNotice> implements ITSystemNoticeService { |
| | | |
| | | @Override |
| | | public void addSystemNotice(Integer userType, String content, Integer userId) throws Exception { |
| | | TSystemNotice systemNotice = new TSystemNotice(); |
| | | systemNotice.setContent(content); |
| | | systemNotice.setInsertTime(new Date()); |
| | | systemNotice.setRead(1); |
| | | systemNotice.setType(2); |
| | | systemNotice.setUserId(userId); |
| | | systemNotice.setUserType(userType); |
| | | this.insert(systemNotice); |
| | | } |
| | | } |
| | |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input type="hidden" id="id" value="${one.id}"> |
| | | <input type="hidden" id="id1" value="${two.id}"> |
| | | <div class="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">常见问题设置</a></li> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="panel-body" style="padding-top: 60px;"> |
| | | <span>用户端:</span> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${one.content}</textarea> |
| | | <span>司机端:</span> |
| | | <textarea id="editor_2" type="text/plain" style="width:1200px;height:400px;">${two.content}</textarea> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update_1(${one.id});"/> |
| | |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | editor_2 = UE.getEditor('editor_2'); |
| | | |
| | | $('#language').on('change', function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgreement/getAgreement", function(data){ |
| | |
| | | ajax.set("type", 12); |
| | | ajax.set("useType", 1); |
| | | ajax.start(); |
| | | |
| | | |
| | | var ajax1 = new $ax(Feng.ctxPath + "/tAgreement/getAgreement", function(data){ |
| | | editor_2.setContent(data.content); |
| | | $('#id1').val(data.id); |
| | | },function(data){ |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax1.set("language", $(this).val()); |
| | | ajax1.set("type", 12); |
| | | ajax1.set("useType", 2); |
| | | ajax1.start(); |
| | | }) |
| | | }); |
| | | |
| | |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(editor_1.getContent(), $('#id').val()); |
| | | if (editor_2.getContentTxt() == ""){ |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(editor_1.getContent(), $('#id').val(),editor_2.getContent(), $('#id1').val()); |
| | | } |
| | | |
| | | function submitData(content,id) { |
| | | function submitData(content,id,content1,id1) { |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgreement/updateAppParam", function(data){ |
| | | Feng.success("编辑成功!"); |
| | |
| | | }); |
| | | ajax.set("context", content); |
| | | ajax.set("id", id); |
| | | ajax.set("context1", content1); |
| | | ajax.set("id1", id1); |
| | | ajax.start(); |
| | | } |
| | | </script> |
| | |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input type="hidden" id="id" value="${one.id}"> |
| | | <input type="hidden" id="id1" value="${two.id}"> |
| | | <div class="tabs-container"> |
| | | <ul class="nav nav-tabs"> |
| | | <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">用户指南设置</a></li> |
| | | </ul> |
| | | <div class="tab-content"> |
| | | |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="col-sm-3" style="padding-top: 10px;"> |
| | | <div class="input-group" style="width: 100%;"> |
| | |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="panel-body" style="padding-top: 60px;"> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${one.content}</textarea> |
| | | <span>用户端:</span> |
| | | <textarea id="editor_1" type="text/plain" style="width:1200px;height:400px;">${one.content!}</textarea> |
| | | <br> |
| | | <br> |
| | | <br> |
| | | <span>司机端:</span> |
| | | <textarea id="editor_2" type="text/plain" style="width:1200px;height:400px;">${two.content!}</textarea> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update_1(${one.id});"/> |
| | |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <script type="text/javascript"> |
| | | var editor_1 = null; |
| | | var editor_2 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor_1 = UE.getEditor('editor_1'); |
| | | editor_2 = UE.getEditor('editor_2'); |
| | | |
| | | $('#language').on('change', function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgreement/getAgreement", function(data){ |
| | |
| | | ajax.set("type", 3); |
| | | ajax.set("useType", 1); |
| | | ajax.start(); |
| | | |
| | | var ajax1 = new $ax(Feng.ctxPath + "/tAgreement/getAgreement", function(data){ |
| | | if(null != data){ |
| | | editor_2.setContent(data.content); |
| | | $('#id1').val(data.id); |
| | | } |
| | | },function(data){ |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax1.set("language", $(this).val()); |
| | | ajax1.set("type", 3); |
| | | ajax1.set("useType", 2); |
| | | ajax1.start(); |
| | | }) |
| | | }); |
| | | |
| | |
| | | Feng.error("内容不能为空!"); |
| | | return; |
| | | } |
| | | submitData(editor_1.getContent(), $('#id').val()); |
| | | submitData(editor_1.getContent(), $('#id').val(),editor_2.getContent(), $('#id1').val()); |
| | | } |
| | | |
| | | function submitData(content,id) { |
| | | function submitData(content,id,content1,id1) { |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tAgreement/updateAppParam", function(data){ |
| | | Feng.success("编辑成功!"); |
| | |
| | | Feng.error("编辑失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set("context", content); |
| | | ajax.set("context1", content1); |
| | | ajax.set("id", id); |
| | | ajax.set("id1", id1); |
| | | ajax.start(); |
| | | } |
| | | </script> |