Explorar el Código

Merge remote-tracking branch 'origin/master'

lchao hace 5 meses
padre
commit
b790f338c4

+ 18 - 26
qmjszx-admin/src/main/java/beilv/web/controller/system/SysLoginController.java

@@ -1,7 +1,11 @@
 package beilv.web.controller.system;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import beilv.common.core.controller.BaseController;
+import beilv.common.core.domain.AjaxResult;
+import beilv.common.core.text.Convert;
+import beilv.common.utils.ServletUtils;
+import beilv.common.utils.StringUtils;
+import beilv.framework.web.service.ConfigService;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.UsernamePasswordToken;
@@ -13,21 +17,17 @@ import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
-import beilv.common.core.controller.BaseController;
-import beilv.common.core.domain.AjaxResult;
-import beilv.common.core.text.Convert;
-import beilv.common.utils.ServletUtils;
-import beilv.common.utils.StringUtils;
-import beilv.framework.web.service.ConfigService;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 /**
  * 登录验证
- * 
+ *
  * @author ruoyi
  */
 @Controller
-public class SysLoginController extends BaseController
-{
+public class SysLoginController extends BaseController {
     /**
      * 是否开启记住我功能
      */
@@ -38,11 +38,9 @@ public class SysLoginController extends BaseController
     private ConfigService configService;
 
     @GetMapping("/login")
-    public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap)
-    {
+    public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) {
         // 如果是Ajax请求,返回Json字符串。
-        if (ServletUtils.isAjaxRequest(request))
-        {
+        if (ServletUtils.isAjaxRequest(request)) {
             return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}");
         }
         // 是否开启记住我
@@ -54,20 +52,15 @@ public class SysLoginController extends BaseController
 
     @PostMapping("/login")
     @ResponseBody
-    public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe)
-    {
+    public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) {
         UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe);
         Subject subject = SecurityUtils.getSubject();
-        try
-        {
+        try {
             subject.login(token);
             return success();
-        }
-        catch (AuthenticationException e)
-        {
+        } catch (AuthenticationException e) {
             String msg = "用户或密码错误";
-            if (StringUtils.isNotEmpty(e.getMessage()))
-            {
+            if (StringUtils.isNotEmpty(e.getMessage())) {
                 msg = e.getMessage();
             }
             return error(msg);
@@ -75,8 +68,7 @@ public class SysLoginController extends BaseController
     }
 
     @GetMapping("/unauth")
-    public String unauth()
-    {
+    public String unauth() {
         return "error/unauth";
     }
 }

+ 5 - 0
qmjszx-admin/src/main/resources/static/ajax/libs/validate/jquery.validate.extend.js

@@ -51,6 +51,11 @@ $(document).ready(function(){
 		var ip = /^(?:(?:2[0-4][0-9]\.)|(?:25[0-5]\.)|(?:1[0-9][0-9]\.)|(?:[1-9][0-9]\.)|(?:[0-9]\.)){3}(?:(?:2[0-4][0-9])|(?:25[0-5])|(?:1[0-9][0-9])|(?:[1-9][0-9])|(?:[0-9]))$/;
 		return this.optional(element) || (ip).test(value);
 	},"IP地址格式示例127.0.0.1");
+	// 保留两位小数的正数
+	jQuery.validator.addMethod("double", function(value, element){
+		var regex = /^\d+(\.\d{1,2})?$/;
+		return this.optional(element) || (regex.test(value));
+	}, "请输入一个保留小数点后两位的正数,例如:123.45");
 	jQuery.validator.addMethod("notEqual", function(value, element, param) {
         return value != param;
     }, $.validator.format("输入值不允许为{0}"));

+ 60 - 24
qmjszx-admin/src/main/resources/templates/competition/add.html

@@ -10,17 +10,17 @@
         <form class="form-horizontal m" id="form-competition-add">
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动标题:</label>
+                    <label class="col-sm-3 control-label is-required">活动标题:</label>
                     <div class="col-sm-8">
-                        <input name="competitionTitle" class="form-control" type="text" placeholder="请输入活动标题">
+                        <input name="competitionTitle" class="form-control" type="text" placeholder="请输入活动标题" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动类型:</label>
+                    <label class="col-sm-3 control-label is-required">活动类型:</label>
                     <div class="col-sm-8">
-                        <select name="competitionType" class="form-control" th:with="type=${@dict.getType('competition_type')}">
+                        <select name="competitionType" class="form-control" th:with="type=${@dict.getType('competition_type')}" required>
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                         </select>
                     </div>
@@ -28,63 +28,71 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">团队最大人数:</label>
+                    <label class="col-sm-3 control-label is-required">团队最大人数:</label>
                     <div class="col-sm-8">
-                        <input name="personMax" class="form-control" type="text" placeholder="请输入团队最大人数">
+                        <input name="personMax" class="form-control" type="text" placeholder="请输入团队最大人数" min="1" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">最大团队数:</label>
+                    <label class="col-sm-3 control-label is-required">最大团队数:</label>
                     <div class="col-sm-8">
-                        <input name="teamMax" class="form-control" type="text"  placeholder="请输入最大团队数">
+                        <input name="teamMax" class="form-control" type="text" placeholder="请输入最大团队数" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">场地:</label>
+                    <label class="col-sm-3 control-label is-required">场地:</label>
                     <div class="col-sm-8">
-                        <input name="competitionPlace" class="form-control" type="text">
+                        <input name="competitionPlace" class="form-control" type="text" placeholder="请输入场地名称或编号" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">报名开始时间:</label>
+                    <label class="col-sm-3 control-label is-required">赛事开始时间:</label>
                     <div class="col-sm-8">
                         <div class="input-group date">
-                            <input name="applyStartTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
                             <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                            <input name="applyStartTime" type="text" class="form-control" id="applyStartTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">报名结束时间:</label>
+                    <label class="col-sm-3 control-label is-required">赛事结束时间:</label>
                     <div class="col-sm-8">
                         <div class="input-group date">
-                            <input name="applyEndTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                             <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                            <input name="applyEndTime" type="text" class="form-control" id="applyEndTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">取消报名截至时间(活动开始前N小时可退款):</label>
+                    <label class="col-sm-3 control-label">取消报名截至时间:</label>
                     <div class="col-sm-8">
-                        <input name="applyBeforeTime" class="form-control" type="text">
+                        <select name="applyBeforeTime" class="form-control">
+                            <option value="1">赛事开始前1小时</option>
+                            <option value="2">赛事开始前2小时</option>
+                            <option value="3">赛事开始前3小时</option>
+                            <option value="6">赛事开始前6小时</option>
+                            <option value="12">赛事开始前12小时</option>
+                            <option value="24">赛事开始前24小时</option>
+                            <option value="48">赛事开始前48小时</option>
+                        </select>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动费用(每人):</label>
+                    <label class="col-sm-3 control-label is-required">报名费用:</label>
                     <div class="col-sm-8">
-                        <input name="competitionExpense" class="form-control" type="text">
+                        <input name="competitionExpense" class="form-control" type="text" required>
                     </div>
                 </div>
             </div>
@@ -112,26 +120,54 @@
     <th:block th:include="include :: datetimepicker-js" />
     <th:block th:include="include :: summernote-js" />
     <script th:inline="javascript">
-        var prefix = ctx + "system/competition"
+        var prefix = ctx + "competition"
         $("#form-competition-add").validate({
-            focusCleanup: true
+            focusCleanup: true,
+            rules:{
+                personMax:{
+                    digits: true
+                },
+                teamMax:{
+                    digits: true
+                },
+                competitionExpense:{
+                    double: true
+                }
+            },
         });
 
         function submitHandler() {
+            var applyStartTime = $('#applyStartTime').val()
+            var applyEndTime = $('#applyEndTime').val()
+            var currentTime = new Date().toISOString().slice(0, 16); // 当前时间,格式为 YYYY-MM-DD HH:MM
+
+
+
             if ($.validate.form()) {
+
+                // 检查赛事开始时间不能小于当前时间
+                if (applyStartTime < currentTime) {
+                    $.modal.alertWarning("赛事开始时间不能小于当前时间");
+                    return false;
+                }
+
+                // 检查赛事结束时间不能小于赛事开始时间
+                if (applyEndTime < applyStartTime) {
+                    $.modal.alertWarning("赛事结束时间不能小于赛事开始时间");
+                    return false;
+                }
+
                 $.operate.save(prefix + "/add", $('#form-competition-add').serialize());
             }
         }
 
         $("input[name='applyStartTime']").datetimepicker({
-            format: "yyyy-mm-dd",
-            minView: "month",
+            format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
 
         $("input[name='applyEndTime']").datetimepicker({
-            format: "yyyy-mm-dd",
-            minView: "month",
+            format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
 

+ 22 - 4
qmjszx-admin/src/main/resources/templates/competition/competition.html

@@ -124,14 +124,14 @@
                     field: 'competitionExpense',
                     title: '活动费用(每人)'
                 },
-                {
+                /*{
                     field: 'competitionDetails',
                     title: '活动详情'
                 },
                 {
                     field: 'registrationNotes',
                     title: '报名须知'
-                },
+                },*/
                 {
                     field: 'competitionState',
                     title: '活动状态',
@@ -148,8 +148,10 @@
                             actions.push('<a class="btn btn-success btn-xs ' + publisFlag + '" href="javascript:void(0)" onclick="$.operate.publish(\'' + row.id + '\', \'' + row.competitionTitle + '\')"><i class="fa fa-edit"></i>发布</a> ')
                             actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                             actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
-                        } else {
-                            actions.push('<a class="btn btn-success btn-xs ' + publisFlag + '" href="javascript:void(0)" onclick="$.operate.close(\'' + row.id + '\')"><i class="fa fa-close"></i>关闭</a> ')
+                        } else if(row.competitionState === 'competiton_state_4'){
+
+                        }else {
+                            actions.push('<a class="btn btn-success btn-xs ' + publisFlag + '" href="javascript:void(0)" onclick="closeCompetition(\'' + row.id + '\')"><i class="fa fa-close"></i>关闭</a> ')
                         }
 
                         return actions.join('');
@@ -158,6 +160,22 @@
         };
         $.table.init(options);
     });
+
+    function closeCompetition(id){
+        alert(id);
+        $.ajax({
+            url: prefix + "/close",
+            type: "GET",
+            data: {id:id},
+            success: function(res){
+                alert(res)
+            },
+            error: function(err){
+                alert(err)
+            }
+        })
+    }
+
 </script>
 </body>
 </html>

+ 29 - 29
qmjszx-admin/src/main/resources/templates/competition/edit.html

@@ -11,15 +11,15 @@
             <input name="id" th:field="*{id}" type="hidden">
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动标题:</label>
+                    <label class="col-sm-3 control-label is-required">活动标题:</label>
                     <div class="col-sm-8">
-                        <input name="competitionTitle" th:field="*{competitionTitle}" class="form-control" type="text">
+                        <input name="competitionTitle" th:field="*{competitionTitle}" class="form-control" type="text" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动类型:</label>
+                    <label class="col-sm-3 control-label is-required">活动类型:</label>
                     <div class="col-sm-8">
                         <select name="competitionType" class="form-control" th:with="type=${@dict.getType('competition_type')}">
                             <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{competitionType}"></option>
@@ -29,69 +29,69 @@
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">团队最大人数:</label>
+                    <label class="col-sm-3 control-label is-required">团队最大人数:</label>
                     <div class="col-sm-8">
-                        <input name="personMax" th:field="*{personMax}" class="form-control" type="text">
+                        <input name="personMax" th:field="*{personMax}" class="form-control" type="text" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">最大团队数:</label>
+                    <label class="col-sm-3 control-label is-required">最大团队数:</label>
                     <div class="col-sm-8">
-                        <input name="teamMax" th:field="*{teamMax}" class="form-control" type="text">
+                        <input name="teamMax" th:field="*{teamMax}" class="form-control" type="text" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">场地:</label>
+                    <label class="col-sm-3 control-label is-required">场地:</label>
                     <div class="col-sm-8">
-                        <input name="competitionPlace" th:field="*{competitionPlace}" class="form-control" type="text">
+                        <input name="competitionPlace" th:field="*{competitionPlace}" class="form-control" type="text" required>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">报名开始时间:</label>
+                    <label class="col-sm-3 control-label is-required">报名开始时间:</label>
                     <div class="col-sm-8">
                         <div class="input-group date">
-                            <input name="applyStartTime" th:value="${#dates.format(competition.applyStartTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                             <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                            <input name="applyStartTime" th:value="${#dates.format(competition.applyStartTime, 'yyyy-MM-dd HH:mm:ss')}" type="text" class="form-control" id="applyStartTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">报名结束时间:</label>
+                    <label class="col-sm-3 control-label is-required">报名结束时间:</label>
                     <div class="col-sm-8">
                         <div class="input-group date">
-                            <input name="applyEndTime" th:value="${#dates.format(competition.applyEndTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                             <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                            <input name="applyEndTime" th:value="${#dates.format(competition.applyEndTime, 'yyyy-MM-dd HH:mm:ss')}" type="text" class="form-control" id="applyEndTime" placeholder="年-月-日 时:分" required>
                         </div>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">取消报名截至时间(活动开始前N小时可退款):</label>
+                    <label class="col-sm-3 control-label is-required">取消报名截至时间:</label>
                     <div class="col-sm-8">
-                        <input name="applyBeforeTime" th:field="*{applyBeforeTime}" class="form-control" type="text">
-                    </div>
-                </div>
-            </div>
-            <div class="col-xs-12">
-                <div class="form-group">
-                    <label class="col-sm-3 control-label">活动上限人数:</label>
-                    <div class="col-sm-8">
-                        <input name="competitionMaximum" th:field="*{competitionMaximum}" class="form-control" type="text">
+                        <select th:field="*{applyBeforeTime}" name="applyBeforeTime" class="form-control">
+                            <option value="1">赛事开始前1小时</option>
+                            <option value="2">赛事开始前2小时</option>
+                            <option value="3">赛事开始前3小时</option>
+                            <option value="6">赛事开始前6小时</option>
+                            <option value="12">赛事开始前12小时</option>
+                            <option value="24">赛事开始前24小时</option>
+                            <option value="48">赛事开始前48小时</option>
+                        </select>
                     </div>
                 </div>
             </div>
             <div class="col-xs-12">
                 <div class="form-group">
-                    <label class="col-sm-3 control-label">活动费用(每人):</label>
+                    <label class="col-sm-3 control-label is-required">活动费用(每人):</label>
                     <div class="col-sm-8">
                         <input name="competitionExpense" th:field="*{competitionExpense}" class="form-control" type="text">
                     </div>
@@ -121,7 +121,7 @@
     <th:block th:include="include :: datetimepicker-js" />
     <th:block th:include="include :: summernote-js" />
     <script th:inline="javascript">
-        var prefix = ctx + "system/competition";
+        var prefix = ctx + "competition";
         $("#form-competition-edit").validate({
             focusCleanup: true
         });
@@ -133,18 +133,18 @@
         }
 
         $("input[name='applyStartTime']").datetimepicker({
-            format: "yyyy-mm-dd",
-            minView: "month",
+            format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
 
         $("input[name='applyEndTime']").datetimepicker({
-            format: "yyyy-mm-dd",
-            minView: "month",
+            format: "yyyy-mm-dd hh:ii",
             autoclose: true
         });
 
         $(function() {
+            console.log()
+
             $('.summernote').each(function(i) {
                 $('#' + this.id).summernote({
                     lang: 'zh-CN',

+ 8 - 1
qmjszx-admin/src/main/java/beilv/web/controller/competition/CompetitionController.java

@@ -1,4 +1,4 @@
-package beilv.web.controller.competition;
+package beilv.competition.controller;
 
 import java.util.List;
 
@@ -128,4 +128,11 @@ public class CompetitionController extends BaseController {
     public AjaxResult publish(String id){
        return toAjax(competitionService.publishCompetitionById(id));
     }
+
+    @RequiresPermissions("system:competition:publish")
+    @GetMapping("/close")
+    @ResponseBody
+    public AjaxResult close(String id){
+        return toAjax(competitionService.closeCompetitionById(id));
+    }
 }

+ 16 - 16
qmjszx-business/src/main/java/beilv/competition/domain/Competition.java

@@ -38,13 +38,13 @@ public class Competition extends BaseEntity {
      * 团队最大人数
      */
     @Excel(name = "团队最大人数")
-    private String personMax;
+    private Integer personMax;
 
     /**
      * 最大团队数
      */
     @Excel(name = "最大团队数")
-    private String teamMax;
+    private Integer teamMax;
 
     /**
      * 场地
@@ -55,28 +55,28 @@ public class Competition extends BaseEntity {
     /**
      * 报名开始时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    @Excel(name = "报名开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @Excel(name = "报名开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date applyStartTime;
 
     /**
      * 报名结束时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
-    @Excel(name = "报名结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @Excel(name = "报名结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date applyEndTime;
 
     /**
      * 取消报名截至时间(活动开始前N小时可退款)
      */
     @Excel(name = "取消报名截至时间(活动开始前N小时可退款)")
-    private String applyBeforeTime;
+    private Double applyBeforeTime;
 
     /**
      * 活动上限人数
      */
     @Excel(name = "活动上限人数")
-    private String competitionMaximum;
+    private Integer competitionMaximum;
 
     /**
      * 活动费用(每人)
@@ -126,19 +126,19 @@ public class Competition extends BaseEntity {
         return competitionType;
     }
 
-    public void setPersonMax(String personMax) {
+    public void setPersonMax(Integer personMax) {
         this.personMax = personMax;
     }
 
-    public String getPersonMax() {
+    public Integer getPersonMax() {
         return personMax;
     }
 
-    public void setTeamMax(String teamMax) {
+    public void setTeamMax(Integer teamMax) {
         this.teamMax = teamMax;
     }
 
-    public String getTeamMax() {
+    public Integer getTeamMax() {
         return teamMax;
     }
 
@@ -166,19 +166,19 @@ public class Competition extends BaseEntity {
         return applyEndTime;
     }
 
-    public void setApplyBeforeTime(String applyBeforeTime) {
+    public void setApplyBeforeTime(Double applyBeforeTime) {
         this.applyBeforeTime = applyBeforeTime;
     }
 
-    public String getApplyBeforeTime() {
+    public Double getApplyBeforeTime() {
         return applyBeforeTime;
     }
 
-    public void setCompetitionMaximum(String competitionMaximum) {
+    public void setCompetitionMaximum(Integer competitionMaximum) {
         this.competitionMaximum = competitionMaximum;
     }
 
-    public String getCompetitionMaximum() {
+    public Integer getCompetitionMaximum() {
         return competitionMaximum;
     }
 

+ 2 - 0
qmjszx-business/src/main/java/beilv/competition/service/ICompetitionService.java

@@ -61,4 +61,6 @@ public interface ICompetitionService {
     public int deleteCompetitionById(Integer id);
 
     int publishCompetitionById(String id);
+
+    int closeCompetitionById(String id);
 }

+ 16 - 1
qmjszx-business/src/main/java/beilv/competition/service/impl/CompetitionServiceImpl.java

@@ -56,7 +56,9 @@ public class CompetitionServiceImpl implements ICompetitionService {
     @Override
     public int insertCompetition(Competition competition) {
         competition.setCompetitionState(DAI_FA_BU);
-        competition.setCompetitionMaximum(String.valueOf(Integer.parseInt(competition.getPersonMax()) * Integer.parseInt(competition.getTeamMax())));
+        int a = competition.getPersonMax() != null ? competition.getPersonMax() : 0;
+        int b = competition.getTeamMax() != null ? competition.getTeamMax() : 0;
+        competition.setCompetitionMaximum(a * b);
         return competitionMapper.insertCompetition(competition);
     }
 
@@ -100,4 +102,17 @@ public class CompetitionServiceImpl implements ICompetitionService {
         competition.setCompetitionState(BAO_MING_ZHONG);
         return competitionMapper.publishCompetition(competition);
     }
+
+    @Override
+    public int closeCompetitionById(String id) {
+        //查询已经缴费的用户
+
+        //调用退费接口
+
+        //修改赛事状态
+        Competition competition = new Competition();
+        competition.setId(Integer.valueOf(id));
+        competition.setCompetitionState(YI_GUAN_BI);
+        return competitionMapper.publishCompetition(competition);
+    }
 }

qmjszx-business/src/main/resources/mapper.competition/CompetitionMapper.xml → qmjszx-business/src/main/resources/mapper/competition/CompetitionMapper.xml


+ 4 - 0
qmjszx-system/src/main/java/beilv/system/mapper/SysMemberMapper.java

@@ -58,4 +58,8 @@ public interface SysMemberMapper {
      * @return 结果
      */
     public int deleteSysMemberByIds(String[] ids);
+
+    SysMember selectByMobile(String phoneNumber);
+
+    SysMember createUserIfAbsent(String phoneNumber, String clientIP, String value);
 }

+ 5 - 47
qmjszx-system/src/main/resources/mapper/system/SysMemberMapper.xml

@@ -9,32 +9,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="username"    column="username"    />
         <result property="password"    column="password"    />
         <result property="realName"    column="real_name"    />
-        <result property="sex"    column="sex"    />
-        <result property="birthday"    column="birthday"    />
-        <result property="cardId"    column="card_id"    />
-        <result property="avatar"    column="avatar"    />
         <result property="mobile"    column="mobile"    />
         <result property="loginDate"    column="login_date"    />
         <result property="loginIp"    column="login_ip"    />
         <result property="registerIp"    column="register_ip"    />
-        <result property="addIp"    column="add_ip"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
-        <result property="lastIp"    column="last_ip"    />
         <result property="integral"    column="integral"    />
         <result property="status"    column="status"    />
-        <result property="userType"    column="user_type"    />
-        <result property="loginType"    column="login_type"    />
         <result property="wxProfile"    column="wx_profile"    />
         <result property="delFlag"    column="del_flag"    />
         <result property="openId"    column="open_id"    />
-        <result property="routineOpenId"    column="routine_open_id"    />
     </resultMap>
 
     <sql id="selectSysMemberVo">
-        select id, username, password, real_name, sex, birthday, card_id, avatar, mobile, login_date, login_ip, register_ip, add_ip, create_by, create_time, update_by, update_time, last_ip, integral, status, user_type, login_type, wx_profile, del_flag, open_id, routine_open_id from sys_member
+        select id, username, password, real_name, mobile, login_date, login_ip, register_ip, create_by, create_time, update_by, update_time, integral, status, wx_profile, del_flag, open_id from sys_member
     </sql>
 
     <select id="selectSysMemberList" parameterType="SysMember" resultMap="SysMemberResult">
@@ -43,23 +34,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
             <if test="password != null  and password != ''"> and password = #{password}</if>
             <if test="realName != null  and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
-            <if test="sex != null "> and sex = #{sex}</if>
-            <if test="birthday != null "> and birthday = #{birthday}</if>
-            <if test="cardId != null  and cardId != ''"> and card_id = #{cardId}</if>
-            <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
             <if test="mobile != null  and mobile != ''"> and mobile = #{mobile}</if>
             <if test="loginDate != null "> and login_date = #{loginDate}</if>
             <if test="loginIp != null  and loginIp != ''"> and login_ip = #{loginIp}</if>
             <if test="registerIp != null  and registerIp != ''"> and register_ip = #{registerIp}</if>
-            <if test="addIp != null  and addIp != ''"> and add_ip = #{addIp}</if>
-            <if test="lastIp != null  and lastIp != ''"> and last_ip = #{lastIp}</if>
             <if test="integral != null "> and integral = #{integral}</if>
             <if test="status != null "> and status = #{status}</if>
-            <if test="userType != null  and userType != ''"> and user_type = #{userType}</if>
-            <if test="loginType != null  and loginType != ''"> and login_type = #{loginType}</if>
             <if test="wxProfile != null  and wxProfile != ''"> and wx_profile = #{wxProfile}</if>
             <if test="openId != null  and openId != ''"> and open_id = #{openId}</if>
-            <if test="routineOpenId != null  and routineOpenId != ''"> and routine_open_id = #{routineOpenId}</if>
         </where>
     </select>
     
@@ -74,55 +56,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="username != null">username,</if>
             <if test="password != null">password,</if>
             <if test="realName != null">real_name,</if>
-            <if test="sex != null">sex,</if>
-            <if test="birthday != null">birthday,</if>
-            <if test="cardId != null">card_id,</if>
-            <if test="avatar != null">avatar,</if>
             <if test="mobile != null">mobile,</if>
             <if test="loginDate != null">login_date,</if>
             <if test="loginIp != null">login_ip,</if>
             <if test="registerIp != null">register_ip,</if>
-            <if test="addIp != null">add_ip,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
-            <if test="lastIp != null">last_ip,</if>
             <if test="integral != null">integral,</if>
             <if test="status != null">status,</if>
-            <if test="userType != null and userType != ''">user_type,</if>
-            <if test="loginType != null and loginType != ''">login_type,</if>
             <if test="wxProfile != null">wx_profile,</if>
             <if test="delFlag != null">del_flag,</if>
             <if test="openId != null">open_id,</if>
-            <if test="routineOpenId != null">routine_open_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="username != null">#{username},</if>
             <if test="password != null">#{password},</if>
             <if test="realName != null">#{realName},</if>
-            <if test="sex != null">#{sex},</if>
-            <if test="birthday != null">#{birthday},</if>
-            <if test="cardId != null">#{cardId},</if>
-            <if test="avatar != null">#{avatar},</if>
             <if test="mobile != null">#{mobile},</if>
             <if test="loginDate != null">#{loginDate},</if>
             <if test="loginIp != null">#{loginIp},</if>
             <if test="registerIp != null">#{registerIp},</if>
-            <if test="addIp != null">#{addIp},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
-            <if test="lastIp != null">#{lastIp},</if>
             <if test="integral != null">#{integral},</if>
             <if test="status != null">#{status},</if>
-            <if test="userType != null and userType != ''">#{userType},</if>
-            <if test="loginType != null and loginType != ''">#{loginType},</if>
             <if test="wxProfile != null">#{wxProfile},</if>
             <if test="delFlag != null">#{delFlag},</if>
             <if test="openId != null">#{openId},</if>
-            <if test="routineOpenId != null">#{routineOpenId},</if>
          </trim>
     </insert>
 
@@ -132,28 +96,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="username != null">username = #{username},</if>
             <if test="password != null">password = #{password},</if>
             <if test="realName != null">real_name = #{realName},</if>
-            <if test="sex != null">sex = #{sex},</if>
-            <if test="birthday != null">birthday = #{birthday},</if>
-            <if test="cardId != null">card_id = #{cardId},</if>
-            <if test="avatar != null">avatar = #{avatar},</if>
             <if test="mobile != null">mobile = #{mobile},</if>
             <if test="loginDate != null">login_date = #{loginDate},</if>
             <if test="loginIp != null">login_ip = #{loginIp},</if>
             <if test="registerIp != null">register_ip = #{registerIp},</if>
-            <if test="addIp != null">add_ip = #{addIp},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="lastIp != null">last_ip = #{lastIp},</if>
             <if test="integral != null">integral = #{integral},</if>
             <if test="status != null">status = #{status},</if>
-            <if test="userType != null and userType != ''">user_type = #{userType},</if>
-            <if test="loginType != null and loginType != ''">login_type = #{loginType},</if>
             <if test="wxProfile != null">wx_profile = #{wxProfile},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
             <if test="openId != null">open_id = #{openId},</if>
-            <if test="routineOpenId != null">routine_open_id = #{routineOpenId},</if>
         </trim>
         where id = #{id}
     </update>
@@ -168,5 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
-
+    <select id="selectByMobile" parameterType="SysMember" resultMap="SysMemberResult">
+        <include refid="selectSysMemberVo"/>
+        where mobile = #{mobile} and del_flag = 0
+    </select>
 </mapper>