| | |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含startTime"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含endTime"); |
| | | Assert.hasKeyAndValue(reqJson, "applyType", "请求报文中未包含applyType"); |
| | | if (!StringUtil.isEmpty(reqJson.getString("startTime"))) { |
| | | String startTime = reqJson.getString("startTime") + " 00:00:00"; |
| | | reqJson.put("startTime", startTime); |
| | | } |
| | | if (!StringUtil.isEmpty(reqJson.getString("endTime"))) { |
| | | String endTime = reqJson.getString("endTime") + " 23:59:59"; |
| | | reqJson.put("endTime", endTime); |
| | | } |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | ApplyRoomDiscountDto applyRoomDiscountDto = new ApplyRoomDiscountDto(); |
| | | applyRoomDiscountDto.setCommunityId(applyRoomDiscountPo.getCommunityId()); |
| | |
| | | //获取本次填写的开始时间 |
| | | Date startDate = simpleDateFormat.parse(applyRoomDiscountPo.getStartTime()); |
| | | if (applyRoomDiscountDtos.size() == 0) { |
| | | //空置房优惠可用 |
| | | applyRoomDiscountPo.setInUse("0"); |
| | | return saveApplyRoomDiscountBMOImpl.save(applyRoomDiscountPo); |
| | | } else if (applyRoomDiscountDtos.size() > 0) { |
| | | //取出结束时间 |
| | | String endTime = applyRoomDiscountDtos.get(0).getEndTime(); |
| | | Date finishTime = simpleDateFormat.parse(endTime); |
| | | if (startDate.getTime() - finishTime.getTime() >= 0) { |
| | | //空置房优惠可用 |
| | | applyRoomDiscountPo.setInUse("0"); |
| | | return saveApplyRoomDiscountBMOImpl.save(applyRoomDiscountPo); |
| | | } else { |
| | | throw new UnsupportedOperationException("该时间段已经申请过空置房,请重新输入空置房申请开始和结束时间"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改优惠申请 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | * @serviceCode /applyRoomDiscount/editApplyRoomDiscount |
| | | * @path /app/applyRoomDiscount/editApplyRoomDiscount |
| | | */ |
| | | @RequestMapping(value = "/editApplyRoomDiscount", method = RequestMethod.POST) |
| | | public ResponseEntity<String> editApplyRoomDiscount(@RequestBody JSONObject reqJson, @RequestHeader(value = "user-id") String userId) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); |
| | | Assert.hasKeyAndValue(reqJson, "state", "请求报文中未包含验房状态"); |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含结束时间"); |
| | | Assert.hasKeyAndValue(reqJson, "ardId", "ardId不能为空"); |
| | | ApplyRoomDiscountPo applyRoomDiscountPo = BeanConvertUtil.covertBean(reqJson, ApplyRoomDiscountPo.class); |
| | | return updateApplyRoomDiscountBMOImpl.update(applyRoomDiscountPo); |
| | | } |
| | | |
| | | /** |
| | | * 审批接口 |
| | | * |
| | | * @param reqJson |