Parcourir la source

fix

release_toaliyun_real
winter il y a 11 mois
Parent
révision
30cd5d134d
6 fichiers modifiés avec 67 ajouts et 75 suppressions
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java
  2. +1
    -4
      mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java
  4. +42
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java
  5. +20
    -31
      mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java
  6. +2
    -22
      mallinkService/src/main/resources/mapper/WxRentContractMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java Voir le fichier

@@ -244,7 +244,7 @@ public class WxAgileContractController extends WxContractBaseController {
ResultData result = wxAgileContractService.saveOrUpdate(wxRentContract, user);
//如果是有效的合同编辑,则复制其他设置到影子合同
if (result.code == Result.SUCCESS && null != oldRentContract && isValidEdit) {
wxAgileContractService.copyContractConfig(false,wxRentContract.getId(), oldRentContract, user, false);
wxAgileContractService.copyContractConfig(false,wxRentContract, oldRentContract, user, false);
}
return result;


+ 1
- 4
mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java Voir le fichier

@@ -41,8 +41,5 @@ public interface WxRentContractMapper extends CommonMapper<WxRentContract, Long>
List<WxRentContract> findToEndContractList(WxRentContract rentContract);
void deleteValidDelete(@Param("tenantId") String tenantId,@Param("id") Long id);
void copyValidDeleteContract(WxRentContract rentContract);
void deleteContract(@Param("tenantId") String tenantId,@Param("id") Long id);
void updateContractId(@Param("tenantId") String tenantId,@Param("oldId") Long oldId,@Param("newId") Long newId);
void setOrgIdNull(@Param("tenantId") String tenantId,@Param("id") Long id,@Param("orgId") Long orgId);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java Voir le fichier

@@ -81,7 +81,7 @@ public interface WxAgileContractService {
PageInfo<WxContractCustomers> getContractCustomersList(WxContractCustomers record, Integer pageIndex, Integer pageSize);
void copyContractConfig(boolean copyContractShop,Long destId,WxRentContract orgContract,MallUserInfo user,boolean isReBuildUnDeposit);
void copyContractConfig(boolean copyContractShop,WxRentContract destContract,WxRentContract orgContract,MallUserInfo user,boolean isReBuildUnDeposit);
void renewalAgile(WxRentContract wxRentContract,MallUserInfo user);


+ 42
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java Voir le fichier

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


+ 20
- 31
mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java Voir le fichier

@@ -516,26 +516,31 @@ public class WxRentContractServiceImpl implements WxRentContractService {
}
//如果合同是影子合同,则删除之前的源合同,本合同的ID变更为源合同的ID
boolean isYingzi = false;
Long orginId = record.getOrginId();
if (record.isYingZiContract()){
isYingzi = true;
wxRentContractMapper.deleteValidDelete(record.getTenantId(),orginId);
WxRentContract mr = wxAgileContractService.findMainContract(id, record);
wxRentContractMapper.copyValidDeleteContract(mr);
wxRentContractMapper.deleteContract(record.getTenantId(),orginId);
wxRentContractMapper.updateContractId(record.getTenantId(), id, orginId);
record.setId(orginId);
Long orginId = record.getOrginId();
//把原合同作废
WxRentContract orc = new WxRentContract();
orc.updateTenantInfo(record);
orc.setId(orginId);;
orc.setStatus(EnumRentContractStatus.INVALID.getCode());
wxRentContractMapper.updateStatus(orc);
//把现合同orgid去掉
wxRentContractMapper.setOrgIdNull(record.getTenantId(), id,orginId);
//原合同账单处理:当前时间之后的未处理过的账单,全部删除,之前的账单,还有以后已经处理过的账单,不处理。需财务手工处理这些账单
WxAllBill bq = new WxAllBill();
bq.updateTenantInfo(record);
bq.setRentContractId(orginId);
bq.setShopEndtime(record.getRentalStartDate());
wxAllBillMapper.deleteNoNeedPayBill(bq);
//更新原合同的账单为现合同的
wxAllBillMapper.updateContractId(orginId,id, record.getTenantId());
}
//更新合同状态为签约
WxRentContract wxRentContract = new WxRentContract();
wxRentContract.updateTenantInfo(record);;
if (isYingzi) {
wxRentContract.setId(orginId);//影子合同的ID已经变为源合同ID了
}else {
wxRentContract.setId(id);
}
wxRentContract.setId(id);
if (record.getRentalStartDate().before(new Date())) {
wxRentContract.setStatus(EnumRentContractStatus.PAING.getCode());
} else {
@@ -555,25 +560,9 @@ public class WxRentContractServiceImpl implements WxRentContractService {
//如果合同的账单cusName为空的话,则设置为customers name
handleContractBillCusName(record,cusName);
//影子合同处理,源合同账单则需要清空当前时间之后未处理的账单
if (isYingzi) {
//原合同账单处理:当前时间之后的未处理过的账单,全部删除,之前的账单,还有以后已经处理过的账单,不处理。需财务手工处理这些账单
WxAllBill bq = new WxAllBill();
bq.updateTenantInfo(wxRentContract);
bq.setRentContractId(orginId);
bq.setShopEndtime(record.getRentalStartDate());
wxAllBillMapper.deleteNoNeedPayBill(bq);
//新合同的账单:把账单的合同编号更改为源合同ID
wxAllBillMapper.updateContractId(id, orginId, wxRentContract.getTenantId());
}
//预览账单改为正式,并写入商户id
WxAllBill billRent = new WxAllBill();
if (isYingzi) {
billRent.setRentContractId(orginId);
}else {
billRent.setRentContractId(id);
}
billRent.setRentContractId(id);
billRent.setIsPreview(EnumIsPreview.NO.getCode());
billRent.updateTenantInfo(record);
wxAllBillMapper.updatePreviewStatus(billRent);


+ 2
- 22
mallinkService/src/main/resources/mapper/WxRentContractMapper.xml Voir le fichier

@@ -243,28 +243,8 @@
where `tenant_id` = #{tenantId} and status = 3 and end_contract_time &lt;= now();
</select>
<delete id="deleteValidDelete" parameterType="java.util.Map">
delete from wx_rent_contract_valid_delete where `tenant_id` = #{tenantId} and id = #{id}
</delete>
<update id="copyValidDeleteContract" parameterType="com.iformall.domain.po.WxRentContract">
insert into wx_rent_contract_valid_delete(<include refid="allColumns"/>) values(
#{id},#{customersId},#{tenantId},#{parentTenantId},#{decimalSize},#{rentalStartDate},
#{rentalEndDate},#{signDate},#{filepath},#{status},#{contractNumber},#{createBy},
#{updateBy},#{dayPriceCalcute},#{monthAverageDays},#{cashtypeContentLsit},#{isDel},
#{updatetime},#{createtime},#{linkPerson},#{linkPhone},#{linkAddress},#{lease},
#{type},#{fromId},#{endContractTime},#{applyStatus},#{createByName},#{updateByName},
#{rentInfo},#{fileNames},#{shopIdStr},#{designFile},#{remark},#{orginId}
)
</update>
<delete id="deleteContract" parameterType="java.util.Map">
delete from wx_rent_contract where `tenant_id` = #{tenantId} and id = #{id}
</delete>
<update id = "updateContractId" parameterType="java.util.Map" >
update wx_rent_contract set id = #{newId},orgin_id = null where id = #{oldId} and `tenant_id` = #{tenantId}
<update id = "setOrgIdNull" parameterType="java.util.Map" >
update wx_rent_contract set orgin_id = null,remark=concat('来自',#{orgId},'编辑') where id = #{id} and `tenant_id` = #{tenantId}
</update>
</mapper>


Chargement…
Annuler
Enregistrer