zhao 6 miesięcy temu
rodzic
commit
f28d3c3384

+ 9 - 9
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/ProxyDemandController.java

@@ -55,15 +55,15 @@ public class ProxyDemandController {
     }
 
     //判断当前预约人数是否已满
-    @GetMapping("/judge")
-    public BaseResult judge(){
-        try {
-            proxyDemandService.findBylastTotal();
-            return BaseResult.ok();
-        }catch (BusinessException e){
-            return BaseResult.notOk(e.getMessage());
-        }
-    }
+//    @GetMapping("/judge")
+//    public BaseResult judge(){
+//        try {
+//            proxyDemandService.findBylastTotal();
+//            return BaseResult.ok();
+//        }catch (BusinessException e){
+//            return BaseResult.notOk(e.getMessage());
+//        }
+//    }
 
 
 }

+ 2 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/ParkData.java

@@ -21,4 +21,6 @@ public class ParkData implements Serializable {
     private Date creatTime;
     //当查询id为-1时,返回所有坐标数据
     private String addrs;
+    //查询顺序
+    private Integer soat;
 }

+ 5 - 5
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/ProxyDemandServiceImpl.java

@@ -41,10 +41,10 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
 
     @Override
     public BaseResult insert(ProxyVerifyDTO proxyVerifyDTO) {
-        int handleTotal = this.findTotalByTime(new Date());
-        if(handleTotal>=10){
-            throw new BusinessException("申请失败,预约已满!");
-        }
+//        int handleTotal = this.findTotalByTime(new Date());
+//        if(handleTotal>=10){
+//            throw new BusinessException("申请失败,预约已满!");
+//        }
         Object o = redisTemplate.opsForValue().get(proxyVerifyDTO.getImgKey());
         if(o==null){
             throw new BusinessException("验证码已过期");
@@ -65,7 +65,7 @@ public class ProxyDemandServiceImpl implements ProxyDemandService {
         proxyDemand.setProxyName(proxyVerifyDTO.getProxyName());
         proxyDemand.setProxyPhone(proxyVerifyDTO.getProxyPhone());
         proxyDemand.setProxyMatters(proxyVerifyDTO.getProxyMatters());
-        proxyDemand.setHandleTotal(handleTotal+1);
+        //proxyDemand.setHandleTotal(handleTotal+1);
         proxyDemandDao.insert(proxyDemand);
         return BaseResult.ok();
     }

+ 7 - 7
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/ReserveOvertimeServiceImpl.java

@@ -53,7 +53,7 @@ public class ReserveOvertimeServiceImpl implements ReserveOvertimeService {
         Date handleTime = overtimeVerifyDTO.getHandleTime();
         int handleTotal = this.findTotalByTime(handleTime);
         //int handleTotal = reserveOvertimeDao.findTotalByTime(handleTime);
-        if(handleTotal>14){
+        if(handleTotal>9){
             throw new BusinessException("今日预约人数已满,请更换办理日期!");
         }
 
@@ -95,18 +95,18 @@ public class ReserveOvertimeServiceImpl implements ReserveOvertimeService {
     public int findTotalByTime(Date handleTime) {
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(handleTime);
-
-        // 设置 startTime 为当天的 00:00:00
+        // 设置为一周的开始时间(通常是周一的 00:00:00)
+        calendar.setFirstDayOfWeek(Calendar.MONDAY); // 设置每周的第一天为周一
+        calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); // 设置为本周的周一
         calendar.set(Calendar.HOUR_OF_DAY, 0);
         calendar.set(Calendar.MINUTE, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.set(Calendar.MILLISECOND, 0);
         Date startTime = calendar.getTime();
-
-        // 设置 endTime 为次日的 00:00:00
-        calendar.add(Calendar.DAY_OF_MONTH, 1);
+        // 设置为一周的结束时间(下周一的 00:00:00 前一秒)
+        calendar.add(Calendar.DAY_OF_WEEK, 7); // 向前移动7天,到达下周的周一
+        calendar.add(Calendar.MILLISECOND, -1); // 回退1毫秒,得到本周日的最后一刻
         Date endTime = calendar.getTime();
-
         return reserveOvertimeDao.findTotalByTime(startTime, endTime);
     }
 

+ 1 - 1
nngkxxdp/src/main/resources/mapper/ParkDataDao.xml

@@ -4,7 +4,7 @@
 
     <!-- 查询首页全部数据 -->
     <select id="findAll" resultType="com.example.nngkxxdp.entity.ParkData">
-        select * from t_park_data
+        select * from t_park_data order by soat
     </select>
 
     <!-- 根据id查询数据 -->