|
|
@@ -1085,7 +1085,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@Override |
|
|
@Override |
|
|
public void copyContractConfig(boolean copyContractShop,Long destId,WxRentContract orgContract,MallUserInfo user,boolean isReBuildUnDeposit) { |
|
|
|
|
|
|
|
|
public void copyContractConfig(boolean copyContractShop,WxRentContract destContract,WxRentContract orgContract,MallUserInfo user,boolean isReBuildUnDeposit) { |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
if (copyContractShop) { |
|
|
if (copyContractShop) { |
|
|
WxContractShop csq = new WxContractShop(); |
|
|
WxContractShop csq = new WxContractShop(); |
|
|
@@ -1096,7 +1096,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
for ( int i = 0 ; i< csqlist.size() ; i ++) { |
|
|
for ( int i = 0 ; i< csqlist.size() ; i ++) { |
|
|
WxContractShop cs = csqlist.get(i); |
|
|
WxContractShop cs = csqlist.get(i); |
|
|
cs.setId(idWorker.nextId()); |
|
|
cs.setId(idWorker.nextId()); |
|
|
cs.setContractId(destId); |
|
|
|
|
|
|
|
|
cs.setContractId(destContract.getId()); |
|
|
cs.setCreateDate(new Date()); |
|
|
cs.setCreateDate(new Date()); |
|
|
cs.setUpdateDate(new Date()); |
|
|
cs.setUpdateDate(new Date()); |
|
|
wxContractShopMapper.insert(cs); |
|
|
wxContractShopMapper.insert(cs); |
|
|
@@ -1109,11 +1109,12 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
cadq.setRentContractId(orgContract.getId()); |
|
|
cadq.setRentContractId(orgContract.getId()); |
|
|
List<WxRentContractAgileDeposit> depositList = wxRentContractAgileDepositMapper.findList(cadq); |
|
|
List<WxRentContractAgileDeposit> depositList = wxRentContractAgileDepositMapper.findList(cadq); |
|
|
if (null != depositList && depositList.size() > 0 ){ |
|
|
if (null != depositList && depositList.size() > 0 ){ |
|
|
|
|
|
List<WxRentContractAgileDeposit> depoList = new ArrayList<WxRentContractAgileDeposit>(); |
|
|
for ( int i = 0 ; i< depositList.size() ; i ++) { |
|
|
for ( int i = 0 ; i< depositList.size() ; i ++) { |
|
|
WxRentContractAgileDeposit rad = depositList.get(i); |
|
|
WxRentContractAgileDeposit rad = depositList.get(i); |
|
|
Long oldId = rad.getId(); |
|
|
Long oldId = rad.getId(); |
|
|
rad.setId(idWorker.nextId()); |
|
|
rad.setId(idWorker.nextId()); |
|
|
rad.setRentContractId(destId); |
|
|
|
|
|
|
|
|
rad.setRentContractId(destContract.getId()); |
|
|
rad.setCreatetime(new Date()); |
|
|
rad.setCreatetime(new Date()); |
|
|
rad.setUpdatetime(new Date()); |
|
|
rad.setUpdatetime(new Date()); |
|
|
wxRentContractAgileDepositMapper.insert(rad); |
|
|
wxRentContractAgileDepositMapper.insert(rad); |
|
|
@@ -1124,19 +1125,29 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
radsq.setRentDepositId(oldId); |
|
|
radsq.setRentDepositId(oldId); |
|
|
List<WxRentContractAgileDepositShop> dslist = wxRentContractAgileDepositShopMapper.findList(radsq); |
|
|
List<WxRentContractAgileDepositShop> dslist = wxRentContractAgileDepositShopMapper.findList(radsq); |
|
|
if (null != dslist && dslist.size() > 0 ){ |
|
|
if (null != dslist && dslist.size() > 0 ){ |
|
|
|
|
|
List<WxShop> slist = new ArrayList<WxShop>(); |
|
|
for ( int j = 0 ; j< dslist.size() ; j ++) { |
|
|
for ( int j = 0 ; j< dslist.size() ; j ++) { |
|
|
WxRentContractAgileDepositShop ds = dslist.get(j); |
|
|
WxRentContractAgileDepositShop ds = dslist.get(j); |
|
|
ds.setId(idWorker.nextId()); |
|
|
ds.setId(idWorker.nextId()); |
|
|
ds.setRentContractId(destId); |
|
|
|
|
|
|
|
|
ds.setRentContractId(destContract.getId()); |
|
|
ds.setRentDepositId(rad.getId()); |
|
|
ds.setRentDepositId(rad.getId()); |
|
|
ds.setCreatetime(new Date()); |
|
|
ds.setCreatetime(new Date()); |
|
|
ds.setUpdatetime(new Date()); |
|
|
ds.setUpdatetime(new Date()); |
|
|
wxRentContractAgileDepositShopMapper.insert(ds); |
|
|
wxRentContractAgileDepositShopMapper.insert(ds); |
|
|
|
|
|
|
|
|
|
|
|
//createDepositBill用 |
|
|
|
|
|
WxShop shop = new WxShop(); |
|
|
|
|
|
shop.updateTenantInfo(user); |
|
|
|
|
|
shop.setId(ds.getShopId()); |
|
|
|
|
|
slist.add(shop); |
|
|
} |
|
|
} |
|
|
|
|
|
rad.setShopList(slist); |
|
|
} |
|
|
} |
|
|
|
|
|
depoList.add(rad); |
|
|
} |
|
|
} |
|
|
|
|
|
//创建押金账单 |
|
|
|
|
|
this.createDepositBill(destContract, depoList, user); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WxRentContractAgileUnDeposit raudq = new WxRentContractAgileUnDeposit(); |
|
|
WxRentContractAgileUnDeposit raudq = new WxRentContractAgileUnDeposit(); |
|
|
raudq.updateTenantInfo(user); |
|
|
raudq.updateTenantInfo(user); |
|
|
raudq.setRentContractId(orgContract.getId()); |
|
|
raudq.setRentContractId(orgContract.getId()); |
|
|
@@ -1146,22 +1157,33 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
WxRentContractAgileUnDeposit raud = undepositList.get(i); |
|
|
WxRentContractAgileUnDeposit raud = undepositList.get(i); |
|
|
Long oraudid = raud.getId(); |
|
|
Long oraudid = raud.getId(); |
|
|
raud.setId(idWorker.nextId()); |
|
|
raud.setId(idWorker.nextId()); |
|
|
raud.setRentContractId(destId); |
|
|
|
|
|
|
|
|
raud.setRentContractId(destContract.getId()); |
|
|
raud.setCreatetime(new Date()); |
|
|
raud.setCreatetime(new Date()); |
|
|
raud.setUpdatetime(new Date()); |
|
|
raud.setUpdatetime(new Date()); |
|
|
wxRentContractAgileUnDepositMapper.insert(raud); |
|
|
wxRentContractAgileUnDepositMapper.insert(raud); |
|
|
|
|
|
|
|
|
|
|
|
List<WxRentContractAgileUnDepositItem> items = new ArrayList<WxRentContractAgileUnDepositItem>(); |
|
|
//是否设置一个默认的 |
|
|
//是否设置一个默认的 |
|
|
if (isReBuildUnDeposit) { |
|
|
if (isReBuildUnDeposit) { |
|
|
if (raud.getSettingMethod().intValue() == EnumRentContractAgilSettingMethod.BY_CONTRACT.getCode().intValue()) { |
|
|
if (raud.getSettingMethod().intValue() == EnumRentContractAgilSettingMethod.BY_CONTRACT.getCode().intValue()) { |
|
|
WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,orgContract,raud.getId(),raud.getFeesId(),null); |
|
|
WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,orgContract,raud.getId(),raud.getFeesId(),null); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(item); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(item); |
|
|
|
|
|
|
|
|
|
|
|
//创建账单 |
|
|
|
|
|
items.add(item); |
|
|
|
|
|
raud.setItems(items); |
|
|
|
|
|
this.createUnDepositBill(raud, user); |
|
|
}else { |
|
|
}else { |
|
|
List<Long> shopIdList = orgContract.shopIdsByRentInfo(); |
|
|
List<Long> shopIdList = orgContract.shopIdsByRentInfo(); |
|
|
for (int j = 0 ; j < shopIdList.size(); j++ ){ |
|
|
for (int j = 0 ; j < shopIdList.size(); j++ ){ |
|
|
WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,orgContract,raud.getId(),raud.getFeesId(),shopIdList.get(j)); |
|
|
WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,orgContract,raud.getId(),raud.getFeesId(),shopIdList.get(j)); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(item); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(item); |
|
|
|
|
|
|
|
|
|
|
|
items.add(item); |
|
|
} |
|
|
} |
|
|
|
|
|
//创建账单 |
|
|
|
|
|
raud.setItems(items); |
|
|
|
|
|
this.createUnDepositBill(raud, user); |
|
|
} |
|
|
} |
|
|
}else { |
|
|
}else { |
|
|
WxRentContractAgileUnDepositItem udiq = new WxRentContractAgileUnDepositItem(); |
|
|
WxRentContractAgileUnDepositItem udiq = new WxRentContractAgileUnDepositItem(); |
|
|
@@ -1173,12 +1195,17 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
for (int j = 0 ; j < udiqList.size(); j++) { |
|
|
for (int j = 0 ; j < udiqList.size(); j++) { |
|
|
WxRentContractAgileUnDepositItem udi = udiqList.get(j); |
|
|
WxRentContractAgileUnDepositItem udi = udiqList.get(j); |
|
|
udi.setId(idWorker.nextId()); |
|
|
udi.setId(idWorker.nextId()); |
|
|
udi.setRentContractId(destId); |
|
|
|
|
|
|
|
|
udi.setRentContractId(destContract.getId()); |
|
|
udi.setUnDepositId(raud.getId()); |
|
|
udi.setUnDepositId(raud.getId()); |
|
|
udi.setCreatetime(new Date()); |
|
|
udi.setCreatetime(new Date()); |
|
|
udi.setUpdatetime(new Date()); |
|
|
udi.setUpdatetime(new Date()); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(udi); |
|
|
wxRentContractAgileUnDepositItemMapper.insert(udi); |
|
|
|
|
|
|
|
|
|
|
|
items.add(udi); |
|
|
} |
|
|
} |
|
|
|
|
|
//创建账单 |
|
|
|
|
|
raud.setItems(items); |
|
|
|
|
|
this.createUnDepositBill(raud, user); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@@ -1196,7 +1223,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
for (int i = 0 ; i < renevueList.size() ; i++) { |
|
|
for (int i = 0 ; i < renevueList.size() ; i++) { |
|
|
WxRentContractAgileRenevue ar = renevueList.get(i); |
|
|
WxRentContractAgileRenevue ar = renevueList.get(i); |
|
|
oldRenevueId = ar.getId(); |
|
|
oldRenevueId = ar.getId(); |
|
|
ar.setRentContractId(destId); |
|
|
|
|
|
|
|
|
ar.setRentContractId(destContract.getId()); |
|
|
ar.setId(idWorker.nextId()); |
|
|
ar.setId(idWorker.nextId()); |
|
|
ar.setCreatetime(new Date()); |
|
|
ar.setCreatetime(new Date()); |
|
|
ar.setUpdatetime(new Date()); |
|
|
ar.setUpdatetime(new Date()); |
|
|
@@ -1206,7 +1233,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
} |
|
|
} |
|
|
if (isReBuildUnDeposit) { |
|
|
if (isReBuildUnDeposit) { |
|
|
if (null != renevueId) { |
|
|
if (null != renevueId) { |
|
|
WxRentContractAgileRenevueItem ari = generateRenevueItem(idWorker, orgContract, destId, renevueId); |
|
|
|
|
|
|
|
|
WxRentContractAgileRenevueItem ari = generateRenevueItem(idWorker, orgContract, destContract.getId(), renevueId); |
|
|
wxRentContractAgileRenevueItemMapper.insert(ari); |
|
|
wxRentContractAgileRenevueItemMapper.insert(ari); |
|
|
} |
|
|
} |
|
|
}else { |
|
|
}else { |
|
|
@@ -1219,7 +1246,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
if (null != riqList && riqList.size() > 0 ) { |
|
|
if (null != riqList && riqList.size() > 0 ) { |
|
|
for (int i = 0 ; i < riqList.size() ; i ++) { |
|
|
for (int i = 0 ; i < riqList.size() ; i ++) { |
|
|
WxRentContractAgileRenevueItem ri = riqList.get(i); |
|
|
WxRentContractAgileRenevueItem ri = riqList.get(i); |
|
|
ri.setRentContractId(destId); |
|
|
|
|
|
|
|
|
ri.setRentContractId(destContract.getId()); |
|
|
ri.setRenevueId(renevueId); |
|
|
ri.setRenevueId(renevueId); |
|
|
ri.setId(idWorker.nextId()); |
|
|
ri.setId(idWorker.nextId()); |
|
|
ri.setCreatetime(new Date()); |
|
|
ri.setCreatetime(new Date()); |
|
|
@@ -1237,7 +1264,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
if (null != renevueFeesList && renevueFeesList.size() > 0 && null != renevueId ) { |
|
|
if (null != renevueFeesList && renevueFeesList.size() > 0 && null != renevueId ) { |
|
|
for (int i = 0 ; i < renevueFeesList.size() ; i++) { |
|
|
for (int i = 0 ; i < renevueFeesList.size() ; i++) { |
|
|
WxRentContractAgileRenevueFees arf = renevueFeesList.get(i); |
|
|
WxRentContractAgileRenevueFees arf = renevueFeesList.get(i); |
|
|
arf.setRentContractId(destId); |
|
|
|
|
|
|
|
|
arf.setRentContractId(destContract.getId()); |
|
|
arf.setAgileRenevueId(renevueId); |
|
|
arf.setAgileRenevueId(renevueId); |
|
|
arf.setId(idWorker.nextId()); |
|
|
arf.setId(idWorker.nextId()); |
|
|
arf.setCreatetime(new Date()); |
|
|
arf.setCreatetime(new Date()); |
|
|
@@ -1253,7 +1280,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
if ( null != jumpList && jumpList.size() > 0 ) { |
|
|
if ( null != jumpList && jumpList.size() > 0 ) { |
|
|
for (int i = 0 ; i < jumpList.size(); i++) { |
|
|
for (int i = 0 ; i < jumpList.size(); i++) { |
|
|
WxRentContractRevenueJump rj = jumpList.get(i); |
|
|
WxRentContractRevenueJump rj = jumpList.get(i); |
|
|
rj.setRentContractId(destId); |
|
|
|
|
|
|
|
|
rj.setRentContractId(destContract.getId()); |
|
|
rj.setId(idWorker.nextId()); |
|
|
rj.setId(idWorker.nextId()); |
|
|
rj.setCreateTime(new Date()); |
|
|
rj.setCreateTime(new Date()); |
|
|
rj.setUpdateTime(new Date()); |
|
|
rj.setUpdateTime(new Date()); |
|
|
@@ -1266,9 +1293,9 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
@Override |
|
|
@Override |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
public void renewalAgile(WxRentContract rentContract,MallUserInfo user) { |
|
|
public void renewalAgile(WxRentContract rentContract,MallUserInfo user) { |
|
|
|
|
|
WxRentContract oldContract = wxRentContractMapper.selectById(rentContract.getId()); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
Long newContractId = idWorker.nextId(); |
|
|
|
|
|
rentContract.setId(newContractId); |
|
|
|
|
|
|
|
|
rentContract.setId(idWorker.nextId()); |
|
|
rentContract.setCreatetime(new Date()); |
|
|
rentContract.setCreatetime(new Date()); |
|
|
rentContract.setCreateBy(user.getId()); |
|
|
rentContract.setCreateBy(user.getId()); |
|
|
rentContract.setCreateByName(user.getName()); |
|
|
rentContract.setCreateByName(user.getName()); |
|
|
@@ -1281,8 +1308,7 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { |
|
|
int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); |
|
|
int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); |
|
|
rentContract.setLease(array[0]); |
|
|
rentContract.setLease(array[0]); |
|
|
wxRentContractMapper.insert(rentContract); |
|
|
wxRentContractMapper.insert(rentContract); |
|
|
|
|
|
|
|
|
copyContractConfig(true,newContractId, rentContract, user, true); |
|
|
|
|
|
|
|
|
copyContractConfig(true,rentContract, oldContract, user, true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private WxRentContractAgileRenevueItem generateRenevueItem(IdWorker idWorker,WxRentContract rentContract,Long newContractId,Long renevueId) { |
|
|
private WxRentContractAgileRenevueItem generateRenevueItem(IdWorker idWorker,WxRentContract rentContract,Long newContractId,Long renevueId) { |
|
|
|