Browse Source

add 钟点房最近12小时占用情况

liu 2 years ago
parent
commit
3c8dae4ba6

+ 0 - 19
.idea/compiler.xml

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="CompilerConfiguration">
-    <annotationProcessing>
-      <profile default="true" name="Default" enabled="true" />
-      <profile name="Maven default annotation processors profile" enabled="true">
-        <sourceOutputDir name="target/generated-sources/annotations" />
-        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
-        <outputRelativeToContentRoot value="true" />
-        <module name="iHotel_student_houtai" />
-      </profile>
-    </annotationProcessing>
-  </component>
-  <component name="JavacSettings">
-    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
-      <module name="iHotel_student_houtai" options="-parameters" />
-    </option>
-  </component>
-</project>

+ 0 - 7
.idea/encodings.xml

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="Encoding">
-    <file url="file://D:/soft/maven-repository/org/springframework/boot/spring-boot-starter-parent/2.4.0/src/main/resources" charset="UTF-8" />
-    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
-  </component>
-</project>

+ 0 - 20
.idea/jarRepositories.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="RemoteRepositoriesConfiguration">
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Central Repository" />
-      <option name="url" value="http://maven.aliyun.com/nexus/content/repositories/central/" />
-    </remote-repository>
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Maven Central repository" />
-      <option name="url" value="https://repo1.maven.org/maven2" />
-    </remote-repository>
-    <remote-repository>
-      <option name="id" value="jboss.community" />
-      <option name="name" value="JBoss Community repository" />
-      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
-    </remote-repository>
-  </component>
-</project>

+ 0 - 12
.idea/misc.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ExternalStorageConfigurationManager" enabled="true" />
-  <component name="MavenProjectsManager">
-    <option name="originalFiles">
-      <list>
-        <option value="$PROJECT_DIR$/pom.xml" />
-      </list>
-    </option>
-  </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
-</project>

+ 0 - 124
.idea/uiDesigner.xml

@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="Palette2">
-    <group name="Swing">
-      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
-      </item>
-      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
-        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
-        <initial-values>
-          <property name="text" value="Button" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="RadioButton" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="CheckBox" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
-        <initial-values>
-          <property name="text" value="Label" />
-        </initial-values>
-      </item>
-      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
-          <preferred-size width="150" height="-1" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
-          <preferred-size width="150" height="50" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
-          <preferred-size width="200" height="200" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
-      </item>
-      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
-      </item>
-      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
-          <preferred-size width="-1" height="20" />
-        </default-constraints>
-      </item>
-      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
-        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
-      </item>
-      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
-        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
-      </item>
-    </group>
-  </component>
-</project>

+ 0 - 6
.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="" vcs="Git" />
-  </component>
-</project>

+ 1 - 1
src/main/java/com/template/api/HouseNumberStateAPI.java

@@ -93,5 +93,5 @@ public interface HouseNumberStateAPI {
 
 
     @GetMapping("/reserveHour")
     @GetMapping("/reserveHour")
     @ApiOperation(value = "房态管理-管理端钟点房当天占用状态", notes = "房态管理-管理端钟点房当天占用状态", httpMethod = "GET")
     @ApiOperation(value = "房态管理-管理端钟点房当天占用状态", notes = "房态管理-管理端钟点房当天占用状态", httpMethod = "GET")
-    CommonResult reserveHour(String houseNumberId, String startTime, String endTime, int adminId);
+    CommonResult reserveHour(String houseNumberId, String startTime, int liveTime, int adminId);
 }
 }

+ 95 - 6
src/main/java/com/template/controller/HouseNumberStateController.java

@@ -427,7 +427,7 @@ public class HouseNumberStateController implements HouseNumberStateAPI {
         LambdaQueryWrapper<HouseLock> wrapperHL = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<HouseLock> wrapperHL = new LambdaQueryWrapper<>();
         wrapperHL.eq(HouseLock::getHouseNumberId, houseNumberId);
         wrapperHL.eq(HouseLock::getHouseNumberId, houseNumberId);
         HouseLock houseLock = houseLockService.getOne(wrapperHL);
         HouseLock houseLock = houseLockService.getOne(wrapperHL);
-        String battery="";
+        String battery = "";
         if (ObjectUtils.isNotEmpty(houseLock)) {
         if (ObjectUtils.isNotEmpty(houseLock)) {
             String equipmentType = houseLock.getEquipmentType();
             String equipmentType = houseLock.getEquipmentType();
 
 
@@ -480,8 +480,8 @@ public class HouseNumberStateController implements HouseNumberStateAPI {
         String liveTime = apartmentSetting.getLiveTime();
         String liveTime = apartmentSetting.getLiveTime();
         String leaveTime = apartmentSetting.getLeaveTime();
         String leaveTime = apartmentSetting.getLeaveTime();
 
 
-        startTime=startTime+" "+liveTime;
-        endTime=endTime+" "+leaveTime;
+        startTime = startTime + " " + liveTime;
+        endTime = endTime + " " + leaveTime;
 
 
         DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LocalDateTime start = LocalDateTime.parse(startTime, dateTimeFormatter1);
         LocalDateTime start = LocalDateTime.parse(startTime, dateTimeFormatter1);
@@ -1560,7 +1560,7 @@ public class HouseNumberStateController implements HouseNumberStateAPI {
         ArrayList<HouseNumberState> list = new ArrayList<>();
         ArrayList<HouseNumberState> list = new ArrayList<>();
         for (String houseNumberId : houseNumberIds) {
         for (String houseNumberId : houseNumberIds) {
             //        查找房间对应的锁房状态
             //        查找房间对应的锁房状态
-         HouseNumberState houseNumberState = houseNumberStateService.getLockHouseNumberState(houseNumberId,now);
+            HouseNumberState houseNumberState = houseNumberStateService.getLockHouseNumberState(houseNumberId, now);
             if (ObjectUtils.isNotEmpty(houseNumberState)) {
             if (ObjectUtils.isNotEmpty(houseNumberState)) {
                 houseNumberState.setEndTime(format);
                 houseNumberState.setEndTime(format);
                 list.add(houseNumberState);
                 list.add(houseNumberState);
@@ -1574,10 +1574,99 @@ public class HouseNumberStateController implements HouseNumberStateAPI {
     }
     }
 
 
     @Override
     @Override
-    public CommonResult reserveHour(String houseNumberId, String startTime, String endTime, int adminId) {
+    public CommonResult reserveHour(String houseNumberId, String startTime, int liveTime, int adminId) {
+        if (ObjectUtils.isEmpty(houseNumberId) && ObjectUtils.isEmpty(startTime) && ObjectUtils.isEmpty(liveTime)) {
+            return CommonResult.fail();
+        }
+        PermissionSetting permissionSetting = permissionSettingService.getById(adminId);
+        if (ObjectUtils.isEmpty(permissionSetting)) {
+            return CommonResult.fail("非法进入");
+        }
+//      判断该用户是否拥有权限
+        String houseTypeManagement = permissionSetting.getHouseStatusManagement();
+        if (!"0".equals(houseTypeManagement) && !houseTypeManagement.contains("1")) {
+            return CommonResult.fail("此账号暂无该权限");
+        }
+        //        获取钟点房可用时间段
+        List<ApartmentSetting> list = apartmentSettingService.list(new LambdaQueryWrapper<>());
+        ApartmentSetting apartmentSetting = list.get(0);
+        String hourTime = apartmentSetting.getHourTime();
 
 
+        DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        LocalDateTime start = LocalDateTime.parse(startTime, dateTimeFormatter1);
+        LocalDateTime end = start.plusHours(liveTime);
+        String endTime = end.format(dateTimeFormatter1);
+        String[] split = hourTime.split(",");
+        ArrayList<ReserveDayVo> reserveDayVos = new ArrayList<>();
+        for (int i = 0; i < 13; i++) {
+            ReserveDayVo reserveDayVo = new ReserveDayVo();
+            LocalDateTime localDateTime = start.plusHours(i);
+            LocalDateTime localDateTime2 = end.plusHours(i);
+            String format = localDateTime.format(dateTimeFormatter1);
+            String format2 = localDateTime2.format(dateTimeFormatter1);
+            reserveDayVo.setDate(format + "至" + format2);
+//            先判断时间是否在可用时间范围内
+            LocalDateTime start1 = localDateTime.withHour(23).withMinute(59).withSecond(59);
+            String format3 = start1.format(dateTimeFormatter1);
+
+            String[] s1 = format.split(" ");
+            String startStr = s1[0];
+
+            String[] s2 = format2.split(" ");
+            String endStr = s2[0];
+
+            Integer status = 1;
+            for (int j = 0; j < split.length; j++) {
+                String s = split[j];
+                String[] split1 = s.split("-");
+                String start2 = split1[0];
+                String end2 = split1[1];
+                String start3 = startStr + " " + start2;
+                String end3 = startStr + " " + end2;
+                LocalDateTime localStart = LocalDateTime.parse(start3, dateTimeFormatter1);
+                LocalDateTime localEnd = LocalDateTime.parse(end3, dateTimeFormatter1);
+
+//            该天最后时间小于结束时间则需要分为2个时间段
+                if (start1.isBefore(localDateTime2)) {
+                    String start4 = endStr + " " + start2;
+                    String end4 = endStr + " " + end2;
+                    LocalDateTime localStart4 = LocalDateTime.parse(start4, dateTimeFormatter1);
+                    LocalDateTime localEnd4 = LocalDateTime.parse(end4, dateTimeFormatter1);
+
+                    if ((localStart.isBefore(localDateTime) || format.equals(start3)) && (start1.isBefore(localEnd) || format3.equals(end3)) && (localStart4.isBefore(start1) || start4.equals(format3)) && (start1.isBefore(localEnd4) || end4.equals(format3))) {
+//                        可用
+                        status = 2;
+                        break;
+                    }
 
 
-        return null;
+                } else {
+                    if ((localStart.isBefore(localDateTime) || format.equals(start3)) && (localDateTime2.isBefore(localEnd) || format2.equals(end3))) {
+//                        可用
+                        status = 2;
+                        break;
+                    }
+
+                }
+
+            }
+
+            if (status == 2) {
+                //        获取该时间段内的房态的使用情况
+                List<HouseNumberState> houseNumberStateList = houseNumberStateService.beBooked(houseNumberId, format, format2);
+                if (ObjectUtils.isNotEmpty(houseNumberStateList) && houseNumberStateList.size() > 0) {
+                    reserveDayVo.setStatus("不可用");
+                } else {
+                    reserveDayVo.setStatus("可用");
+                }
+            } else {
+                reserveDayVo.setStatus("不可用");
+            }
+
+            reserveDayVos.add(reserveDayVo);
+        }
+
+
+        return CommonResult.ok(reserveDayVos);
     }
     }
 
 
 
 

+ 1 - 10
src/main/java/com/template/controller/HouseOrderController.java

@@ -7,8 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.template.annotation.PassToken;
 import com.template.annotation.PassToken;
 import com.template.api.HouseOrderAPI;
 import com.template.api.HouseOrderAPI;
 import com.template.common.utils.*;
 import com.template.common.utils.*;
@@ -23,7 +21,6 @@ import com.template.model.result.PageUtils;
 import com.template.model.vo.*;
 import com.template.model.vo.*;
 import com.template.model.weixin.DateTimeZoneUtil;
 import com.template.model.weixin.DateTimeZoneUtil;
 import com.template.model.weixin.PayUtil;
 import com.template.model.weixin.PayUtil;
-import com.template.model.weixin.SecurityUtil;
 import com.template.model.weixin.WechatPayV3Util;
 import com.template.model.weixin.WechatPayV3Util;
 import com.template.services.*;
 import com.template.services.*;
 import com.wechat.pay.java.core.Config;
 import com.wechat.pay.java.core.Config;
@@ -45,21 +42,15 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.client.RestTemplate;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedWriter;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.nio.charset.StandardCharsets;
 import java.security.Signature;
 import java.security.Signature;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
 import java.time.LocalDateTime;
@@ -1544,7 +1535,7 @@ public class HouseOrderController implements HouseOrderAPI {
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 
 
         try {
         try {
-            System.out.println(TimeExchange.getTime() + "微信支付判断全部通过");
+            log.info(TimeExchange.getTime() + "微信支付判断全部通过");
             //返回0表示等于0,返回1表示大于0,返回-1表示小于0
             //返回0表示等于0,返回1表示大于0,返回-1表示小于0
             if (wpd.getTotalPrice().compareTo(BigDecimal.ZERO) < 0 || wpd.getTotalPrice().compareTo(BigDecimal.ZERO) == 0) {
             if (wpd.getTotalPrice().compareTo(BigDecimal.ZERO) < 0 || wpd.getTotalPrice().compareTo(BigDecimal.ZERO) == 0) {
                 if (oldPr == null) {
                 if (oldPr == null) {