Pārlūkot izejas kodu

Merge branch 'feature/空调加时' of https://gogs.superdesk.cn/super_service/superdesk_superservice into feature/空调加时

wuchangfu 1 gadu atpakaļ
vecāks
revīzija
e12179618a

+ 0 - 13
src/main/java/com/palmnest/application/dto/input/AirConditionerAddTimeInputDto.java

@@ -4,7 +4,6 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 
 public class AirConditionerAddTimeInputDto implements Serializable{
 
@@ -54,11 +53,6 @@ public class AirConditionerAddTimeInputDto implements Serializable{
 	//currentBillStatus
 	private String cancelReason;//取消原因
 
-	/**
-	 * 空调加时下单时,传递所有房号
-	 */
-	private List<Integer> allRoomIds;
-
 	public String getRoomNos() {
 		return roomNos;
 	}
@@ -203,11 +197,4 @@ public class AirConditionerAddTimeInputDto implements Serializable{
 		this.wxUserId = wxUserId;
 	}
 
-	public List<Integer> getAllRoomIds() {
-		return allRoomIds;
-	}
-
-	public void setAllRoomIds(List<Integer> allRoomIds) {
-		this.allRoomIds = allRoomIds;
-	}
 }

+ 3 - 9
src/main/java/com/palmnest/application/dto/input/ConditionerAddTimeOrderUpdateParam.java

@@ -2,10 +2,8 @@ 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.io.Serializable;
 import java.util.Date;
 import java.util.List;
 
@@ -14,18 +12,14 @@ import java.util.List;
  * @since 2023/8/9 10:04
  */
 @Data
-public class ConditionerAddTimeOrderUpdateParam {
-    @NotEmpty
+public class ConditionerAddTimeOrderUpdateParam implements Serializable {
+    private static final long serialVersionUID = 1309632156649001152L;
     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;

+ 2 - 0
src/main/java/com/palmnest/application/dto/output/AirConditionerAddTimeHistoryRecord.java

@@ -19,7 +19,9 @@ public class AirConditionerAddTimeHistoryRecord {
     private String roomNames;// 申请位置
     private String applyArea;// 申请面积
     private String useDisplayTime;// 使用时间
+    private BigDecimal useLengthTime;// 使用时长
     private String priceDisplay;// 单价
+    private String freeDetail;// 费用明细
     private BigDecimal freeTotal;// 费用总计
     private BigDecimal monthlyFree;// 月结费用
 }

+ 19 - 0
src/main/java/com/palmnest/application/dto/output/AirConditionerAddTimeOutDto.java

@@ -49,6 +49,9 @@ public class AirConditionerAddTimeOutDto {
 	private Integer isLastAuditStep = 0 ;//是否审批的最后一步
 	
 	private List<GoodsOperateDto> operateDto; //审批记录
+
+	private Date useStartTime;		//使用开始时间
+	private Date useEndTime;		//使用结束时间
 	
 	public String getVirtualName() {
 		return virtualName;
@@ -261,4 +264,20 @@ public class AirConditionerAddTimeOutDto {
 	public void setLoginName(String loginName) {
 		this.loginName = loginName;
 	}
+
+	public Date getUseStartTime() {
+		return useStartTime;
+	}
+
+	public void setUseStartTime(Date useStartTime) {
+		this.useStartTime = useStartTime;
+	}
+
+	public Date getUseEndTime() {
+		return useEndTime;
+	}
+
+	public void setUseEndTime(Date useEndTime) {
+		this.useEndTime = useEndTime;
+	}
 }

+ 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 getSession().createSQLQuery(sql).setString(0, orderNo).list();
+        return getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderHistory.class).setString(0, orderNo).list();
     }
 }

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

@@ -21,6 +21,6 @@ public class ConditionerAddTimeOrderExtendDaoImpl extends GenericDaoHibernate<Ai
     public AirConditionerAddTimeOrderExtend getByOrderNo(String orderNo) {
         String sql = "select * from tb_airconditioner_addtime_order_extend where code = ?";
         logger.info("根据空调加时订单获取扩展信息 sql: " + sql);
-        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).setString(0, orderNo).uniqueResult();
+        return (AirConditionerAddTimeOrderExtend) getSession().createSQLQuery(sql).addEntity(AirConditionerAddTimeOrderExtend.class).setString(0, orderNo).uniqueResult();
     }
 }

+ 2 - 1
src/main/java/com/palmnest/model/airconditioner/AirConditionerAddTimeOrderExtend.java

@@ -5,6 +5,7 @@ import lombok.Builder;
 import lombok.NoArgsConstructor;
 
 import javax.persistence.*;
+import java.io.Serializable;
 
 /**
  * @author xc
@@ -15,7 +16,7 @@ import javax.persistence.*;
 @Builder
 @NoArgsConstructor
 @AllArgsConstructor
-public class AirConditionerAddTimeOrderExtend {
+public class AirConditionerAddTimeOrderExtend implements Serializable {
     private Long id;
     private String code;//订单号
     private String roomInfos;//所有可用房间信息缓存

+ 2 - 1
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeOrderExtendManagerImpl.java

@@ -15,7 +15,7 @@ import java.util.List;
  * @author xc
  * @since 2023/8/9 09:39
  */
-@Service
+@Service("conditionerAddTimeOrderExtendManager")
 public class ConditionerAddTimeOrderExtendManagerImpl extends GenericManagerImpl<AirConditionerAddTimeOrderExtend, Long> implements ConditionerAddTimeOrderExtendManager {
     private ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao;
     private AirConditionerAddTimeOrderHistoryDao airConditionerAddTimeOrderHistoryDao;
@@ -24,6 +24,7 @@ public class ConditionerAddTimeOrderExtendManagerImpl extends GenericManagerImpl
     @Autowired
     public void setConditionerAddTimeOrderExtendDao(ConditionerAddTimeOrderExtendDao conditionerAddTimeOrderExtendDao) {
         this.conditionerAddTimeOrderExtendDao = conditionerAddTimeOrderExtendDao;
+        this.dao = conditionerAddTimeOrderExtendDao;
     }
 
     @Autowired

+ 44 - 34
src/main/java/com/palmnest/service/estateserve/airconditioner/impl/ConditionerAddTimeServiceImpl.java

@@ -105,6 +105,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
              * 空调加时订单属性填充
              */
             AirConditionerAddTime airConditionerAddTime = new AirConditionerAddTime();
+            airConditionerAddTime.setModificationDisabled(0);
             BeanUtils.copyProperties(airConditionerAddTime, dto);
             if (dto.getBillFrom().equals(CodeConstants.WECHAT)) {
                 String openId = request.getParameter("openId");
@@ -231,6 +232,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
              * 项目的空调使用规则信息
              */
             List<AirRule> airRules = airRuleManager.getAirRule(airConditionerAddTime.getOrganizationId(), applicationType, applicationAirAddTime, dataType, "", "");
+            log.info("空调加时申请,查询到到的空调加时规则为:{}", airRules);
             AirRule airRule = null;
             if (null == airRules || airRules.isEmpty()) {
                 return AppResultUtil.createErrorDto(AppConstants.ERROR_CODE, "空调加时申请失败,不能匹配到空调加时规则或该时段有免费的空调加时无需申请");
@@ -575,21 +577,18 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             /**
              * 下单时保存可用的规则 修改订单时需要用
              */
-            Map<String, Object> param = new HashMap<>();
-            param.put("orgId", airConditionerAddTime.getOrganizationId());
-            param.put("isEnabled", 1);
-            Page airRulePage = airRuleManager.findPageBy(param, 1, 100);
-            List items = airRulePage.getItems();
-            if (cn.superdesk.libs.common.util.CollectionUtils.isEmpty(items)) {
+            if (cn.superdesk.libs.common.util.CollectionUtils.isEmpty(airRules)) {
                 return AppResultUtil.createErrorDto(AppConstants.ERROR_CODE, "空调加时申请失败,没有可用规则,请联系系统管理员");
             }
 
-            String allAirRulesStr = JSON.toJSONString(items);
+            String allAirRulesStr = JSON.toJSONString(airRules);
 
             /**
              * 下单时保存所有可用房间信息 修改订单时需要用
              */
-            List<Integer> allRoomIds = dto.getAllRoomIds();
+            VirtualArchitecture vir = virtualArchManager.get(Integer.valueOf(virtualId));
+            String[] split = vir.getRoomIds().split(";");
+            List<String> allRoomIds = Arrays.asList(split);
             if (cn.superdesk.libs.common.util.CollectionUtils.isEmpty(allRoomIds)) {
                 return AppResultUtil.createErrorDto(AppConstants.ERROR_CODE, "空调加时申请失败,没有可用房间,请联系系统管理员");
             }
@@ -598,7 +597,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             for (int i = 0; i < allRoomIds.size(); i++) {
                 sb.append(allRoomIds.get(i));
                 if (i < allRoomIds.size() - 1) {
-                    sb.append(";");
+                    sb.append(",");
                 }
             }
             List<RoomInfo> allRoomInfos = roomInfoManager.getRoomListByRoomNos(sb.toString());
@@ -775,6 +774,8 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             }
         }
 
+        dto.setUseStartTime(addTime.getUseStartTime());
+        dto.setUseEndTime(addTime.getUseEndTime());
 
         return dto;
     }
@@ -2405,6 +2406,7 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             }
 
             List<AirRule> airRules = JSON.parseArray(extend.getAirRules(), AirRule.class);
+            log.info("空调加时订单计算费用,订单编号:{},订单id:{},空调加时规则:{}", order.getOrderNo(), order.getOrderId(), JSON.toJSONString(airRules));
 
             AirRule airRule = null;
             if (null == airRules || airRules.isEmpty()) {
@@ -2445,6 +2447,10 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
              *	使用面积
              */
             String applyArea;
+
+            List<Integer> roomIds = order.getRoomIds();
+
+
             BigDecimal calcapplyArea = BigDecimal.ZERO;// 按层申请的面积
             Map<Integer, BigDecimal> floorSumAreaMap = new HashMap<>();// 每层楼的合计申请面积
             Map<Integer, Boolean> mapIsHaveFloor = new HashMap<>();// 当前楼层是有-一层起订
@@ -2454,10 +2460,13 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             for (RoomInfo roomInfo : roomInfos) {
 
                 Integer floorId = roomInfo.getFloorId().intValue();
-                String roomName = roomInfo.getName();
 
                 BigDecimal area = roomInfo.getArea();
                 Integer areaRuleType = roomInfo.getAreaRuleType();
+                // 选择的房间不包含当前房间则跳过
+                if (!roomIds.contains(roomInfo.getId())) {
+                    continue;
+                }
 
                 if (floorSumAreaMap.containsKey(floorId)) {
                     BigDecimal temp_area = floorSumAreaMap.get(floorId);
@@ -2683,7 +2692,6 @@ public class ConditionerAddTimeServiceImpl implements ConditionerAddTimeService
             String useEndTimeStr = DateUtils.getDate(airConditionerAddTime.getUseEndTime(), "HH:mm");
 
 
-
             return ConditionerAddTimeOrderFeeVO.builder()
                     .priceDisplay(priceDisplay)// 单价
                     .useLengthTime(useLengthTime)// 使用时长
@@ -2725,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());// 使用开始时间
@@ -2757,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()
         );
 
         // 更新原订单
@@ -2791,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()
+                );
             }
         }
 

+ 292 - 296
src/main/java/com/palmnest/webapp/controller/api/ApiAirConditionerAddTimeController.java

@@ -1,5 +1,6 @@
 package com.palmnest.webapp.controller.api;
 
+import com.alibaba.fastjson.JSON;
 import com.palmnest.application.AppConstants;
 import com.palmnest.application.CodeConstants;
 import com.palmnest.application.bean.AppResultDto;
@@ -42,55 +43,56 @@ import java.util.Map;
 public class ApiAirConditionerAddTimeController {
 
 
-	@Autowired
-	private ConditionerAddTimeService conditionerAddTimeService;
-	@Autowired
-	private UserManager               userManager;
-	@Autowired
-	private BaseRedisService          baseRedisService;
-	@Autowired
-	private FloorInfoManager          floorInfoManager;
-	@Autowired
-	private AppUserService            appUserService;
-	@Autowired
-	private VirtualArchManager        virtualArchManager;
-
-	/**
-	 * @param request
-	 * @return 空调加时列表
-	 */
-	@RequestMapping(value = "/auditList")
-	@ResponseBody
-	public AppResultDto auditList(HttpServletRequest request) {
-
-		log.info("ApiAirConditionerAddTimeController list======");
-
-		try {
-
-			String userName = baseRedisService.get(request.getHeader("token"));
-			if (userName == null) {
-				return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
-			}
-			User user = userManager.getUserByUsername2(userName);
-
-			//User userAir21 = userManager.findByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
-			//User userAir22 = userManager.findByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
-			//User userAir23 = userManager.findByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());
-
-			String isQueryMarchInside = request.getParameter("isQueryMarchInside");//是否查询以前及将来三个月内订单
-			if (StringUtils.isEmpty(isQueryMarchInside)) {
-				isQueryMarchInside = "0";
-			}
-			
-			Integer airSwitchUserId = null;//空调开关人员Id
-			String airswitchPermission = request.getParameter("airswitchPermission");//空调加时开发权限
-			if (StringUtils.isEmpty(isQueryMarchInside)) {
-				airswitchPermission = "0";
-			}
-			
-
-
-			//空调加时审批权限
+    @Autowired
+    private ConditionerAddTimeService conditionerAddTimeService;
+    @Autowired
+    private UserManager userManager;
+    @Autowired
+    private BaseRedisService baseRedisService;
+    @Autowired
+    private FloorInfoManager floorInfoManager;
+    @Autowired
+    private AppUserService appUserService;
+    @Autowired
+    private VirtualArchManager virtualArchManager;
+
+    /**
+     * @param request
+     * @return 空调加时列表
+     */
+    @RequestMapping(value = "/auditList")
+    @ResponseBody
+    public AppResultDto auditList(HttpServletRequest request) {
+
+        log.info("ApiAirConditionerAddTimeController list======");
+
+        try {
+
+            String userName = baseRedisService.get(request.getHeader("token"));
+            log.info("ApiAirConditionerAddTimeController list======token={},userName={}", request.getHeader("token"), userName);
+            if (userName == null) {
+                return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
+            }
+            User user = userManager.getUserByUsername2(userName);
+            log.info("ApiAirConditionerAddTimeController list======user={}", JSON.toJSONString(user));
+
+            // User userAir21 = userManager.findByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
+            // User userAir22 = userManager.findByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
+            // User userAir23 = userManager.findByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());
+
+            String isQueryMarchInside = request.getParameter("isQueryMarchInside");// 是否查询以前及将来三个月内订单
+            if (StringUtils.isEmpty(isQueryMarchInside)) {
+                isQueryMarchInside = "0";
+            }
+
+            Integer airSwitchUserId = null;// 空调开关人员Id
+            String airswitchPermission = request.getParameter("airswitchPermission");// 空调加时开发权限
+            if (StringUtils.isEmpty(isQueryMarchInside)) {
+                airswitchPermission = "0";
+            }
+
+
+            // 空调加时审批权限
 			/*String airAuditPermission = "0";//待审批的数据
 			String airAuditRoleId     = "0";
 			if (userAir21 != null) {
@@ -128,252 +130,246 @@ public class ApiAirConditionerAddTimeController {
 			}*/
 
 
-			int                 pageSize = Integer.parseInt(request.getParameter("pageSize"));
-			int                 pageNo   = Integer.parseInt(request.getParameter("pageNo"));
-			Map<String, Object> params   = new HashMap<String, Object>();
-			String              status   = request.getParameter("status");
-			String              floorId  = request.getParameter("floorId");//楼层id 只过滤一层楼
-
-
-			String applyTime = request.getParameter("applyTime");//2018-09-08 //申请时间
-
-			String isAppManageBook = request.getParameter("isAppManageBook");
-			String preBookUserId   = "";//代订人ID
-			if (StringUtils.isNotEmpty(isAppManageBook) && "1".equals(isAppManageBook)) {
-				preBookUserId = user.getId().toString();
-			}
-			if(StringUtils.isNotEmpty(airswitchPermission) && "1".equals(airswitchPermission)){
-				airSwitchUserId = user.getId().intValue();
-			}
-
-
-			//还要根据管员角色 对应楼层 及审批的状态来过滤
-			//TODO
-			params.put("status", status);
-			//params.put("airAuditPermission", airAuditPermission);
-			//params.put("roleToFloorIds", roleToFloorIds);
-			params.put("applyTime", applyTime);
-			params.put("floorId", floorId);
-			params.put("preBookUserId", preBookUserId);
-			params.put("airSwitchUserId", airSwitchUserId);
-			params.put("isQueryMarchInside", isQueryMarchInside);
-			//params.put("virtualId", virtualId);	
-
-			//appuser 对应项目ID
-			String                           organizationId = "#";
-			List<AppUserOrgnizationRelation> orgList        = userManager.getAppUserOrgByUserId(Integer.parseInt(user.getId().toString()));
-			if (orgList != null && orgList.size() > 0) {
-				AppUserOrgnizationRelation orgRe = orgList.get(0);
-				if (orgRe != null) {
-					organizationId = orgRe.getOrgId().toString();
-				}
-			}
-			params.put("organizationId", organizationId);
-
-
-			Page page = conditionerAddTimeService.findPageBy(params, pageSize, pageNo);
-			return AppResultUtil.createSuccesDto(page);
-		} catch (Exception e) {
-			e.printStackTrace();
-			return AppResultUtil.createErrorDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败" + LogExceptionStackUtil.LogExceptionStack(e));
-		}
-	}
-
-
-	/**
-	 * @param request
-	 * @return 查找维修单详情
-	 */
-	@RequestMapping(value = "/getDetail")
-	@ResponseBody
-	public AppResultDto getDetail(@RequestParam("id") Long id) {
-		log.info("ApiAirConditionerAddTimeController getDetail======");
-
-		return AppResultUtil.createSuccesDto(conditionerAddTimeService.findById(id));
-	}
-
-	/**
-	 * 同意放行
-	 */
-	@RequestMapping(value = "/audit")
-	@ResponseBody
-	public AppResultDto audit(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
-		log.info("ApiAirConditionerAddTimeController agree======");
-
-		dto.setBillFrom(CodeConstants.ANDROID);
-		return conditionerAddTimeService.audit(dto, request);
-	}
-
-	/**
-	 * 同意放行
-	 */
-	@RequestMapping(value = "/cancel")
-	@ResponseBody
-	public AppResultDto cancel(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
-		log.info("ApiAirConditionerAddTimeController agree======");
-
-		dto.setBillFrom(CodeConstants.ANDROID);
-		return conditionerAddTimeService.cancel(dto, request);
-	}
-
-	/**
-	 * 空调开关人员
-	 *
-	 * @param request
-	 * @return
-	 */
-	@RequestMapping(value = "/getAirSwitchUser")
-	@ResponseBody
-	public AppResultDto getAirSwitchUser(HttpServletRequest request) {
-
-		String userName = baseRedisService.get(request.getHeader("token"));
-		if (userName == null) {
-			return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
-		}
-		User tokenUser = userManager.getUserByUsername2(userName);
-
-		//appuser 对应项目ID
-		Integer                          organizationId = 0;
-		List<AppUserOrgnizationRelation> orgList        = userManager.getAppUserOrgByUserId(Integer.parseInt(tokenUser.getId().toString()));
-		if (orgList != null && orgList.size() > 0) {
-			AppUserOrgnizationRelation orgRe = orgList.get(0);
-			if (orgRe != null) {
-				organizationId = orgRe.getOrgId();
-			}
-		}
-
-		//空调开关人员
-		List<User> users = userManager.findByFunctionGeneral(organizationId, CodeConstants.AIRSWITCH_PERMISSION);
-
-		List<JSONObject> usersList = new ArrayList<JSONObject>();
-		for (User user : users) {
-			JSONObject usrsMap = new JSONObject();
-			usrsMap.put("switchUserId", user.getId().toString());
-			usrsMap.put("name", user.getFullName());
-			usrsMap.put("telephone", user.getTelephone());
-			usersList.add(usrsMap);
-		}
-
-		return AppResultUtil.createSuccesDto(usersList);
-	}
-
-
-	/**
-	 * 物品放行
-	 * 选择公司
-	 *
-	 * @throws Exception
-	 */
-	@RequestMapping(value = "/selectCompany")
-	@ResponseBody
-	public AppResultDto selectCompany(@ModelAttribute("airSelectCompanyInputDto") AirSelectCompanyInputDto dto, HttpServletRequest request) throws Exception {
-
-		dto.setAir(true);
-		dto.setBillFrom(CodeConstants.ANDROID);
-		return conditionerAddTimeService.selectCompany(dto, request);
-	}
-
-	/**
-	 * 空调加时申请确认
-	 *
-	 * @param request
-	 * @return
-	 * @throws Exception 
-	 */
-	@RequestMapping(value = "/getRoomsAndAreaByVirtualId")
-	@ResponseBody
-	public AppResultDto getRoomsAndAreaByVirtualId(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) throws Exception {
-
-		log.info("WxAirConditionerAddTimeController getRoomsAndAreaByVirtualId======");
-		return conditionerAddTimeService.getRoomsAndAreaByVirtualId(dto, request);
-	}
-
-
-	/**
-	 * 空调加时申请
-	 *
-	 * @param request
-	 * @return
-	 */
-	@RequestMapping(value = "/apply")
-	@ResponseBody
-	public AppResultDto apply(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
-
-		log.info("ApiAirConditionerAddTimeController apply======");
-		dto.setBillSource("1");//空调加时
-		dto.setBillFrom(CodeConstants.ANDROID);
-		dto.setIsAppManageBook(1);
-		return conditionerAddTimeService.apply(dto, request);
-	}
-
-	/**
-	 * 空调加时申请确认
-	 *
-	 * @param request
-	 * @return
-	 */
-	@RequestMapping(value = "/applyConfirm")
-	@ResponseBody
-	public AppResultDto applyConfirm(HttpServletRequest request) {
-
-		log.info("ApiAirConditionerAddTimeController applyConfirm======");
-		return conditionerAddTimeService.applyConfirm(request);
-	}
-
-	/**
-	 * 获取用户所管理的楼层
-	 *
-	 * @param request
-	 * @param response
-	 */
-	@RequestMapping(value = "/getFloorNosByUserId")
-	@ResponseBody
-	public AppResultDto getFloorNosByUserId(HttpServletRequest request, HttpServletResponse response) {
-
-		List<Map<String, Object>> list     = new ArrayList<Map<String, Object>>();
-		String                    userName = baseRedisService.get(request.getHeader("token"));
-		if (userName == null) {
-			return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
-		}
-		User user   = userManager.getUserByUsername2(userName);
-		Role role21 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
-		Role role22 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
-		Role role23 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());
-
-		//空调加时审批权限
-		String airAuditRoleId = "0";
-		if (role21 != null) {
-			airAuditRoleId = role21.getId().toString();
-		}
-		if (role22 != null && StringUtils.isNotEmpty(airAuditRoleId)) {
-			//airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITKEL.toString();
-			airAuditRoleId = role22.getId().toString();
-		}
-		if (role23 != null && StringUtils.isNotEmpty(airAuditRoleId)) {
-			//airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITGZL.toString();
-			airAuditRoleId = role23.getId().toString();
-		}
-
-
-		try {
-			List<AppUserFloorRelation> userFloorList = userManager.getAppUserFloorByUserId(Integer.parseInt(user.getId().toString()), Integer.parseInt(airAuditRoleId));
-			if (userFloorList != null && userFloorList.size() > 0) {
-				for (int i = 0; i < userFloorList.size(); i++) {
-					AppUserFloorRelation userFloor = userFloorList.get(i);
-					Map<String, Object>  map       = new HashMap<String, Object>();
-					FloorInfo            floor     = floorInfoManager.get(userFloor.getFloor_id());
-					map.put("floorName", floor.getName() + "楼");
-					map.put("floorId", floor.getId() == null ? "" : floor.getId());
-					list.add(map);
-				}
-			}
-
-		} catch (Exception e) {
-			e.printStackTrace();
-			log.error("获取楼层失败" + e.getMessage());
-		}
-
-		return AppResultUtil.createSuccesDto(list);
-	}
+            int pageSize = Integer.parseInt(request.getParameter("pageSize"));
+            int pageNo = Integer.parseInt(request.getParameter("pageNo"));
+            Map<String, Object> params = new HashMap<String, Object>();
+            String status = request.getParameter("status");
+            String floorId = request.getParameter("floorId");// 楼层id 只过滤一层楼
+
+
+            String applyTime = request.getParameter("applyTime");// 2018-09-08 //申请时间
+
+            String isAppManageBook = request.getParameter("isAppManageBook");
+            String preBookUserId = "";// 代订人ID
+            if (StringUtils.isNotEmpty(isAppManageBook) && "1".equals(isAppManageBook)) {
+                preBookUserId = user.getId().toString();
+            }
+            if (StringUtils.isNotEmpty(airswitchPermission) && "1".equals(airswitchPermission)) {
+                airSwitchUserId = user.getId().intValue();
+            }
+
+
+            // 还要根据管员角色 对应楼层 及审批的状态来过滤
+            // TODO
+            params.put("status", status);
+            // params.put("airAuditPermission", airAuditPermission);
+            // params.put("roleToFloorIds", roleToFloorIds);
+            params.put("applyTime", applyTime);
+            params.put("floorId", floorId);
+            params.put("preBookUserId", preBookUserId);
+            params.put("airSwitchUserId", airSwitchUserId);
+            params.put("isQueryMarchInside", isQueryMarchInside);
+            // params.put("virtualId", virtualId);
+
+            // appuser 对应项目ID
+            String organizationId = "#";
+            List<AppUserOrgnizationRelation> orgList = userManager.getAppUserOrgByUserId(Integer.parseInt(user.getId().toString()));
+            if (orgList != null && orgList.size() > 0) {
+                AppUserOrgnizationRelation orgRe = orgList.get(0);
+                if (orgRe != null) {
+                    organizationId = orgRe.getOrgId().toString();
+                }
+            }
+            params.put("organizationId", organizationId);
+
+
+            Page page = conditionerAddTimeService.findPageBy(params, pageSize, pageNo);
+            return AppResultUtil.createSuccesDto(page);
+        } catch (Exception e) {
+            log.error("ApiAirConditionerAddTimeController list error", e);
+            return AppResultUtil.createErrorDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败" + LogExceptionStackUtil.LogExceptionStack(e));
+        }
+    }
+
+
+    /**
+     * @param request
+     * @return 查找维修单详情
+     */
+    @RequestMapping(value = "/getDetail")
+    @ResponseBody
+    public AppResultDto getDetail(@RequestParam("id") Long id) {
+        log.info("ApiAirConditionerAddTimeController getDetail======");
+
+        return AppResultUtil.createSuccesDto(conditionerAddTimeService.findById(id));
+    }
+
+    /**
+     * 同意放行
+     */
+    @RequestMapping(value = "/audit")
+    @ResponseBody
+    public AppResultDto audit(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
+        log.info("ApiAirConditionerAddTimeController agree======");
+
+        dto.setBillFrom(CodeConstants.ANDROID);
+        return conditionerAddTimeService.audit(dto, request);
+    }
+
+    /**
+     * 同意放行
+     */
+    @RequestMapping(value = "/cancel")
+    @ResponseBody
+    public AppResultDto cancel(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
+        log.info("ApiAirConditionerAddTimeController agree======");
+
+        dto.setBillFrom(CodeConstants.ANDROID);
+        return conditionerAddTimeService.cancel(dto, request);
+    }
+
+    /**
+     * 空调开关人员
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/getAirSwitchUser")
+    @ResponseBody
+    public AppResultDto getAirSwitchUser(HttpServletRequest request) {
+
+        String userName = baseRedisService.get(request.getHeader("token"));
+        if (userName == null) {
+            return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
+        }
+        User tokenUser = userManager.getUserByUsername2(userName);
+
+        // appuser 对应项目ID
+        Integer organizationId = 0;
+        List<AppUserOrgnizationRelation> orgList = userManager.getAppUserOrgByUserId(Integer.parseInt(tokenUser.getId().toString()));
+        if (orgList != null && orgList.size() > 0) {
+            AppUserOrgnizationRelation orgRe = orgList.get(0);
+            if (orgRe != null) {
+                organizationId = orgRe.getOrgId();
+            }
+        }
+
+        // 空调开关人员
+        List<User> users = userManager.findByFunctionGeneral(organizationId, CodeConstants.AIRSWITCH_PERMISSION);
+
+        List<JSONObject> usersList = new ArrayList<JSONObject>();
+        for (User user : users) {
+            JSONObject usrsMap = new JSONObject();
+            usrsMap.put("switchUserId", user.getId().toString());
+            usrsMap.put("name", user.getFullName());
+            usrsMap.put("telephone", user.getTelephone());
+            usersList.add(usrsMap);
+        }
+
+        return AppResultUtil.createSuccesDto(usersList);
+    }
+
+
+    /**
+     * 物品放行
+     * 选择公司
+     * @throws Exception
+     */
+    @RequestMapping(value = "/selectCompany")
+    @ResponseBody
+    public AppResultDto selectCompany(@ModelAttribute("airSelectCompanyInputDto") AirSelectCompanyInputDto dto, HttpServletRequest request) throws Exception {
+
+        dto.setAir(true);
+        dto.setBillFrom(CodeConstants.ANDROID);
+        return conditionerAddTimeService.selectCompany(dto, request);
+    }
+
+    /**
+     * 空调加时申请确认
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping(value = "/getRoomsAndAreaByVirtualId")
+    @ResponseBody
+    public AppResultDto getRoomsAndAreaByVirtualId(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) throws Exception {
+
+        log.info("WxAirConditionerAddTimeController getRoomsAndAreaByVirtualId======");
+        return conditionerAddTimeService.getRoomsAndAreaByVirtualId(dto, request);
+    }
+
+
+    /**
+     * 空调加时申请
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/apply")
+    @ResponseBody
+    public AppResultDto apply(@ModelAttribute("airConditionerAddTimeInputDto") AirConditionerAddTimeInputDto dto, HttpServletRequest request) {
+
+        log.info("ApiAirConditionerAddTimeController apply======");
+        dto.setBillSource("1");// 空调加时
+        dto.setBillFrom(CodeConstants.ANDROID);
+        dto.setIsAppManageBook(1);
+        return conditionerAddTimeService.apply(dto, request);
+    }
+
+    /**
+     * 空调加时申请确认
+     * @param request
+     * @return
+     */
+    @RequestMapping(value = "/applyConfirm")
+    @ResponseBody
+    public AppResultDto applyConfirm(HttpServletRequest request) {
+
+        log.info("ApiAirConditionerAddTimeController applyConfirm======");
+        return conditionerAddTimeService.applyConfirm(request);
+    }
+
+    /**
+     * 获取用户所管理的楼层
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/getFloorNosByUserId")
+    @ResponseBody
+    public AppResultDto getFloorNosByUserId(HttpServletRequest request, HttpServletResponse response) {
+
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
+        String userName = baseRedisService.get(request.getHeader("token"));
+        if (userName == null) {
+            return AppResultUtil.createErrorDto(AppConstants.TOKEN_EXPIRED, "token已过期");
+        }
+        User user = userManager.getUserByUsername2(userName);
+        Role role21 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP21_PERMISSION, user.getId());
+        Role role22 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP22_PERMISSION, user.getId());
+        Role role23 = userManager.findRoleByFunctionAndUser(CodeConstants.CSP23_PERMISSION, user.getId());
+
+        // 空调加时审批权限
+        String airAuditRoleId = "0";
+        if (role21 != null) {
+            airAuditRoleId = role21.getId().toString();
+        }
+        if (role22 != null && StringUtils.isNotEmpty(airAuditRoleId)) {
+            // airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITKEL.toString();
+            airAuditRoleId = role22.getId().toString();
+        }
+        if (role23 != null && StringUtils.isNotEmpty(airAuditRoleId)) {
+            // airAuditPermission=airAuditPermission+";"+GoodsCodeConstants.AIR_AUDITGZL.toString();
+            airAuditRoleId = role23.getId().toString();
+        }
+
+
+        try {
+            List<AppUserFloorRelation> userFloorList = userManager.getAppUserFloorByUserId(Integer.parseInt(user.getId().toString()), Integer.parseInt(airAuditRoleId));
+            if (userFloorList != null && userFloorList.size() > 0) {
+                for (int i = 0; i < userFloorList.size(); i++) {
+                    AppUserFloorRelation userFloor = userFloorList.get(i);
+                    Map<String, Object> map = new HashMap<String, Object>();
+                    FloorInfo floor = floorInfoManager.get(userFloor.getFloor_id());
+                    map.put("floorName", floor.getName() + "楼");
+                    map.put("floorId", floor.getId() == null ? "" : floor.getId());
+                    list.add(map);
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("获取楼层失败" + e.getMessage());
+        }
+
+        return AppResultUtil.createSuccesDto(list);
+    }
 
 }

+ 5 - 6
src/main/java/com/palmnest/webapp/controller/backstage/AirConditionerAddTimeController.java

@@ -31,7 +31,6 @@ 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;
 
@@ -230,7 +229,7 @@ public class AirConditionerAddTimeController {
 			dto.setCount(page.getTotalCount());
 			return dto;
 		} catch (Exception e) {
-			e.printStackTrace();
+			log.error("WxAirConditionerAddTimeController reportList error======", e);
 			return new WebPageResultDto(AppConstants.REPAIR_BILL_LIST_ERROR, "查询列表失败", LogExceptionStackUtil.LogExceptionStack(e));
 		}
 	}
@@ -639,9 +638,9 @@ public class AirConditionerAddTimeController {
 	 * @param request
 	 * @return
 	 */
-	@RequestMapping(value = "/calcAddTimeOrderFee", method = RequestMethod.POST)
+	@RequestMapping(value = "/calcAddTimeOrderFee")
 	@ResponseBody
-	public AppResultDto calcAddTimeOrderFee(@RequestBody @Validated ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
+	public AppResultDto calcAddTimeOrderFee(@ModelAttribute 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);
@@ -654,9 +653,9 @@ public class AirConditionerAddTimeController {
 	 * @param request
 	 * @return
 	 */
-	@RequestMapping(value = "updateAddTimeOrder", method = RequestMethod.POST)
+	@RequestMapping(value = "updateAddTimeOrder")
 	@ResponseBody
-	public AppResultDto updateAddTimeOrder(@RequestBody @Validated ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
+	public AppResultDto updateAddTimeOrder(@ModelAttribute ConditionerAddTimeOrderUpdateParam order, HttpServletRequest request) {
 		User  user  = (User) request.getSession().getAttribute("UserCache");
 		log.info("更新空调加时订单, user: {}, order:{}", user.getFullName(), JSON.toJSONString(order));
 		conditionerAddTimeService.updateAddTimeOrder(order, user);

+ 2 - 0
src/main/resources/hibernate.cfg.xml

@@ -120,6 +120,8 @@
 
 
         <mapping class="com.palmnest.model.airconditioner.AirConditionerAddTime"/>
+        <mapping class="com.palmnest.model.airconditioner.AirConditionerAddTimeOrderExtend"/>
+        <mapping class="com.palmnest.model.airconditioner.AirConditionerAddTimeOrderHistory"/>
         <mapping class="com.palmnest.model.airconditioner.AirRule"/>
         <mapping class="com.palmnest.model.airconditioner.ProjectConfig"/>
         <mapping class="com.palmnest.model.OrgElement"/>