xiachuang 1 tahun lalu
induk
melakukan
ba7b99d739

+ 2 - 2
src/main/java/com/palmnest/dao/airconditioner/impl/AirConditionerAddTimeOrderHistoryDaoImpl.java

@@ -22,8 +22,8 @@ public class AirConditionerAddTimeOrderHistoryDaoImpl extends GenericDaoHibernat
 
     @Override
     public List<AirConditionerAddTimeOrderHistory> getByOrderNo(String orderNo) {
-        String sql = "select * from tb_airconditioner_addtime_order_history where order_no = ?";
+        String sql = "select * from tb_airconditioner_addtime_order_history where order_no = ? order by id desc";
         logger.info("根据空调加时订单获取历史记录 sql: " + sql);
-        return (List<AirConditionerAddTimeOrderHistory>)getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderHistory.class).setString(0, orderNo).list();
+        return getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderHistory.class).setString(0, orderNo).list();
     }
 }

+ 25 - 24
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeServiceImpl.java

@@ -2692,7 +2692,6 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             String useEndTimeStr = DateUtils.getDate(airConditionerAddTime.getUseEndTime(), "HH:mm");
 
 
-
             return ConditionerAddTimeOrderFeeVO.builder()
                     .priceDisplay(priceDisplay)// 单价
                     .useLengthTime(useLengthTime)// 使用时长
@@ -2734,28 +2733,28 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
          */
         StringBuilder roomNos = new StringBuilder();
         for (Integer roomId : order.getRoomIds()) {
-            roomNos.append(roomId).append(",");
+            roomNos.append(roomId).append(";");
         }
         List<RoomInfo> roomInfos = conditionerAddTimeOrderFeeVO.getRoomInfos();
-        Map<Integer,RoomInfo> map = new HashMap<>();
+        Map<Integer, RoomInfo> map = new HashMap<>();
         for (RoomInfo roomInfo : roomInfos) {
             map.put(roomInfo.getId(), roomInfo);
         }
         StringBuilder roomNames = new StringBuilder();
         HashSet<Integer> floorSet = new HashSet<>();
         for (Integer roomId : order.getRoomIds()) {
-            roomNames.append(map.get(roomId).getName()).append(",");
+            roomNames.append(map.get(roomId).getName()).append(";");
             floorSet.add(map.get(roomId).getFloorId().intValue());
         }
 
         StringBuilder floorIds = new StringBuilder();
         for (Integer floorId : floorSet) {
-            floorIds.append(floorId).append(",");
+            floorIds.append(floorId).append(";");
         }
 
 
-        airConditionerAddTime.setRoomNos(roomNos.toString());//申请房间id
-        airConditionerAddTime.setRoomNames(roomNames.toString());// 申请房间名称
+        airConditionerAddTime.setRoomNos(roomNos.substring(0, roomNos.length() - 1));// 申请房间id
+        airConditionerAddTime.setRoomNames(roomNames.substring(0, roomNames.length() - 1));// 申请房间名称
         airConditionerAddTime.setApplyArea(conditionerAddTimeOrderFeeVO.getApplyArea());// 申请面积
         airConditionerAddTime.setUseLengthTime(conditionerAddTimeOrderFeeVO.getUseLengthTime()); // 使用时长
         airConditionerAddTime.setUseStartTime(order.getUseStartTime());// 使用开始时间
@@ -2766,20 +2765,20 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
         airConditionerAddTime.setMonthlyFree(conditionerAddTimeOrderFeeVO.getMonthlyFee());// 月结费用
         airConditionerAddTime.setModifier(user.getFullName());// 修改人
         airConditionerAddTime.setModifyTime(new Date());// 修改时间
-        airConditionerAddTime.setFloorId(floorIds.toString());// 楼层id
+        airConditionerAddTime.setFloorId(floorIds.substring(0, floorIds.length() - 1));// 楼层id
         airConditionerAddTime.setModificationDisabled(order.getModificationDisabled());// 是否关闭修改功能
 
         // 保存修改记录
         conditionerAddTimeOrderExtendManager.saveHistory(
                 AirConditionerAddTimeOrderHistory.builder()
-                .orderNo(airConditionerAddTime.getCode())// 订单号
-                .beforeUpdate(history)// 更新前
-                .afterUpdate(JSON.toJSONString(airConditionerAddTime)) // 更新后
-                .createTime(new Date())
-                .createUser(user.getFullName())
-                .remark(order.getRemark())// 备注
-                .modificationDisabled(order.getModificationDisabled()) // 是否关闭修改功能
-                .build()
+                        .orderNo(airConditionerAddTime.getCode())// 订单号
+                        .beforeUpdate(history)// 更新前
+                        .afterUpdate(JSON.toJSONString(airConditionerAddTime)) // 更新后
+                        .createTime(new Date())
+                        .createUser(user.getFullName())
+                        .remark(order.getRemark())// 备注
+                        .modificationDisabled(order.getModificationDisabled()) // 是否关闭修改功能
+                        .build()
         );
 
         // 更新原订单
@@ -2800,14 +2799,16 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
 
         if (list != null && !list.isEmpty()) {
             for (AirConditionerAddTimeOrderHistory airConditionerAddTimeOrderHistory : list) {
-                AirConditionerAddTimeHistoryVO.builder()
-                        .createUser(airConditionerAddTimeOrderHistory.getCreateUser())
-                        .createTime(DateUtils.getDate(airConditionerAddTimeOrderHistory.getCreateTime(), "yyyy-MM-dd HH:mm:ss"))
-                        .remark(airConditionerAddTimeOrderHistory.getRemark())
-                        .modificationDisabled(airConditionerAddTimeOrderHistory.getModificationDisabled())
-                        .beforeUpdate(JSON.parseObject(airConditionerAddTimeOrderHistory.getBeforeUpdate(), AirConditionerAddTimeHistoryRecord.class))
-                        .afterUpdate(JSON.parseObject(airConditionerAddTimeOrderHistory.getAfterUpdate(), AirConditionerAddTimeHistoryRecord.class))
-                        .build();
+                history.add(
+                        AirConditionerAddTimeHistoryVO.builder()
+                                .createUser(airConditionerAddTimeOrderHistory.getCreateUser())
+                                .createTime(DateUtils.getDate(airConditionerAddTimeOrderHistory.getCreateTime(), "yyyy-MM-dd HH:mm:ss"))
+                                .remark(airConditionerAddTimeOrderHistory.getRemark())
+                                .modificationDisabled(airConditionerAddTimeOrderHistory.getModificationDisabled())
+                                .beforeUpdate(JSON.parseObject(airConditionerAddTimeOrderHistory.getBeforeUpdate(), AirConditionerAddTimeHistoryRecord.class))
+                                .afterUpdate(JSON.parseObject(airConditionerAddTimeOrderHistory.getAfterUpdate(), AirConditionerAddTimeHistoryRecord.class))
+                                .build()
+                );
             }
         }