From 085d0e9e62e524b7cf0e7b7d8ad3b51a5a7c1e81 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 24 七月 2024 11:01:09 +0800
Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/IgoTravel into 2.0

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java           |   14 ++++++
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java |   26 ++++++++++++-
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgreementController.java         |   16 ++++++-
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java                   |    1 
 ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/commonProblem.html                                    |   27 ++++++++++++-
 ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementUser.html                                   |   35 ++++++++++++++++-
 6 files changed, 108 insertions(+), 11 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java
index a508eec..f2c516c 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/SysRedPacketRecordController.java
@@ -1,5 +1,6 @@
 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;
@@ -9,7 +10,11 @@
 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;
@@ -86,6 +91,13 @@
     }
 
 
+    @Autowired
+    private ITSystemNoticeService systemNoticeService;
+
+    @Autowired
+    private ITUserService userService;
+
+
     @RequestMapping(value = "/direct")
     @ResponseBody
     public ResultUtil direct(String ids, Integer redId) {
@@ -108,8 +120,7 @@
                 money = Double.valueOf(String.valueOf(sysRedPacketRecord.getMoney()));
                 //计算剩余金额是否够
 
-                if (v <= 0){
-
+                if (v-money*ids.split(",").length <= 0){
                     return ResultUtil.error("当前红包剩余金额不足");
                 }
 
@@ -154,6 +165,17 @@
 //            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,"当前红包为随机红包,可能有部分用户无法领取");
diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgreementController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgreementController.java
index 9baf926..37683fe 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgreementController.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TAgreementController.java
@@ -82,8 +82,10 @@
      */
     @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";
     }
 
@@ -155,8 +157,10 @@
      */
     @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";
     }
 
@@ -217,12 +221,18 @@
      */
     @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;
     }
 
diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java
index 8867c65..30da49d 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITSystemNoticeService.java
@@ -12,5 +12,6 @@
  * @since 2020-06-10
  */
 public interface ITSystemNoticeService extends IService<TSystemNotice> {
+    void addSystemNotice(Integer userType, String content, Integer userId) throws Exception;
 
 }
diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java
index 55a2301..73b2594 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TSystemNoticeServiceImpl.java
@@ -6,6 +6,8 @@
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+
 /**
  * <p>
  * 系统通知 服务实现类
@@ -16,5 +18,15 @@
  */
 @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);
+    }
 }
diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/commonProblem.html b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/commonProblem.html
index c9e54e9..fa44bf8 100644
--- a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/commonProblem.html
+++ b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/commonProblem.html
@@ -11,6 +11,7 @@
                 <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>
@@ -27,7 +28,10 @@
                                         </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});"/>
@@ -50,6 +54,7 @@
     $(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){
@@ -62,6 +67,18 @@
             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();
         })
     });
 
@@ -70,10 +87,14 @@
             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("编辑成功!");
@@ -82,6 +103,8 @@
         });
         ajax.set("context", content);
         ajax.set("id", id);
+        ajax.set("context1", content1);
+        ajax.set("id1", id1);
         ajax.start();
     }
 </script>
diff --git a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementUser.html b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementUser.html
index 53bec87..79b900e 100644
--- a/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementUser.html
+++ b/ManagementIGOTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementUser.html
@@ -11,11 +11,13 @@
                 <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%;">
@@ -26,8 +28,16 @@
                                             </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});"/>
@@ -38,6 +48,8 @@
 
                             </div>
                         </div>
+
+
                     </div>
                 </div>
             </div>
@@ -47,9 +59,11 @@
 
 <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){
@@ -64,6 +78,19 @@
             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();
         })
     });
 
@@ -72,10 +99,10 @@
             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("编辑成功!");
@@ -83,7 +110,9 @@
             Feng.error("编辑失败!" + data.responseJSON.message + "!");
         });
         ajax.set("context", content);
+        ajax.set("context1", content1);
         ajax.set("id", id);
+        ajax.set("id1", id1);
         ajax.start();
     }
 </script>

--
Gitblit v1.7.1