소스 검색

获取空调加时订单下单时 所有可用的房间信息

xiachuang 1 년 전
부모
커밋
30bd304162

+ 12 - 0
src/main/java/com/palmnest/dao/airconditioner/ConditionerAddTimeOrderExtendDao.java

@@ -0,0 +1,12 @@
+package com.palmnest.dao.airconditioner;
+
+import com.palmnest.dao.GenericDao;
+import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
+
+/**
+ * @author xc
+ * @since 2023/8/9 09:42
+ */
+public interface ConditionerAddTimeOrderExtendDao extends GenericDao<AirConditionerAddTimeOrderExtend, Long> {
+    AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo);
+}

+ 27 - 0
src/main/java/com/palmnest/dao/airconditioner/impl/ConditionerAddTimeOrderExtendDaoImpl.java

@@ -0,0 +1,27 @@
+package com.palmnest.dao.airconditioner.impl;
+
+import com.palmnest.dao.airconditioner.ConditionerAddTimeOrderExtendDao;
+import com.palmnest.dao.hibernate.GenericDaoHibernate;
+import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author xc
+ * @since 2023/8/9 09:42
+ */
+@Repository("conditionerAddTimeOrderExtendDao")
+public class ConditionerAddTimeOrderExtendDaoImpl extends GenericDaoHibernate<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendDao {
+    private final Logger logger = Logger.getLogger(ConditionerAddTimeOrderExtendDaoImpl.class);
+    public ConditionerAddTimeOrderExtendDaoImpl() {
+        super(AirConditionerAddTimeOrderExtend.class);
+    }
+
+    @Override
+    public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
+        String sql = "select * from tb_airconditioner_addtime_order_extend" + "\n" +
+                " where code = '" + orderNo + "'";
+        logger.info("根据空调加时订单获取扩展信息 sql: " + sql);
+        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderExtend.class).uniqueResult();
+    }
+}

+ 1 - 0
src/main/java/com/palmnest/service/estateserve/airconditioner/ConditionerAddTimeOrderExtendManager.java

@@ -8,4 +8,5 @@ import com.palmnest.service.GenericManager;
  * @since 2023/8/8 16:21
  */
 public interface ConditionerAddTimeOrderExtendManager extends GenericManager<AirConditionerAddTimeOrderExtend, Long> {
+    AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo);
 }

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

@@ -8,11 +8,13 @@ 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.output.AirConditionerAddTimeOutDto;
+import com.palmnest.model.RoomInfo;
 import com.palmnest.model.airconditioner.AirConditionerAddTime;
 import com.palmnest.model.airconditioner.AirRule;
 
 import javax.servlet.http.HttpServletRequest;
 
+import java.util.List;
 import java.util.Map;
 
 public interface ConditionerAddTimeService {
@@ -110,4 +112,5 @@ public interface ConditionerAddTimeService {
 	public AppResultDto getBusinessData(AirAddTimeBusinessInputDto dto);
 
 
+	List<RoomInfo> getAddTimeOrderHistoryRooms(String orderNo);
 }

+ 28 - 0
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeOrderExtendManagerImpl.java

@@ -0,0 +1,28 @@
+package com.palmnest.service.estateserve.airconditioner.impl;
+
+import com.palmnest.dao.airconditioner.ConditionerAddTimeOrderExtendDao;
+import com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend;
+import com.palmnest.service.estateserve.airconditioner.ConditionerAddTimeOrderExtendManager;
+import com.palmnest.service.impl.GenericManagerImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author xc
+ * @since 2023/8/9 09:39
+ */
+@Service("ConditionerAddTimeOrderExtendManager")
+public class ConditionerAddTimeOrderExtendManagerImpl extends GenericManagerImpl<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendManager {
+    private ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao;
+
+    @Autowired
+    public void setConditionerAddTimeOrderExtendDao(ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao) {
+        this.conditionerAddTimeOrderExtendDao = conditionerAddTimeOrderExtendDao;
+        this.dao = conditionerAddTimeOrderExtendDao;
+    }
+
+    @Override
+    public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
+        return conditionerAddTimeOrderExtendDao.getByOrderNo(orderNo);
+    }
+}

+ 16 - 1
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeServiceImpl.java

@@ -2370,6 +2370,21 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
 		returnList.add(visitorMap);
 
 		return AppResultUtil.createSuccesDto(returnList);
-	}    
+	}
+
+	/**
+	 * 获取空调加时订单下单时 所有可用的房间信息
+	 * @param orderNo 空调加时订单编号
+	 * @return 房间信息列表
+	 */
+	@Override
+	public List<RoomInfo> getAddTimeOrderHistoryRooms(String orderNo) {
+		AirConditionerAddTimeOrderExtend extend = conditionerAddTimeOrderExtendManager.getByOrderNo(orderNo);
+		if (extend == null) {
+			return null;
+		}
+		String roomIds = extend.getRoomInfos();
+        return JSON.parseArray(roomIds, RoomInfo.class);
+	}
 
 }

+ 15 - 4
src/main/java/com/palmnest/webapp/controller/backstage/AirConditionerAddTimeController.java

@@ -10,6 +10,7 @@ import com.palmnest.application.dto.OrgDto;
 import com.palmnest.application.dto.WebPageResultDto;
 import com.palmnest.application.dto.input.AirConditionerAddTimeInputDto;
 import com.palmnest.model.AppUserFloorRelation;
+import com.palmnest.model.RoomInfo;
 import com.palmnest.model.User;
 import com.palmnest.model.property.VirtualArchitecture;
 import com.palmnest.service.AppUserService;
@@ -27,10 +28,7 @@ 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.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
@@ -617,4 +615,17 @@ public class AirConditionerAddTimeController {
 		return new ModelAndView("/admin/airConditionalManage/overtimeReport", model.asMap());
 	}
 
+	/**
+	 * 获取空调加时订单下单时 所有可用的房间信息
+	 * @param orderNo 空调加时订单编号
+	 * @return 房间信息列表
+	 */
+	@RequestMapping(value = "/addTimeOrderHistoryRooms", method = RequestMethod.GET)
+	@ResponseBody
+	public AppResultDto getAddTimeOrderHistoryRooms(@RequestParam("orderNo") String orderNo, HttpServletRequest request) {
+		User  user  = (User) request.getSession().getAttribute("UserCache");
+		log.info("获取空调加时订单下单时 所有可用的房间信息, user: {}, orderNo:{}", user.getFullName(), orderNo);
+		List<RoomInfo> list = conditionerAddTimeService.getAddTimeOrderHistoryRooms(orderNo);
+		return AppResultUtil.createSuccesDto(list);
+	}
 }