|
|
@@ -72,13 +72,12 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate startDate = LocalDate.parse(contract.getContract_start(), formatter);
|
|
|
LocalDate endDate = LocalDate.parse(contract.getContract_end(), formatter);
|
|
|
- if (startDate.isBefore(LocalDate.now()) || startDate.isEqual(LocalDate.now())){
|
|
|
+ if (startDate.isBefore(LocalDate.now()) || startDate.isEqual(LocalDate.now())) {
|
|
|
contract.setStatus(2);//合同生效
|
|
|
- if (endDate.isBefore(LocalDate.now())){
|
|
|
+ if (endDate.isBefore(LocalDate.now())) {
|
|
|
contract.setStatus(3);//合同失效
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
contract.setStatus(1);//合同未生效
|
|
|
}
|
|
|
|
|
|
@@ -92,8 +91,7 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
if (contract.getStatus() == 3) {
|
|
|
//合同失效了释放
|
|
|
floor.setRemain_area(remainArea + demandArea);
|
|
|
- }
|
|
|
- else if (contract.getStatus() == 2){
|
|
|
+ } else if (contract.getStatus() == 2) {
|
|
|
//生效的合同,扣除面积
|
|
|
floor.setRemain_area(remainArea - demandArea <= 0 ? 0 : remainArea - demandArea);
|
|
|
}
|
|
|
@@ -127,13 +125,12 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate startDate = LocalDate.parse(contract.getContract_start(), formatter);
|
|
|
LocalDate endDate = LocalDate.parse(contract.getContract_end(), formatter);
|
|
|
- if (startDate.isBefore(LocalDate.now())){
|
|
|
+ if (startDate.isBefore(LocalDate.now())) {
|
|
|
contract.setStatus(1);//合同生效
|
|
|
- if (endDate.isBefore(LocalDate.now())){
|
|
|
+ if (endDate.isBefore(LocalDate.now())) {
|
|
|
contract.setStatus(2);//合同失效
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
contract.setStatus(0);//合同未生效
|
|
|
}
|
|
|
|
|
|
@@ -141,21 +138,20 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
if (!CollectionUtils.isEmpty(floorList)) {
|
|
|
//删除原有的楼层
|
|
|
ContractFloor oldContract = contractFloorService.findById(contract.getId());
|
|
|
- if (oldContract != null){
|
|
|
+ if (oldContract != null) {
|
|
|
Integer oldStatus = oldContract.getStatus();
|
|
|
oldContract.setDel_flag(true);
|
|
|
contractFloorService.updateSelective(oldContract);
|
|
|
//生效中的合同需要释放面积
|
|
|
- if (oldStatus == 1){
|
|
|
+ if (oldStatus == 1) {
|
|
|
BuildFloor floor = floorService.findById(oldContract.getFloor_id());
|
|
|
Double remainArea = floor.getRemain_area() == null ? 0 : floor.getRemain_area();
|
|
|
Double demandArea = oldContract.getArea() == null ? 0 : oldContract.getArea();
|
|
|
floor.setRemain_area(remainArea - demandArea <= 0 ? 0 : remainArea - demandArea);
|
|
|
floorService.updateFloor(floor);
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- i=0;
|
|
|
+ } else {
|
|
|
+ i = 0;
|
|
|
}
|
|
|
//编辑后的合同
|
|
|
for (ContractFloor contractFloor : floorList) {
|
|
|
@@ -167,8 +163,7 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
if (endDate.isBefore(LocalDate.now())) {
|
|
|
//合同失效了释放
|
|
|
floor.setRemain_area(remainArea + demandArea);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
//生效的合同,扣除面积
|
|
|
floor.setRemain_area(remainArea - demandArea <= 0 ? 0 : remainArea - demandArea);
|
|
|
}
|
|
|
@@ -182,10 +177,9 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
contractFloor.setContract_end(contract.getContract_end());
|
|
|
contractFloor.setUscc(contract.getUscc());
|
|
|
contractFloor.setOrganization_code(contract.getOrganization_code());
|
|
|
- if (contract.getId() != null){
|
|
|
+ if (contract.getId() != null) {
|
|
|
contractFloorService.updateSelective(contractFloor);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
contractFloorService.save(contractFloor);
|
|
|
}
|
|
|
}
|
|
|
@@ -216,9 +210,9 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
public boolean terminate(List<String> ids, String status, String terminate_time) {
|
|
|
for (String id : ids) {
|
|
|
ContractFloor contractFloor = contractFloorService.findById(Integer.parseInt(id));
|
|
|
- if (contractFloor != null){
|
|
|
+ if (contractFloor != null) {
|
|
|
if (contractFloor.getStatus().equals(Constant.CONTRACT_STATUS.EFFECTIVE)
|
|
|
- || contractFloor.getStatus().equals(Constant.CONTRACT_STATUS.TERMINATE)){
|
|
|
+ || contractFloor.getStatus().equals(Constant.CONTRACT_STATUS.TERMINATE)) {
|
|
|
contractFloor.setStatus(Constant.CONTRACT_STATUS.TERMINATE);
|
|
|
contractFloor.setTerminate_time(terminate_time);
|
|
|
contractFloorService.updateSelective(contractFloor);
|
|
|
@@ -246,7 +240,7 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
if (param.getPark_id() == null || param.getPark_id().equals("")) {
|
|
|
//判断是否是父级园区
|
|
|
List<SubPark> parks = parkService.findParentParkById(ShiroUtils.getBuildId().toString());
|
|
|
- if (parks != null && parks.size() > 0){
|
|
|
+ if (parks != null && parks.size() > 0) {
|
|
|
param.setIs_parent("1");
|
|
|
}
|
|
|
param.setPark_id(ShiroUtils.getBuildId() + "");
|
|
|
@@ -271,7 +265,7 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (contract.getStatus().equals(Constant.CONTRACT_STATUS.TERMINATE_FREED)){
|
|
|
+ if (contract.getStatus().equals(Constant.CONTRACT_STATUS.TERMINATE_FREED)) {
|
|
|
contract.setState_code(contract.getStatus().toString());
|
|
|
}
|
|
|
}
|
|
|
@@ -325,7 +319,7 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
Contract contract = new Contract();
|
|
|
contract.setDel_flag(false);
|
|
|
contract.setCompany_id(id);
|
|
|
- contract = this.findOne(contract);
|
|
|
+ contract = this.findOne(contract);
|
|
|
ContractFloor contractFloor = new ContractFloor();
|
|
|
contractFloor.setContract_id(contract.getId());
|
|
|
List<ContractFloor> floors = contractFloorService.findListByWhere(contractFloor);
|
|
|
@@ -385,6 +379,30 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ */
|
|
|
+ public void batchDeleteByContractId(Integer id) {
|
|
|
+
|
|
|
+ Contract contract = new Contract();
|
|
|
+ contract.setId(id);
|
|
|
+ contract.setDel_flag(true);
|
|
|
+ this.updateSelective(contract);
|
|
|
+
|
|
|
+ ContractFloor contractFloor = new ContractFloor();
|
|
|
+ contractFloor.setContract_id(id);
|
|
|
+ List<ContractFloor> floorList = contractFloorService.findListByWhere(contractFloor);
|
|
|
+
|
|
|
+ if (floorList != null && floorList.size() > 0) {
|
|
|
+ for (ContractFloor cf : floorList) {
|
|
|
+ cf.setDel_flag(true);
|
|
|
+ contractFloorService.updateSelective(cf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 功能描述:获取视图模式左侧列表
|
|
|
*
|
|
|
@@ -499,11 +517,11 @@ public class IcContractService extends BaseService<Contract> {
|
|
|
if (Objects.equals(Constant.UserType.STREET, ShiroUtils.getUserType())) {
|
|
|
customSearchCondition.setStreet_id(ShiroUtils.getStreetId() + "");
|
|
|
} else if (Objects.equals(Constant.UserType.BUILD, ShiroUtils.getUserType())) {
|
|
|
- if (customSearchCondition.getPark_id() == null || customSearchCondition.getPark_id().equals("")){
|
|
|
+ if (customSearchCondition.getPark_id() == null || customSearchCondition.getPark_id().equals("")) {
|
|
|
customSearchCondition.setPark_id(ShiroUtils.getBuildId() + "");
|
|
|
//判断是否是父级园区
|
|
|
List<SubPark> parks = parkService.findParentParkById(ShiroUtils.getBuildId().toString());
|
|
|
- if (parks != null && parks.size() > 0){
|
|
|
+ if (parks != null && parks.size() > 0) {
|
|
|
customSearchCondition.setIs_parent("1");
|
|
|
}
|
|
|
}
|