LIVE_YE 9 месяцев назад
Родитель
Сommit
1c3aa7bbc0

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java

@@ -130,4 +130,14 @@ public class SysConfigController extends BaseController
         configService.resetConfigCache();
         return success();
     }
+
+    /**
+     * 密码验证
+     */
+    @PreAuthorize("@ss.hasPermi('system:config:boolean')")
+    @GetMapping(value = "/configKey/boolean")
+    public AjaxResult verifyPwd(SysConfig config)
+    {
+        return configService.verifyPwd(config);
+    }
 }

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.SysConfig;
 
 /**
@@ -86,4 +88,6 @@ public interface ISysConfigService
      * @return 结果
      */
     public boolean checkConfigKeyUnique(SysConfig config);
+
+    AjaxResult verifyPwd(SysConfig config);
 }

+ 40 - 45
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service.impl;
 
+import java.text.ParseException;
 import java.util.*;
 
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -14,13 +15,12 @@ import com.ruoyi.system.service.IBomanReservatService;
 
 /**
  * 预约Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-02-27
  */
 @Service
-public class BomanReservatServiceImpl implements IBomanReservatService 
-{
+public class BomanReservatServiceImpl implements IBomanReservatService {
     @Autowired
     private BomanReservatMapper bomanReservatMapper;
     @Autowired
@@ -28,37 +28,34 @@ public class BomanReservatServiceImpl implements IBomanReservatService
 
     /**
      * 查询预约
-     * 
+     *
      * @param reservatId 预约主键
      * @return 预约
      */
     @Override
-    public BomanReservat selectBomanReservatByReservatId(Long reservatId)
-    {
+    public BomanReservat selectBomanReservatByReservatId(Long reservatId) {
         return bomanReservatMapper.selectBomanReservatByReservatId(reservatId);
     }
 
     /**
      * 查询预约列表
-     * 
+     *
      * @param bomanReservat 预约
      * @return 预约
      */
     @Override
-    public List<BomanReservat> selectBomanReservatList(BomanReservat bomanReservat)
-    {
+    public List<BomanReservat> selectBomanReservatList(BomanReservat bomanReservat) {
         return bomanReservatMapper.selectBomanReservatList(bomanReservat);
     }
 
     /**
      * 新增预约
-     * 
+     *
      * @param bomanReservat 预约
      * @return 结果
      */
     @Override
-    public int insertBomanReservat(BomanReservat bomanReservat)
-    {
+    public int insertBomanReservat(BomanReservat bomanReservat) {
 
         bomanReservat.setCreateTime(DateUtils.getNowDate());
         return bomanReservatMapper.insertBomanReservat(bomanReservat);
@@ -66,38 +63,35 @@ public class BomanReservatServiceImpl implements IBomanReservatService
 
     /**
      * 修改预约
-     * 
+     *
      * @param bomanReservat 预约
      * @return 结果
      */
     @Override
-    public int updateBomanReservat(BomanReservat bomanReservat)
-    {
+    public int updateBomanReservat(BomanReservat bomanReservat) {
         bomanReservat.setUpdateTime(DateUtils.getNowDate());
         return bomanReservatMapper.updateBomanReservat(bomanReservat);
     }
 
     /**
      * 批量删除预约
-     * 
+     *
      * @param reservatIds 需要删除的预约主键
      * @return 结果
      */
     @Override
-    public int deleteBomanReservatByReservatIds(Long[] reservatIds)
-    {
+    public int deleteBomanReservatByReservatIds(Long[] reservatIds) {
         return bomanReservatMapper.deleteBomanReservatByReservatIds(reservatIds);
     }
 
     /**
      * 删除预约信息
-     * 
+     *
      * @param reservatId 预约主键
      * @return 结果
      */
     @Override
-    public int deleteBomanReservatByReservatId(Long reservatId)
-    {
+    public int deleteBomanReservatByReservatId(Long reservatId) {
         return bomanReservatMapper.deleteBomanReservatByReservatId(reservatId);
     }
 
@@ -114,7 +108,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService
      */
     @Override
     public AjaxResult weekAppointment() {
-        Map<String,Object> resultMap = new HashMap<>();
+        Map<String, Object> resultMap = new HashMap<>();
         //获取上周一
         String lastMonday = DateUtils.lastMonday();
         //获取上周日
@@ -134,7 +128,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat);
         //访客人数
         int fk = 0;
-        if(lastList!=null && lastList.size()>0){
+        if (lastList != null && lastList.size() > 0) {
             yy = lastList.size();
         }
         //周一到周日的预约人数
@@ -148,9 +142,9 @@ public class BomanReservatServiceImpl implements IBomanReservatService
             //周几的访客人数
             int weekfk = 0;
             for (BomanReservat reservat : lastList) {
-                if(string.equals(DateUtils.dateTime(reservat.getVisitDate()))){
+                if (string.equals(DateUtils.dateTime(reservat.getVisitDate()))) {
                     weekyy++;
-                    if("2".equals(reservat.getVisitStatus())){
+                    if ("2".equals(reservat.getVisitStatus())) {
                         weekfk++;
                         fk++;
                     }
@@ -159,14 +153,15 @@ public class BomanReservatServiceImpl implements IBomanReservatService
             yyList.add(String.valueOf(weekyy));
             fkList.add(String.valueOf(weekfk));
         }
-        resultMap.put("yyzs",yy);
-        resultMap.put("fkzs",fk);
-        resultMap.put("x",strings);
-        resultMap.put("y1",yyList);
-        resultMap.put("y2",fkList);
+        resultMap.put("yyzs", yy);
+        resultMap.put("fkzs", fk);
+        resultMap.put("x", strings);
+        resultMap.put("y1", yyList);
+        resultMap.put("y2", fkList);
         return AjaxResult.success(resultMap);
     }
 
+
     @Override
     public AjaxResult yydc() {
         Map<String, Object> resultMap = new HashMap<>();
@@ -174,7 +169,7 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         String day = DateUtils.getDate();
 
         BomanReservat bomanReservat = new BomanReservat();
-        bomanReservat.setVisitTime(day);
+        bomanReservat.setVisitDate(DateUtils.getNowDate());
         List<BomanReservat> lastList = bomanReservatMapper.selectBomanReservatTimeList(bomanReservat);
         //本月来访数
         int bylf = 0;
@@ -184,16 +179,16 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         int jrlf = 0;
         //今日预约
         int jryy = 0;
-        if(lastList!=null && lastList.size()>0){
+        if (lastList != null && lastList.size() > 0) {
             byyy = lastList.size();
             for (BomanReservat reservat : lastList) {
-                if("2".equals(reservat.getVisitStatus())){
+                if ("2".equals(reservat.getVisitStatus())) {
                     bylf++;
-                    if(day.contains(DateUtils.dateTime(reservat.getVisitDate()))){
+                    if (day.contains(DateUtils.dateTime(reservat.getVisitDate()))) {
                         jrlf++;
                     }
                 }
-                if(day.contains(DateUtils.dateTime(reservat.getVisitDate()))){
+                if (day.contains(DateUtils.dateTime(reservat.getVisitDate()))) {
                     jryy++;
                 }
             }
@@ -209,24 +204,24 @@ public class BomanReservatServiceImpl implements IBomanReservatService
         int dcwc = 0;
         //订餐晚餐人数
         int dcDinner = 0;
-        if(orderFoods!=null && orderFoods.size()>0){
+        if (orderFoods != null && orderFoods.size() > 0) {
             dczs = orderFoods.size();
             for (OrderFood food : orderFoods) {
-                if("1".equals(food.getOrderFoodType())){
+                if ("1".equals(food.getOrderFoodType())) {
                     dcwc++;
                 }
-                if("2".equals(food.getOrderFoodType())){
+                if ("2".equals(food.getOrderFoodType())) {
                     dcDinner++;
                 }
             }
         }
-        resultMap.put("bylf",bylf);
-        resultMap.put("byyy",byyy);
-        resultMap.put("jrlf",jrlf);
-        resultMap.put("jryy",jryy);
-        resultMap.put("dczs",dczs);
-        resultMap.put("dcwc",dcwc);
-        resultMap.put("dcDinner",dcDinner);
+        resultMap.put("bylf", bylf);
+        resultMap.put("byyy", byyy);
+        resultMap.put("jrlf", jrlf);
+        resultMap.put("jryy", jryy);
+        resultMap.put("dczs", dczs);
+        resultMap.put("dcwc", dcwc);
+        resultMap.put("dcDinner", dcDinner);
         return AjaxResult.success(resultMap);
     }
 

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -3,6 +3,9 @@ package com.ruoyi.system.service.impl;
 import java.util.Collection;
 import java.util.List;
 import javax.annotation.PostConstruct;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.annotation.DataSource;
@@ -219,6 +222,16 @@ public class SysConfigServiceImpl implements ISysConfigService
         return UserConstants.UNIQUE;
     }
 
+    @Override
+    public AjaxResult verifyPwd(SysConfig config) {
+        config.setConfigKey("sys.equip.pwd");
+        SysConfig info = configMapper.selectConfig(config);
+        if(ObjectUtils.isEmpty(info)){
+            return AjaxResult.error();
+        }
+        return AjaxResult.success();
+    }
+
     /**
      * 设置cache key
      * 

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/BomanReservatMapper.xml

@@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="visitStatus != null  and visitStatus != ''"> and visit_status = #{visitStatus}</if>
 
-            <if test="visitDate != null  and visitDate != ''">
+            <if test="visitDate != null">
                 AND date_format(visit_date,'%y%m') = date_format(#{visitDate},'%y%m')
             </if>
 

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="configKey !=null and configKey != ''">
 				and config_key = #{configKey}
 			</if>
+            <if test="configValue !=null and configValue != ''">
+                and config_value = #{configValue}
+            </if>
 		</where>
 	</sql>