Forráskód Böngészése

修改空调加时订单 计算费用

xiachuang 1 éve
szülő
commit
2572c47578

+ 10 - 22
src/main/java/com/palmnest/application/core/util/DateUtils.java

@@ -1,36 +1,24 @@
 package com.palmnest.application.core.util;
 
 
+import cn.superdesk.libs.common.json.JsonUtils;
+import com.palmnest.application.dto.DateTypeDto;
+import net.sf.json.JSONObject;
+
 import java.io.IOException;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
 import java.math.BigDecimal;
 import java.math.MathContext;
 import java.math.RoundingMode;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.json.JSONObject;
-
-import org.apache.poi.hssf.usermodel.HSSFRow;
-
-import cn.superdesk.libs.common.json.JsonUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.palmnest.application.dto.DateTypeDto;
-import com.palmnest.model.DateTypeInfo;
+import java.util.*;
 
 /**
  * 日期转换帮助
@@ -1078,11 +1066,11 @@ public class DateUtils {
 //		
 //	}
 
-	public static Map getIncludeTime(Date useStartTime, Date useEndTime, Date ruleStartTime,
+	public static Map<String, Date> getIncludeTime(Date useStartTime, Date useEndTime, Date ruleStartTime,
 									 Date ruleEndTime) {
 		boolean isOverTime = true;
 		boolean isOver = false;//是否过线
-		Map recodeMap = new HashMap();
+		Map<String, Date> recodeMap = new HashMap<>();
 		int addMinuteNo = 0;
 
 

+ 24 - 0
src/main/java/com/palmnest/application/dto/ConditionerAddTimeOrderFeeVO.java

@@ -0,0 +1,24 @@
+package com.palmnest.application.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+/**
+ * @author xc
+ * @since 2023/8/9 10:06
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ConditionerAddTimeOrderFeeVO {
+    private String priceDisplay;// 单价
+    private BigDecimal useLengthTime;// 使用时长
+    private String feeDetail;// 费用明细
+    private BigDecimal feeTotal;// 费用总计
+    private BigDecimal monthlyFee;// 月结费用
+}

+ 32 - 0
src/main/java/com/palmnest/application/dto/input/ConditionerAddTimeOrderUpdateParam.java

@@ -0,0 +1,32 @@
+package com.palmnest.application.dto.input;
+
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springmodules.validation.bean.conf.loader.annotation.handler.NotBlank;
+import org.springmodules.validation.bean.conf.loader.annotation.handler.NotEmpty;
+import org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author xc
+ * @since 2023/8/9 10:04
+ */
+@Data
+public class ConditionerAddTimeOrderUpdateParam {
+    @NotEmpty
+    private List<Integer> roomIds;
+    @NotBlank
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private Date useStartTime;
+    @NotBlank
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private Date useEndTime;
+    @NotBlank
+    private String orderNo;
+    @NotNull
+    private Long orderId;
+    private String remark;
+    private Integer modificationDisabled = 0;
+}

+ 4 - 4
src/main/java/com/palmnest/service/estateserve/airconditioner/ConditionerAddTimeService.java

@@ -3,10 +3,8 @@ package com.palmnest.service.estateserve.airconditioner;
 
 import com.palmnest.application.bean.AppResultDto;
 import com.palmnest.application.bean.Page;
-import com.palmnest.application.dto.input.AirAddTimeBusinessInputDto;
-import com.palmnest.application.dto.input.AirConditionerAddTimeInputDto;
-import com.palmnest.application.dto.input.AirConditionerAddTimeMeetingInputDto;
-import com.palmnest.application.dto.input.AirSelectCompanyInputDto;
+import com.palmnest.application.dto.ConditionerAddTimeOrderFeeVO;
+import com.palmnest.application.dto.input.*;
 import com.palmnest.application.dto.output.AirConditionerAddTimeOutDto;
 import com.palmnest.model.RoomInfo;
 import com.palmnest.model.airconditioner.AirConditionerAddTime;
@@ -113,4 +111,6 @@ public interface ConditionerAddTimeService {
 
 
 	List<RoomInfo> getAddTimeOrderHistoryRooms(String orderNo);
+
+	ConditionerAddTimeOrderFeeVO calcAddTimeOrderFee(ConditionerAddTimeOrderUpdateParam order);
 }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2010 - 1762
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeServiceImpl.java


+ 19 - 3
src/main/java/com/palmnest/webapp/controller/backstage/AirConditionerAddTimeController.java

@@ -1,14 +1,17 @@
 package com.palmnest.webapp.controller.backstage;
 
+import com.alibaba.fastjson.JSON;
 import com.palmnest.application.AppConstants;
 import com.palmnest.application.CodeConstants;
 import com.palmnest.application.bean.AppResultDto;
 import com.palmnest.application.bean.Page;
 import com.palmnest.application.core.util.AppResultUtil;
 import com.palmnest.application.core.util.LogExceptionStackUtil;
+import com.palmnest.application.dto.ConditionerAddTimeOrderFeeVO;
 import com.palmnest.application.dto.OrgDto;
 import com.palmnest.application.dto.WebPageResultDto;
 import com.palmnest.application.dto.input.AirConditionerAddTimeInputDto;
+import com.palmnest.application.dto.input.ConditionerAddTimeOrderUpdateParam;
 import com.palmnest.model.AppUserFloorRelation;
 import com.palmnest.model.RoomInfo;
 import com.palmnest.model.User;
@@ -19,21 +22,19 @@ import com.palmnest.service.estateserve.FloorInfoManager;
 import com.palmnest.service.estateserve.VirtualArchManager;
 import com.palmnest.service.estateserve.airconditioner.ConditionerAddTimeService;
 import com.palmnest.service.estateserve.airconditioner.ProjectConfigService;
-
 import lombok.extern.slf4j.Slf4j;
 import net.sf.json.JSONObject;
-
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ExtendedModelMap;
 import org.springframework.ui.Model;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -628,4 +629,19 @@ public class AirConditionerAddTimeController {
 		List<RoomInfo> list = conditionerAddTimeService.getAddTimeOrderHistoryRooms(orderNo);
 		return AppResultUtil.createSuccesDto(list);
 	}
+
+	/**
+	 * 修改空调加时订单时 计算费用
+	 * @param order 修改的订单信息
+	 * @param request
+	 * @return
+	 */
+	@RequestMapping(value = "/calcAddTimeOrderFee", method = RequestMethod.POST)
+	@ResponseBody
+	public AppResultDto calcAddTimeOrderFee(@RequestBody @Validated ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
+		User  user  = (User) request.getSession().getAttribute("UserCache");
+		log.info("更新空调加时订单前计算费用, user: {}, order:{}", user.getFullName(), JSON.toJSONString(order));
+		ConditionerAddTimeOrderFeeVO vo = conditionerAddTimeService.calcAddTimeOrderFee(order);
+		return AppResultUtil.createSuccesDto(vo);
+	}
 }