Browse Source

优惠券核销

liu 2 năm trước cách đây
mục cha
commit
70dc78d3f9

+ 1 - 1
mhotel/src/com/happy/Until/TreeRecordsUtil.java

@@ -27,7 +27,7 @@ public class TreeRecordsUtil {
                     .userName(data.getUserName())
                     .headPhoto(data.getHeadPhoto())
             // ½«Ê±¼äת»¯Îª yyyy/MM/dd
-                    .dateTime( DateUtil.parseDateToStr((Func.parseDate(data.getDateTime())), DateUtil.Time_Formatter_Day))
+                    .dateTime( data.getDateTime().substring(0,19))
                     .content(data.getContent())
                     .build();
             List<CommentListVo> news = queryCommentTreeRecords(item.getId(), lists);

+ 2 - 2
mhotel/src/com/happy/action/AppBookingAction.java

@@ -901,7 +901,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
                     System.out.println("进入核销优惠券");
                     for (HotelCouponStatus hotelCouponStatus : hotelCouponStatusList) {
                         String complaintId = hotelCouponStatus.getComplaintId();
-                        System.out.println("核销优惠券id"+complaintId);
+                        System.out.println("核销优惠券id:"+complaintId);
                         HotelCoupon hotelCoupon = hotelCoupomService.getById(complaintId);
                         if (hotelCoupon!=null) {
                             Integer reversedNumber = hotelCoupon.getReversedNumber();
@@ -910,7 +910,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
                             }
                             hotelCoupon.setReversedNumber(reversedNumber+1);
                             hotelCoupon.setModifyDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-                            hotelCoupomService.update(hotelCoupon);
+                            hotelCoupomService.updatReversedNumber(hotelCoupon);
                         }
                     }
                 }

+ 1 - 0
mhotel/src/com/happy/dao/HotelCouponDao.java

@@ -83,4 +83,5 @@ public interface HotelCouponDao {
 
     int usefulCouponTotal(String hotelId, String userId,Double totalPrice,String format);
 
+    int updatReversedNumber(HotelCoupon hotelCoupon);
 }

+ 21 - 0
mhotel/src/com/happy/dao/impl/HotelCouponImplDao.java

@@ -422,6 +422,27 @@ public class HotelCouponImplDao implements HotelCouponDao {
         sps.addValue("now",format);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
+
+    @Override
+    public int updatReversedNumber(HotelCoupon hotelCoupon) {
+       String sql=" update  hotel_coupon set reversed_number = :reversedNumber where id= :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        // 将要修改的数据填充到查询语句中
+
+        sps.addValue("id", hotelCoupon.getId());
+        sps.addValue("reversedNumber", hotelCoupon.getReversedNumber());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+
+
+    }
+
     private void appendValue(HotelCoupon hotelCoupon, StringBuffer stringBuffer, MapSqlParameterSource sps){
         if (!Func.checkNull(String.valueOf(hotelCoupon.getHotelIds()))){
             stringBuffer.append(" hotelIds=:hotelIds ,");

+ 1 - 0
mhotel/src/com/happy/service/HotelCoupomService.java

@@ -95,4 +95,5 @@ public interface HotelCoupomService {
     int useCoupons(HotelCoupon hotelCoupon, HotelCouponStatus hotelCouponStatus);
 
 
+    int updatReversedNumber(HotelCoupon hotelCoupon);
 }

+ 5 - 0
mhotel/src/com/happy/service/impl/HotelCoupomImplService.java

@@ -278,5 +278,10 @@ public class HotelCoupomImplService implements HotelCoupomService {
         return 0;
     }
 
+    @Override
+    public int updatReversedNumber(HotelCoupon hotelCoupon) {
+        return hotelCouponDao.updatReversedNumber(hotelCoupon);
+    }
+
 
 }