浏览代码

fix 排序

Administrator 1 年之前
父节点
当前提交
eef5e5b8b3

+ 11 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/reservat/BomanReservatController.java

@@ -99,7 +99,7 @@ public class BomanReservatController extends BaseController {
     }
 
     /**
-     * 陵园预约核销
+     * 陵园预约核销APP核销
      */
     @PreAuthorize("@ss.hasPermi('system:reservat:hx')")
     @GetMapping("/hx")
@@ -107,6 +107,16 @@ public class BomanReservatController extends BaseController {
         return bomanReservatService.verification(reservatId);
     }
 
+
+    /**
+     * 陵园预约核销管理员核销
+     */
+    @PreAuthorize("@ss.hasPermi('system:reservat:hx')")
+    @GetMapping("/hxManage")
+    public AjaxResult verificationManage(Long reservatId) {
+        return bomanReservatService.verificationManage(reservatId);
+    }
+
     /**
      * 删除陵园预约
      */

+ 17 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -64,6 +64,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
         return false;
     }
+
+    /**
+     * 判断两个时间如果再同一天的话,前者是否大于等于后者
+     * */
+    public static Boolean sameDayCompareD(Date dateOne, Date dateTwo) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
+        String formatOne = simpleDateFormat.format(dateOne);
+        String formatTwo = simpleDateFormat.format(dateTwo);
+        try {
+            if (simpleDateFormat.parse(formatOne).getTime() >= simpleDateFormat.parse(formatTwo).getTime()) {
+                return true;
+            }
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
     /**
      * 得到加减某个值的日期 yyyy-MM-dd
      *

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IBomanReservatService.java

@@ -71,6 +71,7 @@ public interface IBomanReservatService
     AjaxResult  indexStatistics (BomanReservat bomanReservat);
 
     AjaxResult verification(Long reservatId);
+    AjaxResult verificationManage(Long reservatId);
 
     /**
      *  陵园实时参观统计

+ 25 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BomanReservatServiceImpl.java

@@ -320,6 +320,31 @@ public class BomanReservatServiceImpl implements IBomanReservatService {
         return i > 0 ? AjaxResult.success() : AjaxResult.error();
     }
 
+    /**
+     * 管理员核销
+     * @param reservatId
+     * @return
+     */
+    @Override
+    public AjaxResult verificationManage(Long reservatId) {
+        BomanReservat reservat = bomanReservatMapper.selectBomanReservatByReservatId(reservatId);
+        if (!"3".equals(reservat.getVisitType())){
+            return AjaxResult.error("当前预约未通过,禁止核销");
+        }
+        if ("2".equals(reservat.getVisitStatus())) {
+            return AjaxResult.error("当前预约已核销,请勿重复操作。");
+        }
+        //判断时间是否一致 日期和时段
+        String visitDate = reservat.getVisitDate();
+        if (StringUtils.isNotBlank(visitDate) && DateUtils.sameDayCompareD(DateUtils.parseDate(visitDate),DateUtils.getNowDate()) ){
+            return AjaxResult.error("核销时间必须大于等于预约日期。");
+        }
+        BomanReservat bomanReservat = new BomanReservat();
+        bomanReservat.setReservatId(reservatId);
+        bomanReservat.setVisitStatus("2");
+        int i = bomanReservatMapper.updateBomanReservat(bomanReservat);
+        return i > 0 ? AjaxResult.success() : AjaxResult.error();
+    }
 
     /**
      * 陵园实时参观统计

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

@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dataType != null and dataType == '3'"> and  visit_date &gt;= DATE_SUB(NOW(), INTERVAL 7 DAY)</if>
             <if test="dataType != null and dataType == '4'"> and visit_date &gt;= DATE_SUB(NOW(), INTERVAL 30 DAY))</if>
         </where>
-        order by create_time DESC
+        order by visit_date DESC,visit_time DESC
     </select>
     
     <select id="selectBomanReservatByReservatId" parameterType="Long" resultMap="BomanReservatResult">