|
@@ -3,6 +3,8 @@ package com.idea.saleManage.service;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
|
|
+import com.idea.buildManage.model.ParkRoom;
|
|
|
|
+import com.idea.buildManage.service.ParkRoomService;
|
|
import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
import com.idea.customerManagement.mapper.CustomerManagementMapper;
|
|
import com.idea.customerManagement.model.CustomerManagement;
|
|
import com.idea.customerManagement.model.CustomerManagement;
|
|
import com.idea.saleManage.mapper.CheckInMapper;
|
|
import com.idea.saleManage.mapper.CheckInMapper;
|
|
@@ -18,6 +20,7 @@ import com.rockstar.util.StringUtils;
|
|
import com.rockstar.util.UUIDUtils;
|
|
import com.rockstar.util.UUIDUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -30,6 +33,8 @@ public class CheckInService implements BaseService<CheckIn, CheckInExample> {
|
|
private CheckInMapper modelMapper;
|
|
private CheckInMapper modelMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private CustomerManagementMapper customerManagementMapper;
|
|
private CustomerManagementMapper customerManagementMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ParkRoomService parkRoomService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页查询
|
|
* 分页查询
|
|
@@ -113,23 +118,45 @@ public class CheckInService implements BaseService<CheckIn, CheckInExample> {
|
|
return modelMapper.insertSelective(record);
|
|
return modelMapper.insertSelective(record);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional
|
|
|
|
+ public int add(CheckIn model,String customerManagementId){
|
|
|
|
+ // 更新购房状态 已入驻
|
|
|
|
+ CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(customerManagementId);
|
|
|
|
+ customerManagement.setStatus(4);
|
|
|
|
+ customerManagementMapper.updateByPrimaryKeySelective(customerManagement);
|
|
|
|
+ // 更新房间状态
|
|
|
|
+ ParkRoom parkRoom = parkRoomService.selectByPrimaryKey(customerManagement.getHouseId());
|
|
|
|
+ parkRoom.setSoldStatus(7);
|
|
|
|
+ parkRoomService.updateByPrimaryKeySelective(parkRoom);
|
|
|
|
+
|
|
|
|
+ return this.insertSelective(model);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ @Transactional
|
|
public int edit(CheckIn model,String customerManagementId){
|
|
public int edit(CheckIn model,String customerManagementId){
|
|
- if(StringUtils.isNotEmpty(model.getStatus())){
|
|
|
|
|
|
+
|
|
|
|
+ CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(customerManagementId);
|
|
|
|
+ ParkRoom parkRoom = parkRoomService.selectByPrimaryKey(customerManagement.getHouseId());
|
|
|
|
+
|
|
|
|
+ // 已入驻
|
|
|
|
+ if(model.getStatus().equals("1")){
|
|
// 更新购房状态 已入驻
|
|
// 更新购房状态 已入驻
|
|
- CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(customerManagementId);
|
|
|
|
customerManagement.setStatus(4);
|
|
customerManagement.setStatus(4);
|
|
- customerManagementMapper.updateByPrimaryKeySelective(customerManagement);
|
|
|
|
- }else {
|
|
|
|
|
|
+ // 更新房间状态 已入住
|
|
|
|
+ parkRoom.setSoldStatus(7);
|
|
|
|
+ }
|
|
|
|
+ // 未入住
|
|
|
|
+ if(model.getStatus().equals("2")) {
|
|
// 更新购房状态 已签约
|
|
// 更新购房状态 已签约
|
|
- CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(customerManagementId);
|
|
|
|
- if(customerManagement.getStatus() == 4){
|
|
|
|
- customerManagement.setStatus(3);
|
|
|
|
- }
|
|
|
|
- customerManagement.setStatus(4);
|
|
|
|
- customerManagementMapper.updateByPrimaryKeySelective(customerManagement);
|
|
|
|
|
|
+ customerManagement.setStatus(3);
|
|
|
|
+ // 更新房间状态 已签约
|
|
|
|
+ parkRoom.setSoldStatus(3);
|
|
|
|
+ model.setInDate(null);
|
|
}
|
|
}
|
|
- return modelMapper.updateByPrimaryKeySelective(model);
|
|
|
|
|
|
+ customerManagementMapper.updateByPrimaryKeySelective(customerManagement);
|
|
|
|
+ parkRoomService.updateByPrimaryKeySelective(parkRoom);
|
|
|
|
+
|
|
|
|
+ return modelMapper.updateByPrimaryKey(model);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|